]> The Tcpdump Group git mirrors - tcpdump/blob - win32/Include/Rpc/rpc.h
Modified the license at the beginning of the files created by the Politecno di Torino...
[tcpdump] / win32 / Include / Rpc / rpc.h
1 /*
2 * Copyright (c) 1999 - 2000
3 * NetGroup, Politecnico di Torino (Italy)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the Politecnico di Torino nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 enum auth_stat {
34 AUTH_OK=0,
35 /*
36 * failed at remote end
37 */
38 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
39 AUTH_REJECTEDCRED=2, /* client should begin new session */
40 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
41 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
42 AUTH_TOOWEAK=5, /* rejected due to security reasons */
43 /*
44 * failed locally
45 */
46 AUTH_INVALIDRESP=6, /* bogus response verifier */
47 AUTH_FAILED=7 /* some unknown reason */
48 };
49
50 enum msg_type {
51 CALL=0,
52 REPLY=1
53 };
54
55 enum reply_stat {
56 MSG_ACCEPTED=0,
57 MSG_DENIED=1
58 };
59
60 enum accept_stat {
61 SUCCESS=0,
62 PROG_UNAVAIL=1,
63 PROG_MISMATCH=2,
64 PROC_UNAVAIL=3,
65 GARBAGE_ARGS=4,
66 SYSTEM_ERR=5
67 };
68
69 enum reject_stat {
70 RPC_MISMATCH=0,
71 AUTH_ERROR=1
72 };
73
74 #define u_long unsigned long
75 #define u_int unsigned int
76 #define u_short unsigned short
77 #define enum_t int
78 #define caddr_t char*
79
80 struct opaque_auth {
81 enum_t oa_flavor; /* flavor of auth */
82 caddr_t oa_base; /* address of more auth stuff */
83 u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
84 };
85
86 struct accepted_reply {
87 struct opaque_auth ar_verf;
88 enum accept_stat ar_stat;
89 union {
90 struct {
91 u_long low;
92 u_long high;
93 } AR_versions;
94 /*struct {
95 caddr_t where;
96 xdrproc_t proc;
97 } AR_results;
98 /* and many other null cases */
99 } ru;
100 #define ar_results ru.AR_results
101 #define ar_vers ru.AR_versions
102 };
103
104 struct rejected_reply {
105 enum reject_stat rj_stat;
106 union {
107 struct {
108 u_long low;
109 u_long high;
110 } RJ_versions;
111 enum auth_stat RJ_why; /* why authentication did not work */
112 } ru;
113 #define rj_vers ru.RJ_versions
114 #define rj_why ru.RJ_why
115 };
116
117 struct reply_body {
118 enum reply_stat rp_stat;
119 union {
120 struct accepted_reply RP_ar;
121 struct rejected_reply RP_dr;
122 } ru;
123 #define rp_acpt ru.RP_ar
124 #define rp_rjct ru.RP_dr
125 };
126
127 struct call_body {
128 u_long cb_rpcvers; /* must be equal to two */
129 u_long cb_prog;
130 u_long cb_vers;
131 u_long cb_proc;
132 struct opaque_auth cb_cred;
133 struct opaque_auth cb_verf; /* protocol specific - provided by client */
134 };
135
136 struct rpc_msg {
137 u_long rm_xid;
138 enum msg_type rm_direction;
139 union {
140 struct call_body RM_cmb;
141 struct reply_body RM_rmb;
142 } ru;
143 #define rm_call ru.RM_cmb
144 #define rm_reply ru.RM_rmb
145 };
146
147 #define PMAPPORT ((u_short)111)
148 #define PMAPPROG ((u_long)100000)
149 #define PMAPVERS ((u_long)2)
150 #define PMAPVERS_PROTO ((u_long)2)
151 #define PMAPVERS_ORIG ((u_long)1)
152 #define PMAPPROC_NULL ((u_long)0)
153 #define PMAPPROC_SET ((u_long)1)
154 #define PMAPPROC_UNSET ((u_long)2)
155 #define PMAPPROC_GETPORT ((u_long)3)
156 #define PMAPPROC_DUMP ((u_long)4)
157 #define PMAPPROC_CALLIT ((u_long)5)