Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/gssrpc
File: svc.h
/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright (c) 2010, Oracle America, Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* All rights reserved.
[4] Fix | Delete
*
[5] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[6] Fix | Delete
* modification, are permitted provided that the following conditions are met:
[7] Fix | Delete
*
[8] Fix | Delete
* * Redistributions of source code must retain the above copyright
[9] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[10] Fix | Delete
*
[11] Fix | Delete
* * Redistributions in binary form must reproduce the above copyright
[12] Fix | Delete
* notice, this list of conditions and the following disclaimer in
[13] Fix | Delete
* the documentation and/or other materials provided with the
[14] Fix | Delete
* distribution.
[15] Fix | Delete
*
[16] Fix | Delete
* * Neither the name of the "Oracle America, Inc." nor the names of
[17] Fix | Delete
* its contributors may be used to endorse or promote products
[18] Fix | Delete
* derived from this software without specific prior written permission.
[19] Fix | Delete
*
[20] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
[21] Fix | Delete
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
[22] Fix | Delete
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
[23] Fix | Delete
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
[24] Fix | Delete
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
[25] Fix | Delete
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
[26] Fix | Delete
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
[27] Fix | Delete
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
[28] Fix | Delete
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
[29] Fix | Delete
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
[30] Fix | Delete
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[31] Fix | Delete
*/
[32] Fix | Delete
[33] Fix | Delete
/*
[34] Fix | Delete
* svc.h, Server-side remote procedure call interface.
[35] Fix | Delete
*/
[36] Fix | Delete
[37] Fix | Delete
#ifndef GSSRPC_SVC_H
[38] Fix | Delete
#define GSSRPC_SVC_H
[39] Fix | Delete
[40] Fix | Delete
#include <gssrpc/svc_auth.h>
[41] Fix | Delete
[42] Fix | Delete
GSSRPC__BEGIN_DECLS
[43] Fix | Delete
/*
[44] Fix | Delete
* This interface must manage two items concerning remote procedure calling:
[45] Fix | Delete
*
[46] Fix | Delete
* 1) An arbitrary number of transport connections upon which rpc requests
[47] Fix | Delete
* are received. The two most notable transports are TCP and UDP; they are
[48] Fix | Delete
* created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
[49] Fix | Delete
* they in turn call xprt_register and xprt_unregister.
[50] Fix | Delete
*
[51] Fix | Delete
* 2) An arbitrary number of locally registered services. Services are
[52] Fix | Delete
* described by the following four data: program number, version number,
[53] Fix | Delete
* "service dispatch" function, a transport handle, and a boolean that
[54] Fix | Delete
* indicates whether or not the exported program should be registered with a
[55] Fix | Delete
* local binder service; if true the program's number and version and the
[56] Fix | Delete
* port number from the transport handle are registered with the binder.
[57] Fix | Delete
* These data are registered with the rpc svc system via svc_register.
[58] Fix | Delete
*
[59] Fix | Delete
* A service's dispatch function is called whenever an rpc request comes in
[60] Fix | Delete
* on a transport. The request's program and version numbers must match
[61] Fix | Delete
* those of the registered service. The dispatch function is passed two
[62] Fix | Delete
* parameters, struct svc_req * and SVCXPRT *, defined below.
[63] Fix | Delete
*/
[64] Fix | Delete
[65] Fix | Delete
enum xprt_stat {
[66] Fix | Delete
XPRT_DIED,
[67] Fix | Delete
XPRT_MOREREQS,
[68] Fix | Delete
XPRT_IDLE
[69] Fix | Delete
};
[70] Fix | Delete
[71] Fix | Delete
/*
[72] Fix | Delete
* Server side transport handle
[73] Fix | Delete
*/
[74] Fix | Delete
typedef struct SVCXPRT {
[75] Fix | Delete
#ifdef _WIN32
[76] Fix | Delete
SOCKET xp_sock;
[77] Fix | Delete
#else
[78] Fix | Delete
int xp_sock;
[79] Fix | Delete
#endif
[80] Fix | Delete
u_short xp_port; /* associated port number */
[81] Fix | Delete
struct xp_ops {
[82] Fix | Delete
/* receive incomming requests */
[83] Fix | Delete
bool_t (*xp_recv)(struct SVCXPRT *, struct rpc_msg *);
[84] Fix | Delete
/* get transport status */
[85] Fix | Delete
enum xprt_stat (*xp_stat)(struct SVCXPRT *);
[86] Fix | Delete
/* get arguments */
[87] Fix | Delete
bool_t (*xp_getargs)(struct SVCXPRT *, xdrproc_t,
[88] Fix | Delete
void *);
[89] Fix | Delete
/* send reply */
[90] Fix | Delete
bool_t (*xp_reply)(struct SVCXPRT *,
[91] Fix | Delete
struct rpc_msg *);
[92] Fix | Delete
/* free mem allocated for args */
[93] Fix | Delete
bool_t (*xp_freeargs)(struct SVCXPRT *, xdrproc_t,
[94] Fix | Delete
void *);
[95] Fix | Delete
/* destroy this struct */
[96] Fix | Delete
void (*xp_destroy)(struct SVCXPRT *);
[97] Fix | Delete
} *xp_ops;
[98] Fix | Delete
int xp_addrlen; /* length of remote address */
[99] Fix | Delete
struct sockaddr_in xp_raddr; /* remote address */
[100] Fix | Delete
struct opaque_auth xp_verf; /* raw response verifier */
[101] Fix | Delete
SVCAUTH *xp_auth; /* auth flavor of current req */
[102] Fix | Delete
void *xp_p1; /* private */
[103] Fix | Delete
void *xp_p2; /* private */
[104] Fix | Delete
int xp_laddrlen; /* lenght of local address */
[105] Fix | Delete
struct sockaddr_in xp_laddr; /* local address */
[106] Fix | Delete
} SVCXPRT;
[107] Fix | Delete
[108] Fix | Delete
/*
[109] Fix | Delete
* Approved way of getting address of caller
[110] Fix | Delete
*/
[111] Fix | Delete
#define svc_getcaller(x) (&(x)->xp_raddr)
[112] Fix | Delete
[113] Fix | Delete
/*
[114] Fix | Delete
* Operations defined on an SVCXPRT handle
[115] Fix | Delete
*
[116] Fix | Delete
* SVCXPRT *xprt;
[117] Fix | Delete
* struct rpc_msg *msg;
[118] Fix | Delete
* xdrproc_t xargs;
[119] Fix | Delete
* caddr_t argsp;
[120] Fix | Delete
*/
[121] Fix | Delete
#define SVC_RECV(xprt, msg) \
[122] Fix | Delete
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
[123] Fix | Delete
#define svc_recv(xprt, msg) \
[124] Fix | Delete
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
[125] Fix | Delete
[126] Fix | Delete
#define SVC_STAT(xprt) \
[127] Fix | Delete
(*(xprt)->xp_ops->xp_stat)(xprt)
[128] Fix | Delete
#define svc_stat(xprt) \
[129] Fix | Delete
(*(xprt)->xp_ops->xp_stat)(xprt)
[130] Fix | Delete
[131] Fix | Delete
#define SVC_GETARGS(xprt, xargs, argsp) \
[132] Fix | Delete
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
[133] Fix | Delete
#define svc_getargs(xprt, xargs, argsp) \
[134] Fix | Delete
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
[135] Fix | Delete
[136] Fix | Delete
#define SVC_GETARGS_REQ(xprt, req, xargs, argsp) \
[137] Fix | Delete
(*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp))
[138] Fix | Delete
#define svc_getargs_req(xprt, req, xargs, argsp) \
[139] Fix | Delete
(*(xprt)->xp_ops->xp_getargs_req)((xprt), (req), (xargs), (argsp))
[140] Fix | Delete
[141] Fix | Delete
#define SVC_REPLY(xprt, msg) \
[142] Fix | Delete
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
[143] Fix | Delete
#define svc_reply(xprt, msg) \
[144] Fix | Delete
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
[145] Fix | Delete
[146] Fix | Delete
#define SVC_REPLY_REQ(xprt, req, msg) \
[147] Fix | Delete
(*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg))
[148] Fix | Delete
#define svc_reply_req(xprt, msg) \
[149] Fix | Delete
(*(xprt)->xp_ops->xp_reply_req) ((xprt), (req), (msg))
[150] Fix | Delete
[151] Fix | Delete
#define SVC_FREEARGS(xprt, xargs, argsp) \
[152] Fix | Delete
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
[153] Fix | Delete
#define svc_freeargs(xprt, xargs, argsp) \
[154] Fix | Delete
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
[155] Fix | Delete
[156] Fix | Delete
#define SVC_DESTROY(xprt) \
[157] Fix | Delete
(*(xprt)->xp_ops->xp_destroy)(xprt)
[158] Fix | Delete
#define svc_destroy(xprt) \
[159] Fix | Delete
(*(xprt)->xp_ops->xp_destroy)(xprt)
[160] Fix | Delete
[161] Fix | Delete
[162] Fix | Delete
/*
[163] Fix | Delete
* Service request
[164] Fix | Delete
*/
[165] Fix | Delete
struct svc_req {
[166] Fix | Delete
rpcprog_t rq_prog; /* service program number */
[167] Fix | Delete
rpcvers_t rq_vers; /* service protocol version */
[168] Fix | Delete
rpcproc_t rq_proc; /* the desired procedure */
[169] Fix | Delete
struct opaque_auth rq_cred; /* raw creds from the wire */
[170] Fix | Delete
void * rq_clntcred; /* read only cooked client cred */
[171] Fix | Delete
void * rq_svccred; /* read only svc cred/context */
[172] Fix | Delete
void * rq_clntname; /* read only client name */
[173] Fix | Delete
SVCXPRT *rq_xprt; /* associated transport */
[174] Fix | Delete
/* The request's auth flavor *should* be here, but the svc_req */
[175] Fix | Delete
/* isn't passed around everywhere it is necessary. The */
[176] Fix | Delete
/* transport *is* passed around, so the auth flavor it stored */
[177] Fix | Delete
/* there. This means that the transport must be single */
[178] Fix | Delete
/* threaded, but other parts of SunRPC already require that. */
[179] Fix | Delete
/*SVCAUTH *rq_auth; associated auth flavor */
[180] Fix | Delete
};
[181] Fix | Delete
[182] Fix | Delete
[183] Fix | Delete
/*
[184] Fix | Delete
* Service registration
[185] Fix | Delete
*
[186] Fix | Delete
* svc_register(xprt, prog, vers, dispatch, protocol)
[187] Fix | Delete
* SVCXPRT *xprt;
[188] Fix | Delete
* rpcprog_t prog;
[189] Fix | Delete
* rpcvers_t vers;
[190] Fix | Delete
* void (*dispatch)();
[191] Fix | Delete
* int protocol; like IPPROTO_TCP or _UDP; zero means do not register
[192] Fix | Delete
*
[193] Fix | Delete
* registerrpc(prog, vers, proc, routine, inproc, outproc)
[194] Fix | Delete
* returns 0 upon success, -1 if error.
[195] Fix | Delete
*/
[196] Fix | Delete
extern bool_t svc_register(SVCXPRT *, rpcprog_t, rpcvers_t,
[197] Fix | Delete
void (*)(struct svc_req *, SVCXPRT *), int);
[198] Fix | Delete
[199] Fix | Delete
extern int registerrpc(rpcprog_t, rpcvers_t, rpcproc_t,
[200] Fix | Delete
char *(*)(void *),
[201] Fix | Delete
xdrproc_t, xdrproc_t);
[202] Fix | Delete
[203] Fix | Delete
/*
[204] Fix | Delete
* Service un-registration
[205] Fix | Delete
*
[206] Fix | Delete
* svc_unregister(prog, vers)
[207] Fix | Delete
* rpcprog_t prog;
[208] Fix | Delete
* rpcvers_t vers;
[209] Fix | Delete
*/
[210] Fix | Delete
extern void svc_unregister(rpcprog_t, rpcvers_t);
[211] Fix | Delete
[212] Fix | Delete
/*
[213] Fix | Delete
* Transport registration.
[214] Fix | Delete
*
[215] Fix | Delete
* xprt_register(xprt)
[216] Fix | Delete
* SVCXPRT *xprt;
[217] Fix | Delete
*/
[218] Fix | Delete
extern void xprt_register(SVCXPRT *);
[219] Fix | Delete
[220] Fix | Delete
/*
[221] Fix | Delete
* Transport un-register
[222] Fix | Delete
*
[223] Fix | Delete
* xprt_unregister(xprt)
[224] Fix | Delete
* SVCXPRT *xprt;
[225] Fix | Delete
*/
[226] Fix | Delete
extern void xprt_unregister(SVCXPRT *);
[227] Fix | Delete
[228] Fix | Delete
[229] Fix | Delete
/*
[230] Fix | Delete
* When the service routine is called, it must first check to see if
[231] Fix | Delete
* it knows about the procedure; if not, it should call svcerr_noproc
[232] Fix | Delete
* and return. If so, it should deserialize its arguments via
[233] Fix | Delete
* SVC_GETARGS or the new SVC_GETARGS_REQ (both defined above). If
[234] Fix | Delete
* the deserialization does not work, svcerr_decode should be called
[235] Fix | Delete
* followed by a return. Successful decoding of the arguments should
[236] Fix | Delete
* be followed the execution of the procedure's code and a call to
[237] Fix | Delete
* svc_sendreply or the new svc_sendreply_req.
[238] Fix | Delete
*
[239] Fix | Delete
* Also, if the service refuses to execute the procedure due to too-
[240] Fix | Delete
* weak authentication parameters, svcerr_weakauth should be called.
[241] Fix | Delete
* Note: do not confuse access-control failure with weak authentication!
[242] Fix | Delete
*
[243] Fix | Delete
* NB: In pure implementations of rpc, the caller always waits for a reply
[244] Fix | Delete
* msg. This message is sent when svc_sendreply is called.
[245] Fix | Delete
* Therefore pure service implementations should always call
[246] Fix | Delete
* svc_sendreply even if the function logically returns void; use
[247] Fix | Delete
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
[248] Fix | Delete
* for the abuse of pure rpc via batched calling or pipelining. In the
[249] Fix | Delete
* case of a batched call, svc_sendreply should NOT be called since
[250] Fix | Delete
* this would send a return message, which is what batching tries to avoid.
[251] Fix | Delete
* It is the service/protocol writer's responsibility to know which calls are
[252] Fix | Delete
* batched and which are not. Warning: responding to batch calls may
[253] Fix | Delete
* deadlock the caller and server processes!
[254] Fix | Delete
*/
[255] Fix | Delete
[256] Fix | Delete
extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, caddr_t);
[257] Fix | Delete
extern void svcerr_decode(SVCXPRT *);
[258] Fix | Delete
extern void svcerr_weakauth(SVCXPRT *);
[259] Fix | Delete
extern void svcerr_noproc(SVCXPRT *);
[260] Fix | Delete
extern void svcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t);
[261] Fix | Delete
extern void svcerr_auth(SVCXPRT *, enum auth_stat);
[262] Fix | Delete
extern void svcerr_noprog(SVCXPRT *);
[263] Fix | Delete
extern void svcerr_systemerr(SVCXPRT *);
[264] Fix | Delete
[265] Fix | Delete
/*
[266] Fix | Delete
* Lowest level dispatching -OR- who owns this process anyway.
[267] Fix | Delete
* Somebody has to wait for incoming requests and then call the correct
[268] Fix | Delete
* service routine. The routine svc_run does infinite waiting; i.e.,
[269] Fix | Delete
* svc_run never returns.
[270] Fix | Delete
* Since another (co-existant) package may wish to selectively wait for
[271] Fix | Delete
* incoming calls or other events outside of the rpc architecture, the
[272] Fix | Delete
* routine svc_getreq is provided. It must be passed readfds, the
[273] Fix | Delete
* "in-place" results of a select system call (see select, section 2).
[274] Fix | Delete
*/
[275] Fix | Delete
[276] Fix | Delete
/*
[277] Fix | Delete
* Global keeper of rpc service descriptors in use
[278] Fix | Delete
* dynamic; must be inspected before each call to select
[279] Fix | Delete
*/
[280] Fix | Delete
extern int svc_maxfd;
[281] Fix | Delete
#ifdef FD_SETSIZE
[282] Fix | Delete
extern fd_set svc_fdset;
[283] Fix | Delete
/* RENAMED */
[284] Fix | Delete
#define gssrpc_svc_fds gsssrpc_svc_fdset.fds_bits[0] /* compatibility */
[285] Fix | Delete
#else
[286] Fix | Delete
extern int svc_fds;
[287] Fix | Delete
#endif /* def FD_SETSIZE */
[288] Fix | Delete
extern int svc_maxfd;
[289] Fix | Delete
[290] Fix | Delete
/*
[291] Fix | Delete
* a small program implemented by the svc_rpc implementation itself;
[292] Fix | Delete
* also see clnt.h for protocol numbers.
[293] Fix | Delete
*/
[294] Fix | Delete
extern void rpctest_service();
[295] Fix | Delete
[296] Fix | Delete
extern void svc_getreq(int);
[297] Fix | Delete
#ifdef FD_SETSIZE
[298] Fix | Delete
extern void svc_getreqset(fd_set *);/* takes fdset instead of int */
[299] Fix | Delete
extern void svc_getreqset2(fd_set *, int);
[300] Fix | Delete
#else
[301] Fix | Delete
extern void svc_getreqset(int *);
[302] Fix | Delete
#endif
[303] Fix | Delete
extern void svc_run(void); /* never returns */
[304] Fix | Delete
[305] Fix | Delete
/*
[306] Fix | Delete
* Socket to use on svcxxx_create call to get default socket
[307] Fix | Delete
*/
[308] Fix | Delete
#define RPC_ANYSOCK -1
[309] Fix | Delete
[310] Fix | Delete
/*
[311] Fix | Delete
* These are the existing service side transport implementations
[312] Fix | Delete
*/
[313] Fix | Delete
[314] Fix | Delete
/*
[315] Fix | Delete
* Memory based rpc for testing and timing.
[316] Fix | Delete
*/
[317] Fix | Delete
extern SVCXPRT *svcraw_create(void);
[318] Fix | Delete
[319] Fix | Delete
/*
[320] Fix | Delete
* Udp based rpc.
[321] Fix | Delete
*/
[322] Fix | Delete
extern SVCXPRT *svcudp_create(int);
[323] Fix | Delete
extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int);
[324] Fix | Delete
extern int svcudp_enablecache(SVCXPRT *, uint32_t);
[325] Fix | Delete
[326] Fix | Delete
/*
[327] Fix | Delete
* Tcp based rpc.
[328] Fix | Delete
*/
[329] Fix | Delete
extern SVCXPRT *svctcp_create(int, u_int, u_int);
[330] Fix | Delete
[331] Fix | Delete
/*
[332] Fix | Delete
* Like svtcp_create(), except the routine takes any *open* UNIX file
[333] Fix | Delete
* descriptor as its first input.
[334] Fix | Delete
*/
[335] Fix | Delete
extern SVCXPRT *svcfd_create(int, u_int, u_int);
[336] Fix | Delete
[337] Fix | Delete
/* XXX add auth_gsapi_log_*? */
[338] Fix | Delete
[339] Fix | Delete
GSSRPC__END_DECLS
[340] Fix | Delete
[341] Fix | Delete
#endif /* !defined(GSSRPC_SVC_H) */
[342] Fix | Delete
[343] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function