Annotation of /trunk/mkinitrd-magellan/klibc/usr/kinit/nfsmount/sunrpc.h
Parent Directory | Revision Log
Revision 532 -
(hide annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 1815 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 1815 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | niro | 532 | /* |
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 | struct rpc_udp_header { | ||
42 | uint32_t xid; | ||
43 | uint32_t msg_type; | ||
44 | }; | ||
45 | |||
46 | struct rpc_header { | ||
47 | uint32_t frag_hdr; | ||
48 | struct rpc_udp_header udp; | ||
49 | }; | ||
50 | |||
51 | struct rpc_call { | ||
52 | struct rpc_header hdr; | ||
53 | uint32_t rpc_vers; | ||
54 | |||
55 | uint32_t program; | ||
56 | uint32_t prog_vers; | ||
57 | uint32_t proc; | ||
58 | uint32_t cred_flavor; | ||
59 | |||
60 | uint32_t cred_len; | ||
61 | uint32_t vrf_flavor; | ||
62 | uint32_t vrf_len; | ||
63 | }; | ||
64 | |||
65 | struct rpc_reply { | ||
66 | struct rpc_header hdr; | ||
67 | uint32_t reply_state; | ||
68 | uint32_t vrf_flavor; | ||
69 | uint32_t vrf_len; | ||
70 | uint32_t state; | ||
71 | }; | ||
72 | |||
73 | struct rpc { | ||
74 | struct rpc_call *call; | ||
75 | size_t call_len; | ||
76 | struct rpc_reply *reply; | ||
77 | size_t reply_len; | ||
78 | }; | ||
79 | |||
80 | struct client; | ||
81 | |||
82 | typedef int (*call_stub) (struct client *, struct rpc *); | ||
83 | |||
84 | struct client { | ||
85 | int sock; | ||
86 | call_stub call_stub; | ||
87 | }; | ||
88 | |||
89 | #define CLI_RESVPORT 00000001 | ||
90 | |||
91 | struct client *tcp_client(uint32_t server, uint16_t port, uint32_t flags); | ||
92 | struct client *udp_client(uint32_t server, uint16_t port, uint32_t flags); | ||
93 | void client_free(struct client *client); | ||
94 | |||
95 | int rpc_call(struct client *client, struct rpc *rpc); | ||
96 | |||
97 | uint32_t portmap(uint32_t server, uint32_t program, uint32_t version, uint32_t proto); | ||
98 | |||
99 | #endif /* NFSMOUNT_SUNRPC_H */ |