]> The Tcpdump Group git mirrors - tcpdump/blob - win32/Include/Rpc/rpc.h
fe03c8e859e2da23a4fddf77aa31543462824550
[tcpdump] / win32 / Include / Rpc / rpc.h
1 /*
2 * Copyright (c) 1999, 2000
3 * Politecnico di Torino. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the Politecnico
13 * di Torino, and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 */
21
22 enum auth_stat {
23 AUTH_OK=0,
24 /*
25 * failed at remote end
26 */
27 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
28 AUTH_REJECTEDCRED=2, /* client should begin new session */
29 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
30 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
31 AUTH_TOOWEAK=5, /* rejected due to security reasons */
32 /*
33 * failed locally
34 */
35 AUTH_INVALIDRESP=6, /* bogus response verifier */
36 AUTH_FAILED=7 /* some unknown reason */
37 };
38
39 enum msg_type {
40 CALL=0,
41 REPLY=1
42 };
43
44 enum reply_stat {
45 MSG_ACCEPTED=0,
46 MSG_DENIED=1
47 };
48
49 enum accept_stat {
50 SUCCESS=0,
51 PROG_UNAVAIL=1,
52 PROG_MISMATCH=2,
53 PROC_UNAVAIL=3,
54 GARBAGE_ARGS=4,
55 SYSTEM_ERR=5
56 };
57
58 enum reject_stat {
59 RPC_MISMATCH=0,
60 AUTH_ERROR=1
61 };
62
63 #define u_long unsigned long
64 #define u_int unsigned int
65 #define u_short unsigned short
66 #define enum_t int
67 #define caddr_t char*
68
69 struct opaque_auth {
70 enum_t oa_flavor; /* flavor of auth */
71 caddr_t oa_base; /* address of more auth stuff */
72 u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
73 };
74
75 struct accepted_reply {
76 struct opaque_auth ar_verf;
77 enum accept_stat ar_stat;
78 union {
79 struct {
80 u_long low;
81 u_long high;
82 } AR_versions;
83 /*struct {
84 caddr_t where;
85 xdrproc_t proc;
86 } AR_results;
87 /* and many other null cases */
88 } ru;
89 #define ar_results ru.AR_results
90 #define ar_vers ru.AR_versions
91 };
92
93 struct rejected_reply {
94 enum reject_stat rj_stat;
95 union {
96 struct {
97 u_long low;
98 u_long high;
99 } RJ_versions;
100 enum auth_stat RJ_why; /* why authentication did not work */
101 } ru;
102 #define rj_vers ru.RJ_versions
103 #define rj_why ru.RJ_why
104 };
105
106 struct reply_body {
107 enum reply_stat rp_stat;
108 union {
109 struct accepted_reply RP_ar;
110 struct rejected_reply RP_dr;
111 } ru;
112 #define rp_acpt ru.RP_ar
113 #define rp_rjct ru.RP_dr
114 };
115
116 struct call_body {
117 u_long cb_rpcvers; /* must be equal to two */
118 u_long cb_prog;
119 u_long cb_vers;
120 u_long cb_proc;
121 struct opaque_auth cb_cred;
122 struct opaque_auth cb_verf; /* protocol specific - provided by client */
123 };
124
125 struct rpc_msg {
126 u_long rm_xid;
127 enum msg_type rm_direction;
128 union {
129 struct call_body RM_cmb;
130 struct reply_body RM_rmb;
131 } ru;
132 #define rm_call ru.RM_cmb
133 #define rm_reply ru.RM_rmb
134 };
135
136 #define PMAPPORT ((u_short)111)
137 #define PMAPPROG ((u_long)100000)
138 #define PMAPVERS ((u_long)2)
139 #define PMAPVERS_PROTO ((u_long)2)
140 #define PMAPVERS_ORIG ((u_long)1)
141 #define PMAPPROC_NULL ((u_long)0)
142 #define PMAPPROC_SET ((u_long)1)
143 #define PMAPPROC_UNSET ((u_long)2)
144 #define PMAPPROC_GETPORT ((u_long)3)
145 #define PMAPPROC_DUMP ((u_long)4)
146 #define PMAPPROC_CALLIT ((u_long)5)