mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-15 08:47:19 +08:00
librpc: now compiles
This commit is contained in:
parent
8f59c0aea7
commit
cd450d239d
@ -1,310 +0,0 @@
|
||||
/* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* The contents of this file are subject to the Sun Standards
|
||||
* License Version 1.0 the (the "License";) You may not use
|
||||
* this file except in compliance with the License. You may
|
||||
* obtain a copy of the License at lib/libc/rpc/LICENSE
|
||||
*
|
||||
* Software distributed under the License is distributed on
|
||||
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
|
||||
* express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Copyright 1998 by Sun Microsystems, Inc
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun
|
||||
* Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* from: @(#)clnt.h 1.31 94/04/29 SMI
|
||||
* from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/clnt.h,v 1.21 2003/01/24 01:47:55 fjoe Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* clnt.h - Client side remote procedure call interface.
|
||||
*
|
||||
* Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _RPC_CLNT_H_
|
||||
#define _RPC_CLNT_H_
|
||||
#include <rpc/clnt_stat.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/un.h>
|
||||
#include <rpc/auth.h> /* auth_stat */
|
||||
|
||||
/*
|
||||
* Error info.
|
||||
*/
|
||||
struct rpc_err {
|
||||
enum clnt_stat re_status;
|
||||
union {
|
||||
int RE_errno; /* related system error */
|
||||
enum auth_stat RE_why; /* why the auth error occurred */
|
||||
struct {
|
||||
rpcvers_t low; /* lowest version supported */
|
||||
rpcvers_t high; /* highest version supported */
|
||||
} RE_vers;
|
||||
struct { /* maybe meaningful if RPC_FAILED */
|
||||
int32_t s1;
|
||||
int32_t s2;
|
||||
} RE_lb; /* life boot & debugging only */
|
||||
} ru;
|
||||
#define re_errno ru.RE_errno
|
||||
#define re_why ru.RE_why
|
||||
#define re_vers ru.RE_vers
|
||||
#define re_lb ru.RE_lb
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Client rpc handle.
|
||||
* Created by individual implementations
|
||||
* Client is responsible for initializing auth, see e.g. auth_none.c.
|
||||
*/
|
||||
typedef struct __rpc_client {
|
||||
AUTH *cl_auth; /* authenticator */
|
||||
struct clnt_ops {
|
||||
/* call remote procedure */
|
||||
enum clnt_stat (*cl_call)(struct __rpc_client *,
|
||||
rpcproc_t, xdrproc_t, void *, xdrproc_t,
|
||||
void *, struct timeval);
|
||||
/* abort a call */
|
||||
void (*cl_abort)(void);
|
||||
/* get specific error code */
|
||||
void (*cl_geterr)(struct __rpc_client *,
|
||||
struct rpc_err *);
|
||||
/* frees results */
|
||||
bool_t (*cl_freeres)(struct __rpc_client *,
|
||||
xdrproc_t, void *);
|
||||
/* destroy this structure */
|
||||
void (*cl_destroy)(struct __rpc_client *);
|
||||
/* the ioctl() of rpc */
|
||||
bool_t (*cl_control)(struct __rpc_client *, int,
|
||||
char *);
|
||||
} *cl_ops;
|
||||
void *cl_private; /* private stuff */
|
||||
} CLIENT;
|
||||
|
||||
#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
|
||||
|
||||
/*
|
||||
* client side rpc interface ops
|
||||
*
|
||||
* Parameter types are:
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* enum clnt_stat
|
||||
* CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
|
||||
* CLIENT *rh;
|
||||
* rpcproc_t proc;
|
||||
* xdrproc_t xargs;
|
||||
* void *argsp;
|
||||
* xdrproc_t xres;
|
||||
* void *resp;
|
||||
* struct timeval timeout;
|
||||
*/
|
||||
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
|
||||
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
|
||||
argsp, xres, resp, secs))
|
||||
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
|
||||
((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
|
||||
argsp, xres, resp, secs))
|
||||
|
||||
/*
|
||||
* void
|
||||
* CLNT_ABORT(rh);
|
||||
* CLIENT *rh;
|
||||
*/
|
||||
#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
|
||||
#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
|
||||
|
||||
/*
|
||||
* struct rpc_err
|
||||
* CLNT_GETERR(rh);
|
||||
* CLIENT *rh;
|
||||
*/
|
||||
#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
|
||||
#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
|
||||
|
||||
|
||||
/*
|
||||
* bool_t
|
||||
* CLNT_FREERES(rh, xres, resp);
|
||||
* CLIENT *rh;
|
||||
* xdrproc_t xres;
|
||||
* void *resp;
|
||||
*/
|
||||
#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
|
||||
#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
|
||||
|
||||
/*
|
||||
* bool_t
|
||||
* CLNT_CONTROL(cl, request, info)
|
||||
* CLIENT *cl;
|
||||
* u_int request;
|
||||
* char *info;
|
||||
*/
|
||||
#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
|
||||
#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
|
||||
|
||||
/*
|
||||
* control operations that apply to udp, tcp and unix transports
|
||||
*
|
||||
* Note: options marked XXX are no-ops in this implementation of RPC.
|
||||
* The are present in TI-RPC but can't be implemented here since they
|
||||
* depend on the presence of STREAMS/TLI, which we don't have.
|
||||
*
|
||||
*/
|
||||
#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
|
||||
#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
|
||||
#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
|
||||
#define CLGET_FD 6 /* get connections file descriptor */
|
||||
#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) */
|
||||
#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */
|
||||
#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */
|
||||
#define CLGET_XID 10 /* Get xid */
|
||||
#define CLSET_XID 11 /* Set xid */
|
||||
#define CLGET_VERS 12 /* Get version number */
|
||||
#define CLSET_VERS 13 /* Set version number */
|
||||
#define CLGET_PROG 14 /* Get program number */
|
||||
#define CLSET_PROG 15 /* Set program number */
|
||||
#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */
|
||||
#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */
|
||||
#define CLSET_POP_TIMOD 18 /* pop timod XXX */
|
||||
|
||||
/*
|
||||
* Connectionless only control operations
|
||||
*/
|
||||
#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
|
||||
#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
|
||||
|
||||
/*
|
||||
* Operations which GSSAPI needs. (Bletch.)
|
||||
*/
|
||||
#define CLGET_LOCAL_ADDR 19 /* get local addr (sockaddr) */
|
||||
|
||||
|
||||
/*
|
||||
* void
|
||||
* CLNT_DESTROY(rh);
|
||||
* CLIENT *rh;
|
||||
*/
|
||||
#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
|
||||
#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
|
||||
|
||||
|
||||
/*
|
||||
* RPCTEST is a test program which is accessible on every rpc
|
||||
* transport/port. It is used for testing, performance evaluation,
|
||||
* and network administration.
|
||||
*/
|
||||
|
||||
#define RPCTEST_PROGRAM ((rpcprog_t)1)
|
||||
#define RPCTEST_VERSION ((rpcvers_t)1)
|
||||
#define RPCTEST_NULL_PROC ((rpcproc_t)2)
|
||||
#define RPCTEST_NULL_BATCH_PROC ((rpcproc_t)3)
|
||||
|
||||
/*
|
||||
* By convention, procedure 0 takes null arguments and returns them
|
||||
*/
|
||||
|
||||
#define NULLPROC ((rpcproc_t)0)
|
||||
|
||||
/*
|
||||
* Below are the client handle creation routines for the various
|
||||
* implementations of client side rpc. They can return NULL if a
|
||||
* creation failure occurs.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. Supported protocols are "udp", "tcp"
|
||||
* and "unix".
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,
|
||||
const char *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clntunix_create(struct sockaddr_un *,
|
||||
u_long, u_long, int *, u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* Print why creation failed
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void clnt_pcreateerror(const char *); /* stderr */
|
||||
extern char *clnt_spcreateerror(const char *); /* string */
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Like clnt_perror(), but is more verbose in its output
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void clnt_perrno(enum clnt_stat); /* stderr */
|
||||
extern char *clnt_sperrno(enum clnt_stat); /* string */
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Print an English error message, given the client error code
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void clnt_perror(CLIENT *, const char *); /* stderr */
|
||||
extern char *clnt_sperror(CLIENT *, const char *); /* string */
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* If a creation fails, the following allows the user to figure out why.
|
||||
*/
|
||||
struct rpc_createerr {
|
||||
enum clnt_stat cf_stat;
|
||||
struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
|
||||
};
|
||||
|
||||
extern struct rpc_createerr rpc_createerr;
|
||||
|
||||
/* For backward compatibility */
|
||||
#include <rpc/clnt_soc.h>
|
||||
|
||||
#endif /* !_RPC_CLNT_H_ */
|
@ -56,7 +56,10 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern u_int __rpc_get_a_size(int);
|
||||
extern u_int __rpc_get_t_size(int, long);
|
||||
#ifndef __rtems__
|
||||
/* XXX defined in old.. in new rpc.h as internal */
|
||||
extern u_int __rpc_get_t_size(int, long);
|
||||
#endif
|
||||
extern int __rpc_dtbsize(void);
|
||||
extern int _rpc_dtablesize(void);
|
||||
extern int _rpc_get_default_domain(char **);
|
||||
|
@ -1,296 +0,0 @@
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* from: @(#)svc.h 1.35 88/12/17 SMI
|
||||
* from: @(#)svc.h 1.27 94/04/25 SMI
|
||||
* $FreeBSD: src/include/rpc/svc.h,v 1.24 2003/06/15 10:32:01 mbr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* svc.h, Server-side remote procedure call interface.
|
||||
*
|
||||
* Copyright (C) 1986-1993 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_SVC_H
|
||||
#define _RPC_SVC_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h> /* xdrproc_t */
|
||||
#include <sys/socket.h> /* socklen_t */
|
||||
#include <netinet/in.h> /* struct sockaddr_in */
|
||||
#include <rpc/auth.h> /* auth_stat */
|
||||
|
||||
/*
|
||||
* This interface must manage two items concerning remote procedure calling:
|
||||
*
|
||||
* 1) An arbitrary number of transport connections upon which rpc requests
|
||||
* are received. The two most notable transports are TCP and UDP; they are
|
||||
* created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
|
||||
* they in turn call xprt_register and xprt_unregister.
|
||||
*
|
||||
* 2) An arbitrary number of locally registered services. Services are
|
||||
* described by the following four data: program number, version number,
|
||||
* "service dispatch" function, a transport handle, and a boolean that
|
||||
* indicates whether or not the exported program should be registered with a
|
||||
* local binder service; if true the program's number and version and the
|
||||
* port number from the transport handle are registered with the binder.
|
||||
* These data are registered with the rpc svc system via svc_register.
|
||||
*
|
||||
* A service's dispatch function is called whenever an rpc request comes in
|
||||
* on a transport. The request's program and version numbers must match
|
||||
* those of the registered service. The dispatch function is passed two
|
||||
* parameters, struct svc_req * and SVCXPRT *, defined below.
|
||||
*/
|
||||
|
||||
enum xprt_stat {
|
||||
XPRT_DIED,
|
||||
XPRT_MOREREQS,
|
||||
XPRT_IDLE,
|
||||
_XPRT_STAT = 0xffffffff
|
||||
};
|
||||
|
||||
struct rpc_msg;
|
||||
|
||||
/*
|
||||
* Server side transport handle
|
||||
*/
|
||||
typedef struct __rpc_svcxprt {
|
||||
int xp_sock;
|
||||
u_short xp_port; /* associated port number */
|
||||
struct xp_ops {
|
||||
/* receive incoming requests */
|
||||
bool_t (*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *);
|
||||
/* get transport status */
|
||||
enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *);
|
||||
/* get arguments */
|
||||
bool_t (*xp_getargs)(struct __rpc_svcxprt *, xdrproc_t,
|
||||
caddr_t args_ptr);
|
||||
/* send reply */
|
||||
bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *);
|
||||
/* free mem allocated for args */
|
||||
bool_t (*xp_freeargs)(struct __rpc_svcxprt *, xdrproc_t,
|
||||
caddr_t args_ptr);
|
||||
/* destroy this struct */
|
||||
void (*xp_destroy)(struct __rpc_svcxprt *);
|
||||
} *xp_ops;
|
||||
socklen_t xp_addrlen; /* length of remote address */
|
||||
struct sockaddr_in xp_raddr; /* remote addr. (backward ABI compat) */
|
||||
struct opaque_auth xp_verf; /* raw response verifier */
|
||||
void *xp_p1; /* private: for use by svc ops */
|
||||
void *xp_p2; /* private: for use by svc ops */
|
||||
} SVCXPRT;
|
||||
|
||||
/*
|
||||
* Service request
|
||||
*/
|
||||
struct svc_req {
|
||||
u_int32_t rq_prog; /* service program number */
|
||||
u_int32_t rq_vers; /* service protocol version */
|
||||
u_int32_t rq_proc; /* the desired procedure */
|
||||
struct opaque_auth rq_cred; /* raw creds from the wire */
|
||||
caddr_t rq_clntcred; /* read only cooked cred */
|
||||
SVCXPRT *rq_xprt; /* associated transport */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Operations defined on an SVCXPRT handle
|
||||
*
|
||||
* SVCXPRT *xprt;
|
||||
* struct rpc_msg *msg;
|
||||
* xdrproc_t xargs;
|
||||
* caddr_t argsp;
|
||||
*/
|
||||
#define SVC_RECV(xprt, msg) \
|
||||
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
|
||||
#define svc_recv(xprt, msg) \
|
||||
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
|
||||
|
||||
#define SVC_STAT(xprt) \
|
||||
(*(xprt)->xp_ops->xp_stat)(xprt)
|
||||
#define svc_stat(xprt) \
|
||||
(*(xprt)->xp_ops->xp_stat)(xprt)
|
||||
|
||||
#define SVC_GETARGS(xprt, xargs, argsp) \
|
||||
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
|
||||
#define svc_getargs(xprt, xargs, argsp) \
|
||||
(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
|
||||
|
||||
#define SVC_REPLY(xprt, msg) \
|
||||
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
|
||||
#define svc_reply(xprt, msg) \
|
||||
(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
|
||||
|
||||
#define SVC_FREEARGS(xprt, xargs, argsp) \
|
||||
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
|
||||
#define svc_freeargs(xprt, xargs, argsp) \
|
||||
(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
|
||||
|
||||
#define SVC_DESTROY(xprt) \
|
||||
(*(xprt)->xp_ops->xp_destroy)(xprt)
|
||||
#define svc_destroy(xprt) \
|
||||
(*(xprt)->xp_ops->xp_destroy)(xprt)
|
||||
|
||||
/*
|
||||
* Transport registration.
|
||||
*
|
||||
* xprt_register(xprt)
|
||||
* SVCXPRT *xprt;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void xprt_register(SVCXPRT *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Transport un-register
|
||||
*
|
||||
* xprt_unregister(xprt)
|
||||
* SVCXPRT *xprt;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void xprt_unregister(SVCXPRT *);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* When the service routine is called, it must first check to see if it
|
||||
* knows about the procedure; if not, it should call svcerr_noproc
|
||||
* and return. If so, it should deserialize its arguments via
|
||||
* SVC_GETARGS (defined above). If the deserialization does not work,
|
||||
* svcerr_decode should be called followed by a return. Successful
|
||||
* decoding of the arguments should be followed the execution of the
|
||||
* procedure's code and a call to svc_sendreply.
|
||||
*
|
||||
* Also, if the service refuses to execute the procedure due to too-
|
||||
* weak authentication parameters, svcerr_weakauth should be called.
|
||||
* Note: do not confuse access-control failure with weak authentication!
|
||||
*
|
||||
* NB: In pure implementations of rpc, the caller always waits for a reply
|
||||
* msg. This message is sent when svc_sendreply is called.
|
||||
* Therefore pure service implementations should always call
|
||||
* svc_sendreply even if the function logically returns void; use
|
||||
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
|
||||
* for the abuse of pure rpc via batched calling or pipelining. In the
|
||||
* case of a batched call, svc_sendreply should NOT be called since
|
||||
* this would send a return message, which is what batching tries to avoid.
|
||||
* It is the service/protocol writer's responsibility to know which calls are
|
||||
* batched and which are not. Warning: responding to batch calls may
|
||||
* deadlock the caller and server processes!
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t svc_sendreply(SVCXPRT *, xdrproc_t, void *);
|
||||
extern void svcerr_decode(SVCXPRT *);
|
||||
extern void svcerr_weakauth(SVCXPRT *);
|
||||
extern void svcerr_noproc(SVCXPRT *);
|
||||
extern void svcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t);
|
||||
extern void svcerr_auth(SVCXPRT *, enum auth_stat);
|
||||
extern void svcerr_noprog(SVCXPRT *);
|
||||
extern void svcerr_systemerr(SVCXPRT *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Lowest level dispatching -OR- who owns this process anyway.
|
||||
* Somebody has to wait for incoming requests and then call the correct
|
||||
* service routine. The routine svc_run does infinite waiting; i.e.,
|
||||
* svc_run never returns.
|
||||
* Since another (co-existant) package may wish to selectively wait for
|
||||
* incoming calls or other events outside of the rpc architecture, the
|
||||
* routine svc_getreq is provided. It must be passed readfds, the
|
||||
* "in-place" results of a select system call (see select, section 2).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Global keeper of rpc service descriptors in use
|
||||
* dynamic; must be inspected before each call to select
|
||||
*/
|
||||
extern int svc_maxfd;
|
||||
extern fd_set svc_fdset;
|
||||
#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
|
||||
|
||||
#ifndef _KERNEL
|
||||
/*
|
||||
* a small program implemented by the svc_rpc implementation itself;
|
||||
* also see clnt.h for protocol numbers.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void rpctest_service(void);
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void svc_getreq(int);
|
||||
extern void svc_getreqset(fd_set *);
|
||||
extern void svc_getreqset2(fd_set *, int); /* XXX: nonstd, undoc */
|
||||
extern void svc_run(void);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Socket to use on svcxxx_create call to get default socket
|
||||
*/
|
||||
#define RPC_ANYSOCK -1
|
||||
#define RPC_ANYFD RPC_ANYSOCK
|
||||
|
||||
/*
|
||||
* These are the existing service side transport implementations
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Transport independent svc_create routine.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Connectionless and connectionful create routines
|
||||
*/
|
||||
|
||||
extern SVCXPRT *svc_vc_create(const int, const u_int, const u_int);
|
||||
/*
|
||||
* const int fd; -- open connection end point
|
||||
* const u_int sendsize; -- max send size
|
||||
* const u_int recvsize; -- max recv size
|
||||
*/
|
||||
|
||||
/*
|
||||
* Added for compatibility to old rpc 4.0. Obsoleted by svc_vc_create().
|
||||
*/
|
||||
extern SVCXPRT *svcunix_create(int, u_int, u_int, char *);
|
||||
|
||||
/*
|
||||
* Added for compatibility to old rpc 4.0. Obsoleted by svc_fd_create().
|
||||
*/
|
||||
extern SVCXPRT *svcunixfd_create(int, u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/* for backward compatibility */
|
||||
#include <rpc/svc_soc.h>
|
||||
|
||||
#endif /* !_RPC_SVC_H */
|
@ -45,7 +45,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.9 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/auth.h>
|
||||
|
@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/auth_unix.c,v 1.12 1999/12/29 0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -45,6 +45,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/authunix_prot.c,v 1.6 1999/08/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/auth.h>
|
||||
|
@ -46,6 +46,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/bindresvport.c,v 1.12 2000/01/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
@ -40,6 +40,8 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_generic.c,v 1.9 1999/08/28
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/errno.h>
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_perror.c,v 1.11 1999/08/28
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -51,6 +52,9 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_perror.c,v 1.11 1999/08/28
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/auth.h>
|
||||
#include <rpc/clnt.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
static char *auth_errmsg(enum auth_stat stat);
|
||||
#define CLNT_PERROR_BUFLEN 256
|
||||
|
@ -48,9 +48,13 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_raw.c,v 1.10 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
#define MCALL_MSG_SIZE 24
|
||||
|
||||
@ -189,7 +193,7 @@ call_again:
|
||||
}
|
||||
} /* end successful completion */
|
||||
else {
|
||||
if (AUTH_REFRESH(h->cl_auth))
|
||||
if (AUTH_REFRESH(h->cl_auth, &msg))
|
||||
goto call_again;
|
||||
} /* end of unsuccessful completion */
|
||||
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_simple.c,v 1.12 2000/01/27
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,6 +53,9 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_simple.c,v 1.12 2000/01/27
|
||||
#include <rpc/rpc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
struct call_rpc_private {
|
||||
CLIENT *client;
|
||||
@ -63,10 +67,10 @@ struct call_rpc_private {
|
||||
|
||||
int
|
||||
callrpc(
|
||||
char *host,
|
||||
const char *host,
|
||||
int prognum, int versnum, int procnum,
|
||||
xdrproc_t inproc, char *in,
|
||||
xdrproc_t outproc, char *out )
|
||||
xdrproc_t inproc, void *in,
|
||||
xdrproc_t outproc, void *out )
|
||||
{
|
||||
register struct call_rpc_private *crp = callrpc_private;
|
||||
struct sockaddr_in server_addr;
|
||||
|
@ -56,6 +56,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_tcp.c,v 1.14 2000/01/27 23
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -330,7 +331,7 @@ call_again:
|
||||
} /* end successful completion */
|
||||
else {
|
||||
/* maybe our credentials need to be refreshed ... */
|
||||
if (refreshes-- && AUTH_REFRESH(h->cl_auth))
|
||||
if (refreshes-- && AUTH_REFRESH(h->cl_auth, &reply_msg))
|
||||
goto call_again;
|
||||
} /* end of unsuccessful completion */
|
||||
return (ct->ct_error.re_status);
|
||||
@ -470,11 +471,14 @@ clnttcp_control(
|
||||
= htonl(*(u_int32_t *)info);
|
||||
break;
|
||||
|
||||
#ifndef __rtems__
|
||||
/* XXX defined in old.. not new */
|
||||
case CLGET_LOCAL_ADDR:
|
||||
len = sizeof(struct sockaddr);
|
||||
if (getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0)
|
||||
return(FALSE);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case CLGET_RETRY_TIMEOUT:
|
||||
case CLSET_RETRY_TIMEOUT:
|
||||
|
@ -43,6 +43,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/clnt_udp.c,v 1.15 2000/01/27 23
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -388,7 +389,7 @@ send_again:
|
||||
} /* end successful completion */
|
||||
else {
|
||||
/* maybe our credentials need to be refreshed ... */
|
||||
if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) {
|
||||
if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth, &reply_msg)) {
|
||||
nrefreshes--;
|
||||
goto call_again;
|
||||
}
|
||||
@ -549,11 +550,14 @@ clntudp_control(
|
||||
*(u_long *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT)
|
||||
= htonl(*(u_long *)info);
|
||||
break;
|
||||
#ifndef __rtems__
|
||||
/* XXX defined in old.. not new */
|
||||
case CLGET_LOCAL_ADDR:
|
||||
len = sizeof(struct sockaddr);
|
||||
if (getsockname(cu->cu_sock, (struct sockaddr *)info, &len) <0)
|
||||
return(FALSE);
|
||||
break;
|
||||
#endif
|
||||
case CLGET_SVC_ADDR:
|
||||
case CLSET_SVC_ADDR:
|
||||
case CLSET_PUSH_TIMOD:
|
||||
|
@ -44,13 +44,19 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/get_myaddress.c,v 1.17 2000/01/
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mbuf.h>
|
||||
#ifndef __rtems__
|
||||
/* XXX old.. not new */
|
||||
#include <sys/mbuf.h>
|
||||
#else
|
||||
#include <freebsd/sys/mbuf.h>
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -41,6 +41,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/getrpcent.c,v 1.10 1999/08/28 0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -41,6 +41,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/getrpcport.c,v 1.10 1999/08/28
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <rpc/rpc.h>
|
||||
|
@ -43,6 +43,7 @@ static char sccsid[] = "@(#)netname.c 1.8 91/03/11 Copyr 1986 Sun Micro";
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/param.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpc_com.h>
|
||||
@ -88,8 +89,8 @@ getnetname(char name[MAXNETNAMELEN+1])
|
||||
int
|
||||
user2netname(
|
||||
char netname[MAXNETNAMELEN + 1],
|
||||
uid_t uid,
|
||||
char *domain)
|
||||
const uid_t uid,
|
||||
const char *domain)
|
||||
{
|
||||
char *dfltdom;
|
||||
|
||||
@ -115,8 +116,8 @@ user2netname(
|
||||
int
|
||||
host2netname(
|
||||
char netname[MAXNETNAMELEN + 1],
|
||||
char *host,
|
||||
char *domain)
|
||||
const char *host,
|
||||
const char *domain)
|
||||
{
|
||||
char *dfltdom;
|
||||
char hostname[MAXHOSTNAMELEN+1];
|
||||
|
@ -40,6 +40,7 @@ static char sccsid[] = "@(#)netnamer.c 1.13 91/03/11 Copyr 1986 Sun Micro";
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/param.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpc_com.h>
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_clnt.c,v 1.11 2000/01/27 2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
@ -45,6 +45,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_getmaps.c,v 1.11 2000/01/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
@ -53,7 +54,12 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_getmaps.c,v 1.11 2000/01/2
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/mbuf.h>
|
||||
#ifndef __rtems__
|
||||
/* XXX fix for new location */
|
||||
#include <sys/mbuf.h>
|
||||
#else
|
||||
#include <freebsd/sys/mbuf.h>
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#define NAMELEN 255
|
||||
|
@ -44,11 +44,17 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_getport.c,v 1.10 2000/01/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/mbuf.h>
|
||||
#ifndef __rtems__
|
||||
/* XXX fix for new location */
|
||||
#include <sys/mbuf.h>
|
||||
#else
|
||||
#include <freebsd/sys/mbuf.h>
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_prot.c,v 1.6 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
|
@ -44,6 +44,11 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/pmap_prot2.c,v 1.7 1999/08/28 0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#ifndef __rtems__
|
||||
/* XXX not needed in old.. */
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
|
@ -248,7 +248,10 @@ getbroadcastnets(
|
||||
return (i);
|
||||
}
|
||||
|
||||
#ifndef __rtems__
|
||||
/* XXX now defined in rpc/clnt.h */
|
||||
typedef bool_t (*resultproc_t)(caddr_t, struct sockaddr_in *);
|
||||
#endif
|
||||
|
||||
enum clnt_stat
|
||||
clnt_broadcast(
|
||||
@ -256,9 +259,9 @@ clnt_broadcast(
|
||||
u_long vers, /* version number */
|
||||
u_long proc, /* procedure number */
|
||||
xdrproc_t xargs, /* xdr routine for args */
|
||||
caddr_t argsp, /* pointer to args */
|
||||
void * argsp, /* pointer to args */
|
||||
xdrproc_t xresults, /* xdr routine for results */
|
||||
caddr_t resultsp, /* pointer to results */
|
||||
void * resultsp, /* pointer to results */
|
||||
resultproc_t eachresult /* call with each result obtained */ )
|
||||
{
|
||||
enum clnt_stat stat = RPC_SUCCESS; /* to avoid warning */
|
||||
|
@ -1450,7 +1450,7 @@ If the socket is not bound to a local
|
||||
.SM TCP
|
||||
port, then this routine binds it to an arbitrary port. Upon
|
||||
completion,
|
||||
\fB\%xprt\->xp_sock\fR
|
||||
\fB\%xprt\->xp_fd\fR
|
||||
is the transport's socket descriptor, and
|
||||
\fB\%xprt\->xp_port\fR
|
||||
is the transport's port number.
|
||||
@ -1515,7 +1515,7 @@ If the socket is not bound to a local
|
||||
port, then this routine binds it to an arbitrary port.
|
||||
Upon
|
||||
completion,
|
||||
\fB\%xprt\->xp_sock\fR
|
||||
\fB\%xprt\->xp_fd\fR
|
||||
is the transport's socket descriptor, and
|
||||
\fB\%xprt\->xp_port\fR
|
||||
is the transport's port number.
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_callmsg.c,v 1.9 1999/08/28
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -36,7 +36,12 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_commondata.c,v 1.7 1999/08/
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/clnt.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This file should only contain common data (global data) that is exported
|
||||
* by public interfaces
|
||||
|
@ -37,6 +37,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_dtablesize.c,v 1.10 1999/08
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -50,6 +50,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/rpc_prot.c,v 1.8 1999/08/28 00:
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <assert.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
|
@ -40,10 +40,15 @@ static char sccsid[] = "@(#)rpcdname.c 1.7 91/03/11 Copyr 1989 Sun Micro";
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <rpc/rpc.h>
|
||||
#ifdef __rtems__
|
||||
/* XXX in rpc.h in old .. not new */
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
int getdomainname(char *, size_t);
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <stdio.h>
|
||||
|
@ -6,9 +6,14 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rtems.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __rtems__
|
||||
/* XXX in rpc.h in old .. not new */
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RPC variables for single-thread
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc.c,v 1.14 1999/08/28 00:00:4
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h> /* for ffs */
|
||||
@ -55,6 +56,10 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc.c,v 1.14 1999/08/28 00:00:4
|
||||
#include <sys/errno.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#ifdef __rtems__
|
||||
/* XXX in rpc.h in old .. not new */
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
#define xports (rtems_rpc_task_variables->svc_xports)
|
||||
#define xportssize (rtems_rpc_task_variables->svc_xportssize)
|
||||
@ -90,7 +95,7 @@ void
|
||||
xprt_register(
|
||||
SVCXPRT *xprt )
|
||||
{
|
||||
register int sock = xprt->xp_sock;
|
||||
register int sock = xprt->xp_fd;
|
||||
|
||||
if (sock + 1 > __svc_fdsetsize) {
|
||||
int bytes = sizeof (fd_set);
|
||||
@ -136,7 +141,7 @@ void
|
||||
xprt_unregister(
|
||||
SVCXPRT *xprt )
|
||||
{
|
||||
register int sock = xprt->xp_sock;
|
||||
register int sock = xprt->xp_fd;
|
||||
|
||||
if (xports[sock] == xprt) {
|
||||
xports[sock] = (SVCXPRT *)0;
|
||||
|
@ -50,6 +50,7 @@ static const char rcsid[] =
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#ifdef _KERNEL
|
||||
#include <sys/param.h>
|
||||
#include <rpc/types.h>
|
||||
@ -64,6 +65,10 @@ static const char rcsid[] =
|
||||
#include <rpc/rpc.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef __rtems__
|
||||
/* XXX in rpc.h in old .. not new */
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* svcauthsw is the bdevsw of server side authentication.
|
||||
|
@ -48,6 +48,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_auth_unix.c,v 1.8 1999/08/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <rpc/rpc.h>
|
||||
|
@ -46,8 +46,13 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_raw.c,v 1.7 1999/08/28 00:0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __rtems__
|
||||
/* XXX in rpc.h in old .. not new */
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is the "network" that we will be moving data over
|
||||
@ -86,7 +91,7 @@ svcraw_create(void)
|
||||
if (srp == 0)
|
||||
return (0);
|
||||
}
|
||||
srp->server.xp_sock = 0;
|
||||
srp->server.xp_fd = 0;
|
||||
srp->server.xp_port = 0;
|
||||
srp->server.xp_ops = &server_ops;
|
||||
srp->server.xp_verf.oa_base = srp->verf_body;
|
||||
|
@ -42,6 +42,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_run.c,v 1.10 1999/08/28 00:
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/errno.h>
|
||||
@ -51,6 +52,9 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_run.c,v 1.10 1999/08/28 00:
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
svc_run(void)
|
||||
|
@ -44,6 +44,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_simple.c,v 1.9 1999/08/28 0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -54,6 +55,9 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_simple.c,v 1.9 1999/08/28 0
|
||||
#include <netdb.h>
|
||||
|
||||
#include <inttypes.h> /* for PRIxx printf formats */
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
struct prog_lst {
|
||||
char *(*p_progname)(char *);
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_tcp.c,v 1.18 2000/01/27 23:
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -56,6 +57,9 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_tcp.c,v 1.18 2000/01/27 23:
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/select.h>
|
||||
#ifdef __rtems__
|
||||
#include <rpc/rpc_rtems.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ops vector for TCP/IP based rpc service handle
|
||||
@ -119,7 +123,7 @@ struct tcp_conn { /* kept in xprt->xp_p1 */
|
||||
* If the socket, sock is not bound to a port then svctcp_create
|
||||
* binds it to an arbitrary port. The routine then starts a tcp
|
||||
* listener on the socket's associated port. In any (successful) case,
|
||||
* xprt->xp_sock is the registered socket number and xprt->xp_port is the
|
||||
* xprt->xp_fd is the registered socket number and xprt->xp_port is the
|
||||
* associated port number.
|
||||
*
|
||||
* Since tcp streams do buffered io similar to stdio, the caller can specify
|
||||
@ -184,7 +188,7 @@ svctcp_create(
|
||||
xprt->xp_verf = _null_auth;
|
||||
xprt->xp_ops = &svctcp_rendezvous_op;
|
||||
xprt->xp_port = ntohs(addr.sin_port);
|
||||
xprt->xp_sock = sock;
|
||||
xprt->xp_fd = sock;
|
||||
xprt_register(xprt);
|
||||
return (xprt);
|
||||
}
|
||||
@ -233,7 +237,7 @@ makefd_xprt(
|
||||
xprt->xp_addrlen = 0;
|
||||
xprt->xp_ops = &svctcp_op; /* truely deals with calls */
|
||||
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
|
||||
xprt->xp_sock = fd;
|
||||
xprt->xp_fd = fd;
|
||||
xprt_register(xprt);
|
||||
done:
|
||||
return (xprt);
|
||||
@ -253,7 +257,7 @@ rendezvous_request(
|
||||
r = (struct tcp_rendezvous *)xprt->xp_p1;
|
||||
again:
|
||||
len = sizeof(struct sockaddr_in);
|
||||
if ((sock = accept(xprt->xp_sock, (struct sockaddr *)&addr,
|
||||
if ((sock = accept(xprt->xp_fd, (struct sockaddr *)&addr,
|
||||
&len)) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto again;
|
||||
@ -297,7 +301,7 @@ svctcp_destroy(
|
||||
register struct tcp_conn *cd = (struct tcp_conn *)xprt->xp_p1;
|
||||
|
||||
xprt_unregister(xprt);
|
||||
(void)_RPC_close(xprt->xp_sock);
|
||||
(void)_RPC_close(xprt->xp_fd);
|
||||
if (xprt->xp_port != 0) {
|
||||
/* a rendezvouser socket */
|
||||
xprt->xp_port = 0;
|
||||
@ -334,7 +338,7 @@ readtcp(
|
||||
int len)
|
||||
{
|
||||
SVCXPRT *xprt = (SVCXPRT*) _xprt;
|
||||
register int sock = xprt->xp_sock;
|
||||
register int sock = xprt->xp_fd;
|
||||
struct timeval start, delta, tv;
|
||||
struct timeval tmp1, tmp2;
|
||||
fd_set *fds;
|
||||
@ -406,7 +410,7 @@ writetcp(
|
||||
register int i, cnt;
|
||||
|
||||
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
|
||||
if ((i = _RPC_write(xprt->xp_sock, buf, cnt)) < 0) {
|
||||
if ((i = _RPC_write(xprt->xp_fd, buf, cnt)) < 0) {
|
||||
((struct tcp_conn *)(xprt->xp_p1))->strm_stat =
|
||||
XPRT_DIED;
|
||||
return (-1);
|
||||
|
@ -45,6 +45,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/rpc/svc_udp.c,v 1.13 2000/01/27 23:
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -93,7 +94,7 @@ struct svcudp_data {
|
||||
* If sock<0 then a socket is created, else sock is used.
|
||||
* If the socket, sock is not bound to a port then svcudp_create
|
||||
* binds it to an arbitrary port. In any (successful) case,
|
||||
* xprt->xp_sock is the registered socket number and xprt->xp_port is the
|
||||
* xprt->xp_fd is the registered socket number and xprt->xp_port is the
|
||||
* associated port number.
|
||||
* Once *xprt is initialized, it is registered as a transporter;
|
||||
* see (svc.h, xprt_register).
|
||||
@ -153,7 +154,7 @@ svcudp_bufcreate(
|
||||
xprt->xp_verf.oa_base = su->su_verfbody;
|
||||
xprt->xp_ops = &svcudp_op;
|
||||
xprt->xp_port = ntohs(addr.sin_port);
|
||||
xprt->xp_sock = sock;
|
||||
xprt->xp_fd = sock;
|
||||
xprt_register(xprt);
|
||||
return (xprt);
|
||||
}
|
||||
@ -187,7 +188,7 @@ svcudp_recv(
|
||||
|
||||
again:
|
||||
xprt->xp_addrlen = sizeof(struct sockaddr_in);
|
||||
rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz,
|
||||
rlen = recvfrom(xprt->xp_fd, rpc_buffer(xprt), (int) su->su_iosz,
|
||||
0, (struct sockaddr *)&(xprt->xp_raddr), &(xprt->xp_addrlen));
|
||||
if (rlen == -1 && errno == EINTR)
|
||||
goto again;
|
||||
@ -200,7 +201,7 @@ svcudp_recv(
|
||||
su->su_xid = msg->rm_xid;
|
||||
if (su->su_cache != NULL) {
|
||||
if (cache_get(xprt, msg, &reply, &replylen)) {
|
||||
(void) sendto(xprt->xp_sock, reply, (int) replylen, 0,
|
||||
(void) sendto(xprt->xp_fd, reply, (int) replylen, 0,
|
||||
(struct sockaddr *) &xprt->xp_raddr, xprt->xp_addrlen);
|
||||
return (TRUE);
|
||||
}
|
||||
@ -223,7 +224,7 @@ svcudp_reply(
|
||||
msg->rm_xid = su->su_xid;
|
||||
if (xdr_replymsg(xdrs, msg)) {
|
||||
slen = (int)XDR_GETPOS(xdrs);
|
||||
if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0,
|
||||
if (sendto(xprt->xp_fd, rpc_buffer(xprt), slen, 0,
|
||||
(struct sockaddr *)&(xprt->xp_raddr), xprt->xp_addrlen)
|
||||
== slen) {
|
||||
stat = TRUE;
|
||||
@ -264,7 +265,7 @@ svcudp_destroy(
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
|
||||
xprt_unregister(xprt);
|
||||
(void)_RPC_close(xprt->xp_sock);
|
||||
(void)_RPC_close(xprt->xp_fd);
|
||||
XDR_DESTROY(&(su->su_xdrs));
|
||||
mem_free(rpc_buffer(xprt), su->su_iosz);
|
||||
mem_free((caddr_t)su, sizeof(struct svcudp_data));
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr.c,v 1.9 1999/08/28 00:02:55
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -77,7 +78,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
|
||||
void
|
||||
xdr_free(
|
||||
xdrproc_t proc,
|
||||
char *objp)
|
||||
void *objp)
|
||||
{
|
||||
XDR x;
|
||||
|
||||
|
@ -46,6 +46,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_array.c,v 1.8 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_float.c,v 1.7 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -48,6 +48,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_mem.c,v 1.8 1999/08/28 00:0
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <string.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
@ -53,6 +53,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_rec.c,v 1.12 2000/01/19 06:
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -145,9 +146,9 @@ xdrrec_create(
|
||||
XDR *xdrs,
|
||||
u_int sendsize,
|
||||
u_int recvsize,
|
||||
caddr_t tcp_handle,
|
||||
int (*readit)(char*, char*, int), /* like read, but pass it a tcp_handle, not sock */
|
||||
int (*writeit)(char*, char*, int) /* like write, but pass it a tcp_handle, not sock */
|
||||
void *tcp_handle,
|
||||
int (*readit)(void*, void*, int), /* like read, but pass it a tcp_handle, not sock */
|
||||
int (*writeit)(void*, void*, int) /* like write, but pass it a tcp_handle, not sock */
|
||||
)
|
||||
{
|
||||
RECSTREAM *rstrm =
|
||||
@ -466,7 +467,7 @@ xdrrec_eof(
|
||||
bool_t
|
||||
xdrrec_endofrecord(
|
||||
XDR *xdrs,
|
||||
bool_t sendnow)
|
||||
int sendnow)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
u_long len; /* fragment length */
|
||||
|
@ -46,6 +46,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_reference.c,v 1.8 1999/08/2
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD: src/lib/libc/xdr/xdr_stdio.c,v 1.7 1999/08/28 00
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <freebsd/bsd.h>
|
||||
#include <rpc/types.h>
|
||||
#include <stdio.h>
|
||||
#include <rpc/xdr.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user