-
Notifications
You must be signed in to change notification settings - Fork 12
/
portmap.x
318 lines (256 loc) · 7.92 KB
/
portmap.x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* $Id: portmap.x,v 1.2 2008/01/02 23:19:27 dancy Exp $ */
/* Extracted from rfc1057.txt and tweaked some */
const PMAP_PORT = 111; /* portmapper port number */
struct mapping {
unsigned int prog;
unsigned int vers;
unsigned int prot;
unsigned int port;
};
const IPPROTO_TCP = 6; /* protocol number for TCP/IP */
const IPPROTO_UDP = 17; /* protocol number for UDP/IP */
typedef struct pmapentry *pmaplist;
struct pmapentry {
mapping map;
pmaplist next;
};
struct call_args {
unsigned int prog;
unsigned int vers;
unsigned int proc;
opaque args<>;
};
struct call_result {
unsigned int port;
opaque res<>;
};
/*
* A mapping of (program, version, network ID) to address
*
* The network identifier (r_netid):
* This is a string that represents a local identification for a
* network. This is defined by a system administrator based on local
* conventions, and cannot be depended on to have the same value on
* every system.
*/
struct rpcb {
unsigned long r_prog; /* program number */
unsigned long r_vers; /* version number */
string r_netid<>; /* network id */
string r_addr<>; /* universal address */
string r_owner<>; /* owner of this service */
};
struct rp__list {
rpcb rpcb_map;
struct rp__list *rpcb_next;
};
typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */
/*
* Arguments of remote calls
*/
struct rpcb_rmtcallargs {
unsigned long prog; /* program number */
unsigned long vers; /* version number */
unsigned long proc; /* procedure number */
opaque args<>; /* argument */
};
/*
* Results of the remote call
*/
struct rpcb_rmtcallres {
string addr<>; /* remote universal address */
opaque results<>; /* result */
};
/*
* rpcb_entry contains a merged address of a service on a particular
* transport, plus associated netconfig information. A list of
* rpcb_entry items is returned by RPCBPROC_GETADDRLIST. The meanings
* and values used for the r_nc_* fields are given below.
*
* The network identifier (r_nc_netid):
* This is a string that represents a local identification for a
* network. This is defined by a system administrator based on
* local conventions, and cannot be depended on to have the same
* value on every system.
*
* Transport semantics (r_nc_semantics):
* This represents the type of transport, and has the following values:
* NC_TPI_CLTS (1) Connectionless
* NC_TPI_COTS (2) Connection oriented
* NC_TPI_COTS_ORD (3) Connection oriented with graceful close
* NC_TPI_RAW (4) Raw transport
*
* Protocol family (r_nc_protofmly):
* This identifies the family to which the protocol belongs. The
* following values are defined:
* NC_NOPROTOFMLY "-"
* NC_LOOPBACK "loopback"
* NC_INET "inet"
* NC_IMPLINK "implink"
* NC_PUP "pup"
* NC_CHAOS "chaos"
* NC_NS "ns"
* NC_NBS "nbs"
* NC_ECMA "ecma"
* NC_DATAKIT "datakit"
* NC_CCITT "ccitt"
* NC_SNA "sna"
* NC_DECNET "decnet"
* NC_DLI "dli"
* NC_LAT "lat"
* NC_HYLINK "hylink"
* NC_APPLETALK "appletalk"
* NC_NIT "nit"
* NC_IEEE802 "ieee802"
* NC_OSI "osi"
* NC_X25 "x25"
* NC_OSINET "osinet"
* NC_GOSIP "gosip"
*
* Protocol name (r_nc_proto):
* This identifies a protocol within a family. The following are
* currently defined:
* NC_NOPROTO "-"
* NC_TCP "tcp"
* NC_UDP "udp"
* NC_ICMP "icmp"
*/
struct rpcb_entry {
string r_maddr<>; /* merged address of service */
string r_nc_netid<>; /* netid field */
unsigned long r_nc_semantics; /* semantics of transport */
string r_nc_protofmly<>; /* protocol family */
string r_nc_proto<>; /* protocol name */
};
/*
* A list of addresses supported by a service.
*/
struct rpcb_entry_list {
rpcb_entry rpcb_entry_map;
struct rpcb_entry_list *rpcb_entry_next;
};
typedef rpcb_entry_list *rpcb_entry_list_ptr;
/*
* rpcbind statistics
*/
/* Never referenced -- dancy
const rpcb_highproc_2 = RPCBPROC_CALLIT;
const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
const rpcb_highproc_4 = RPCBPROC_GETSTAT;
*/
const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */
const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */
const RPCBVERS_4_STAT = 2;
const RPCBVERS_3_STAT = 1;
const RPCBVERS_2_STAT = 0;
/* Link list of all the stats about getport and getaddr */
struct rpcbs_addrlist {
unsigned long prog;
unsigned long vers;
int success;
int failure;
string netid<>;
struct rpcbs_addrlist *next;
};
/* Link list of all the stats about rmtcall */
struct rpcbs_rmtcalllist {
unsigned long prog;
unsigned long vers;
unsigned long proc;
int success;
int failure;
int indirect; /* whether callit or indirect */
string netid<>;
struct rpcbs_rmtcalllist *next;
};
typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
struct rpcb_stat {
rpcbs_proc info;
int setinfo;
int unsetinfo;
rpcbs_addrlist_ptr addrinfo;
rpcbs_rmtcalllist_ptr rmtinfo;
};
/*
* One rpcb_stat structure is returned for each version of rpcbind
* being monitored.
*/
typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
/*
* netbuf structure, used to store the transport specific form of
* a universal transport address.
*/
struct netbuf {
unsigned int maxlen;
opaque buf<>;
};
program PMAP_PROG {
version PMAP_VERS {
void
PMAPPROC_NULL(void) = 0;
bool
PMAPPROC_SET(mapping) = 1;
bool
PMAPPROC_UNSET(mapping) = 2;
unsigned int
PMAPPROC_GETPORT(mapping) = 3;
pmaplist
PMAPPROC_DUMP(void) = 4;
call_result
PMAPPROC_CALLIT(call_args) = 5;
} = 2;
version RPCBVERS {
void RPCBPROC_NULL(rpcb) = 0; /* Added by dancy */
bool
RPCBPROC_SET(rpcb) = 1;
bool
RPCBPROC_UNSET(rpcb) = 2;
string
RPCBPROC_GETADDR(rpcb) = 3;
rpcblist_ptr
RPCBPROC_DUMP(void) = 4;
rpcb_rmtcallres
RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
unsigned int
RPCBPROC_GETTIME(void) = 6;
netbuf
RPCBPROC_UADDR2TADDR(string) = 7;
string
RPCBPROC_TADDR2UADDR(netbuf) = 8;
} = 3;
version RPCBVERS4 {
void RPCBPROC_NULL(rpcb) = 0; /* Added by dancy */
bool
RPCBPROC_SET(rpcb) = 1;
bool
RPCBPROC_UNSET(rpcb) = 2;
string
RPCBPROC_GETADDR(rpcb) = 3;
rpcblist_ptr
RPCBPROC_DUMP(void) = 4;
/*
* NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
* the new name is intended to indicate that this
* procedure should be used for broadcast RPC, and
* RPCBPROC_INDIRECT should be used for indirect calls.
*/
rpcb_rmtcallres
RPCBPROC_BCAST(rpcb_rmtcallargs) = /*RPCBPROC_CALLIT*/ 5;
unsigned int
RPCBPROC_GETTIME(void) = 6;
netbuf
RPCBPROC_UADDR2TADDR(string) = 7;
string
RPCBPROC_TADDR2UADDR(netbuf) = 8;
string
RPCBPROC_GETVERSADDR(rpcb) = 9;
rpcb_rmtcallres
RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
rpcb_entry_list_ptr
RPCBPROC_GETADDRLIST(rpcb) = 11;
rpcb_stat_byvers
RPCBPROC_GETSTAT(void) = 12;
} = 4;
} = 100000;