Contents of /trunk/mkinitrd-magellan/klibc/usr/kinit/nfsmount/sunrpc.h
Parent Directory | Revision Log
Revision 815 -
(show annotations)
(download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 1923 byte(s)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 1923 byte(s)
-updated to klibc-1.5.15
1 | /* |
2 | * open-coded SunRPC structures |
3 | */ |
4 | #ifndef NFSMOUNT_SUNRPC_H |
5 | #define NFSMOUNT_SUNRPC_H |
6 | |
7 | #include <sys/types.h> |
8 | #include <inttypes.h> |
9 | |
10 | #define SUNRPC_PORT 111 |
11 | #define MOUNT_PORT 627 |
12 | |
13 | #define RPC_CALL 0 |
14 | #define RPC_REPLY 1 |
15 | |
16 | #define PORTMAP_PROGRAM 100000 |
17 | #define NLM_PROGRAM 100021 |
18 | |
19 | #define RPC_PMAP_PROGRAM 100000 |
20 | #define RPC_PMAP_VERSION 2 |
21 | #define RPC_PMAP_PORT 111 |
22 | |
23 | #define PMAP_PROC_NULL 0 |
24 | #define PMAP_PROC_SET 1 |
25 | #define PMAP_PROC_UNSET 2 |
26 | #define PMAP_PROC_GETPORT 3 |
27 | #define PMAP_PROC_DUMP 4 |
28 | |
29 | #define LAST_FRAG 0x80000000 |
30 | |
31 | #define REPLY_OK 0 |
32 | #define REPLY_DENIED 1 |
33 | |
34 | #define SUCCESS 0 |
35 | #define PROG_UNAVAIL 1 |
36 | #define PROG_MISMATCH 2 |
37 | #define PROC_UNAVAIL 3 |
38 | #define GARBAGE_ARGS 4 |
39 | #define SYSTEM_ERR 5 |
40 | |
41 | enum { |
42 | AUTH_NULL, |
43 | AUTH_UNIX, |
44 | }; |
45 | |
46 | struct rpc_auth { |
47 | uint32_t flavor; |
48 | uint32_t len; |
49 | uint32_t body[]; |
50 | }; |
51 | |
52 | struct rpc_udp_header { |
53 | uint32_t xid; |
54 | uint32_t msg_type; |
55 | }; |
56 | |
57 | struct rpc_header { |
58 | uint32_t frag_hdr; |
59 | struct rpc_udp_header udp; |
60 | }; |
61 | |
62 | struct rpc_call { |
63 | struct rpc_header hdr; |
64 | uint32_t rpc_vers; |
65 | |
66 | uint32_t program; |
67 | uint32_t prog_vers; |
68 | uint32_t proc; |
69 | uint32_t cred_flavor; |
70 | |
71 | uint32_t cred_len; |
72 | uint32_t vrf_flavor; |
73 | uint32_t vrf_len; |
74 | }; |
75 | |
76 | struct rpc_reply { |
77 | struct rpc_header hdr; |
78 | uint32_t reply_state; |
79 | uint32_t vrf_flavor; |
80 | uint32_t vrf_len; |
81 | uint32_t state; |
82 | }; |
83 | |
84 | struct rpc { |
85 | struct rpc_call *call; |
86 | size_t call_len; |
87 | struct rpc_reply *reply; |
88 | size_t reply_len; |
89 | }; |
90 | |
91 | struct client; |
92 | |
93 | typedef int (*call_stub) (struct client *, struct rpc *); |
94 | |
95 | struct client { |
96 | int sock; |
97 | call_stub call_stub; |
98 | }; |
99 | |
100 | #define CLI_RESVPORT 00000001 |
101 | |
102 | struct client *tcp_client(uint32_t server, uint16_t port, uint32_t flags); |
103 | struct client *udp_client(uint32_t server, uint16_t port, uint32_t flags); |
104 | void client_free(struct client *client); |
105 | |
106 | int rpc_call(struct client *client, struct rpc *rpc); |
107 | |
108 | uint32_t portmap(uint32_t server, uint32_t program, uint32_t version, uint32_t proto); |
109 | |
110 | #endif /* NFSMOUNT_SUNRPC_H */ |