Path: blob/main/crypto/krb5/src/include/gssrpc/rpc_msg.h
34907 views
/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */1/*2* Copyright (c) 2010, Oracle America, Inc.3*4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions are met:8*9* * Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11*12* * Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in14* the documentation and/or other materials provided with the15* distribution.16*17* * Neither the name of the "Oracle America, Inc." nor the names of18* its contributors may be used to endorse or promote products19* derived from this software without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS22* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED23* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A24* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT25* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,26* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED27* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR28* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF29* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING30* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS31* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.32*/33/* @(#)rpc_msg.h 1.7 86/07/16 SMI */3435/*36* rpc_msg.h37* rpc message definition38*/3940#ifndef GSSRPC_RPC_MSG_H41#define GSSRPC_RPC_MSG_H4243GSSRPC__BEGIN_DECLS4445#define RPC_MSG_VERSION ((uint32_t) 2)46#define RPC_SERVICE_PORT ((u_short) 2048)4748/*49* Bottom up definition of an rpc message.50* NOTE: call and reply use the same overall struct but51* different parts of unions within it.52*/5354enum msg_type {55CALL=0,56REPLY=157};5859enum reply_stat {60MSG_ACCEPTED=0,61MSG_DENIED=162};6364enum accept_stat {65SUCCESS=0,66PROG_UNAVAIL=1,67PROG_MISMATCH=2,68PROC_UNAVAIL=3,69GARBAGE_ARGS=4,70SYSTEM_ERR=571};7273enum reject_stat {74RPC_MISMATCH=0,75AUTH_ERROR=176};7778/*79* Reply part of an rpc exchange80*/8182/*83* Reply to an rpc request that was accepted by the server.84* Note: there could be an error even though the request was85* accepted.86*/87struct accepted_reply {88struct opaque_auth ar_verf;89enum accept_stat ar_stat;90union {91struct {92rpcvers_t low;93rpcvers_t high;94} AR_versions;95struct {96caddr_t where;97xdrproc_t proc;98} AR_results;99/* and many other null cases */100} ru;101#define ar_results ru.AR_results102#define ar_vers ru.AR_versions103};104105/*106* Reply to an rpc request that was rejected by the server.107*/108struct rejected_reply {109enum reject_stat rj_stat;110union {111struct {112rpcvers_t low;113rpcvers_t high;114} RJ_versions;115enum auth_stat RJ_why; /* why authentication did not work */116} ru;117#define rj_vers ru.RJ_versions118#define rj_why ru.RJ_why119};120121/*122* Body of a reply to an rpc request.123*/124struct reply_body {125enum reply_stat rp_stat;126union {127struct accepted_reply RP_ar;128struct rejected_reply RP_dr;129} ru;130#define rp_acpt ru.RP_ar131#define rp_rjct ru.RP_dr132};133134/*135* Body of an rpc request call.136*/137struct call_body {138rpcvers_t cb_rpcvers; /* must be equal to two */139rpcprog_t cb_prog;140rpcvers_t cb_vers;141rpcproc_t cb_proc;142struct opaque_auth cb_cred;143struct opaque_auth cb_verf; /* protocol specific - provided by client */144};145146/*147* The rpc message148*/149struct rpc_msg {150uint32_t rm_xid;151enum msg_type rm_direction;152union {153struct call_body RM_cmb;154struct reply_body RM_rmb;155} ru;156#define rm_call ru.RM_cmb157#define rm_reply ru.RM_rmb158};159#define acpted_rply ru.RM_rmb.ru.RP_ar160#define rjcted_rply ru.RM_rmb.ru.RP_dr161162163/*164* XDR routine to handle a rpc message.165* xdr_callmsg(xdrs, cmsg)166* XDR *xdrs;167* struct rpc_msg *cmsg;168*/169extern bool_t xdr_callmsg(XDR *, struct rpc_msg *);170171/*172* XDR routine to pre-serialize the static part of a rpc message.173* xdr_callhdr(xdrs, cmsg)174* XDR *xdrs;175* struct rpc_msg *cmsg;176*/177extern bool_t xdr_callhdr(XDR *, struct rpc_msg *);178179/*180* XDR routine to handle a rpc reply.181* xdr_replymsg(xdrs, rmsg)182* XDR *xdrs;183* struct rpc_msg *rmsg;184*/185extern bool_t xdr_replymsg(XDR *, struct rpc_msg *);186187/*188* Fills in the error part of a reply message.189* _seterr_reply(msg, error)190* struct rpc_msg *msg;191* struct rpc_err *error;192*/193/*194* RENAMED: should be _seterr_reply or __seterr_reply if we can use195* reserved namespace.196*/197extern void gssrpc__seterr_reply(struct rpc_msg *, struct rpc_err *);198199/* XDR the MSG_ACCEPTED part of a reply message union */200extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *);201202/* XDR the MSG_DENIED part of a reply message union */203extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *);204GSSRPC__END_DECLS205206#endif /* !defined(GSSRPC_RPC_MSG_H) */207208209