Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/rpc/rpc_msg.h
$ cat -n /usr/include/ntirpc/rpc/rpc_msg.h 1 /* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */ 2 3 /* 4 * Copyright (c) 2009, Sun Microsystems, Inc. 5 * Copyright (c) 2012-2017 Red Hat, Inc. and/or its affiliates. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * - Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * - Neither the name of Sun Microsystems, Inc. nor the names of its 16 * contributors may be used to endorse or promote products derived 17 * from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 * 31 * from: @(#)rpc_msg.h 1.7 86/07/16 SMI 32 * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC 33 * $FreeBSD: src/include/rpc/rpc_msg.h,v 1.15 2003/01/01 18:48:42 schweikh Exp $ 34 */ 35 36 /* 37 * rpc_msg.h 38 * rpc message definition 39 * 40 * Copyright (C) 1984, Sun Microsystems, Inc. 41 */ 42 43 #ifndef _TIRPC_RPC_MSG_H 44 #define _TIRPC_RPC_MSG_H 45 46 #define RPC_MSG_VERSION ((u_int32_t) 2) 47 #define RPC_SERVICE_PORT ((u_short) 2048) 48 49 #include
50 #include
51 #include
52 53 /* 54 * Bottom up definition of an rpc message. 55 * NOTE: call and reply use the same overall stuct but 56 * different parts of unions within it. 57 */ 58 59 enum msg_type { 60 CALL = 0, 61 REPLY = 1 62 }; 63 64 enum reply_stat { 65 MSG_ACCEPTED = 0, 66 MSG_DENIED = 1 67 }; 68 69 enum accept_stat { 70 SUCCESS = 0, 71 PROG_UNAVAIL = 1, 72 PROG_MISMATCH = 2, 73 PROC_UNAVAIL = 3, 74 GARBAGE_ARGS = 4, 75 SYSTEM_ERR = 5 76 }; 77 78 enum reject_stat { 79 RPC_MISMATCH = 0, 80 AUTH_ERROR = 1 81 }; 82 83 /* 84 * Reply part of an rpc exchange 85 */ 86 struct rpcversions { 87 rpcvers_t low; 88 rpcvers_t high; 89 }; 90 struct xdrpair { 91 xdrproc_t proc; 92 void *where; 93 }; 94 95 /* 96 * Reply to an rpc request that was accepted by the server. 97 * Note: there could be an error even though the request was 98 * accepted. 99 */ 100 struct accepted_reply { 101 enum accept_stat ar_stat; 102 union { 103 struct rpcversions AR_versions; 104 struct xdrpair AR_results; 105 /* and many other null cases */ 106 } ru; 107 #define ar_results ru.AR_results 108 #define ar_vers ru.AR_versions 109 110 /* after union to avoid (rare) corruption by rejected_reply */ 111 struct opaque_auth ar_verf; 112 }; 113 114 /* 115 * Reply to an rpc request that was rejected by the server. 116 */ 117 struct rejected_reply { 118 enum reject_stat rj_stat; 119 union { 120 struct rpcversions RJ_versions; 121 enum auth_stat RJ_why; /* why authentication did not work */ 122 } ru; 123 #define rj_vers ru.RJ_versions 124 #define rj_why ru.RJ_why 125 }; 126 127 /* 128 * Body of a reply to an rpc request. 129 */ 130 struct reply_body { 131 enum reply_stat rp_stat; 132 union { 133 struct accepted_reply RP_ar; 134 struct rejected_reply RP_dr; 135 } ru; 136 #define rp_acpt ru.RP_ar 137 #define rp_rjct ru.RP_dr 138 }; 139 140 /* 141 * Body of an rpc request call. 142 */ 143 struct call_body { 144 rpcvers_t cb_rpcvers; /* must be equal to two */ 145 }; 146 147 /* 148 * The rpc message 149 */ 150 151 #define RPC_MSG_FLAG_NONE 0x0000 152 153 struct rpc_msg { 154 u_int32_t rm_xid; 155 enum msg_type rm_direction; 156 struct { 157 struct call_body RM_cmb; 158 struct reply_body RM_rmb; 159 } ru; 160 #define rm_call ru.RM_cmb 161 #define rm_reply ru.RM_rmb 162 163 /* New with TI-RPC */ 164 struct xdrpair rm_xdr; 165 uint32_t rm_flags; 166 167 /* Moved in N TI-RPC; used by auth, logging, replies */ 168 rpcprog_t cb_prog; 169 rpcvers_t cb_vers; 170 rpcproc_t cb_proc; 171 172 struct opaque_auth cb_cred; 173 struct opaque_auth cb_verf; /* protocol specific - provided by client */ 174 175 /* avoid separate alloc/free */ 176 char rq_cred_body[MAX_AUTH_BYTES]; /* size is excessive */ 177 }; 178 #define RPCM_ack ru.RM_rmb.ru.RP_ar 179 #define RPCM_rej ru.RM_rmb.ru.RP_dr 180 181 __BEGIN_DECLS 182 static inline void 183 rpc_msg_init(struct rpc_msg *msg) 184 { 185 /* required for REPLY decodes */ 186 msg->RPCM_ack.ar_verf = _null_auth; 187 msg->RPCM_ack.ar_results.where = NULL; 188 msg->RPCM_ack.ar_results.proc = (xdrproc_t) xdr_void; 189 } 190 191 /* 192 * XDR routine to handle a rpc message. 193 * xdr_ncallmsg(xdrs, cmsg) 194 * XDR *xdrs; 195 * struct rpc_msg *cmsg; 196 */ 197 extern bool xdr_ncallmsg(XDR *, struct rpc_msg *); 198 extern bool xdr_call_decode(XDR *, struct rpc_msg *, int32_t *buf); 199 extern bool xdr_call_encode(XDR *, struct rpc_msg *); 200 201 /* 202 * XDR routine to handle a duplex rpc message. 203 * xdr_dplx_msg(xdrs, cmsg) 204 * XDR *xdrs; 205 * struct rpc_msg *cmsg; 206 */ 207 extern bool xdr_dplx_msg(XDR *, struct rpc_msg *); 208 extern bool xdr_dplx_decode(XDR *, struct rpc_msg *); 209 extern bool xdr_reply_decode(XDR *, struct rpc_msg *, int32_t *buf); 210 extern bool xdr_reply_encode(XDR *, struct rpc_msg *); 211 212 /* 213 * XDR routine to pre-serialize the static part of a rpc message. 214 * xdr_ncallhdr(xdrs, cmsg) 215 * XDR *xdrs; 216 * struct rpc_msg *cmsg; 217 */ 218 extern bool xdr_ncallhdr(XDR *, struct rpc_msg *); 219 220 /* 221 * XDR routine to handle a rpc reply. 222 * xdr_nreplymsg(xdrs, rmsg) 223 * XDR *xdrs; 224 * struct rpc_msg *rmsg; 225 */ 226 extern bool xdr_nreplymsg(XDR *, struct rpc_msg *); 227 228 /* 229 * XDR routine to handle an accepted rpc reply. 230 * xdr_accepted_reply(xdrs, rej) 231 * XDR *xdrs; 232 * struct accepted_reply *rej; 233 */ 234 extern bool xdr_naccepted_reply(XDR *, struct accepted_reply *); 235 236 /* 237 * XDR routine to handle a rejected rpc reply. 238 * xdr_rejected_reply(xdrs, rej) 239 * XDR *xdrs; 240 * struct rejected_reply *rej; 241 */ 242 extern bool xdr_nrejected_reply(XDR *, struct rejected_reply *); 243 244 /* 245 * Fills in the error part of a reply message. 246 * _seterr_reply(msg, error) 247 * struct rpc_msg *msg; 248 * struct rpc_err *error; 249 */ 250 extern void _seterr_reply(struct rpc_msg *, struct rpc_err *); 251 __END_DECLS 252 /* For backward compatibility */ 253 #include
254 #endif /* !_TIRPC_RPC_MSG_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™