From 1bcdb3f6ec4574b680f3237ff7683fd7e961c76a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 16 Nov 1999 13:31:13 +0000 Subject: Committed modifications from ITRON Task and Task Dependendent Synchronization Working Group. Included are tests. --- c/src/lib/include/rdbg/Makefile.am | 31 --- c/src/lib/include/rdbg/i386/Makefile.am | 33 --- c/src/lib/include/rdbg/i386/rdbg_f.h | 41 ---- c/src/lib/include/rdbg/i386/reg.h | 36 ---- c/src/lib/include/rdbg/powerpc/Makefile.am | 33 --- c/src/lib/include/rdbg/powerpc/rdbg_f.h | 38 ---- c/src/lib/include/rdbg/powerpc/reg.h | 16 -- c/src/lib/include/rdbg/rdbg.h | 95 -------- c/src/lib/include/rdbg/servrpc.h | 280 ------------------------ c/src/lib/include/rpc/Makefile.am | 26 --- c/src/lib/include/rpc/auth.h | 167 -------------- c/src/lib/include/rpc/clnt.h | 336 ----------------------------- c/src/lib/include/rpc/rpc.h | 86 -------- c/src/lib/include/rpc/rpc_msg.h | 192 ----------------- c/src/lib/include/rpc/svc.h | 291 ------------------------- c/src/lib/include/rpc/svc_auth.h | 47 ---- c/src/lib/include/rpc/types.h | 75 ------- c/src/lib/include/rpc/xdr.h | 275 ----------------------- 18 files changed, 2098 deletions(-) delete mode 100644 c/src/lib/include/rdbg/Makefile.am delete mode 100644 c/src/lib/include/rdbg/i386/Makefile.am delete mode 100644 c/src/lib/include/rdbg/i386/rdbg_f.h delete mode 100644 c/src/lib/include/rdbg/i386/reg.h delete mode 100644 c/src/lib/include/rdbg/powerpc/Makefile.am delete mode 100644 c/src/lib/include/rdbg/powerpc/rdbg_f.h delete mode 100644 c/src/lib/include/rdbg/powerpc/reg.h delete mode 100644 c/src/lib/include/rdbg/rdbg.h delete mode 100644 c/src/lib/include/rdbg/servrpc.h delete mode 100644 c/src/lib/include/rpc/Makefile.am delete mode 100644 c/src/lib/include/rpc/auth.h delete mode 100644 c/src/lib/include/rpc/clnt.h delete mode 100644 c/src/lib/include/rpc/rpc.h delete mode 100644 c/src/lib/include/rpc/rpc_msg.h delete mode 100644 c/src/lib/include/rpc/svc.h delete mode 100644 c/src/lib/include/rpc/svc_auth.h delete mode 100644 c/src/lib/include/rpc/types.h delete mode 100644 c/src/lib/include/rpc/xdr.h (limited to 'c/src/lib') diff --git a/c/src/lib/include/rdbg/Makefile.am b/c/src/lib/include/rdbg/Makefile.am deleted file mode 100644 index 241633d9be..0000000000 --- a/c/src/lib/include/rdbg/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -## -## $Id$ -## - -AUTOMAKE_OPTIONS = foreign 1.4 - -if HAS_RDBG -H_PIECES = rdbg.h servrpc.h - -noinst_HEADERS = $(H_PIECES) - -TMPINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rdbg \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rdbg/%) - -$(PROJECT_INCLUDE)/rdbg: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rdbg/%.h: %.h - $(INSTALL_DATA) $< $@ -endif - -all-am: $(TMPINSTALL_FILES) -debug-am: $(TMPINSTALL_FILES) -profile-am: $(TMPINSTALL_FILES) - -if HAS_RDBG -SUBDIRS = $(RTEMS_CPU) -endif - -include $(top_srcdir)/../../../automake/subdirs.am -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/include/rdbg/i386/Makefile.am b/c/src/lib/include/rdbg/i386/Makefile.am deleted file mode 100644 index 8b768f4f49..0000000000 --- a/c/src/lib/include/rdbg/i386/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -## -## $Id$ -## - -AUTOMAKE_OPTIONS = foreign 1.4 - -H_PIECES = rdbg_f.h reg.h - -noinst_HEADERS = $(H_PIECES) - -##TMPINSTALL_FILES = \ -##$(PROJECT_INCLUDE)/rdbg/i386 \ -##$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rdbg/i386/%) - -##$(PROJECT_INCLUDE)/rdbg/i386: -## @$(mkinstalldirs) $@ -##$(PROJECT_INCLUDE)/rdbg/i386/%.h: %.h -## $(INSTALL_DATA) $< $@ - -TMPINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rdbg \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rdbg/%) - -$(PROJECT_INCLUDE)/rdbg: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rdbg/%.h: %.h - $(INSTALL_DATA) $< $@ - -all-am: $(TMPINSTALL_FILES) -debug-am: $(TMPINSTALL_FILES) -profile-am: $(TMPINSTALL_FILES) - -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/include/rdbg/i386/rdbg_f.h b/c/src/lib/include/rdbg/i386/rdbg_f.h deleted file mode 100644 index c75cecc7bc..0000000000 --- a/c/src/lib/include/rdbg/i386/rdbg_f.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - ************************************************************************** - * - * Component = RDBG - * Module = rdbg_f.h - * - * Synopsis = Machine-dependent header file - * - * $Id$ - * - ************************************************************************** - */ - -#ifndef RDBG_F_H -#define RDBG_F_H - -#include -#include - -#define EFLAGS_TF 0x00100 - -static inline int isRdbgException(Exception_context *ctx) -{ - if ( - ctx->ctx->idtIndex != I386_EXCEPTION_DEBUG && - ctx->ctx->idtIndex != I386_EXCEPTION_BREAKPOINT && - ctx->ctx->idtIndex != I386_EXCEPTION_ENTER_RDBG - ) return 0; - else return 1; -} -static inline int getExcNum(Exception_context *ctx) -{ - return ctx->ctx->idtIndex; -} - -extern void connect_rdbg_exception(); - -#endif - - - diff --git a/c/src/lib/include/rdbg/i386/reg.h b/c/src/lib/include/rdbg/i386/reg.h deleted file mode 100644 index 06fb8340e1..0000000000 --- a/c/src/lib/include/rdbg/i386/reg.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Registers Offset in frame definition - * - * $Id$ - */ - -#define NBREGS 19 - -#define SS 18 -#define UESP 17 -#define EFL 16 -#define CS 15 -#define EIP 14 -#define ERR 13 -#define TRAPNO 12 -#define EAX 11 -#define ECX 10 -#define EDX 9 -#define EBX 8 -#define ESP 7 -#define EBP 6 -#define ESI 5 -#define EDI 4 -#define DS 3 -#define ES 2 -#define FS 1 -#define GS 0 - -typedef unsigned int regs[NBREGS]; - -/* To be used in common code */ -typedef regs REGS; - - - - diff --git a/c/src/lib/include/rdbg/powerpc/Makefile.am b/c/src/lib/include/rdbg/powerpc/Makefile.am deleted file mode 100644 index aed4cc5454..0000000000 --- a/c/src/lib/include/rdbg/powerpc/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -## -## $Id$ -## - -AUTOMAKE_OPTIONS = foreign 1.4 - -H_PIECES = rdbg_f.h reg.h - -noinst_HEADERS = $(H_PIECES) - -##TMPINSTALL_FILES = \ -##$(PROJECT_INCLUDE)/rdbg/powerpc \ -##$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rdbg/powerpc/%) - -##$(PROJECT_INCLUDE)/rdbg/powerpc: -## @$(mkinstalldirs) $@ -##$(PROJECT_INCLUDE)/rdbg/powerpc/%.h: %.h -## $(INSTALL_DATA) $< $@ - -TMPINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rdbg \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rdbg/%) - -$(PROJECT_INCLUDE)/rdbg: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rdbg/%.h: %.h - $(INSTALL_DATA) $< $@ - -all-am: $(TMPINSTALL_FILES) -debug-am: $(TMPINSTALL_FILES) -profile-am: $(TMPINSTALL_FILES) - -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/include/rdbg/powerpc/rdbg_f.h b/c/src/lib/include/rdbg/powerpc/rdbg_f.h deleted file mode 100644 index 521595407e..0000000000 --- a/c/src/lib/include/rdbg/powerpc/rdbg_f.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - ************************************************************************** - * - * Component = RDBG - * Module = rdbg_f.h - * - * Synopsis = Machine-dependent header file - * - * $Id$ - * - ************************************************************************** - */ - -#ifndef RDBG_F_H -#define RDBG_F_H - -#include -#include - -static inline int isRdbgException(Exception_context *ctx) -{ - if ( - ctx->ctx->_EXC_number != ASM_SYS_VECTOR && - ctx->ctx->_EXC_number != ASM_TRACE_VECTOR - ) return 0; - else return 1; -} -static inline int getExcNum(Exception_context *ctx) -{ - return ctx->ctx->_EXC_number; -} - -extern void connect_rdbg_exception(); - -#endif - - - diff --git a/c/src/lib/include/rdbg/powerpc/reg.h b/c/src/lib/include/rdbg/powerpc/reg.h deleted file mode 100644 index 9a6af28118..0000000000 --- a/c/src/lib/include/rdbg/powerpc/reg.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Registers frame offset definition - * - * $Id$ - */ - -#define NBREGS 43 - -typedef unsigned int regs[NBREGS]; - -/* To be used in common code */ -typedef regs REGS; - - - - diff --git a/c/src/lib/include/rdbg/rdbg.h b/c/src/lib/include/rdbg/rdbg.h deleted file mode 100644 index 6d03a573d1..0000000000 --- a/c/src/lib/include/rdbg/rdbg.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - ************************************************************************** - * - * Component = RDBG - * - * Synopsis = rdbg.h - * - * $Id$ - * - ************************************************************************** - */ - -#ifndef RDBG_H -#define RDBG_H - -#include -#include -#include -#include /* For malloc() and free() prototypes */ -#include -#include - -#define Malloc(size) malloc (size) -#define Free(block) free (block) -#define Realloc(block,size) realloc (block, size) -#define StrDup(str) strdup(str) - -#define LIST_PID 16 /* dynamic list of processes/tasks */ -#define LIST_PID_DEB 17 /* list of processes under debug now */ -#define LIST_PID_THREAD 18 /* list of threads for specific process */ -#define LIST_CONN 19 /* dynamic list of connections */ - - /* RTEMS internals */ -extern void remotedeb_2 (struct svc_req* rqstp, SVCXPRT* transp); -extern void setErrno (int error); -extern int getErrno (); -extern int ptrace (int request, int pid, char* addr, - int data, char* addr2); - -extern int TSP_RETRIES; -extern volatile int ExitForSingleStep; -extern volatile int justSaveContext; -extern volatile Objects_Id currentTargetThread; -extern volatile int CannotRestart; -extern volatile int TotalReboot; - - /* Missing RPC prototypes */ -SVCXPRT* svcudp_create (int fd); -void svc_processrequest (SVCXPRT* xprt, - u_long prog, u_long vers, - void (*dispatch)()); -int svcudp_enablecache (SVCXPRT *transp, u_long size); - -typedef struct Exception_context_struct { - struct Exception_context_struct *next; - struct Exception_context_struct *previous; - Objects_Id id; - Objects_Id semaphoreId; - CPU_Exception_frame *ctx; -} Exception_context; - -struct xdr_regs; - -extern int PushExceptCtx (Objects_Id Id, - Objects_Id semId, - CPU_Exception_frame *ctx); -extern int PopExceptCtx (Objects_Id Id); -extern Exception_context *GetExceptCtx (Objects_Id Id); -extern int Single_Step (CPU_Exception_frame* ctx); -extern int CheckForSingleStep (CPU_Exception_frame* ctx); -extern void BreakPointExcHdl (CPU_Exception_frame *ctx); -extern void CtxToRegs (const CPU_Exception_frame*,struct xdr_regs*); -extern void RegsToCtx (const struct xdr_regs*,CPU_Exception_frame*); - -extern void enterRdbg (); -extern void get_ctx_thread (Thread_Control *thread, - CPU_Exception_frame* ctx); -extern void set_ctx_thread (Thread_Control *thread, - CPU_Exception_frame* ctx); -extern int PushSavedExceptCtx ( Objects_Id Id, - CPU_Exception_frame *ctx ); -extern int ExcepToSig (Exception_context *ctx); - -extern int ExitForSingleStep; - -extern rtems_id serializeSemId; -extern rtems_id wakeupEventSemId; -extern volatile unsigned int NbSerializedCtx; - -void copyback_data_cache_and_invalidate_instr_cache(unsigned char* addr, int size); - -#include - -#endif /* !RDBG_H */ - diff --git a/c/src/lib/include/rdbg/servrpc.h b/c/src/lib/include/rdbg/servrpc.h deleted file mode 100644 index e183e1af7d..0000000000 --- a/c/src/lib/include/rdbg/servrpc.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * $Id$ - */ - -#ifndef SERVRPC_H -#define SERVRPC_H - - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -extern int CONN_LIST_INC; -extern int PID_LIST_INC; -extern int TSP_RETRIES; -extern int BackPort; -extern char ActName[]; -extern int getId(); - - -#ifdef DDEBUG -int rdb_debug; /* True if env var RDB_DEBUG defined */ -extern const char* PtraceNames[]; /* list of ptrace requests for debug out */ -extern const char* BmsgNames[]; /* list of BMSG_xxx names */ -extern const char* PtraceName(int req); - -#ifdef i386 /* low-high machine such as 386 */ -#define HL_W(w) (((UINT16)(w)>>8)+((((w)&0xFF)<<8))) -#define HL_D(d) (((UINT32)(d)>>24)+(((d)&0x00FF0000)>>8) \ - +(((d)&0xFF00)<<8)+(((d)&0xFF)<<24)) -#else -#define HL_W(w) w -#define HL_D(d) d -#endif - -# define DPRINTF(a) (rdb_debug ? printk ("%d >>> ", getId()), printk a : 0) -#else -# define DPRINTF(a) /* suppress */ -#endif - - /* Macros for analyzing/creating process status values. Presently do - not need to be separated per target. Could even use WIF... */ - -#define STS_SIGNALLED(status) (((status) & 0xFF) == 0x7F) -#define STS_TERMONSIG(status) (((status) & 0xFF) && !STS_SIGNALLED(status)) -#define STS_TERMGETSIG(status) ((status) & 0x7F) -#define STS_MAKESIG(sig) (((sig) << 8) | 0x7f) -#define STS_GETSIG(status) ((status) >> 8) -#define STS_GETCODE(status) ((status) >> 8) - - -/* now define base types */ -#ifndef UCHAR_DEFINED -#define UCHAR_DEFINED /* to handle duplicate typedes */ -typedef unsigned char UCHAR; -typedef unsigned char UINT8; -typedef char INT8; -typedef unsigned short UINT16; -typedef short INT16; -typedef unsigned long UINT32; -typedef long INT32; -#endif /* UCHAR_DEFINED */ - -typedef long PID; /* generalized process id */ - -#ifndef True -# define True 1 -# define False 0 -typedef char Boolean; -#endif - -#define MAX_FILENAME 1024 /* largest filename with path */ -#define MAX_SEND 5 /* up to 5 pended outbound messages */ - -#define SERVER_VERS 1 - -typedef enum -{ /* message types */ - BMSG_WARM=1, /* warm test for network connection */ - BMSG_WAIT, /* wait change (stopped/started) */ - BMSG_BREAK, /* breakpoint changed */ - BMSG_EXEC_FAIL, /* exec failed from spawn */ - BMSG_DETACH, /* process detached from server */ - BMSG_KILLED, /* killed by server */ - BMSG_NOT_PRIM, /* no longer the primary owner */ - BMSG_NEW_PID /* the process was restart with new pid (in - context). Same ownership rules. */ -} BACK_MSG; - -typedef struct -{ /* this is the break_list[0] entry of pid */ - UCHAR clr_step; /* true if step off break in last_break */ - UCHAR pad1; /* Set if STEPEMUL breakpoints exist */ - UINT16 last_break; /* last breakpoint we stopped on (if break) */ - UINT32 range_start; /* start address of range */ - UINT32 range_end; /* end address inclusive */ -} BASE_BREAK; - -enum -{ /* last start values */ - LAST_NONE, /* stopped already */ - LAST_STEP, /* did a step last - do not send to prim */ - LAST_CONT, /* did a continue last */ - LAST_RANGE, /* in the middle of step-in-range */ - LAST_STEPOFF, /* stepped off break, now need to cont */ - LAST_KILLED, /* was killed by ptrace */ - LAST_DETACHED /* was detached by ptrace */ -}; -#define LAST_START 0x80 /* first execed. This is to handle MiX - bug where we need to start again */ - -typedef struct -{ /* one per open process */ - PID pid; /* process id (or 0 if free) */ - int state; /* status from last wait if stopped */ - UCHAR running; /* True if running, else stopped/term */ - /* now connection control over process */ - UCHAR owners; /* count of owners for notify and term release */ - UCHAR primary_conn; /* primary owner connection or 255=none */ - - UCHAR filler; /* Preserve alignment */ - - /* now break control and support */ - UINT8 last_start; /* LAST_xx start info for wait() */ - UINT8 flags; /* PIDFLG_xxx flags */ - UINT16 break_alloc; /* number of entries in break_list */ - xdr_break *break_list; /* list of breakpoints ([0] is BASE_BREAK) */ - /* now registers and other save information */ - xdr_regs regs; /* saved registers when stopped */ - int is_step; /* Was break or step (regs ambiguous often) */ - int stop_wanted; /* Don't ignore next stop */ - UINT32 thread; /* current stopped thread or -1 if none */ - char *name; /* full pathname or NULL if not known */ - INT32 child; /* child pid that manages the pid */ - UINT32 textStart; /* for relocating breakpoints at restart */ -} PID_LIST; -PID_LIST *pid_list; /* array of processes being managed */ -int pid_list_cnt; /* number of entries allocated */ -UINT16 last_break; /* unique handle generator for breaks */ -#define NO_PRIMARY ((UCHAR)-1) - -typedef union -{ /* an opaque net address */ - unsigned long l[4]; - unsigned char c[16]; /* corresponds to IP, enough for ChIPC */ -} NET_OPAQUE; - -typedef struct -{ /* one per connection */ - UCHAR in_use; /* True if in use */ - UCHAR debug_type; /* type of connection */ - UINT16 flags; /* flags for connection (CFLG_xxx) */ - NET_OPAQUE sender; /* opaque address for transport compare */ - NET_OPAQUE back_port; /* opaque address for transport event msgs */ - NET_OPAQUE route; /* optional route address */ - UINT32 pid_map[10]; /* map of pids owned relative to pid list */ - /* this allows up to 320 pids to be managed */ - UCHAR last_msg_num; /* msg number used last to handle multi-send */ - /* next field associated with UDP send messages */ - UCHAR retry; /* count of retries. If 0, ok. If not 0, we - are in active wait for reply to an event */ - UCHAR send_idx; /* current number of send's pended */ - struct SEND_LIST - { /* holds pending msgs */ - UCHAR send_type; /* BMSG_xxx type of message */ - UCHAR retry; /* number of times to retry */ - UINT16 spec; /* spec field */ - PID pid; /* pid if applies */ - UINT32 context; /* additional context if needed */ - } send_list[MAX_SEND]; /* pended list of messages being sent */ - char user_name[NAMEMAX]; /* name of user connecting in */ - /* next fields are managed at runtime to handle lists, command upload, and - command download. */ - enum {LST_NONE, LST_SPAWN, LST_INFO, LST_CMD_DOWN} list_type; - char *list; /* curr list we are sending/getting (malloced) */ - UINT16 list_sz; /* size of current list (string len) */ - UINT16 list_num; /* number of current list or position */ - UINT16 list_alloc; /* amount allocated so far */ - UINT16 list_save; /* used internally */ -} CONN_LIST; -CONN_LIST *conn_list; /* an array of connections */ -int conn_list_cnt; /* number allocated */ - - /* Operations over the PID map. Each indexes into long and then bit */ - /* 5 is log2 of 32, the number of bits in an int */ -#define PIDMAP_TEST(conn,idx) \ - (conn_list [conn].pid_map [(idx) >> 5] & (1 << ((idx) & 31))) - -#define PIDMAP_SET(conn,idx) \ - (conn_list [conn].pid_map [(idx) >> 5] |= 1 << ((idx) & 31)) - -#define PIDMAP_CLEAR(conn,idx) \ - (conn_list [conn].pid_map [(idx) >> 5] &= ~(1 << ((idx) &31))) - -#define PROC_TERMINATED(plst) \ - (!(plst)->running && !STS_SIGNALLED ((plst)->state)) - - -/* first define the Connection routines exported from servcon.c */ - -int ConnCreate (struct svc_req *rqstp, open_in *in); -void ConnDelete (int conn_idx, struct svc_req *rqstp, close_control control); - -void TspInit (int rpc_io_channel); -Boolean TspTranslateRpcAddr (struct svc_req *rqstp, NET_OPAQUE *opaque); -Boolean TspValidateAddr (NET_OPAQUE *opaque, NET_OPAQUE *sender); -int TspConnGetIndex (struct svc_req *rqstp); - -void TspSendWaitChange (int conn_idx, BACK_MSG msg, UINT16 spec, PID pid, - UINT32 context, Boolean force); -void TspSendMessage (int conn_idx, Boolean resend); -void TspMessageReceive (int conn_idx, PID pid); -char* TspGetHostName (int conn_idx); -void TgtCreateNew (PID pid, int conn_idx, INT32 child, - char *name, Boolean spawn); -Boolean TgtAttach (int conn_idx, PID pid); -void TgtNotifyWaitChange(PID pid, int status, Boolean exclude); -void TgtNotifyAll (int pid_idx, BACK_MSG msg, UINT16 spec, - UINT32 context, int exclude_conn, Boolean force); -void TgtDelete (PID_LIST*, int conn_idx, BACK_MSG notify); -int TgtKillAndDelete (PID_LIST *plst, struct svc_req *rqstp, Boolean term); -void TgtDetachCon (int conn_idx, int pid_idx, Boolean delete); -int TgtThreadList (PID_LIST*, unsigned* buf, unsigned int size); -int TgtGetThreadName (PID_LIST*, unsigned thLi, char* name); -int TgtPtrace (int req, PID pid, char *addr, int data, void *addr2); -int TgtRealPtrace (int req, PID pid, char *addr, int data, void *addr2); -Boolean TgtHandleChildChange(PID pid, int* status, int* unexp, - CPU_Exception_frame *ctx); -#ifdef DDEBUG - /* TgtDbgPtrace is a wrapper for RealPtrace() doing traces */ -int TgtDbgPtrace (int req, PID pid, char *addr, int data, void *addr2); -#endif - - -/* Information stored in "handle" */ -#define BKPT_INACTIVE 1 /* bkpt inactive for this execution */ -#define BKPT_ACTIVE 0 /* bkpt active for this execution */ - -int BreakOverwrite (const PID_LIST* plst,const char* addr, - unsigned int size); -int BreakSet (PID_LIST*, int conn_idx, xdr_break*); -int BreakSetAt (PID_LIST*, int conn_idx, unsigned long addr,break_type); -int BreakClear (PID_LIST*, int conn_idx, int handle); -int BreakGetIndex (PID_LIST*, void* addr); -int BreakGet (const PID_LIST*, int data, xdr_break*); -void BreakHide (const PID_LIST*, void*, int, void*); -int BreakStepOff (const PID_LIST*, void** paddr2); -void BreakSteppedOff (PID_LIST*); -int BreakRespawn (PID_LIST*); -int BreakIdentify (PID_LIST*, int adjust, int thread); -void BreakPcChanged (PID_LIST*); -int BreakStepRange (PID_LIST*, void* addr, int len); -void BreaksDisable (int pid); -void BreaksEnable (int pid); - -int TgtBreakRestoreOrig (int pid, void* addr, void* addr2); -void TgtBreakCancelStep (PID_LIST* plst); - -Boolean ListAlloc (char *buff, CONN_LIST *clst); -int FindPidEntry (int pid); - -open_out* RPCGENSRVNAME(open_connex_2_svc) (open_in *in, - struct svc_req *rqstp); -signal_out* RPCGENSRVNAME(send_signal_2_svc) (signal_in *in, - struct svc_req *rqstp); -ptrace_out* RPCGENSRVNAME(ptrace_2_svc) (ptrace_in *in, - struct svc_req *rqstp); -wait_out* RPCGENSRVNAME(wait_info_2_svc) (wait_in *in, - struct svc_req *rqstp); -#endif /* !SERVRPC_H */ - diff --git a/c/src/lib/include/rpc/Makefile.am b/c/src/lib/include/rpc/Makefile.am deleted file mode 100644 index a4753a7ba5..0000000000 --- a/c/src/lib/include/rpc/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -## -## $Id$ -## - -AUTOMAKE_OPTIONS = foreign 1.4 - -if HAS_NETWORKING -H_PIECES = auth.h rpc.h svc.h types.h clnt.h rpc_msg.h svc_auth.h xdr.h - -noinst_HEADERS = $(H_PIECES) - -TMPINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rpc \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/rpc/%) - -$(PROJECT_INCLUDE)/rpc: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rpc/%.h: %.h - $(INSTALL_DATA) $< $@ -endif - -all-am: $(TMPINSTALL_FILES) -debug-am: $(TMPINSTALL_FILES) -profile-am: $(TMPINSTALL_FILES) - -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/include/rpc/auth.h b/c/src/lib/include/rpc/auth.h deleted file mode 100644 index 8f14d144f6..0000000000 --- a/c/src/lib/include/rpc/auth.h +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef RPC_AUTH_H -#define RPC_AUTH_H - -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ -/* - * 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, MERCHANTIBILITY 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 - */ - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -union des_block { - struct { - u_int32 high; - u_int32 low; - } key; - char c[8]; -}; -typedef union des_block des_block; -extern bool_t xdr_des_block(); - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf)(); - int (*ah_marshal)(); /* nextverf & serialize */ - int (*ah_validate)(); /* validate varifier */ - int (*ah_refresh)(); /* refresh credentials */ - void (*ah_destroy)(); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -} AUTH; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - - -extern struct opaque_auth _null_auth; - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -extern AUTH *authunix_create(); -extern AUTH *authunix_create_default(); /* takes no parameters */ -extern AUTH *authnone_create(); /* takes no parameters */ -extern AUTH *authdes_create(); - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_UNIX 1 /* unix style (uid, gids) */ -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ - -#endif /* RPC_AUTH_H */ diff --git a/c/src/lib/include/rpc/clnt.h b/c/src/lib/include/rpc/clnt.h deleted file mode 100644 index faefdb5d50..0000000000 --- a/c/src/lib/include/rpc/clnt.h +++ /dev/null @@ -1,336 +0,0 @@ -#ifndef RPC_CLNT_H -#define RPC_CLNT_H - -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ -/* - * 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, MERCHANTIBILITY 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 - */ - -/* - * clnt.h - Client side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _CLNT_ -#define _CLNT_ - -/* - * Rpc calls return an enum clnt_stat. This should be looked at more, - * since each implementation is required to live with this (implementation - * independent) list of errors. - */ -enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unkown protocol */ - - /* - * _ create errors - */ - RPC_PMAPFAILURE=14, /* the pmapper failed in its call */ - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - /* - * unspecified error - */ - RPC_FAILED=16 -}; - - -/* - * Error info. - */ -struct rpc_err { - enum clnt_stat re_status; - union { - int RE_errno; /* realated system error */ - enum auth_stat RE_why; /* why the auth error occurred */ - struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ - } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long 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, see e.g. rpc_udp.c. - * Client is responsible for initializing auth, see e.g. auth_none.c. - */ -typedef struct { - AUTH *cl_auth; /* authenticator */ - struct clnt_ops { - enum clnt_stat (*cl_call)(); /* call remote procedure */ - void (*cl_abort)(); /* abort a call */ - void (*cl_geterr)(); /* get specific error code */ - bool_t (*cl_freeres)(); /* frees results */ - void (*cl_destroy)();/* destroy this structure */ - bool_t (*cl_control)();/* the ioctl() of rpc */ - } *cl_ops; - caddr_t cl_private; /* private stuff */ -} CLIENT; - - -/* - * client side rpc interface ops - * - * Parameter types are: - * - */ - -/* - * enum clnt_stat - * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * u_long proc; - * xdrproc_t xargs; - * caddr_t argsp; - * xdrproc_t xres; - * caddr_t 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; - * caddr_t 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 both udp and tcp transports - */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -/* - * udp only control operations - */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ - -/* - * 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 accessable on every rpc - * transport/port. It is used for testing, performance evaluation, - * and network administration. - */ - -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) - -/* - * By convention, procedure 0 takes null arguments and returns them - */ - -#define NULLPROC ((u_long)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. - */ - -/* - * Memory based rpc (for speed check and testing) - * CLIENT * - * clntraw_create(prog, vers) - * u_long prog; - * u_long vers; - */ -extern CLIENT *clntraw_create(); - - -/* - * Generic client creation routine. Supported protocols are "udp" and "tcp" - */ -extern CLIENT * -clnt_create(/*host, prog, vers, prot*/); /* - char *host; -- hostname - u_long prog; -- program number - u_long vers; -- version number - char *prot; -- protocol -*/ - - - - -/* - * TCP based rpc - * CLIENT * - * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clnttcp_create(); - -/* - * UDP based rpc. - * CLIENT * - * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * - * Same as above, but you specify max packet sizes. - * CLIENT * - * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait; - * int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntudp_create(); -extern CLIENT *clntudp_bufcreate(); - -/* - * Print why creation failed - */ -void clnt_pcreateerror(/* char *msg */); /* stderr */ -char *clnt_spcreateerror(/* char *msg */); /* string */ - -/* - * Like clnt_perror(), but is more verbose in its output - */ -void clnt_perrno(/* enum clnt_stat num */); /* stderr */ - -/* - * Print an English error message, given the client error code - */ -void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */ -char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */ - -/* - * 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; - - - -/* - * Copy error message to buffer. - */ -char *clnt_sperrno(/* enum clnt_stat num */); /* string */ - - - -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ - -#endif /*!_CLNT_*/ - -#endif /* RPC_CLNT_H */ diff --git a/c/src/lib/include/rpc/rpc.h b/c/src/lib/include/rpc/rpc.h deleted file mode 100644 index 0a0affd82a..0000000000 --- a/c/src/lib/include/rpc/rpc.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef RPC_H -#define RPC_H - -/* @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC; from 1.9 88/02/08 SMI */ -/* - * 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, MERCHANTIBILITY 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 - */ - -/* - * rpc.h, Just includes the billions of rpc header files necessary to - * do remote procedure calling. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ -#ifndef __RPC_HEADER__ -#define __RPC_HEADER__ - -#include /* some typedefs */ -#include -#include - -/* external data representation interfaces */ -#include /* generic (de)serializer */ - -/* Client side only authentication */ -#include /* generic authenticator (client side) */ - -/* Client side (mostly) remote procedure call */ -#include /* generic rpc stuff */ - -/* semi-private protocol headers */ -#include /* protocol for rpc messages */ -/*#include "auth_unix.h" * protocol for unix style cred */ -/* - * Uncomment-out the next line if you are building the rpc library with - * DES Authentication (see the README file in the secure_rpc/ directory). - */ -/*#include "auth_des.h" * protocol for des style cred */ - -/* Server side only remote procedure callee */ -#include /* service manager and multiplexer */ -#include /* service side authenticator */ - -/* - * COMMENT OUT THE NEXT INCLUDE (or add to the #ifndef) IF RUNNING ON - * A VERSION OF UNIX THAT USES SUN'S NFS SOURCE. These systems will - * already have the structures defined by included in . - */ -/* routines for parsing /etc/rpc */ - -struct rpcent { - char *r_name; /* name of server for this rpc program */ - char **r_aliases; /* alias list */ - int r_number; /* rpc program number */ -}; - -struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); - -#endif /* ndef __RPC_HEADER__ */ - -#endif /* RPC_H */ diff --git a/c/src/lib/include/rpc/rpc_msg.h b/c/src/lib/include/rpc/rpc_msg.h deleted file mode 100644 index 2f34fb614c..0000000000 --- a/c/src/lib/include/rpc/rpc_msg.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef RPC_MSG_H -#define RPC_MSG_H - -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * 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, MERCHANTIBILITY 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 - */ -/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ - -/* - * rpc_msg.h - * rpc message definition - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#define RPC_MSG_VERSION ((u_long) 2) -#define RPC_SERVICE_PORT ((u_short) 2048) - -/* - * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall stuct but - * different parts of unions within it. - */ - -enum msg_type { - CALL=0, - REPLY=1 -}; - -enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 -}; - -enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 -}; - -enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 -}; - -/* - * Reply part of an rpc exchange - */ - -/* - * Reply to an rpc request that was accepted by the server. - * Note: there could be an error even though the request was - * accepted. - */ -struct accepted_reply { - struct opaque_auth ar_verf; - enum accept_stat ar_stat; - union { - struct { - u_long low; - u_long high; - } AR_versions; - struct { - caddr_t where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions -}; - -/* - * Reply to an rpc request that was rejected by the server. - */ -struct rejected_reply { - enum reject_stat rj_stat; - union { - struct { - u_long low; - u_long high; - } RJ_versions; - enum auth_stat RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why -}; - -/* - * Body of a reply to an rpc request. - */ -struct reply_body { - enum reply_stat rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr -}; - -/* - * Body of an rpc request call. - */ -struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ -}; - -/* - * The rpc message - */ -struct rpc_msg { - u_long rm_xid; - enum msg_type rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb -}; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr - - -/* - * XDR routine to handle a rpc message. - * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callmsg(); - -/* - * XDR routine to pre-serialize the static part of a rpc message. - * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callhdr(); - -/* - * XDR routine to handle a rpc reply. - * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; - */ -extern bool_t xdr_replymsg(); - -/* - * Fills in the error part of a reply message. - * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; - */ -extern void _seterr_reply(); - -#endif /* RPC_MSG_H */ diff --git a/c/src/lib/include/rpc/svc.h b/c/src/lib/include/rpc/svc.h deleted file mode 100644 index c576b5538b..0000000000 --- a/c/src/lib/include/rpc/svc.h +++ /dev/null @@ -1,291 +0,0 @@ - -#ifndef RPC_SVC_H -#define RPC_SVC_H - -/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ -/* - * 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, MERCHANTIBILITY 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 - */ - -/* - * svc.h, Server-side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __SVC_HEADER__ -#define __SVC_HEADER__ - -/* - * 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 -}; - -/* - * Server side transport handle - */ -typedef struct { - int xp_sock; - u_short xp_port; /* associated port number */ - struct xp_ops { - bool_t (*xp_recv)(); /* receive incomming requests */ - enum xprt_stat (*xp_stat)(); /* get transport status */ - bool_t (*xp_getargs)(); /* get arguments */ - bool_t (*xp_reply)(); /* send reply */ - bool_t (*xp_freeargs)();/* free mem allocated for args */ - void (*xp_destroy)(); /* destroy this struct */ - } *xp_ops; - int xp_addrlen; /* length of remote address */ - struct sockaddr_in xp_raddr; /* remote address */ - struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private */ - caddr_t xp_p2; /* private */ -} SVCXPRT; - -/* - * Approved way of getting address of caller - */ -#define svc_getcaller(x) (&(x)->xp_raddr) - -/* - * 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) - - -/* - * Service request - */ -struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long 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 */ -}; - - -/* - * Service registration - * - * svc_register(xprt, prog, vers, dispatch, protocol) - * SVCXPRT *xprt; - * u_long prog; - * u_long vers; - * void (*dispatch)(); - * int protocol; (like TCP or UDP, zero means do not register) - */ -extern bool_t svc_register(); - -/* - * Service un-registration - * - * svc_unregister(prog, vers) - * u_long prog; - * u_long vers; - */ -extern void svc_unregister(); - -/* - * Transport registration. - * - * xprt_register(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_register(); - -/* - * Transport un-register - * - * xprt_unregister(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_unregister(); - - - - -/* - * 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! - */ - -extern bool_t svc_sendreply(); -extern void svcerr_decode(); -extern void svcerr_weakauth(); -extern void svcerr_noproc(); -extern void svcerr_progvers(); -extern void svcerr_auth(); -extern void svcerr_noprog(); -extern void svcerr_systemerr(); - -/* - * 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 - */ -#ifdef FD_SETSIZE -extern fd_set svc_fdset; -#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ - -/* - * a small program implemented by the svc_rpc implementation itself; - * also see clnt.h for protocol numbers. - */ -extern void rpctest_service(); - -extern void svc_getreq(); -extern void svc_getreqset(); /* takes fdset instead of int */ -extern void svc_run(); /* never returns */ - -/* - * Socket to use on svcxxx_create call to get default socket - */ -#define RPC_ANYSOCK -1 - -/* - * These are the existing service side transport implementations - */ - -/* - * Memory based rpc for testing and timing. - */ -extern SVCXPRT *svcraw_create(); - -/* - * Udp based rpc. - */ -extern SVCXPRT *svcudp_create(); -extern SVCXPRT *svcudp_bufcreate(); -extern int svcudp_enablecache(SVCXPRT *transp, u_long size); - -/* - * Tcp based rpc. - */ -extern SVCXPRT *svctcp_create(); - - - -#endif /* !__SVC_HEADER__ */ - -extern int _rpcsvccount; -extern int _rpcsvcstate; -extern int _SERVED; - -#endif /* RPC_SVC_H */ diff --git a/c/src/lib/include/rpc/svc_auth.h b/c/src/lib/include/rpc/svc_auth.h deleted file mode 100644 index 5c233a6a47..0000000000 --- a/c/src/lib/include/rpc/svc_auth.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef RPC_SVC_AUTH_H -#define RPC_SVC_AUTH_H - -/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * 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, MERCHANTIBILITY 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 - */ -/* @(#)svc_auth.h 1.6 86/07/16 SMI */ - -/* - * svc_auth.h, Service side of rpc authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - - -/* - * Server side authenticator - */ -extern enum auth_stat _authenticate(); - -#endif /* SVC_AUTH_H */ diff --git a/c/src/lib/include/rpc/types.h b/c/src/lib/include/rpc/types.h deleted file mode 100644 index b6d7eb3ccc..0000000000 --- a/c/src/lib/include/rpc/types.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef RPC_TYPES_H -#define RPC_TYPES_H - -/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ -/* - * 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, MERCHANTIBILITY 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 - */ -/* @(#)types.h 1.18 87/07/24 SMI */ - -/* - * Rpc additions to - */ -#ifndef __TYPES_RPC_HEADER__ -#define __TYPES_RPC_HEADER__ - -/*#include */ -typedef unsigned long u_int32; /* 32-bit unsigned integers */ - -#define bool_t int -#define enum_t int -#ifndef FALSE -# define FALSE (0) -#endif -#ifndef TRUE -# define TRUE (1) -#endif -#define __dontcare__ -1 -#ifndef NULL -# define NULL 0 -#endif - -void *malloc(); -#define mem_alloc(bsize) malloc(bsize) -#define mem_free(ptr, bsize) free(ptr) - -#ifndef makedev /* ie, we haven't already included it */ -#include -#endif -#include - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK (u_long)0x7F000001 -#endif -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -#endif /* ndef __TYPES_RPC_HEADER__ */ - -#endif /* RPC_TYPES_H */ diff --git a/c/src/lib/include/rpc/xdr.h b/c/src/lib/include/rpc/xdr.h deleted file mode 100644 index ef2df51d93..0000000000 --- a/c/src/lib/include/rpc/xdr.h +++ /dev/null @@ -1,275 +0,0 @@ -#ifndef RPC_XDR_H -#define RPC_XDR_H - -/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ -/* - * 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, MERCHANTIBILITY 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 - */ -/* @(#)xdr.h 1.19 87/04/22 SMI */ - -/* - * xdr.h, External Data Representation Serialization Routines. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef __XDR_HEADER__ -#define __XDR_HEADER__ - -/* - * XDR provides a conventional way for converting between C data - * types and an external bit-string representation. Library supplied - * routines provide for the conversion on built-in C data types. These - * routines and utility routines defined here are used to help implement - * a type encode/decode routine for each user-defined type. - * - * Each data type provides a single procedure which takes two arguments: - * - * bool_t - * xdrproc(xdrs, argresp) - * XDR *xdrs; - * *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be - * converted. The XDR handle contains an operation field which indicates - * which of the operations (ENCODE, DECODE * or FREE) is to be performed. - * - * XDR_DECODE may allocate space if the pointer argresp is null. This - * data can be freed with the XDR_FREE operation. - * - * We write only one procedure per data type to make it easy - * to keep the encode and decode procedures for a data type consistent. - * In many cases the same code performs all operations on a user defined type, - * because all the hard work is done in the component type routines. - * decode as a series of calls on the nested data types. - */ - -/* - * Xdr operations. XDR_ENCODE causes the type to be encoded into the - * stream. XDR_DECODE causes the type to be extracted from the stream. - * XDR_FREE can be used to release the space allocated by an XDR_DECODE - * request. - */ -enum xdr_op { - XDR_ENCODE=0, - XDR_DECODE=1, - XDR_FREE=2 -}; - -/* - * This is the number of bytes per unit of external data. - */ -#define BYTES_PER_XDR_UNIT (4) -#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ - * BYTES_PER_XDR_UNIT) - -/* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t)(); - -/* - * The XDR handle. - * Contains operation which is being applied to the stream, - * an operations vector for the paticular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular impelementation. - */ -typedef struct { - enum xdr_op x_op; /* operation; fast additional param */ - struct xdr_ops { - bool_t (*x_getlong)(); /* get a long from underlying stream */ - bool_t (*x_putlong)(); /* put a long to " */ - bool_t (*x_getbytes)();/* get some bytes from " */ - bool_t (*x_putbytes)();/* put some bytes to " */ - u_int (*x_getpostn)();/* returns bytes off from beginning */ - bool_t (*x_setpostn)();/* lets you reposition the stream */ - long * (*x_inline)(); /* buf quick ptr to buffered data */ - void (*x_destroy)(); /* free privates of this xdr_stream */ - } *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ -} XDR; - -/* - * Operations defined on a XDR handle - * - * XDR *xdrs; - * long *longp; - * caddr_t addr; - * u_int len; - * u_int pos; - */ -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) -#define xdr_destroy(xdrs) \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs) - -/* - * Support struct for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * a entry with a null procedure pointer. The xdr_union routine gets - * the discriminant value and then searches the array of structures - * for a matching value. If a match is found the associated xdr routine - * is called to handle that part of the union. If there is - * no match, then a default routine may be called. - * If there is no match and no default routine it is an error. - */ -#define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim { - int value; - xdrproc_t proc; -}; - -/* - * In-line routines for fast encode/decode of primitve data types. - * Caveat emptor: these use single memory cycles to get the - * data from the underlying buffer, and will fail to operate - * properly if the data is not aligned. The standard way to use these - * is to say: - * if ((buf = XDR_INLINE(xdrs, count)) == NULL) - * return (FALSE); - * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * - * N.B. and frozen for all time: each data type here uses 4 bytes - * of external representation. - */ -#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v)) - -#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) -#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) - -#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) -#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), ((long)(v))) - -/* - * These are the "generic" xdr routines. - */ -extern bool_t xdr_void(); -extern bool_t xdr_int(); -extern bool_t xdr_u_int(); -extern bool_t xdr_long(); -extern bool_t xdr_u_long(); -extern bool_t xdr_short(); -extern bool_t xdr_u_short(); -extern bool_t xdr_bool(); -extern bool_t xdr_enum(); -extern bool_t xdr_array(); -extern bool_t xdr_bytes(); -extern bool_t xdr_opaque(); -extern bool_t xdr_string(); -extern bool_t xdr_union(); -extern bool_t xdr_char(); -extern bool_t xdr_u_char(); -extern bool_t xdr_vector(); -extern bool_t xdr_float(); -extern bool_t xdr_double(); -extern bool_t xdr_reference(); -extern bool_t xdr_pointer(); -extern bool_t xdr_wrapstring(); - -/* - * Common opaque bytes objects used by many rpc protocols; - * declared here due to commonality. - */ -#define MAX_NETOBJ_SZ 1024 -struct netobj { - u_int n_len; - char *n_bytes; -}; -typedef struct netobj netobj; -extern bool_t xdr_netobj(); - -/* - * These are the public routines for the various implementations of - * xdr streams. - */ -extern void xdrmem_create(); /* XDR using memory buffers */ -extern void xdrstdio_create(); /* XDR using stdio library */ -extern void xdrrec_create(); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(); /* make end of xdr record */ -extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */ -extern bool_t xdrrec_eof(); /* true if no more input */ - -#endif /* !__XDR_HEADER__ */ - -#endif /* RPC_XDR_H */ -- cgit v1.2.3