fresh git tree for public release
we regretfully had to remove our git history for licensing reasons Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
commit
0ad4db4fad
271 changed files with 71255 additions and 0 deletions
63
libtirpc/tirpc/fpmath.h
Normal file
63
libtirpc/tirpc/fpmath.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*-
|
||||
* Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
|
||||
* Copyright (c) 2002 David Schultz <dschultz@uclink.Berkeley.EDU>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/fpmath.h,v 1.1 2003/02/08 20:37:53 mike Exp $
|
||||
*/
|
||||
|
||||
#include <sys/endian.h>
|
||||
#include "_fpmath.h"
|
||||
|
||||
union IEEEf2bits {
|
||||
float f;
|
||||
struct {
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
unsigned int man :23;
|
||||
unsigned int exp :8;
|
||||
unsigned int sign :1;
|
||||
#else /* _BIG_ENDIAN */
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :8;
|
||||
unsigned int man :23;
|
||||
#endif
|
||||
} bits;
|
||||
};
|
||||
|
||||
union IEEEd2bits {
|
||||
double d;
|
||||
struct {
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
unsigned int manl :32;
|
||||
unsigned int manh :20;
|
||||
unsigned int exp :11;
|
||||
unsigned int sign :1;
|
||||
#else /* _BIG_ENDIAN */
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :11;
|
||||
unsigned int manh :20;
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
} bits;
|
||||
};
|
||||
2
libtirpc/tirpc/getpeereid.h
Normal file
2
libtirpc/tirpc/getpeereid.h
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
int getpeereid(SOCKET s, uid_t *euid, gid_t *egid);
|
||||
129
libtirpc/tirpc/libc_private.h
Normal file
129
libtirpc/tirpc/libc_private.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by John Birrell.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/libc_private.h,v 1.11 2003/11/05 18:17:30 deischen Exp $
|
||||
*
|
||||
* Private definitions for libc, libc_r and libpthread.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LIBC_PRIVATE_H_
|
||||
#define _LIBC_PRIVATE_H_
|
||||
|
||||
/*
|
||||
* This global flag is non-zero when a process has created one
|
||||
* or more threads. It is used to avoid calling locking functions
|
||||
* when they are not required.
|
||||
*/
|
||||
extern int __isthreaded;
|
||||
|
||||
/*
|
||||
* File lock contention is difficult to diagnose without knowing
|
||||
* where locks were set. Allow a debug library to be built which
|
||||
* records the source file and line number of each lock call.
|
||||
*/
|
||||
#ifdef _FLOCK_DEBUG
|
||||
#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__)
|
||||
#else
|
||||
#define _FLOCKFILE(x) _flockfile(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for locking and unlocking FILEs. These test if the
|
||||
* process is threaded to avoid locking when not required.
|
||||
*/
|
||||
#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp)
|
||||
#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp)
|
||||
|
||||
/*
|
||||
* Indexes into the pthread jump table.
|
||||
*
|
||||
* Warning! If you change this type, you must also change the threads
|
||||
* libraries that reference it (libc_r, libpthread).
|
||||
*/
|
||||
typedef enum {
|
||||
PJT_COND_BROADCAST,
|
||||
PJT_COND_DESTROY,
|
||||
PJT_COND_INIT,
|
||||
PJT_COND_SIGNAL,
|
||||
PJT_COND_WAIT,
|
||||
PJT_GETSPECIFIC,
|
||||
PJT_KEY_CREATE,
|
||||
PJT_KEY_DELETE,
|
||||
PJT_MAIN_NP,
|
||||
PJT_MUTEX_DESTROY,
|
||||
PJT_MUTEX_INIT,
|
||||
PJT_MUTEX_LOCK,
|
||||
PJT_MUTEX_TRYLOCK,
|
||||
PJT_MUTEX_UNLOCK,
|
||||
PJT_MUTEXATTR_DESTROY,
|
||||
PJT_MUTEXATTR_INIT,
|
||||
PJT_MUTEXATTR_SETTYPE,
|
||||
PJT_ONCE,
|
||||
PJT_RWLOCK_DESTROY,
|
||||
PJT_RWLOCK_INIT,
|
||||
PJT_RWLOCK_RDLOCK,
|
||||
PJT_RWLOCK_TRYRDLOCK,
|
||||
PJT_RWLOCK_TRYWRLOCK,
|
||||
PJT_RWLOCK_UNLOCK,
|
||||
PJT_RWLOCK_WRLOCK,
|
||||
PJT_SELF,
|
||||
PJT_SETSPECIFIC,
|
||||
PJT_SIGMASK,
|
||||
PJT_MAX
|
||||
} pjt_index_t;
|
||||
|
||||
typedef int (*pthread_func_t)(void);
|
||||
typedef pthread_func_t pthread_func_entry_t[2];
|
||||
|
||||
extern pthread_func_entry_t __thr_jtable[];
|
||||
|
||||
/*
|
||||
* yplib internal interfaces
|
||||
*/
|
||||
#ifdef YP
|
||||
int _yp_check(char **);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This is a pointer in the C run-time startup code. It is used
|
||||
* by getprogname() and setprogname().
|
||||
*/
|
||||
extern const char *__progname;
|
||||
|
||||
/*
|
||||
* This is the lock to make malloc() thread-safe. It is externalized
|
||||
* so that thread libraries can protect malloc across fork().
|
||||
*/
|
||||
extern struct _spinlock *__malloc_lock;
|
||||
|
||||
#endif /* _LIBC_PRIVATE_H_ */
|
||||
201
libtirpc/tirpc/misc/event.h
Normal file
201
libtirpc/tirpc/misc/event.h
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/*-
|
||||
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/event.h,v 1.22 2003/02/02 19:39:51 nectar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_EVENT_H_
|
||||
#define _TIRPC_EVENT_H_
|
||||
|
||||
#define EVFILT_READ (-1)
|
||||
#define EVFILT_WRITE (-2)
|
||||
#define EVFILT_AIO (-3) /* attached to aio requests */
|
||||
#define EVFILT_VNODE (-4) /* attached to vnodes */
|
||||
#define EVFILT_PROC (-5) /* attached to struct proc */
|
||||
#define EVFILT_SIGNAL (-6) /* attached to struct proc */
|
||||
#define EVFILT_TIMER (-7) /* timers */
|
||||
#define EVFILT_NETDEV (-8) /* network devices */
|
||||
|
||||
#define EVFILT_SYSCOUNT 8
|
||||
|
||||
#define EV_SET(kevp_, a, b, c, d, e, f) do { \
|
||||
struct kevent *kevp = (kevp_); \
|
||||
(kevp)->ident = (a); \
|
||||
(kevp)->filter = (b); \
|
||||
(kevp)->flags = (c); \
|
||||
(kevp)->fflags = (d); \
|
||||
(kevp)->data = (e); \
|
||||
(kevp)->udata = (f); \
|
||||
} while(0)
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct kevent {
|
||||
uintptr_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
u_short flags;
|
||||
u_int fflags;
|
||||
intptr_t data;
|
||||
void *udata; /* opaque user data identifier */
|
||||
};
|
||||
|
||||
/* actions */
|
||||
#define EV_ADD 0x0001 /* add event to kq (implies enable) */
|
||||
#define EV_DELETE 0x0002 /* delete event from kq */
|
||||
#define EV_ENABLE 0x0004 /* enable event */
|
||||
#define EV_DISABLE 0x0008 /* disable event (not reported) */
|
||||
|
||||
/* flags */
|
||||
#define EV_ONESHOT 0x0010 /* only report one occurrence */
|
||||
#define EV_CLEAR 0x0020 /* clear event state after reporting */
|
||||
|
||||
#define EV_SYSFLAGS 0xF000 /* reserved by system */
|
||||
#define EV_FLAG1 0x2000 /* filter-specific flag */
|
||||
|
||||
/* returned values */
|
||||
#define EV_EOF 0x8000 /* EOF detected */
|
||||
#define EV_ERROR 0x4000 /* error, data contains errno */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
|
||||
*/
|
||||
#define NOTE_LOWAT 0x0001 /* low water mark */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_VNODE, shared with userspace
|
||||
*/
|
||||
#define NOTE_DELETE 0x0001 /* vnode was removed */
|
||||
#define NOTE_WRITE 0x0002 /* data contents changed */
|
||||
#define NOTE_EXTEND 0x0004 /* size increased */
|
||||
#define NOTE_ATTRIB 0x0008 /* attributes changed */
|
||||
#define NOTE_LINK 0x0010 /* link count changed */
|
||||
#define NOTE_RENAME 0x0020 /* vnode was renamed */
|
||||
#define NOTE_REVOKE 0x0040 /* vnode access was revoked */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_PROC, shared with userspace
|
||||
*/
|
||||
#define NOTE_EXIT 0x80000000 /* process exited */
|
||||
#define NOTE_FORK 0x40000000 /* process forked */
|
||||
#define NOTE_EXEC 0x20000000 /* process exec'd */
|
||||
#define NOTE_PCTRLMASK 0xf0000000 /* mask for hint bits */
|
||||
#define NOTE_PDATAMASK 0x000fffff /* mask for pid */
|
||||
|
||||
/* additional flags for EVFILT_PROC */
|
||||
#define NOTE_TRACK 0x00000001 /* follow across forks */
|
||||
#define NOTE_TRACKERR 0x00000002 /* could not track child */
|
||||
#define NOTE_CHILD 0x00000004 /* am a child process */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_NETDEV, shared with userspace
|
||||
*/
|
||||
#define NOTE_LINKUP 0x0001 /* link is up */
|
||||
#define NOTE_LINKDOWN 0x0002 /* link is down */
|
||||
#define NOTE_LINKINV 0x0004 /* link state is invalid */
|
||||
|
||||
/*
|
||||
* This is currently visible to userland to work around broken
|
||||
* programs which pull in <sys/proc.h>.
|
||||
*/
|
||||
#include <sys/queue.h>
|
||||
|
||||
struct knote;
|
||||
SLIST_HEAD(klist, knote);
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#ifdef MALLOC_DECLARE
|
||||
MALLOC_DECLARE(M_KQUEUE);
|
||||
#endif
|
||||
|
||||
#define KNOTE(list, hint) if ((list) != NULL) knote(list, hint)
|
||||
|
||||
/*
|
||||
* Flag indicating hint is a signal. Used by EVFILT_SIGNAL, and also
|
||||
* shared by EVFILT_PROC (all knotes attached to p->p_klist)
|
||||
*/
|
||||
#define NOTE_SIGNAL 0x08000000
|
||||
|
||||
struct filterops {
|
||||
int f_isfd; /* true if ident == filedescriptor */
|
||||
int (*f_attach)(struct knote *kn);
|
||||
void (*f_detach)(struct knote *kn);
|
||||
int (*f_event)(struct knote *kn, long hint);
|
||||
};
|
||||
|
||||
struct knote {
|
||||
SLIST_ENTRY(knote) kn_link; /* for fd */
|
||||
SLIST_ENTRY(knote) kn_selnext; /* for struct selinfo */
|
||||
TAILQ_ENTRY(knote) kn_tqe;
|
||||
struct kqueue *kn_kq; /* which queue we are on */
|
||||
struct kevent kn_kevent;
|
||||
int kn_status;
|
||||
int kn_sfflags; /* saved filter flags */
|
||||
intptr_t kn_sdata; /* saved data field */
|
||||
union {
|
||||
struct file *p_fp; /* file data pointer */
|
||||
struct proc *p_proc; /* proc pointer */
|
||||
} kn_ptr;
|
||||
struct filterops *kn_fop;
|
||||
void *kn_hook;
|
||||
#define KN_ACTIVE 0x01 /* event has been triggered */
|
||||
#define KN_QUEUED 0x02 /* event is on queue */
|
||||
#define KN_DISABLED 0x04 /* event is disabled */
|
||||
#define KN_DETACHED 0x08 /* knote is detached */
|
||||
|
||||
#define kn_id kn_kevent.ident
|
||||
#define kn_filter kn_kevent.filter
|
||||
#define kn_flags kn_kevent.flags
|
||||
#define kn_fflags kn_kevent.fflags
|
||||
#define kn_data kn_kevent.data
|
||||
#define kn_fp kn_ptr.p_fp
|
||||
};
|
||||
|
||||
struct thread;
|
||||
struct proc;
|
||||
|
||||
extern void knote(struct klist *list, long hint);
|
||||
extern void knote_remove(struct thread *p, struct klist *list);
|
||||
extern void knote_fdclose(struct thread *p, int fd);
|
||||
extern int kqueue_register(struct kqueue *kq,
|
||||
struct kevent *kev, struct thread *p);
|
||||
extern int kqueue_add_filteropts(int filt, struct filterops *filtops);
|
||||
extern int kqueue_del_filteropts(int filt);
|
||||
|
||||
#else /* !_KERNEL */
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
struct timespec;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int kqueue(void);
|
||||
int kevent(int kq, const struct kevent *changelist, int nchanges,
|
||||
struct kevent *eventlist, int nevents,
|
||||
const struct timespec *timeout);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_KERNEL */
|
||||
|
||||
#endif /* !_TIRPC_EVENT_H_ */
|
||||
6
libtirpc/tirpc/misc/queue.h
Normal file
6
libtirpc/tirpc/misc/queue.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <sys/queue.h>
|
||||
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
#define STAILQ_FIRST(head) ((head)->stqh_first)
|
||||
62
libtirpc/tirpc/misc/socket.h
Normal file
62
libtirpc/tirpc/misc/socket.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)socket.h 8.4 (Berkeley) 2/21/94
|
||||
* $FreeBSD: src/sys/sys/socket.h,v 1.73 2003/11/14 18:48:15 bms Exp $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MISC_SYS_SOCKET_H_
|
||||
#define _MISC_SYS_SOCKET_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define CMGROUP_MAX 16
|
||||
#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
|
||||
|
||||
/*
|
||||
* Credentials structure, used to verify the identity of a peer
|
||||
* process that has sent us a message. This is allocated by the
|
||||
* peer process but filled in by the kernel. This prevents the
|
||||
* peer from lying about its identity. (Note that cmcred_groups[0]
|
||||
* is the effective GID.)
|
||||
*/
|
||||
struct cmsgcred {
|
||||
pid_t cmcred_pid; /* PID of sending process */
|
||||
uid_t cmcred_uid; /* real UID of sending process */
|
||||
uid_t cmcred_euid; /* effective UID of sending process */
|
||||
gid_t cmcred_gid; /* real GID of sending process */
|
||||
short cmcred_ngroups; /* number or groups */
|
||||
gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
|
||||
};
|
||||
|
||||
#endif /* _MISC_SYS_SOCKET_H_ */
|
||||
33
libtirpc/tirpc/namespace.h
Normal file
33
libtirpc/tirpc/namespace.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/namespace.h,v 1.16 2003/05/01 19:03:13 nectar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NAMESPACE_H_
|
||||
#define _NAMESPACE_H_
|
||||
|
||||
|
||||
#endif /* _NAMESPACE_H_ */
|
||||
95
libtirpc/tirpc/netconfig.h
Normal file
95
libtirpc/tirpc/netconfig.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#ifndef _NETCONFIG_H_
|
||||
#define _NETCONFIG_H_
|
||||
|
||||
//#include <features.h>
|
||||
|
||||
// XXX Should be in, or come from, the registry!!!
|
||||
#define NETCONFIG "c:\\etc\\netconfig"
|
||||
#define NETPATH "NETPATH"
|
||||
|
||||
struct netconfig {
|
||||
char *nc_netid; /* Network ID */
|
||||
unsigned long nc_semantics; /* Semantics (see below) */
|
||||
unsigned long nc_flag; /* Flags (see below) */
|
||||
char *nc_protofmly; /* Protocol family */
|
||||
char *nc_proto; /* Protocol name */
|
||||
char *nc_device; /* Network device pathname */
|
||||
unsigned long nc_nlookups; /* Number of directory lookup libs */
|
||||
char **nc_lookups; /* Names of the libraries */
|
||||
unsigned long nc_unused[9]; /* reserved */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct netconfig **nc_head;
|
||||
struct netconfig **nc_curr;
|
||||
} NCONF_HANDLE;
|
||||
|
||||
/*
|
||||
* nc_semantics values
|
||||
*/
|
||||
#define NC_TPI_CLTS 1
|
||||
#define NC_TPI_COTS 2
|
||||
#define NC_TPI_COTS_ORD 3
|
||||
#define NC_TPI_RAW 4
|
||||
|
||||
/*
|
||||
* nc_flag values
|
||||
*/
|
||||
#define NC_NOFLAG 0x00
|
||||
#define NC_VISIBLE 0x01
|
||||
#define NC_BROADCAST 0x02
|
||||
|
||||
/*
|
||||
* nc_protofmly values
|
||||
*/
|
||||
#define NC_NOPROTOFMLY "-"
|
||||
#define NC_LOOPBACK "loopback"
|
||||
#define NC_INET "inet"
|
||||
#define NC_INET6 "inet6"
|
||||
#define NC_IMPLINK "implink"
|
||||
#define NC_PUP "pup"
|
||||
#define NC_CHAOS "chaos"
|
||||
#define NC_NS "ns"
|
||||
#define NC_NBS "nbs"
|
||||
#define NC_ECMA "ecma"
|
||||
#define NC_DATAKIT "datakit"
|
||||
#define NC_CCITT "ccitt"
|
||||
#define NC_SNA "sna"
|
||||
#define NC_DECNET "decnet"
|
||||
#define NC_DLI "dli"
|
||||
#define NC_LAT "lat"
|
||||
#define NC_HYLINK "hylink"
|
||||
#define NC_APPLETALK "appletalk"
|
||||
#define NC_NIT "nit"
|
||||
#define NC_IEEE802 "ieee802"
|
||||
#define NC_OSI "osi"
|
||||
#define NC_X25 "x25"
|
||||
#define NC_OSINET "osinet"
|
||||
#define NC_GOSIP "gosip"
|
||||
|
||||
/*
|
||||
* nc_proto values
|
||||
*/
|
||||
#define NC_NOPROTO "-"
|
||||
#define NC_TCP "tcp"
|
||||
#define NC_UDP "udp"
|
||||
#define NC_ICMP "icmp"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern void *setnetconfig (void);
|
||||
extern struct netconfig *getnetconfig (void *);
|
||||
extern struct netconfig *getnetconfigent (const char *);
|
||||
extern void freenetconfigent (struct netconfig *);
|
||||
extern int endnetconfig (void *);
|
||||
|
||||
extern void *setnetpath (void);
|
||||
extern struct netconfig *getnetpath (void *);
|
||||
extern int endnetpath (void *);
|
||||
|
||||
extern void nc_perror (const char *);
|
||||
extern char *nc_sperror (void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _NETCONFIG_H_ */
|
||||
80
libtirpc/tirpc/nss_tls.h
Normal file
80
libtirpc/tirpc/nss_tls.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*-
|
||||
* Copyright (c) 2003 Networks Associates Technology, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed for the FreeBSD Project by
|
||||
* Jacques A. Vidrine, Safeport Network Services, and Network
|
||||
* Associates Laboratories, the Security Research Division of Network
|
||||
* Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
|
||||
* ("CBOSS"), as part of the DARPA CHATS research program.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/nss_tls.h,v 1.2 2003/04/21 15:44:25 nectar Exp $
|
||||
*
|
||||
* Macros which generate thread local storage handling code in NSS modules.
|
||||
*/
|
||||
#ifndef _NSS_TLS_H_
|
||||
#define _NSS_TLS_H_
|
||||
|
||||
#define NSS_TLS_HANDLING(name) \
|
||||
static pthread_key_t name##_state_key; \
|
||||
static void name##_keyinit(void); \
|
||||
static int name##_getstate(struct name##_state **); \
|
||||
\
|
||||
static void \
|
||||
name##_keyinit(void) \
|
||||
{ \
|
||||
(void)_pthread_key_create(&name##_state_key, name##_endstate); \
|
||||
} \
|
||||
\
|
||||
static int \
|
||||
name##_getstate(struct name##_state **p) \
|
||||
{ \
|
||||
static struct name##_state st; \
|
||||
static pthread_once_t keyinit = PTHREAD_ONCE_INIT; \
|
||||
int rv; \
|
||||
\
|
||||
if (!__isthreaded || _pthread_main_np() != 0) { \
|
||||
*p = &st; \
|
||||
return (0); \
|
||||
} \
|
||||
rv = _pthread_once(&keyinit, name##_keyinit); \
|
||||
if (rv != 0) \
|
||||
return (rv); \
|
||||
*p = _pthread_getspecific(name##_state_key); \
|
||||
if (*p != NULL) \
|
||||
return (0); \
|
||||
*p = calloc(1, sizeof(**p)); \
|
||||
if (*p == NULL) \
|
||||
return (ENOMEM); \
|
||||
rv = _pthread_setspecific(name##_state_key, *p); \
|
||||
if (rv != 0) { \
|
||||
free(*p); \
|
||||
*p = NULL; \
|
||||
} \
|
||||
return (rv); \
|
||||
} \
|
||||
/* allow the macro invocation to end with a semicolon */ \
|
||||
typedef int _##name##_bmVjdGFy
|
||||
|
||||
#endif /* _NSS_TLS_H_ */
|
||||
163
libtirpc/tirpc/reentrant.h
Normal file
163
libtirpc/tirpc/reentrant.h
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/*-
|
||||
* Copyright (c) 1997,98 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by J.T. Conklin.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/reentrant.h,v 1.2 2002/11/01 09:37:17 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Requirements:
|
||||
*
|
||||
* 1. The thread safe mechanism should be lightweight so the library can
|
||||
* be used by non-threaded applications without unreasonable overhead.
|
||||
*
|
||||
* 2. There should be no dependency on a thread engine for non-threaded
|
||||
* applications.
|
||||
*
|
||||
* 3. There should be no dependency on any particular thread engine.
|
||||
*
|
||||
* 4. The library should be able to be compiled without support for thread
|
||||
* safety.
|
||||
*
|
||||
*
|
||||
* Rationale:
|
||||
*
|
||||
* One approach for thread safety is to provide discrete versions of the
|
||||
* library: one thread safe, the other not. The disadvantage of this is
|
||||
* that libc is rather large, and two copies of a library which are 99%+
|
||||
* identical is not an efficent use of resources.
|
||||
*
|
||||
* Another approach is to provide a single thread safe library. However,
|
||||
* it should not add significant run time or code size overhead to non-
|
||||
* threaded applications.
|
||||
*
|
||||
* Since the NetBSD C library is used in other projects, it should be
|
||||
* easy to replace the mutual exclusion primitives with ones provided by
|
||||
* another system. Similarly, it should also be easy to remove all
|
||||
* support for thread safety completely if the target environment does
|
||||
* not support threads.
|
||||
*
|
||||
*
|
||||
* Implementation Details:
|
||||
*
|
||||
* The mutex primitives used by the library (mutex_t, mutex_lock, etc.)
|
||||
* are macros which expand to the cooresponding primitives provided by
|
||||
* the thread engine or to nothing. The latter is used so that code is
|
||||
* not unreasonably cluttered with #ifdefs when all thread safe support
|
||||
* is removed.
|
||||
*
|
||||
* The mutex macros can be directly mapped to the mutex primitives from
|
||||
* pthreads, however it should be reasonably easy to wrap another mutex
|
||||
* implementation so it presents a similar interface.
|
||||
*
|
||||
* Stub implementations of the mutex functions are provided with *weak*
|
||||
* linkage. These functions simply return success. When linked with a
|
||||
* thread library (i.e. -lpthread), the functions will override the
|
||||
* stubs.
|
||||
*/
|
||||
#ifndef _REENTRANT_H
|
||||
#define _REENTRANT_H
|
||||
//#include <pthread.h>
|
||||
#include <libc_private.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define mutex_t CRITICAL_SECTION
|
||||
#define cond_t CONDITION_VARIABLE
|
||||
#define rwlock_t SRWLOCK
|
||||
|
||||
|
||||
#define thread_key_t DWORD
|
||||
#define MUTEX_INITIALIZER -1 /*THIS_NEEDS_HELP*/
|
||||
#define RWLOCK_INITIALIZER -1 /*THIS_NEEDS_HELP*/
|
||||
#define mutex_init(m, a) InitializeCriticalSection(m)
|
||||
#define mutex_lock(m) EnterCriticalSection(m)
|
||||
#define mutex_unlock(m) LeaveCriticalSection(m)
|
||||
#define mutex_trylock(m) TryEnterCriticalSection(m)
|
||||
|
||||
#define cond_init(c, a, p) InitializeConditionVariable(c)
|
||||
#define cond_signal(m) WakeConditionVariable(m)
|
||||
#define cond_broadcast(m) WakeAllConditionVariable(m)
|
||||
#define cond_wait(c, m) SleepConditionVariableCS(c, m, INFINITE)
|
||||
#define cond_wait_timed(c, m, t) SleepConditionVariableCS(c, m, t)
|
||||
|
||||
#define rwlock_init(l, a) InitializeSRWLock(l)
|
||||
#define rwlock_rdlock(l) AcquireSRWLockShared(l)
|
||||
#define rwlock_wrlock(l) AcquireSRWLockExclusive(l)
|
||||
/* XXX Code will have to be changed to release the right kind!!! XXX */
|
||||
#define rwlock_unlock(l) ReleaseSRWLockExclusive(l)
|
||||
|
||||
#define thr_keycreate(k, d) ((*k) = TlsAlloc())
|
||||
#define thr_keydelete(k) TlsFree(k)
|
||||
#define thr_setspecific(k, p) TlsSetValue(k, p)
|
||||
#define thr_getspecific(k) TlsGetValue(k)
|
||||
#define thr_sigsetmask(f, n, o) dunno_sigmask(f, n, o)
|
||||
|
||||
#define thr_self() GetCurrentThreadId()
|
||||
#define thr_exit(x) ExitThread(x)
|
||||
|
||||
/*
|
||||
#define mutex_t pthread_mutex_t
|
||||
#define cond_t pthread_cond_t
|
||||
#define rwlock_t pthread_rwlock_t
|
||||
|
||||
#define thread_key_t pthread_key_t
|
||||
#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
|
||||
#define mutex_init(m, a) pthread_mutex_init(m, a)
|
||||
#define mutex_lock(m) pthread_mutex_lock(m)
|
||||
#define mutex_unlock(m) pthread_mutex_unlock(m)
|
||||
#define mutex_trylock(m) pthread_mutex_trylock(m)
|
||||
|
||||
#define cond_init(c, a, p) pthread_cond_init(c, a)
|
||||
#define cond_signal(m) pthread_cond_signal(m)
|
||||
#define cond_broadcast(m) pthread_cond_broadcast(m)
|
||||
#define cond_wait(c, m) pthread_cond_wait(c, m)
|
||||
|
||||
#define rwlock_init(l, a) pthread_rwlock_init(l, a)
|
||||
#define rwlock_rdlock(l) pthread_rwlock_rdlock(l)
|
||||
#define rwlock_wrlock(l) pthread_rwlock_wrlock(l)
|
||||
#define rwlock_unlock(l) pthread_rwlock_unlock(l)
|
||||
|
||||
#define thr_keycreate(k, d) pthread_key_create(k, d)
|
||||
#define thr_keydelete(k) pthread_key_delete(k)
|
||||
#define thr_setspecific(k, p) pthread_setspecific(k, p)
|
||||
#define thr_getspecific(k) pthread_getspecific(k)
|
||||
#define thr_sigsetmask(f, n, o) pthread_sigmask(f, n, o)
|
||||
|
||||
#define thr_self() pthread_self()
|
||||
#define thr_exit(x) pthread_exit(x)
|
||||
*/
|
||||
#endif /* reentrant.h */
|
||||
391
libtirpc/tirpc/rpc/auth.h
Normal file
391
libtirpc/tirpc/rpc/auth.h
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
/* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)auth.h 1.17 88/02/08 SMI
|
||||
* from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
|
||||
* from: @(#)auth.h 1.43 98/02/02 SMI
|
||||
* $FreeBSD: src/include/rpc/auth.h,v 1.20 2003/01/01 18:48:42 schweikh Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 an AUTH * to routines that create rpc
|
||||
* "sessions".
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_AUTH_H
|
||||
#define _TIRPC_AUTH_H
|
||||
|
||||
#include <rpc/xdr.h>
|
||||
#include <rpc/clnt_stat.h>
|
||||
//#include <sys/cdefs.h>
|
||||
//#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#define MAX_AUTH_BYTES 400
|
||||
#define MAXNETNAMELEN 255 /* maximum length of network user's name */
|
||||
|
||||
/*
|
||||
* Client side authentication/security data
|
||||
*/
|
||||
|
||||
typedef struct sec_data {
|
||||
u_int secmod; /* security mode number e.g. in nfssec.conf */
|
||||
u_int rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */
|
||||
int flags; /* AUTH_F_xxx flags */
|
||||
caddr_t data; /* opaque data per flavor */
|
||||
} sec_data_t;
|
||||
|
||||
#ifdef _SYSCALL32_IMPL
|
||||
struct sec_data32 {
|
||||
uint32_t secmod; /* security mode number e.g. in nfssec.conf */
|
||||
uint32_t rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */
|
||||
int32_t flags; /* AUTH_F_xxx flags */
|
||||
caddr32_t data; /* opaque data per flavor */
|
||||
};
|
||||
#endif /* _SYSCALL32_IMPL */
|
||||
|
||||
/*
|
||||
* AUTH_DES flavor specific data from sec_data opaque data field.
|
||||
* AUTH_KERB has the same structure.
|
||||
*/
|
||||
typedef struct des_clnt_data {
|
||||
struct netbuf syncaddr; /* time sync addr */
|
||||
struct knetconfig *knconf; /* knetconfig info that associated */
|
||||
/* with the syncaddr. */
|
||||
char *netname; /* server's netname */
|
||||
int netnamelen; /* server's netname len */
|
||||
} dh_k4_clntdata_t;
|
||||
|
||||
#ifdef _SYSCALL32_IMPL
|
||||
struct des_clnt_data32 {
|
||||
struct netbuf32 syncaddr; /* time sync addr */
|
||||
caddr32_t knconf; /* knetconfig info that associated */
|
||||
/* with the syncaddr. */
|
||||
caddr32_t netname; /* server's netname */
|
||||
int32_t netnamelen; /* server's netname len */
|
||||
};
|
||||
#endif /* _SYSCALL32_IMPL */
|
||||
|
||||
#ifdef KERBEROS
|
||||
/*
|
||||
* flavor specific data to hold the data for AUTH_DES/AUTH_KERB(v4)
|
||||
* in sec_data->data opaque field.
|
||||
*/
|
||||
typedef struct krb4_svc_data {
|
||||
int window; /* window option value */
|
||||
} krb4_svcdata_t;
|
||||
|
||||
typedef struct krb4_svc_data des_svcdata_t;
|
||||
#endif /* KERBEROS */
|
||||
|
||||
/*
|
||||
* authentication/security specific flags
|
||||
*/
|
||||
#define AUTH_F_RPCTIMESYNC 0x001 /* use RPC to do time sync */
|
||||
#define AUTH_F_TRYNONE 0x002 /* allow fall back to AUTH_NONE */
|
||||
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
#ifdef KERBEROS
|
||||
/*
|
||||
* kerberos errors
|
||||
*/
|
||||
AUTH_KERB_GENERIC = 8, /* kerberos generic error */
|
||||
AUTH_TIMEEXPIRE = 9, /* time of credential expired */
|
||||
AUTH_TKT_FILE = 10, /* something wrong with ticket file */
|
||||
AUTH_DECODE = 11, /* can't decode authenticator */
|
||||
AUTH_NET_ADDR = 12, /* wrong net address in ticket */
|
||||
#endif /* KERBEROS */
|
||||
|
||||
/*
|
||||
* RPCSEC_GSS errors
|
||||
*/
|
||||
RPCSEC_GSS_CREDPROBLEM = 13,
|
||||
RPCSEC_GSS_CTXPROBLEM = 14
|
||||
|
||||
};
|
||||
|
||||
typedef u_int32_t u_int32; /* 32-bit unsigned integers */
|
||||
|
||||
union des_block {
|
||||
struct {
|
||||
u_int32_t high;
|
||||
u_int32_t low;
|
||||
} key;
|
||||
char c[8];
|
||||
};
|
||||
typedef union des_block des_block;
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_des_block(XDR *, des_block *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* 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 __auth {
|
||||
struct opaque_auth ah_cred;
|
||||
struct opaque_auth ah_verf;
|
||||
union des_block ah_key;
|
||||
struct auth_ops {
|
||||
void (*ah_nextverf) (struct __auth *);
|
||||
/* nextverf & serialize */
|
||||
int (*ah_marshal) (struct __auth *, XDR *);
|
||||
/* validate verifier */
|
||||
int (*ah_validate) (struct __auth *,
|
||||
struct opaque_auth *);
|
||||
/* refresh credentials */
|
||||
int (*ah_refresh) (struct __auth *, void *);
|
||||
/* destroy this structure */
|
||||
void (*ah_destroy) (struct __auth *);
|
||||
/* encode data for wire */
|
||||
int (*ah_wrap) (struct __auth *, XDR *, xdrproc_t, caddr_t);
|
||||
/* decode data for wire */
|
||||
int (*ah_unwrap) (struct __auth *, XDR *, xdrproc_t, caddr_t);
|
||||
|
||||
} *ah_ops;
|
||||
void *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, msg) \
|
||||
((*((auth)->ah_ops->ah_refresh))(auth, msg))
|
||||
#define auth_refresh(auth, msg) \
|
||||
((*((auth)->ah_ops->ah_refresh))(auth, msg))
|
||||
|
||||
#define AUTH_DESTROY(auth) \
|
||||
((*((auth)->ah_ops->ah_destroy))(auth))
|
||||
#define auth_destroy(auth) \
|
||||
((*((auth)->ah_ops->ah_destroy))(auth))
|
||||
|
||||
#define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \
|
||||
((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
|
||||
xfunc, xwhere))
|
||||
#define auth_wrap(auth, xdrs, xfunc, xwhere) \
|
||||
((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
|
||||
xfunc, xwhere))
|
||||
|
||||
#define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
|
||||
((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
|
||||
xfunc, xwhere))
|
||||
#define auth_unwrap(auth, xdrs, xfunc, xwhere) \
|
||||
((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
|
||||
xfunc, xwhere))
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern struct opaque_auth _null_auth;
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Any style authentication. These routines can be used by any
|
||||
* authentication style that does not use the wrap/unwrap functions.
|
||||
*/
|
||||
int authany_wrap(void), authany_unwrap(void);
|
||||
|
||||
/*
|
||||
* These are the various implementations of client side authenticators.
|
||||
*/
|
||||
|
||||
/*
|
||||
* System style authentication
|
||||
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
|
||||
* char *machname;
|
||||
* int uid;
|
||||
* int gid;
|
||||
* int len;
|
||||
* int *aup_gids;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern AUTH *authunix_create(char *, uid_t, uid_t, int, uid_t *);
|
||||
extern AUTH *authunix_create_default(void); /* takes no parameters */
|
||||
extern AUTH *authnone_create(void); /* takes no parameters */
|
||||
__END_DECLS
|
||||
/*
|
||||
* DES style authentication
|
||||
* AUTH *authsecdes_create(servername, window, timehost, ckey)
|
||||
* char *servername; - network name of server
|
||||
* u_int window; - time to live
|
||||
* const char *timehost; - optional hostname to sync with
|
||||
* des_block *ckey; - optional conversation key to use
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *);
|
||||
extern AUTH *authdes_seccreate (const char *, const u_int, const char *,
|
||||
const des_block *);
|
||||
__END_DECLS
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
|
||||
__END_DECLS
|
||||
|
||||
#define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip))
|
||||
#define authsys_create_default() authunix_create_default()
|
||||
|
||||
/*
|
||||
* Netname manipulation routines.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern int getnetname(char *);
|
||||
extern int host2netname(char *, const char *, const char *);
|
||||
extern int user2netname(char *, const uid_t, const char *);
|
||||
extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *);
|
||||
extern int netname2host(char *, char *, const int);
|
||||
extern void passwd2des ( char *, char * );
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
*
|
||||
* These routines interface to the keyserv daemon
|
||||
*
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern int key_decryptsession(const char *, des_block *);
|
||||
extern int key_encryptsession(const char *, des_block *);
|
||||
extern int key_gendes(des_block *);
|
||||
extern int key_setsecret(const char *);
|
||||
extern int key_secretkey_is_set(void);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Publickey routines.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern int getpublickey (const char *, char *);
|
||||
extern int getpublicandprivatekey (char *, char *);
|
||||
extern int getsecretkey (char *, char *, char *);
|
||||
__END_DECLS
|
||||
|
||||
#ifdef KERBEROS
|
||||
/*
|
||||
* Kerberos style authentication
|
||||
* AUTH *authkerb_seccreate(service, srv_inst, realm, window, timehost, status)
|
||||
* const char *service; - service name
|
||||
* const char *srv_inst; - server instance
|
||||
* const char *realm; - server realm
|
||||
* const u_int window; - time to live
|
||||
* const char *timehost; - optional hostname to sync with
|
||||
* int *status; - kerberos status returned
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern AUTH *authkerb_seccreate(const char *, const char *, const char *,
|
||||
const u_int, const char *, int *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Map a kerberos credential into a unix cred.
|
||||
*
|
||||
* authkerb_getucred(rqst, uid, gid, grouplen, groups)
|
||||
* const struct svc_req *rqst; - request pointer
|
||||
* uid_t *uid;
|
||||
* gid_t *gid;
|
||||
* short *grouplen;
|
||||
* int *groups;
|
||||
*
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern int authkerb_getucred(/* struct svc_req *, uid_t *, gid_t *,
|
||||
short *, int * */);
|
||||
__END_DECLS
|
||||
#endif /* KERBEROS */
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct svc_req;
|
||||
struct rpc_msg;
|
||||
enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *);
|
||||
enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *);
|
||||
enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *);
|
||||
__END_DECLS
|
||||
|
||||
#define AUTH_NONE 0 /* no authentication */
|
||||
#define AUTH_NULL 0 /* backward compatibility */
|
||||
#define AUTH_SYS 1 /* unix style (uid, gids) */
|
||||
#define AUTH_UNIX AUTH_SYS
|
||||
#define AUTH_SHORT 2 /* short hand unix style */
|
||||
#define AUTH_DH 3 /* for Diffie-Hellman mechanism */
|
||||
#define AUTH_DES AUTH_DH /* for backward compatibility */
|
||||
#define AUTH_KERB 4 /* kerberos style */
|
||||
#define RPCSEC_GSS 6 /* RPCSEC_GSS */
|
||||
|
||||
#endif /* !_TIRPC_AUTH_H */
|
||||
130
libtirpc/tirpc/rpc/auth_des.h
Normal file
130
libtirpc/tirpc/rpc/auth_des.h
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
|
||||
/* $FreeBSD: src/include/rpc/auth_des.h,v 1.3 2002/03/23 17:24:55 imp Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC
|
||||
* from: @(#)auth_des.h 1.14 94/04/25 SMI
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* auth_des.h, Protocol for DES style authentication for RPC
|
||||
*/
|
||||
|
||||
#ifndef _TI_AUTH_DES_
|
||||
#define _TI_AUTH_DES_
|
||||
|
||||
#include <rpc/auth.h>
|
||||
|
||||
/*
|
||||
* There are two kinds of "names": fullnames and nicknames
|
||||
*/
|
||||
enum authdes_namekind {
|
||||
ADN_FULLNAME,
|
||||
ADN_NICKNAME
|
||||
};
|
||||
|
||||
/*
|
||||
* A fullname contains the network name of the client,
|
||||
* a conversation key and the window
|
||||
*/
|
||||
struct authdes_fullname {
|
||||
char *name; /* network name of client, up to MAXNETNAMELEN */
|
||||
union des_block key; /* conversation key */
|
||||
/* u_long window; */
|
||||
u_int32_t window; /* associated window */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* A credential
|
||||
*/
|
||||
struct authdes_cred {
|
||||
enum authdes_namekind adc_namekind;
|
||||
struct authdes_fullname adc_fullname;
|
||||
/*u_long adc_nickname;*/
|
||||
u_int32_t adc_nickname;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A des authentication verifier
|
||||
*/
|
||||
struct authdes_verf {
|
||||
union {
|
||||
struct timeval adv_ctime; /* clear time */
|
||||
des_block adv_xtime; /* crypt time */
|
||||
} adv_time_u;
|
||||
//u_long adv_int_u;
|
||||
u_int32_t adv_int_u;
|
||||
};
|
||||
|
||||
/*
|
||||
* des authentication verifier: client variety
|
||||
*
|
||||
* adv_timestamp is the current time.
|
||||
* adv_winverf is the credential window + 1.
|
||||
* Both are encrypted using the conversation key.
|
||||
*/
|
||||
#define adv_timestamp adv_time_u.adv_ctime
|
||||
#define adv_xtimestamp adv_time_u.adv_xtime
|
||||
#define adv_winverf adv_int_u
|
||||
|
||||
/*
|
||||
* des authentication verifier: server variety
|
||||
*
|
||||
* adv_timeverf is the client's timestamp + client's window
|
||||
* adv_nickname is the server's nickname for the client.
|
||||
* adv_timeverf is encrypted using the conversation key.
|
||||
*/
|
||||
#define adv_timeverf adv_time_u.adv_ctime
|
||||
#define adv_xtimeverf adv_time_u.adv_xtime
|
||||
#define adv_nickname adv_int_u
|
||||
|
||||
/*
|
||||
* Map a des credential into a unix cred.
|
||||
*
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
|
||||
__END_DECLS
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
|
||||
extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
|
||||
extern int rtime(dev_t, struct netbuf *, int, struct timeval *,
|
||||
struct timeval *);
|
||||
extern void kgetnetname(char *);
|
||||
extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ndef _TI_AUTH_DES_ */
|
||||
131
libtirpc/tirpc/rpc/auth_gss.h
Normal file
131
libtirpc/tirpc/rpc/auth_gss.h
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
auth_gss.h
|
||||
|
||||
Copyright (c) 2000 The Regents of the University of Michigan.
|
||||
All rights reserved.
|
||||
|
||||
Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>.
|
||||
All rights reserved, all wrongs reversed.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the University nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_AUTH_GSS_H
|
||||
#define _TIRPC_AUTH_GSS_H
|
||||
|
||||
#include <rpc/clnt.h>
|
||||
#define SECURITY_WIN32
|
||||
#include <sspi.h>
|
||||
|
||||
/* RPCSEC_GSS control procedures. */
|
||||
typedef enum {
|
||||
RPCSEC_GSS_DATA = 0,
|
||||
RPCSEC_GSS_INIT = 1,
|
||||
RPCSEC_GSS_CONTINUE_INIT = 2,
|
||||
RPCSEC_GSS_DESTROY = 3
|
||||
} rpc_gss_proc_t;
|
||||
|
||||
/* RPCSEC_GSS services. */
|
||||
typedef enum {
|
||||
RPCSEC_GSS_SVC_NONE = 1,
|
||||
RPCSEC_GSS_SVC_INTEGRITY = 2,
|
||||
RPCSEC_GSS_SVC_PRIVACY = 3
|
||||
} rpc_gss_svc_t;
|
||||
|
||||
#define RPCSEC_GSS_VERSION 1
|
||||
|
||||
/* RPCSEC_GSS security triple. */
|
||||
struct rpc_gss_sec {
|
||||
gss_OID mech; /* mechanism */
|
||||
gss_qop_t qop; /* quality of protection */
|
||||
rpc_gss_svc_t svc; /* service */
|
||||
gss_cred_id_t cred; /* cred handle */
|
||||
u_int req_flags; /* req flags for init_sec_context */
|
||||
};
|
||||
|
||||
/* Private data required for kernel implementation */
|
||||
struct authgss_private_data {
|
||||
gss_ctx_id_t pd_ctx; /* Session context handle */
|
||||
gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */
|
||||
u_int pd_seq_win; /* Sequence window */
|
||||
};
|
||||
|
||||
#define g_OID_equal(o1, o2) \
|
||||
(((o1)->length == (o2)->length) && \
|
||||
((o1)->elements != 0) && ((o2)->elements != 0) && \
|
||||
(memcmp((o1)->elements, (o2)->elements, (int) (o1)->length) == 0))
|
||||
|
||||
/* from kerberos source, gssapi_krb5.c */
|
||||
extern gss_OID_desc krb5oid;
|
||||
extern gss_OID_desc spkm3oid;
|
||||
|
||||
/* Credentials. */
|
||||
struct rpc_gss_cred {
|
||||
u_int gc_v; /* version */
|
||||
rpc_gss_proc_t gc_proc; /* control procedure */
|
||||
u_int gc_seq; /* sequence number */
|
||||
rpc_gss_svc_t gc_svc; /* service */
|
||||
gss_buffer_desc gc_ctx; /* context handle */
|
||||
};
|
||||
|
||||
/* Context creation response. */
|
||||
struct rpc_gss_init_res {
|
||||
gss_buffer_desc gr_ctx; /* context handle */
|
||||
u_int gr_major; /* major status */
|
||||
u_int gr_minor; /* minor status */
|
||||
u_int gr_win; /* sequence window */
|
||||
gss_buffer_desc gr_token; /* token */
|
||||
};
|
||||
|
||||
/* Maximum sequence number value. */
|
||||
#define MAXSEQ 0x80000000
|
||||
|
||||
/* Prototypes. */
|
||||
__BEGIN_DECLS
|
||||
bool_t xdr_rpc_gss_cred __P((XDR *xdrs, struct rpc_gss_cred *p));
|
||||
bool_t xdr_rpc_gss_init_args __P((XDR *xdrs, gss_buffer_desc *p));
|
||||
bool_t xdr_rpc_gss_init_res __P((XDR *xdrs, struct rpc_gss_init_res *p));
|
||||
bool_t xdr_rpc_gss_data __P((XDR *xdrs, xdrproc_t xdr_func,
|
||||
caddr_t xdr_ptr, gss_ctx_id_t ctx,
|
||||
gss_qop_t qop, rpc_gss_svc_t svc,
|
||||
u_int seq));
|
||||
|
||||
AUTH *authgss_create __P((CLIENT *, gss_name_t,
|
||||
struct rpc_gss_sec *));
|
||||
AUTH *authgss_create_default __P((CLIENT *, char *, struct rpc_gss_sec *));
|
||||
bool_t authgss_service __P((AUTH *auth, int svc));
|
||||
bool_t authgss_get_private_data __P((AUTH *auth,
|
||||
struct authgss_private_data *));
|
||||
|
||||
void log_debug __P((const char *fmt, ...));
|
||||
void log_status __P((char *m, OM_uint32 major,
|
||||
OM_uint32 minor));
|
||||
void log_hexdump __P((const u_char *buf, int len, int offset));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_TIRPC_AUTH_GSS_H */
|
||||
140
libtirpc/tirpc/rpc/auth_kerb.h
Normal file
140
libtirpc/tirpc/rpc/auth_kerb.h
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/* $FreeBSD: src/include/rpc/auth_kerb.h,v 1.2 2002/09/04 23:58:23 alfred Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* auth_kerb.h, Protocol for Kerberos style authentication for RPC
|
||||
*
|
||||
* Copyright (C) 1986, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_AUTH_KERB_H
|
||||
#define _RPC_AUTH_KERB_H
|
||||
|
||||
#ifdef KERBEROS
|
||||
|
||||
#include <kerberos/krb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/t_kuser.h>
|
||||
#include <netinet/in.h>
|
||||
#include <rpc/svc.h>
|
||||
|
||||
/*
|
||||
* There are two kinds of "names": fullnames and nicknames
|
||||
*/
|
||||
enum authkerb_namekind {
|
||||
AKN_FULLNAME,
|
||||
AKN_NICKNAME
|
||||
};
|
||||
/*
|
||||
* A fullname contains the ticket and the window
|
||||
*/
|
||||
struct authkerb_fullname {
|
||||
KTEXT_ST ticket;
|
||||
u_long window; /* associated window */
|
||||
};
|
||||
|
||||
/*
|
||||
* cooked credential stored in rq_clntcred
|
||||
*/
|
||||
struct authkerb_clnt_cred {
|
||||
/* start of AUTH_DAT */
|
||||
unsigned char k_flags; /* Flags from ticket */
|
||||
char pname[ANAME_SZ]; /* Principal's name */
|
||||
char pinst[INST_SZ]; /* His Instance */
|
||||
char prealm[REALM_SZ]; /* His Realm */
|
||||
unsigned long checksum; /* Data checksum (opt) */
|
||||
C_Block session; /* Session Key */
|
||||
int life; /* Life of ticket */
|
||||
unsigned long time_sec; /* Time ticket issued */
|
||||
unsigned long address; /* Address in ticket */
|
||||
/* KTEXT_ST reply; Auth reply (opt) */
|
||||
/* end of AUTH_DAT */
|
||||
unsigned long expiry; /* time the ticket is expiring */
|
||||
u_long nickname; /* Nickname into cache */
|
||||
u_long window; /* associated window */
|
||||
};
|
||||
|
||||
typedef struct authkerb_clnt_cred authkerb_clnt_cred;
|
||||
|
||||
/*
|
||||
* A credential
|
||||
*/
|
||||
struct authkerb_cred {
|
||||
enum authkerb_namekind akc_namekind;
|
||||
struct authkerb_fullname akc_fullname;
|
||||
u_long akc_nickname;
|
||||
};
|
||||
|
||||
/*
|
||||
* A kerb authentication verifier
|
||||
*/
|
||||
struct authkerb_verf {
|
||||
union {
|
||||
struct timeval akv_ctime; /* clear time */
|
||||
des_block akv_xtime; /* crypt time */
|
||||
} akv_time_u;
|
||||
u_long akv_int_u;
|
||||
};
|
||||
|
||||
/*
|
||||
* des authentication verifier: client variety
|
||||
*
|
||||
* akv_timestamp is the current time.
|
||||
* akv_winverf is the credential window + 1.
|
||||
* Both are encrypted using the conversation key.
|
||||
*/
|
||||
#ifndef akv_timestamp
|
||||
#define akv_timestamp akv_time_u.akv_ctime
|
||||
#define akv_xtimestamp akv_time_u.akv_xtime
|
||||
#define akv_winverf akv_int_u
|
||||
#endif
|
||||
/*
|
||||
* des authentication verifier: server variety
|
||||
*
|
||||
* akv_timeverf is the client's timestamp + client's window
|
||||
* akv_nickname is the server's nickname for the client.
|
||||
* akv_timeverf is encrypted using the conversation key.
|
||||
*/
|
||||
#ifndef akv_timeverf
|
||||
#define akv_timeverf akv_time_u.akv_ctime
|
||||
#define akv_xtimeverf akv_time_u.akv_xtime
|
||||
#define akv_nickname akv_int_u
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Register the service name, instance and realm.
|
||||
*/
|
||||
extern int authkerb_create(char *, char *, char *, u_int,
|
||||
struct netbuf *, int *, dev_t, int, AUTH **);
|
||||
extern bool_t xdr_authkerb_cred(XDR *, struct authkerb_cred *);
|
||||
extern bool_t xdr_authkerb_verf(XDR *, struct authkerb_verf *);
|
||||
extern int svc_kerb_reg(SVCXPRT *, char *, char *, char *);
|
||||
extern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *);
|
||||
|
||||
#endif KERBEROS
|
||||
#endif /* !_RPC_AUTH_KERB_H */
|
||||
83
libtirpc/tirpc/rpc/auth_unix.h
Normal file
83
libtirpc/tirpc/rpc/auth_unix.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)auth_unix.h 1.8 88/02/08 SMI
|
||||
* from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/auth_unix.h,v 1.11 2002/03/23 17:24:55 imp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* auth_unix.h, Protocol for UNIX style authentication parameters for RPC
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The system is very weak. The client uses no encryption for it
|
||||
* credentials and only sends null verifiers. The server sends backs
|
||||
* null verifiers or optionally a verifier that suggests a new short hand
|
||||
* for the credentials.
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_AUTH_UNIX_H
|
||||
#define _TIRPC_AUTH_UNIX_H
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
/* The machine name is part of a credential; it may not exceed 255 bytes */
|
||||
#define MAX_MACHINE_NAME 255
|
||||
|
||||
/* gids compose part of a credential; there may not be more than 16 of them */
|
||||
#define NGRPS 16
|
||||
|
||||
/*
|
||||
* Unix style credentials.
|
||||
*/
|
||||
struct authunix_parms {
|
||||
u_long aup_time;
|
||||
char *aup_machname;
|
||||
uid_t aup_uid;
|
||||
gid_t aup_gid;
|
||||
u_int aup_len;
|
||||
gid_t *aup_gids;
|
||||
};
|
||||
|
||||
#define authsys_parms authunix_parms
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* If a response verifier has flavor AUTH_SHORT,
|
||||
* then the body of the response verifier encapsulates the following structure;
|
||||
* again it is serialized in the obvious fashion.
|
||||
*/
|
||||
struct short_hand_verf {
|
||||
struct opaque_auth new_cred;
|
||||
};
|
||||
|
||||
#endif /* !_TIRPC_AUTH_UNIX_H */
|
||||
558
libtirpc/tirpc/rpc/clnt.h
Normal file
558
libtirpc/tirpc/rpc/clnt.h
Normal file
|
|
@ -0,0 +1,558 @@
|
|||
/* $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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 _TIRPC_CLNT_H_
|
||||
#define _TIRPC_CLNT_H_
|
||||
|
||||
//#include <rpc/clnt_stat.h>
|
||||
#include "clnt_stat.h"
|
||||
#include <rpc/auth.h>
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
//#include <netconfig.h>
|
||||
//#include <sys/un.h>
|
||||
|
||||
/*
|
||||
* Well-known IPV6 RPC broadcast address.
|
||||
*/
|
||||
#define RPCB_MULTICAST_ADDR "ff02::202"
|
||||
|
||||
/*
|
||||
* the following errors are in general unrecoverable. The caller
|
||||
* should give up rather than retry.
|
||||
*/
|
||||
#define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \
|
||||
((s) == RPC_CANTENCODEARGS) || \
|
||||
((s) == RPC_CANTDECODERES) || \
|
||||
((s) == RPC_VERSMISMATCH) || \
|
||||
((s) == RPC_PROCUNAVAIL) || \
|
||||
((s) == RPC_PROGUNAVAIL) || \
|
||||
((s) == RPC_PROGVERSMISMATCH) || \
|
||||
((s) == RPC_CANTDECODEARGS))
|
||||
|
||||
/*
|
||||
* 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)(struct __rpc_client *);
|
||||
/* 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 *, u_int,
|
||||
void *);
|
||||
} *cl_ops;
|
||||
void *cl_private; /* private stuff */
|
||||
char *cl_netid; /* network token */
|
||||
char *cl_tp; /* device name */
|
||||
HANDLE *cb_thread;
|
||||
int (*cb_xdr)(void *, void *);
|
||||
int (*cb_fn)(void *, void *, void **);
|
||||
void *cb_args;
|
||||
bool_t shutdown;
|
||||
} CLIENT;
|
||||
|
||||
typedef struct __cb_req {
|
||||
u_int32_t rq_prog;
|
||||
u_int32_t rq_vers;
|
||||
u_int32_t rq_proc;
|
||||
void *xdr;
|
||||
} cb_req;
|
||||
|
||||
/*
|
||||
* Timers used for the pseudo-transport protocol when using datagrams
|
||||
*/
|
||||
struct rpc_timers {
|
||||
u_short rt_srtt; /* smoothed round-trip time */
|
||||
u_short rt_deviate; /* estimated deviation */
|
||||
u_long rt_rtxcur; /* current (backed-off) rto */
|
||||
};
|
||||
|
||||
/*
|
||||
* Feedback values used for possible congestion and rate control
|
||||
*/
|
||||
#define FEEDBACK_REXMIT1 1 /* first retransmit */
|
||||
#define FEEDBACK_OK 2 /* no retransmits */
|
||||
|
||||
/* Used to set version of portmapper used in broadcast */
|
||||
|
||||
#define CLCR_SET_LOWVERS 3
|
||||
#define CLCR_GET_LOWVERS 4
|
||||
|
||||
#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 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) */
|
||||
#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) */
|
||||
#define CLSET_PUSH_TIMOD 17 /* push timod if not already present */
|
||||
#define CLSET_POP_TIMOD 18 /* pop timod */
|
||||
/*
|
||||
* Connectionless only control operations
|
||||
*/
|
||||
#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
|
||||
#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
|
||||
#define CLSET_ASYNC 19
|
||||
#define CLSET_CONNECT 20 /* Use connect() for UDP. (int) */
|
||||
|
||||
/*
|
||||
* 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 those that
|
||||
* belong to the nettype namespace (/etc/netconfig).
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,
|
||||
const char *);
|
||||
/*
|
||||
*
|
||||
* const char *hostname; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const char *nettype; -- network type
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. Just like clnt_create(), except
|
||||
* it takes an additional timeout parameter.
|
||||
*/
|
||||
extern CLIENT * clnt_create_timed(const char *, const rpcprog_t,
|
||||
const rpcvers_t, const char *, const struct timeval *);
|
||||
/*
|
||||
*
|
||||
* const char *hostname; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const char *nettype; -- network type
|
||||
* const struct timeval *tp; -- timeout
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. Supported protocols are which belong
|
||||
* to the nettype name space.
|
||||
*/
|
||||
extern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
|
||||
const rpcvers_t, const rpcvers_t,
|
||||
const char *);
|
||||
/*
|
||||
* const char *host; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* rpcvers_t *vers_out; -- servers highest available version
|
||||
* const rpcvers_t vers_low; -- low version number
|
||||
* const rpcvers_t vers_high; -- high version number
|
||||
* const char *nettype; -- network type
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. Supported protocols are which belong
|
||||
* to the nettype name space.
|
||||
*/
|
||||
extern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
|
||||
rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
|
||||
const struct timeval *);
|
||||
/*
|
||||
* const char *host; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* rpcvers_t *vers_out; -- servers highest available version
|
||||
* const rpcvers_t vers_low; -- low version number
|
||||
* const rpcvers_t vers_high; -- high version number
|
||||
* const char *nettype; -- network type
|
||||
* const struct timeval *tp -- timeout
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. It takes a netconfig structure
|
||||
* instead of nettype
|
||||
*/
|
||||
extern CLIENT *clnt_tp_create(const char *, const rpcprog_t,
|
||||
const rpcvers_t, const struct netconfig *);
|
||||
/*
|
||||
* const char *hostname; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const struct netconfig *netconf; -- network config structure
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic client creation routine. Just like clnt_tp_create(), except
|
||||
* it takes an additional timeout parameter.
|
||||
*/
|
||||
extern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
|
||||
const rpcvers_t, const struct netconfig *, const struct timeval *);
|
||||
/*
|
||||
* const char *hostname; -- hostname
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const struct netconfig *netconf; -- network config structure
|
||||
* const struct timeval *tp -- timeout
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic TLI create routine. Only provided for compatibility.
|
||||
*/
|
||||
|
||||
extern CLIENT *clnt_tli_create(const SOCKET, const struct netconfig *,
|
||||
struct netbuf *, const rpcprog_t,
|
||||
const rpcvers_t, const u_int, const u_int,
|
||||
int (*cb_xdr)(void *, void *),
|
||||
int (*cb)(void *, void *, void **), void *args);
|
||||
/*
|
||||
* const register int fd; -- fd
|
||||
* const struct netconfig *nconf; -- netconfig structure
|
||||
* struct netbuf *svcaddr; -- servers address
|
||||
* const u_long prog; -- program number
|
||||
* const u_long vers; -- version number
|
||||
* const u_int sendsz; -- send size
|
||||
* const u_int recvsz; -- recv size
|
||||
*/
|
||||
|
||||
/*
|
||||
* Low level clnt create routine for connectionful transports, e.g. tcp.
|
||||
*/
|
||||
extern CLIENT *clnt_vc_create(const SOCKET, const struct netbuf *,
|
||||
const rpcprog_t, const rpcvers_t,
|
||||
u_int, u_int, int (*cb_xdr)(void *, void *),
|
||||
int (*cb)(void *, void *, void **), void *args);
|
||||
/*
|
||||
* Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().
|
||||
*/
|
||||
extern CLIENT *clntunix_create(struct sockaddr_un *,
|
||||
u_long, u_long, int *, u_int, u_int);
|
||||
/*
|
||||
* const int fd; -- open file descriptor
|
||||
* const struct netbuf *svcaddr; -- servers address
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const u_int sendsz; -- buffer recv size
|
||||
* const u_int recvsz; -- buffer send size
|
||||
*/
|
||||
|
||||
/*
|
||||
* Low level clnt create routine for connectionless transports, e.g. udp.
|
||||
*/
|
||||
extern CLIENT *clnt_dg_create(const SOCKET, const struct netbuf *,
|
||||
const rpcprog_t, const rpcvers_t,
|
||||
const u_int, const u_int);
|
||||
/*
|
||||
* const int fd; -- open file descriptor
|
||||
* const struct netbuf *svcaddr; -- servers address
|
||||
* const rpcprog_t program; -- program number
|
||||
* const rpcvers_t version; -- version number
|
||||
* const u_int sendsz; -- buffer recv size
|
||||
* const u_int recvsz; -- buffer send size
|
||||
*/
|
||||
|
||||
/*
|
||||
* Memory based rpc (for speed check and testing)
|
||||
* CLIENT *
|
||||
* clnt_raw_create(prog, vers)
|
||||
* u_long prog;
|
||||
* u_long vers;
|
||||
*/
|
||||
extern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t);
|
||||
|
||||
__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 */
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern struct rpc_createerr *__rpc_createerr(void);
|
||||
__END_DECLS
|
||||
#define get_rpc_createerr() (*(__rpc_createerr()))
|
||||
#define rpc_createerr (*(__rpc_createerr()))
|
||||
|
||||
/*
|
||||
* The simplified interface:
|
||||
* enum clnt_stat
|
||||
* rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
|
||||
* const char *host;
|
||||
* const rpcprog_t prognum;
|
||||
* const rpcvers_t versnum;
|
||||
* const rpcproc_t procnum;
|
||||
* const xdrproc_t inproc, outproc;
|
||||
* const char *in;
|
||||
* char *out;
|
||||
* const char *nettype;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern enum clnt_stat rpc_call(const char *, const rpcprog_t,
|
||||
const rpcvers_t, const rpcproc_t,
|
||||
const xdrproc_t, const char *,
|
||||
const xdrproc_t, char *, const char *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* RPC broadcast interface
|
||||
* The call is broadcasted to all locally connected nets.
|
||||
*
|
||||
* extern enum clnt_stat
|
||||
* rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
|
||||
* eachresult, nettype)
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const rpcproc_t proc; -- procedure number
|
||||
* const xdrproc_t xargs; -- xdr routine for args
|
||||
* caddr_t argsp; -- pointer to args
|
||||
* const xdrproc_t xresults; -- xdr routine for results
|
||||
* caddr_t resultsp; -- pointer to results
|
||||
* const resultproc_t eachresult; -- call with each result
|
||||
* const char *nettype; -- Transport type
|
||||
*
|
||||
* For each valid response received, the procedure eachresult is called.
|
||||
* Its form is:
|
||||
* done = eachresult(resp, raddr, nconf)
|
||||
* bool_t done;
|
||||
* caddr_t resp;
|
||||
* struct netbuf *raddr;
|
||||
* struct netconfig *nconf;
|
||||
* where resp points to the results of the call and raddr is the
|
||||
* address if the responder to the broadcast. nconf is the transport
|
||||
* on which the response was received.
|
||||
*
|
||||
* extern enum clnt_stat
|
||||
* rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
|
||||
* eachresult, inittime, waittime, nettype)
|
||||
* const rpcprog_t prog; -- program number
|
||||
* const rpcvers_t vers; -- version number
|
||||
* const rpcproc_t proc; -- procedure number
|
||||
* const xdrproc_t xargs; -- xdr routine for args
|
||||
* caddr_t argsp; -- pointer to args
|
||||
* const xdrproc_t xresults; -- xdr routine for results
|
||||
* caddr_t resultsp; -- pointer to results
|
||||
* const resultproc_t eachresult; -- call with each result
|
||||
* const int inittime; -- how long to wait initially
|
||||
* const int waittime; -- maximum time to wait
|
||||
* const char *nettype; -- Transport type
|
||||
*/
|
||||
|
||||
typedef bool_t (*resultproc_t)(caddr_t, ...);
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
|
||||
const rpcproc_t, const xdrproc_t,
|
||||
caddr_t, const xdrproc_t, caddr_t,
|
||||
const resultproc_t, const char *);
|
||||
extern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
|
||||
const rpcproc_t, const xdrproc_t,
|
||||
caddr_t, const xdrproc_t, caddr_t,
|
||||
const resultproc_t, const int,
|
||||
const int, const char *);
|
||||
__END_DECLS
|
||||
|
||||
/* For backward compatibility */
|
||||
#include <rpc/clnt_soc.h>
|
||||
|
||||
#endif /* !_TIRPC_CLNT_H_ */
|
||||
122
libtirpc/tirpc/rpc/clnt_soc.h
Normal file
122
libtirpc/tirpc/rpc/clnt_soc.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/* $NetBSD: clnt_soc.h,v 1.1 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/clnt_soc.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1984 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* clnt.h - Client side remote procedure call interface.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_CLNT_SOC_H
|
||||
#define _RPC_CLNT_SOC_H
|
||||
|
||||
/* derived from clnt_soc.h 1.3 88/12/17 SMI */
|
||||
|
||||
/*
|
||||
* All the following declarations are only for backward compatibility
|
||||
* with TS-RPC.
|
||||
*/
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
|
||||
|
||||
/*
|
||||
* 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;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clnttcp_create(struct sockaddr_in *, u_long, u_long, SOCKET *,
|
||||
u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Raw (memory) rpc.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clntraw_create(u_long, u_long);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
IPv6 socket version
|
||||
*/
|
||||
#ifdef INET6
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clnttcp6_create(struct sockaddr_in6 *, u_long, u_long, int *,
|
||||
u_int, u_int);
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern CLIENT *clntudp_create(struct sockaddr_in *, u_long, u_long,
|
||||
struct timeval, int *);
|
||||
extern CLIENT *clntudp_bufcreate(struct sockaddr_in *, u_long, u_long,
|
||||
struct timeval, int *, u_int, u_int);
|
||||
#ifdef INET6
|
||||
extern CLIENT *clntudp6_create(struct sockaddr_in6 *, u_long, u_long,
|
||||
struct timeval, int *);
|
||||
extern CLIENT *clntudp6_bufcreate(struct sockaddr_in6 *, u_long, u_long,
|
||||
struct timeval, int *, u_int, u_int);
|
||||
#endif
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* _RPC_CLNT_SOC_H */
|
||||
83
libtirpc/tirpc/rpc/clnt_stat.h
Normal file
83
libtirpc/tirpc/rpc/clnt_stat.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* $FreeBSD: src/include/rpc/clnt_stat.h,v 1.2 2001/03/20 08:20:50 alfred Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991, 1994, 1996, 1997 by Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* clnt_stat.h - Client side remote procedure call enum
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RPC_CLNT_STAT_H
|
||||
#define _RPC_CLNT_STAT_H
|
||||
|
||||
/* #pragma ident "@(#)clnt_stat.h 1.2 97/04/28 SMI" */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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 */
|
||||
RPC_INTR = 18, /* call interrupted */
|
||||
RPC_UDERROR = 23, /* recv got uderr indication */
|
||||
/*
|
||||
* 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" */
|
||||
|
||||
/*
|
||||
* rpc_call & clnt_create errors
|
||||
*/
|
||||
RPC_UNKNOWNHOST = 13, /* unknown host name */
|
||||
RPC_UNKNOWNPROTO = 17, /* unknown protocol */
|
||||
RPC_UNKNOWNADDR = 19, /* Remote address unknown */
|
||||
RPC_NOBROADCAST = 21, /* Broadcasting not supported */
|
||||
|
||||
/*
|
||||
* rpcbind errors
|
||||
*/
|
||||
RPC_RPCBFAILURE = 14, /* the pmapper failed in its call */
|
||||
#define RPC_PMAPFAILURE RPC_RPCBFAILURE
|
||||
RPC_PROGNOTREGISTERED = 15, /* remote program is not registered */
|
||||
RPC_N2AXLATEFAILURE = 22,
|
||||
/* Name to address translation failed */
|
||||
/*
|
||||
* Misc error in the TLI library
|
||||
*/
|
||||
RPC_TLIERROR = 20,
|
||||
/*
|
||||
* unspecified error
|
||||
*/
|
||||
RPC_FAILED = 16,
|
||||
/*
|
||||
* asynchronous errors
|
||||
*/
|
||||
RPC_INPROGRESS = 24,
|
||||
RPC_STALERACHANDLE = 25,
|
||||
RPC_CANTCONNECT = 26, /* couldn't make connection (cots) */
|
||||
RPC_XPRTFAILED = 27, /* received discon from remote (cots) */
|
||||
RPC_CANTCREATESTREAM = 28 /* can't push rpc module (cots) */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_RPC_CLNT_STAT_H */
|
||||
82
libtirpc/tirpc/rpc/des.h
Normal file
82
libtirpc/tirpc/rpc/des.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */
|
||||
/* $FreeBSD: src/include/rpc/des.h,v 1.4 2002/03/23 17:24:55 imp Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Generic DES driver interface
|
||||
* Keep this file hardware independent!
|
||||
* Copyright (c) 1986 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
|
||||
#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
|
||||
|
||||
enum desdir { ENCRYPT, DECRYPT };
|
||||
enum desmode { CBC, ECB };
|
||||
|
||||
/*
|
||||
* parameters to ioctl call
|
||||
*/
|
||||
struct desparams {
|
||||
u_char des_key[8]; /* key (with low bit parity) */
|
||||
enum desdir des_dir; /* direction */
|
||||
enum desmode des_mode; /* mode */
|
||||
u_char des_ivec[8]; /* input vector */
|
||||
unsigned des_len; /* number of bytes to crypt */
|
||||
union {
|
||||
u_char UDES_data[DES_QUICKLEN];
|
||||
u_char *UDES_buf;
|
||||
} UDES;
|
||||
# define des_data UDES.UDES_data /* direct data here if quick */
|
||||
# define des_buf UDES.UDES_buf /* otherwise, pointer to data */
|
||||
};
|
||||
|
||||
#ifdef notdef
|
||||
|
||||
/*
|
||||
* These ioctls are only implemented in SunOS. Maybe someday
|
||||
* if somebody writes a driver for DES hardware that works
|
||||
* with FreeBSD, we can being that back.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Encrypt an arbitrary sized buffer
|
||||
*/
|
||||
#define DESIOCBLOCK _IOWR('d', 6, struct desparams)
|
||||
|
||||
/*
|
||||
* Encrypt of small amount of data, quickly
|
||||
*/
|
||||
#define DESIOCQUICK _IOWR('d', 7, struct desparams)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Software DES.
|
||||
*/
|
||||
extern int _des_crypt( char *, int, struct desparams * );
|
||||
105
libtirpc/tirpc/rpc/des_crypt.h
Normal file
105
libtirpc/tirpc/rpc/des_crypt.h
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
|
||||
* $FreeBSD: src/include/rpc/des_crypt.h,v 1.4 2002/03/23 17:24:55 imp Exp $
|
||||
*
|
||||
* des_crypt.h, des library routine interface
|
||||
* Copyright (C) 1986, Sun Microsystems, Inc.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* des_crypt.h, des library routine interface
|
||||
*/
|
||||
|
||||
#ifndef _DES_DES_CRYPT_H
|
||||
#define _DES_DES_CRYPT_H
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
|
||||
#define DES_DIRMASK (1 << 0)
|
||||
#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
|
||||
#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
|
||||
|
||||
|
||||
#define DES_DEVMASK (1 << 1)
|
||||
#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
|
||||
#define DES_SW (1*DES_DEVMASK) /* Use software device */
|
||||
|
||||
|
||||
#define DESERR_NONE 0 /* succeeded */
|
||||
#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
|
||||
#define DESERR_HWERROR 2 /* failed, hardware/driver error */
|
||||
#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
|
||||
|
||||
#define DES_FAILED(err) \
|
||||
((err) > DESERR_NOHWDEVICE)
|
||||
|
||||
/*
|
||||
* cbc_crypt()
|
||||
* ecb_crypt()
|
||||
*
|
||||
* Encrypt (or decrypt) len bytes of a buffer buf.
|
||||
* The length must be a multiple of eight.
|
||||
* The key should have odd parity in the low bit of each byte.
|
||||
* ivec is the input vector, and is updated to the new one (cbc only).
|
||||
* The mode is created by oring together the appropriate parameters.
|
||||
* DESERR_NOHWDEVICE is returned if DES_HW was specified but
|
||||
* there was no hardware to do it on (the data will still be
|
||||
* encrypted though, in software).
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Cipher Block Chaining mode
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
int cbc_crypt( char *, char *, unsigned int, unsigned int, char *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Electronic Code Book mode
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
int ecb_crypt( char *, char *, unsigned int, unsigned int );
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Set des parity for a key.
|
||||
* DES parity is odd and in the low bit of each byte
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
void des_setparity( char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _DES_DES_CRYPT_H */
|
||||
63
libtirpc/tirpc/rpc/nettype.h
Normal file
63
libtirpc/tirpc/rpc/nettype.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* $NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/nettype.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* nettype.h, Nettype definitions.
|
||||
* All for the topmost layer of rpc
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_NETTYPE_H
|
||||
#define _TIRPC_NETTYPE_H
|
||||
|
||||
#include <netconfig.h>
|
||||
|
||||
#define _RPC_NONE 0
|
||||
#define _RPC_NETPATH 1
|
||||
#define _RPC_VISIBLE 2
|
||||
#define _RPC_CIRCUIT_V 3
|
||||
#define _RPC_DATAGRAM_V 4
|
||||
#define _RPC_CIRCUIT_N 5
|
||||
#define _RPC_DATAGRAM_N 6
|
||||
#define _RPC_TCP 7
|
||||
#define _RPC_UDP 8
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void *__rpc_setconf(const char *);
|
||||
extern void __rpc_endconf(void *);
|
||||
extern struct netconfig *__rpc_getconf(void *);
|
||||
extern struct netconfig *__rpc_getconfip(const char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_TIRPC_NETTYPE_H */
|
||||
85
libtirpc/tirpc/rpc/pmap_clnt.h
Normal file
85
libtirpc/tirpc/rpc/pmap_clnt.h
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/* $NetBSD: pmap_clnt.h,v 1.9 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap_clnt.h 1.11 88/02/08 SMI
|
||||
* from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/pmap_clnt.h,v 1.14 2002/04/28 15:18:45 des Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* pmap_clnt.h
|
||||
* Supplies C routines to get to portmap services.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
* success = pmap_set(program, version, protocol, port);
|
||||
* success = pmap_unset(program, version);
|
||||
* port = pmap_getport(address, program, version, protocol);
|
||||
* head = pmap_getmaps(address);
|
||||
* clnt_stat = pmap_rmtcall(address, program, version, procedure,
|
||||
* xdrargs, argsp, xdrres, resp, tout, port_ptr)
|
||||
* (works for udp only.)
|
||||
* clnt_stat = clnt_broadcast(program, version, procedure,
|
||||
* xdrargs, argsp, xdrres, resp, eachresult)
|
||||
* (like pmap_rmtcall, except the call is broadcasted to all
|
||||
* locally connected nets. For each valid response received,
|
||||
* the procedure eachresult is called. Its form is:
|
||||
* done = eachresult(resp, raddr)
|
||||
* bool_t done;
|
||||
* caddr_t resp;
|
||||
* struct sockaddr_in raddr;
|
||||
* where resp points to the results of the call and raddr is the
|
||||
* address if the responder to the broadcast.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_PMAP_CLNT_H_
|
||||
#define _RPC_PMAP_CLNT_H_
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t pmap_set(u_long, u_long, int, int);
|
||||
extern bool_t pmap_unset(u_long, u_long);
|
||||
extern struct pmaplist *pmap_getmaps(struct sockaddr_in *);
|
||||
extern enum clnt_stat pmap_rmtcall(struct sockaddr_in *,
|
||||
u_long, u_long, u_long,
|
||||
xdrproc_t, caddr_t,
|
||||
xdrproc_t, caddr_t,
|
||||
struct timeval, u_long *);
|
||||
extern enum clnt_stat clnt_broadcast(u_long, u_long, u_long,
|
||||
xdrproc_t, void *,
|
||||
xdrproc_t, void *,
|
||||
resultproc_t);
|
||||
extern u_short pmap_getport(struct sockaddr_in *,
|
||||
u_long, u_long, u_int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_PMAP_CLNT_H_ */
|
||||
106
libtirpc/tirpc/rpc/pmap_prot.h
Normal file
106
libtirpc/tirpc/rpc/pmap_prot.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/* $NetBSD: pmap_prot.h,v 1.8 2000/06/02 22:57:55 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap_prot.h 1.14 88/02/08 SMI
|
||||
* from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/pmap_prot.h,v 1.12 2002/03/23 17:24:55 imp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* pmap_prot.h
|
||||
* Protocol for the local binder service, or pmap.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
* The following procedures are supported by the protocol:
|
||||
*
|
||||
* PMAPPROC_NULL() returns ()
|
||||
* takes nothing, returns nothing
|
||||
*
|
||||
* PMAPPROC_SET(struct pmap) returns (bool_t)
|
||||
* TRUE is success, FALSE is failure. Registers the tuple
|
||||
* [prog, vers, prot, port].
|
||||
*
|
||||
* PMAPPROC_UNSET(struct pmap) returns (bool_t)
|
||||
* TRUE is success, FALSE is failure. Un-registers pair
|
||||
* [prog, vers]. prot and port are ignored.
|
||||
*
|
||||
* PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
|
||||
* 0 is failure. Otherwise returns the port number where the pair
|
||||
* [prog, vers] is registered. It may lie!
|
||||
*
|
||||
* PMAPPROC_DUMP() RETURNS (struct pmaplist *)
|
||||
*
|
||||
* PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
|
||||
* RETURNS (port, string<>);
|
||||
* usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
|
||||
* Calls the procedure on the local machine. If it is not registered,
|
||||
* this procedure is quite; ie it does not return error information!!!
|
||||
* This procedure only is supported on rpc/udp and calls via
|
||||
* rpc/udp. This routine only passes null authentication parameters.
|
||||
* This file has no interface to xdr routines for PMAPPROC_CALLIT.
|
||||
*
|
||||
* The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_PMAP_PROT_H
|
||||
#define _RPC_PMAP_PROT_H
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
#define PMAPPORT ((u_short)111)
|
||||
#define PMAPPROG ((u_long)100000)
|
||||
#define PMAPVERS ((u_long)2)
|
||||
#define PMAPVERS_PROTO ((u_long)2)
|
||||
#define PMAPVERS_ORIG ((u_long)1)
|
||||
#define PMAPPROC_NULL ((u_long)0)
|
||||
#define PMAPPROC_SET ((u_long)1)
|
||||
#define PMAPPROC_UNSET ((u_long)2)
|
||||
#define PMAPPROC_GETPORT ((u_long)3)
|
||||
#define PMAPPROC_DUMP ((u_long)4)
|
||||
#define PMAPPROC_CALLIT ((u_long)5)
|
||||
|
||||
struct pmap {
|
||||
long unsigned pm_prog;
|
||||
long unsigned pm_vers;
|
||||
long unsigned pm_prot;
|
||||
long unsigned pm_port;
|
||||
};
|
||||
|
||||
struct pmaplist {
|
||||
struct pmap pml_map;
|
||||
struct pmaplist *pml_next;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_pmap(XDR *, struct pmap *);
|
||||
extern bool_t xdr_pmaplist(XDR *, struct pmaplist **);
|
||||
extern bool_t xdr_pmaplist_ptr(XDR *, struct pmaplist *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_PMAP_PROT_H */
|
||||
64
libtirpc/tirpc/rpc/pmap_rmt.h
Normal file
64
libtirpc/tirpc/rpc/pmap_rmt.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* $NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap_rmt.h 1.2 88/02/08 SMI
|
||||
* from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/pmap_rmt.h,v 1.12 2002/03/23 17:24:55 imp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structures and XDR routines for parameters to and replies from
|
||||
* the portmapper remote-call-service.
|
||||
*
|
||||
* Copyright (C) 1986, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_PMAP_RMT_H
|
||||
#define _RPC_PMAP_RMT_H
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
struct rmtcallargs {
|
||||
u_long prog, vers, proc, arglen;
|
||||
caddr_t args_ptr;
|
||||
xdrproc_t xdr_args;
|
||||
};
|
||||
|
||||
struct rmtcallres {
|
||||
u_long *port_ptr;
|
||||
u_long resultslen;
|
||||
caddr_t results_ptr;
|
||||
xdrproc_t xdr_results;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *);
|
||||
extern bool_t xdr_rmtcallres(XDR *, struct rmtcallres *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_PMAP_RMT_H */
|
||||
57
libtirpc/tirpc/rpc/raw.h
Normal file
57
libtirpc/tirpc/rpc/raw.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/raw.h,v 1.1 2001/03/19 12:49:47 alfred Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_RAW_H
|
||||
#define _RPC_RAW_H
|
||||
|
||||
/* from: @(#)raw.h 1.11 94/04/25 SMI */
|
||||
/* from: @(#)raw.h 1.2 88/10/25 SMI */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* raw.h
|
||||
*
|
||||
* Raw interface
|
||||
* The common memory area over which they will communicate
|
||||
*/
|
||||
extern char *__rpc_rawcombuf;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _RPC_RAW_H */
|
||||
113
libtirpc/tirpc/rpc/rpc.h
Normal file
113
libtirpc/tirpc/rpc/rpc.h
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpc.h, Just includes the billions of rpc header files necessary to
|
||||
* do remote procedure calling.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
#ifndef _TIRPC_RPC_H
|
||||
#define _TIRPC_RPC_H
|
||||
|
||||
#include <rpc/types.h> /* some typedefs */
|
||||
#include "winsock2.h"
|
||||
//#include <sys/socket.h>
|
||||
//#include <netinet/in.h>
|
||||
|
||||
/* external data representation interfaces */
|
||||
#include <rpc/xdr.h> /* generic (de)serializer */
|
||||
|
||||
/* Client side only authentication */
|
||||
#include <rpc/auth.h> /* generic authenticator (client side) */
|
||||
|
||||
/* Client side (mostly) remote procedure call */
|
||||
#include <rpc/clnt.h> /* generic rpc stuff */
|
||||
|
||||
/* semi-private protocol headers */
|
||||
#include <rpc/rpc_msg.h> /* protocol for rpc messages */
|
||||
#include <rpc/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 <rpc/auth_des.h> /* protocol for des style cred */
|
||||
|
||||
#ifdef HAVE_RPCSEC_GSS
|
||||
#include <rpc/auth_gss.h> /* RPCSEC_GSS */
|
||||
#endif
|
||||
|
||||
/* Server side only remote procedure callee */
|
||||
#include <rpc/svc_auth.h> /* service side authenticator */
|
||||
#include <rpc/svc.h> /* service manager and multiplexer */
|
||||
|
||||
/* Portmapper client, server, and protocol headers */
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
#include <rpc/rpcb_clnt.h> /* rpcbind interface functions */
|
||||
#endif
|
||||
#include <rpc/rpcent.h>
|
||||
|
||||
#ifndef UDPMSGSIZE
|
||||
#define UDPMSGSIZE 8800
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int get_myaddress(struct sockaddr_in *);
|
||||
extern int bindresvport(SOCKET, struct sockaddr_in *) __THROW;
|
||||
extern int registerrpc(int, int, int, char *(*)(char [UDPMSGSIZE]),
|
||||
xdrproc_t, xdrproc_t);
|
||||
extern int callrpc(const char *, int, int, int, xdrproc_t, void *,
|
||||
xdrproc_t , void *);
|
||||
extern int getrpcport(char *, int, int, int);
|
||||
|
||||
char *taddr2uaddr(const struct netconfig *, const struct netbuf *);
|
||||
struct netbuf *uaddr2taddr(const struct netconfig *, const char *);
|
||||
|
||||
void freeuaddr(char *); /* free memory allocated by taddr2uaddr */
|
||||
void freenetbuf(struct netbuf *); /* free memory allocated by uaddr2taddr */
|
||||
|
||||
struct sockaddr;
|
||||
extern int bindresvport_sa(SOCKET, struct sockaddr *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* The following are not exported interfaces, they are for internal library
|
||||
* and rpcbind use only. Do not use, they may change without notice.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
SOCKET __rpc_nconf2fd(const struct netconfig *);
|
||||
int __rpc_nconf2sockinfo(const struct netconfig *, struct __rpc_sockinfo *);
|
||||
int __rpc_fd2sockinfo(SOCKET, struct __rpc_sockinfo *);
|
||||
u_int __rpc_get_t_size(int, int, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_RPC_H */
|
||||
87
libtirpc/tirpc/rpc/rpc_com.h
Normal file
87
libtirpc/tirpc/rpc/rpc_com.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/rpc_com.h,v 1.6 2003/01/16 07:13:51 mbr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpc_com.h, Common definitions for both the server and client side.
|
||||
* All for the topmost layer of rpc
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RPC_RPCCOM_H
|
||||
#define _RPC_RPCCOM_H
|
||||
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
/* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */
|
||||
|
||||
/*
|
||||
* The max size of the transport, if the size cannot be determined
|
||||
* by other means.
|
||||
*/
|
||||
#define RPC_MAXDATASIZE 9000
|
||||
#define RPC_MAXADDRSIZE 1024
|
||||
|
||||
//#ifdef _WIN32
|
||||
//#define __RPC_GETXID(now) ((u_int32_t)_getpid() ^ (u_int32_t)(now)->tv_sec ^ \
|
||||
// (u_int32_t)(now)->tv_usec)
|
||||
//#else
|
||||
#define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \
|
||||
(u_int32_t)(now)->tv_usec)
|
||||
//#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern u_int __rpc_get_a_size(int);
|
||||
extern int __rpc_dtbsize(void);
|
||||
extern int _rpc_dtablesize(void);
|
||||
extern struct netconfig * __rpcgettp(int);
|
||||
extern int __rpc_get_default_domain(char **);
|
||||
|
||||
char *__rpc_taddr2uaddr_af(int, const struct netbuf *);
|
||||
struct netbuf *__rpc_uaddr2taddr_af(int, const char *);
|
||||
int __rpc_fixup_addr(struct netbuf *, const struct netbuf *);
|
||||
int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **);
|
||||
int __rpc_seman2socktype(int);
|
||||
int __rpc_socktype2seman(int);
|
||||
void *rpc_nullproc(CLIENT *);
|
||||
int __rpc_sockisbound(SOCKET);
|
||||
|
||||
struct netbuf *__rpcb_findaddr(rpcprog_t, rpcvers_t, const struct netconfig *,
|
||||
const char *, CLIENT **);
|
||||
bool_t rpc_control(int,void *);
|
||||
|
||||
char *_get_next_token(char *, int);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RPC_RPCCOM_H */
|
||||
224
libtirpc/tirpc/rpc/rpc_msg.h
Normal file
224
libtirpc/tirpc/rpc/rpc_msg.h
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
/* $NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)rpc_msg.h 1.7 86/07/16 SMI
|
||||
* from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/rpc_msg.h,v 1.15 2003/01/01 18:48:42 schweikh Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpc_msg.h
|
||||
* rpc message definition
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_RPC_MSG_H
|
||||
#define _TIRPC_RPC_MSG_H
|
||||
|
||||
#define RPC_MSG_VERSION ((u_int32_t) 2)
|
||||
#define RPC_SERVICE_PORT ((u_short) 2048)
|
||||
|
||||
#include <rpc/auth.h>
|
||||
|
||||
/*
|
||||
* 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 {
|
||||
rpcvers_t low;
|
||||
rpcvers_t 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 {
|
||||
rpcvers_t low;
|
||||
rpcvers_t 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 {
|
||||
rpcvers_t cb_rpcvers; /* must be equal to two */
|
||||
rpcprog_t cb_prog;
|
||||
rpcvers_t cb_vers;
|
||||
rpcproc_t cb_proc;
|
||||
struct opaque_auth cb_cred;
|
||||
struct opaque_auth cb_verf; /* protocol specific - provided by client */
|
||||
};
|
||||
|
||||
/*
|
||||
* The rpc message
|
||||
*/
|
||||
struct rpc_msg {
|
||||
u_int32_t 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
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* XDR routine to handle a rpc message.
|
||||
* xdr_callmsg(xdrs, cmsg)
|
||||
* XDR *xdrs;
|
||||
* struct rpc_msg *cmsg;
|
||||
*/
|
||||
extern bool_t xdr_callmsg(XDR *, struct rpc_msg *);
|
||||
|
||||
/*
|
||||
* 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 *, struct rpc_msg *);
|
||||
|
||||
/*
|
||||
* XDR routine to handle a rpc reply.
|
||||
* xdr_replymsg(xdrs, rmsg)
|
||||
* XDR *xdrs;
|
||||
* struct rpc_msg *rmsg;
|
||||
*/
|
||||
extern bool_t xdr_replymsg(XDR *, struct rpc_msg *);
|
||||
|
||||
/*
|
||||
* XDR routine to read just xid and direction, then union
|
||||
* xdr_getxiddir(xdrs, rmsg)
|
||||
* XDR *xdrs;
|
||||
* struct rpc_msg *rmsg;
|
||||
*/
|
||||
extern bool_t xdr_getxiddir(XDR *, struct rpc_msg *);
|
||||
extern bool_t xdr_getreplyunion(XDR *, struct rpc_msg *);
|
||||
extern bool_t xdr_getcallbody(XDR *, struct rpc_msg *);
|
||||
|
||||
/*
|
||||
* XDR routine to handle an accepted rpc reply.
|
||||
* xdr_accepted_reply(xdrs, rej)
|
||||
* XDR *xdrs;
|
||||
* struct accepted_reply *rej;
|
||||
*/
|
||||
extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *);
|
||||
|
||||
/*
|
||||
* XDR routine to handle a rejected rpc reply.
|
||||
* xdr_rejected_reply(xdrs, rej)
|
||||
* XDR *xdrs;
|
||||
* struct rejected_reply *rej;
|
||||
*/
|
||||
extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *);
|
||||
|
||||
/*
|
||||
* 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(struct rpc_msg *, struct rpc_err *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_TIRPC_RPC_MSG_H */
|
||||
83
libtirpc/tirpc/rpc/rpcb_clnt.h
Normal file
83
libtirpc/tirpc/rpc/rpcb_clnt.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/* $NetBSD: rpcb_clnt.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/rpcb_clnt.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpcb_clnt.h
|
||||
* Supplies C routines to get to rpcbid services.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
* success = rpcb_set(program, version, nconf, address);
|
||||
* success = rpcb_unset(program, version, nconf);
|
||||
* success = rpcb_getaddr(program, version, nconf, host);
|
||||
* head = rpcb_getmaps(nconf, host);
|
||||
* clnt_stat = rpcb_rmtcall(nconf, host, program, version, procedure,
|
||||
* xdrargs, argsp, xdrres, resp, tout, addr_ptr)
|
||||
* success = rpcb_gettime(host, timep)
|
||||
* uaddr = rpcb_taddr2uaddr(nconf, taddr);
|
||||
* taddr = rpcb_uaddr2uaddr(nconf, uaddr);
|
||||
*/
|
||||
|
||||
#ifndef _RPC_RPCB_CLNT_H
|
||||
#define _RPC_RPCB_CLNT_H
|
||||
|
||||
/* #pragma ident "@(#)rpcb_clnt.h 1.13 94/04/25 SMI" */
|
||||
/* rpcb_clnt.h 1.3 88/12/05 SMI */
|
||||
|
||||
#include <rpc/types.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
__BEGIN_DECLS
|
||||
extern bool_t rpcb_set(const rpcprog_t, const rpcvers_t,
|
||||
const struct netconfig *, const struct netbuf *);
|
||||
extern bool_t rpcb_unset(const rpcprog_t, const rpcvers_t,
|
||||
const struct netconfig *);
|
||||
extern rpcblist *rpcb_getmaps(const struct netconfig *, const char *);
|
||||
extern enum clnt_stat rpcb_rmtcall(const struct netconfig *,
|
||||
const char *, const rpcprog_t,
|
||||
const rpcvers_t, const rpcproc_t,
|
||||
const xdrproc_t, const caddr_t,
|
||||
const xdrproc_t, const caddr_t,
|
||||
const struct timeval,
|
||||
const struct netbuf *);
|
||||
extern bool_t rpcb_getaddr(const rpcprog_t, const rpcvers_t,
|
||||
const struct netconfig *, struct netbuf *,
|
||||
const char *);
|
||||
extern bool_t rpcb_gettime(const char *, time_t *);
|
||||
extern char *rpcb_taddr2uaddr(struct netconfig *, struct netbuf *);
|
||||
extern struct netbuf *rpcb_uaddr2taddr(struct netconfig *, char *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_RPCB_CLNT_H */
|
||||
803
libtirpc/tirpc/rpc/rpcb_prot.h
Normal file
803
libtirpc/tirpc/rpc/rpcb_prot.h
Normal file
|
|
@ -0,0 +1,803 @@
|
|||
/*
|
||||
* Please do not edit this file.
|
||||
* It was generated using rpcgen.
|
||||
*/
|
||||
|
||||
#ifndef _RPCB_PROT_H_RPCGEN
|
||||
#define _RPCB_PROT_H_RPCGEN
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
#ifndef IXDR_GET_INT32
|
||||
#define IXDR_GET_INT32(buf) IXDR_GET_LONG((buf))
|
||||
#endif
|
||||
#ifndef IXDR_PUT_INT32
|
||||
#define IXDR_PUT_INT32(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
#endif
|
||||
#ifndef IXDR_GET_U_INT32
|
||||
#define IXDR_GET_U_INT32(buf) IXDR_GET_U_LONG((buf))
|
||||
#endif
|
||||
#ifndef IXDR_PUT_U_INT32
|
||||
#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_U_LONG((buf), (v))
|
||||
#endif
|
||||
/*
|
||||
* $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $
|
||||
*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988 by Sun Microsystems, Inc.
|
||||
*/
|
||||
/* from rpcb_prot.x */
|
||||
|
||||
/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */
|
||||
|
||||
#ifndef _KERNEL
|
||||
|
||||
|
||||
/*
|
||||
* The following procedures are supported by the protocol in version 3:
|
||||
*
|
||||
* RPCBPROC_NULL() returns ()
|
||||
* takes nothing, returns nothing
|
||||
*
|
||||
* RPCBPROC_SET(rpcb) returns (bool_t)
|
||||
* TRUE is success, FALSE is failure. Registers the tuple
|
||||
* [prog, vers, address, owner, netid].
|
||||
* Finds out owner and netid information on its own.
|
||||
*
|
||||
* RPCBPROC_UNSET(rpcb) returns (bool_t)
|
||||
* TRUE is success, FALSE is failure. Un-registers tuple
|
||||
* [prog, vers, netid]. addresses is ignored.
|
||||
* If netid is NULL, unregister all.
|
||||
*
|
||||
* RPCBPROC_GETADDR(rpcb) returns (string).
|
||||
* 0 is failure. Otherwise returns the universal address where the
|
||||
* triple [prog, vers, netid] is registered. Ignore address and owner.
|
||||
*
|
||||
* RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
|
||||
* used to dump the entire rpcbind maps
|
||||
*
|
||||
* RPCBPROC_CALLIT(rpcb_rmtcallargs)
|
||||
* RETURNS (rpcb_rmtcallres);
|
||||
* Calls the procedure on the remote machine. If it is not registered,
|
||||
* this procedure is quiet; i.e. it does not return error information!!!
|
||||
* This routine only passes null authentication parameters.
|
||||
* It has no interface to xdr routines for RPCBPROC_CALLIT.
|
||||
*
|
||||
* RPCBPROC_GETTIME() returns (int).
|
||||
* Gets the remote machines time
|
||||
*
|
||||
* RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
|
||||
* Returns the netbuf address from universal address.
|
||||
*
|
||||
* RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
|
||||
* Returns the universal address from netbuf address.
|
||||
*
|
||||
* END OF RPCBIND VERSION 3 PROCEDURES
|
||||
*/
|
||||
/*
|
||||
* Except for RPCBPROC_CALLIT, the procedures above are carried over to
|
||||
* rpcbind version 4. Those below are added or modified for version 4.
|
||||
* NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
|
||||
* AS RPCBPROC_CALLIT.
|
||||
*
|
||||
* RPCBPROC_BCAST(rpcb_rmtcallargs)
|
||||
* RETURNS (rpcb_rmtcallres);
|
||||
* Calls the procedure on the remote machine. If it is not registered,
|
||||
* this procedure IS quiet; i.e. it DOES NOT return error information!!!
|
||||
* This routine should be used for broadcasting and nothing else.
|
||||
*
|
||||
* RPCBPROC_GETVERSADDR(rpcb) returns (string).
|
||||
* 0 is failure. Otherwise returns the universal address where the
|
||||
* triple [prog, vers, netid] is registered. Ignore address and owner.
|
||||
* Same as RPCBPROC_GETADDR except that if the given version number
|
||||
* is not available, the address is not returned.
|
||||
*
|
||||
* RPCBPROC_INDIRECT(rpcb_rmtcallargs)
|
||||
* RETURNS (rpcb_rmtcallres);
|
||||
* Calls the procedure on the remote machine. If it is not registered,
|
||||
* this procedure is NOT quiet; i.e. it DOES return error information!!!
|
||||
* as any normal application would expect.
|
||||
*
|
||||
* RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
|
||||
* Same as RPCBPROC_GETADDR except that it returns a list of all the
|
||||
* addresses registered for the combination (prog, vers) (for all
|
||||
* transports).
|
||||
*
|
||||
* RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
|
||||
* Returns the statistics about the kind of requests received by rpcbind.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A mapping of (program, version, network ID) to address
|
||||
*/
|
||||
|
||||
struct rpcb {
|
||||
rpcprog_t r_prog;
|
||||
rpcvers_t r_vers;
|
||||
char *r_netid;
|
||||
char *r_addr;
|
||||
char *r_owner;
|
||||
};
|
||||
typedef struct rpcb rpcb;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb(XDR *, rpcb*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb(XDR *, rpcb*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rpcb();
|
||||
bool_t xdr_rpcb(XDR *, rpcb*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef rpcb RPCB;
|
||||
|
||||
|
||||
/*
|
||||
* A list of mappings
|
||||
*
|
||||
* Below are two definitions for the rpcblist structure. This is done because
|
||||
* xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
|
||||
* struct rpcblist * that rpcgen would produce. One version of the rpcblist
|
||||
* structure (actually called rp__list) is used with rpcgen, and the other is
|
||||
* defined only in the header file for compatibility with the specified
|
||||
* interface.
|
||||
*/
|
||||
|
||||
struct rp__list {
|
||||
rpcb rpcb_map;
|
||||
struct rp__list *rpcb_next;
|
||||
};
|
||||
typedef struct rp__list rp__list;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rp__list(XDR *, rp__list*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rp__list(XDR *, rp__list*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rp__list();
|
||||
bool_t xdr_rp__list(XDR *, rp__list*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef rp__list *rpcblist_ptr;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcblist_ptr(XDR *, rpcblist_ptr*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcblist_ptr(XDR *, rpcblist_ptr*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rpcblist_ptr();
|
||||
bool_t xdr_rpcblist_ptr(XDR *, rpcblist_ptr*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef struct rp__list rpcblist;
|
||||
typedef struct rp__list RPCBLIST;
|
||||
|
||||
#ifndef __cplusplus
|
||||
struct rpcblist {
|
||||
RPCB rpcb_map;
|
||||
struct rpcblist *rpcb_next;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern bool_t xdr_rpcblist(XDR *, rpcblist**);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Arguments of remote calls
|
||||
*/
|
||||
|
||||
struct rpcb_rmtcallargs {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc;
|
||||
struct {
|
||||
u_int args_len;
|
||||
char *args_val;
|
||||
} args;
|
||||
};
|
||||
typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_rmtcallargs(XDR *, rpcb_rmtcallargs*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_rmtcallargs(XDR *, rpcb_rmtcallargs*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rpcb_rmtcallargs();
|
||||
bool_t xdr_rpcb_rmtcallargs(XDR *, rpcb_rmtcallargs*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* Client-side only representation of rpcb_rmtcallargs structure.
|
||||
*
|
||||
* The routine that XDRs the rpcb_rmtcallargs structure must deal with the
|
||||
* opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to
|
||||
* be passed the XDR routine that knows the args' structure. This routine
|
||||
* doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
|
||||
* the application being called already knows the args structure. So we use a
|
||||
* different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
|
||||
* includes the args' XDR routine.
|
||||
*/
|
||||
struct r_rpcb_rmtcallargs {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc;
|
||||
struct {
|
||||
u_int args_len;
|
||||
char *args_val;
|
||||
} args;
|
||||
xdrproc_t xdr_args; /* encodes args */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Results of the remote call
|
||||
*/
|
||||
|
||||
struct rpcb_rmtcallres {
|
||||
char *addr;
|
||||
struct {
|
||||
u_int results_len;
|
||||
char *results_val;
|
||||
} results;
|
||||
};
|
||||
typedef struct rpcb_rmtcallres rpcb_rmtcallres;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_rmtcallres(XDR *, rpcb_rmtcallres*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_rmtcallres(XDR *, rpcb_rmtcallres*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rpcb_rmtcallres();
|
||||
bool_t xdr_rpcb_rmtcallres(XDR *, rpcb_rmtcallres*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* Client-side only representation of rpcb_rmtcallres structure.
|
||||
*/
|
||||
struct r_rpcb_rmtcallres {
|
||||
char *addr;
|
||||
struct {
|
||||
u_int32_t results_len;
|
||||
char *results_val;
|
||||
} results;
|
||||
xdrproc_t xdr_res; /* decodes results */
|
||||
};
|
||||
|
||||
/*
|
||||
* rpcb_entry contains a merged address of a service on a particular
|
||||
* transport, plus associated netconfig information. A list of rpcb_entrys
|
||||
* is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used
|
||||
* in r_nc_* fields.
|
||||
*/
|
||||
|
||||
struct rpcb_entry {
|
||||
char *r_maddr;
|
||||
char *r_nc_netid;
|
||||
u_int r_nc_semantics;
|
||||
char *r_nc_protofmly;
|
||||
char *r_nc_proto;
|
||||
};
|
||||
typedef struct rpcb_entry rpcb_entry;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_entry(XDR *, rpcb_entry*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_entry(XDR *, rpcb_entry*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcb_entry();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* A list of addresses supported by a service.
|
||||
*/
|
||||
|
||||
struct rpcb_entry_list {
|
||||
rpcb_entry rpcb_entry_map;
|
||||
struct rpcb_entry_list *rpcb_entry_next;
|
||||
};
|
||||
typedef struct rpcb_entry_list rpcb_entry_list;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_entry_list(XDR *, rpcb_entry_list*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_entry_list(XDR *, rpcb_entry_list*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcb_entry_list();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef rpcb_entry_list *rpcb_entry_list_ptr;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_entry_list_ptr(XDR *, rpcb_entry_list_ptr*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_entry_list_ptr(XDR *, rpcb_entry_list_ptr*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcb_entry_list_ptr();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* rpcbind statistics
|
||||
*/
|
||||
|
||||
#define rpcb_highproc_2 RPCBPROC_CALLIT
|
||||
#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR
|
||||
#define rpcb_highproc_4 RPCBPROC_GETSTAT
|
||||
#define RPCBSTAT_HIGHPROC 13
|
||||
#define RPCBVERS_STAT 3
|
||||
#define RPCBVERS_4_STAT 2
|
||||
#define RPCBVERS_3_STAT 1
|
||||
#define RPCBVERS_2_STAT 0
|
||||
|
||||
/* Link list of all the stats about getport and getaddr */
|
||||
|
||||
struct rpcbs_addrlist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
int success;
|
||||
int failure;
|
||||
char *netid;
|
||||
struct rpcbs_addrlist *next;
|
||||
};
|
||||
typedef struct rpcbs_addrlist rpcbs_addrlist;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcbs_addrlist(XDR *, rpcbs_addrlist*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcbs_addrlist(XDR *, rpcbs_addrlist*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcbs_addrlist();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/* Link list of all the stats about rmtcall */
|
||||
|
||||
struct rpcbs_rmtcalllist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc;
|
||||
int success;
|
||||
int failure;
|
||||
int indirect;
|
||||
char *netid;
|
||||
struct rpcbs_rmtcalllist *next;
|
||||
};
|
||||
typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcbs_rmtcalllist(XDR *, rpcbs_rmtcalllist*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcbs_rmtcalllist(XDR *, rpcbs_rmtcalllist*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcbs_rmtcalllist();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcbs_proc(XDR *, rpcbs_proc);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcbs_proc(XDR *, rpcbs_proc);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcbs_proc();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcbs_addrlist_ptr(XDR *, rpcbs_addrlist_ptr*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcbs_addrlist_ptr(XDR *, rpcbs_addrlist_ptr*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcbs_addrlist_ptr();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *, rpcbs_rmtcalllist_ptr*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *, rpcbs_rmtcalllist_ptr*);
|
||||
#else /* Old Style C */
|
||||
//bool_t xdr_rpcbs_rmtcalllist_ptr();
|
||||
bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *, rpcbs_rmtcalllist_ptr*);
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
struct rpcb_stat {
|
||||
rpcbs_proc info;
|
||||
int setinfo;
|
||||
int unsetinfo;
|
||||
rpcbs_addrlist_ptr addrinfo;
|
||||
rpcbs_rmtcalllist_ptr rmtinfo;
|
||||
};
|
||||
typedef struct rpcb_stat rpcb_stat;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_stat(XDR *, rpcb_stat*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_stat(XDR *, rpcb_stat*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcb_stat();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* One rpcb_stat structure is returned for each version of rpcbind
|
||||
* being monitored.
|
||||
*/
|
||||
|
||||
typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_rpcb_stat_byvers(XDR *, rpcb_stat_byvers);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_rpcb_stat_byvers(XDR *, rpcb_stat_byvers);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_rpcb_stat_byvers();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
/*
|
||||
* We don't define netbuf in RPCL, since it would contain structure member
|
||||
* names that would conflict with the definition of struct netbuf in
|
||||
* <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here,
|
||||
* and implement it ourselves in rpc/rpcb_prot.c.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
|
||||
#else /* __STDC__ */
|
||||
extern bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
|
||||
#endif
|
||||
|
||||
#define RPCBVERS_3 RPCBVERS
|
||||
#define RPCBVERS_4 RPCBVERS4
|
||||
|
||||
#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock"
|
||||
|
||||
#else /* ndef _KERNEL */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A mapping of (program, version, network ID) to address
|
||||
*/
|
||||
struct rpcb {
|
||||
rpcprog_t r_prog; /* program number */
|
||||
rpcvers_t r_vers; /* version number */
|
||||
char *r_netid; /* network id */
|
||||
char *r_addr; /* universal address */
|
||||
char *r_owner; /* owner of the mapping */
|
||||
};
|
||||
typedef struct rpcb RPCB;
|
||||
|
||||
/*
|
||||
* A list of mappings
|
||||
*/
|
||||
struct rpcblist {
|
||||
RPCB rpcb_map;
|
||||
struct rpcblist *rpcb_next;
|
||||
};
|
||||
typedef struct rpcblist RPCBLIST;
|
||||
typedef struct rpcblist *rpcblist_ptr;
|
||||
|
||||
/*
|
||||
* Remote calls arguments
|
||||
*/
|
||||
struct rpcb_rmtcallargs {
|
||||
rpcprog_t prog; /* program number */
|
||||
rpcvers_t vers; /* version number */
|
||||
rpcproc_t proc; /* procedure number */
|
||||
u_int32_t arglen; /* arg len */
|
||||
caddr_t args_ptr; /* argument */
|
||||
xdrproc_t xdr_args; /* XDR routine for argument */
|
||||
};
|
||||
typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
|
||||
|
||||
/*
|
||||
* Remote calls results
|
||||
*/
|
||||
struct rpcb_rmtcallres {
|
||||
char *addr_ptr; /* remote universal address */
|
||||
u_int32_t resultslen; /* results length */
|
||||
caddr_t results_ptr; /* results */
|
||||
xdrproc_t xdr_results; /* XDR routine for result */
|
||||
};
|
||||
typedef struct rpcb_rmtcallres rpcb_rmtcallres;
|
||||
|
||||
struct rpcb_entry {
|
||||
char *r_maddr;
|
||||
char *r_nc_netid;
|
||||
unsigned int r_nc_semantics;
|
||||
char *r_nc_protofmly;
|
||||
char *r_nc_proto;
|
||||
};
|
||||
typedef struct rpcb_entry rpcb_entry;
|
||||
|
||||
/*
|
||||
* A list of addresses supported by a service.
|
||||
*/
|
||||
|
||||
struct rpcb_entry_list {
|
||||
rpcb_entry rpcb_entry_map;
|
||||
struct rpcb_entry_list *rpcb_entry_next;
|
||||
};
|
||||
typedef struct rpcb_entry_list rpcb_entry_list;
|
||||
|
||||
typedef rpcb_entry_list *rpcb_entry_list_ptr;
|
||||
|
||||
/*
|
||||
* rpcbind statistics
|
||||
*/
|
||||
|
||||
#define rpcb_highproc_2 RPCBPROC_CALLIT
|
||||
#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR
|
||||
#define rpcb_highproc_4 RPCBPROC_GETSTAT
|
||||
#define RPCBSTAT_HIGHPROC 13
|
||||
#define RPCBVERS_STAT 3
|
||||
#define RPCBVERS_4_STAT 2
|
||||
#define RPCBVERS_3_STAT 1
|
||||
#define RPCBVERS_2_STAT 0
|
||||
|
||||
/* Link list of all the stats about getport and getaddr */
|
||||
|
||||
struct rpcbs_addrlist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
int success;
|
||||
int failure;
|
||||
char *netid;
|
||||
struct rpcbs_addrlist *next;
|
||||
};
|
||||
typedef struct rpcbs_addrlist rpcbs_addrlist;
|
||||
|
||||
/* Link list of all the stats about rmtcall */
|
||||
|
||||
struct rpcbs_rmtcalllist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc;
|
||||
int success;
|
||||
int failure;
|
||||
int indirect;
|
||||
char *netid;
|
||||
struct rpcbs_rmtcalllist *next;
|
||||
};
|
||||
typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
|
||||
|
||||
typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
|
||||
|
||||
typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
|
||||
|
||||
typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
|
||||
|
||||
struct rpcb_stat {
|
||||
rpcbs_proc info;
|
||||
int setinfo;
|
||||
int unsetinfo;
|
||||
rpcbs_addrlist_ptr addrinfo;
|
||||
rpcbs_rmtcalllist_ptr rmtinfo;
|
||||
};
|
||||
typedef struct rpcb_stat rpcb_stat;
|
||||
|
||||
/*
|
||||
* One rpcb_stat structure is returned for each version of rpcbind
|
||||
* being monitored.
|
||||
*/
|
||||
|
||||
typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef _KERNEL */
|
||||
|
||||
#define RPCBPROG ((u_int32_t)100000)
|
||||
#define RPCBVERS ((u_int32_t)3)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define RPCBPROC_SET ((u_int32_t)1)
|
||||
extern "C" bool_t * rpcbproc_set_3(rpcb *, CLIENT *);
|
||||
extern "C" bool_t * rpcbproc_set_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_UNSET ((u_int32_t)2)
|
||||
extern "C" bool_t * rpcbproc_unset_3(rpcb *, CLIENT *);
|
||||
extern "C" bool_t * rpcbproc_unset_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_GETADDR ((u_int32_t)3)
|
||||
extern "C" char ** rpcbproc_getaddr_3(rpcb *, CLIENT *);
|
||||
extern "C" char ** rpcbproc_getaddr_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_DUMP ((u_int32_t)4)
|
||||
extern "C" rpcblist_ptr * rpcbproc_dump_3(void *, CLIENT *);
|
||||
extern "C" rpcblist_ptr * rpcbproc_dump_3_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_CALLIT ((u_int32_t)5)
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_callit_3(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_callit_3_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
#define RPCBPROC_GETTIME ((u_int32_t)6)
|
||||
extern "C" u_int * rpcbproc_gettime_3(void *, CLIENT *);
|
||||
extern "C" u_int * rpcbproc_gettime_3_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_UADDR2TADDR ((u_int32_t)7)
|
||||
extern "C" struct netbuf * rpcbproc_uaddr2taddr_3(char **, CLIENT *);
|
||||
extern "C" struct netbuf * rpcbproc_uaddr2taddr_3_svc(char **, struct svc_req *);
|
||||
#define RPCBPROC_TADDR2UADDR ((u_int32_t)8)
|
||||
extern "C" char ** rpcbproc_taddr2uaddr_3(struct netbuf *, CLIENT *);
|
||||
extern "C" char ** rpcbproc_taddr2uaddr_3_svc(struct netbuf *, struct svc_req *);
|
||||
|
||||
#elif __STDC__
|
||||
#define RPCBPROC_SET ((u_int32_t)1)
|
||||
extern bool_t * rpcbproc_set_3(rpcb *, CLIENT *);
|
||||
extern bool_t * rpcbproc_set_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_UNSET ((u_int32_t)2)
|
||||
extern bool_t * rpcbproc_unset_3(rpcb *, CLIENT *);
|
||||
extern bool_t * rpcbproc_unset_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_GETADDR ((u_int32_t)3)
|
||||
extern char ** rpcbproc_getaddr_3(rpcb *, CLIENT *);
|
||||
extern char ** rpcbproc_getaddr_3_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_DUMP ((u_int32_t)4)
|
||||
extern rpcblist_ptr * rpcbproc_dump_3(void *, CLIENT *);
|
||||
extern rpcblist_ptr * rpcbproc_dump_3_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_CALLIT ((u_int32_t)5)
|
||||
extern rpcb_rmtcallres * rpcbproc_callit_3(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern rpcb_rmtcallres * rpcbproc_callit_3_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
#define RPCBPROC_GETTIME ((u_int32_t)6)
|
||||
extern u_int * rpcbproc_gettime_3(void *, CLIENT *);
|
||||
extern u_int * rpcbproc_gettime_3_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_UADDR2TADDR ((u_int32_t)7)
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_3(char **, CLIENT *);
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_3_svc(char **, struct svc_req *);
|
||||
#define RPCBPROC_TADDR2UADDR ((u_int32_t)8)
|
||||
extern char ** rpcbproc_taddr2uaddr_3(struct netbuf *, CLIENT *);
|
||||
extern char ** rpcbproc_taddr2uaddr_3_svc(struct netbuf *, struct svc_req *);
|
||||
|
||||
#else /* Old Style C */
|
||||
#define RPCBPROC_SET ((u_int32_t)1)
|
||||
extern bool_t * rpcbproc_set_3();
|
||||
extern bool_t * rpcbproc_set_3_svc();
|
||||
#define RPCBPROC_UNSET ((u_int32_t)2)
|
||||
extern bool_t * rpcbproc_unset_3();
|
||||
extern bool_t * rpcbproc_unset_3_svc();
|
||||
#define RPCBPROC_GETADDR ((u_int32_t)3)
|
||||
extern char ** rpcbproc_getaddr_3();
|
||||
extern char ** rpcbproc_getaddr_3_svc();
|
||||
#define RPCBPROC_DUMP ((u_int32_t)4)
|
||||
extern rpcblist_ptr * rpcbproc_dump_3();
|
||||
extern rpcblist_ptr * rpcbproc_dump_3_svc();
|
||||
#define RPCBPROC_CALLIT ((u_int32_t)5)
|
||||
extern rpcb_rmtcallres * rpcbproc_callit_3();
|
||||
extern rpcb_rmtcallres * rpcbproc_callit_3_svc();
|
||||
#define RPCBPROC_GETTIME ((u_int32_t)6)
|
||||
extern u_int * rpcbproc_gettime_3();
|
||||
extern u_int * rpcbproc_gettime_3_svc();
|
||||
#define RPCBPROC_UADDR2TADDR ((u_int32_t)7)
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_3();
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_3_svc();
|
||||
#define RPCBPROC_TADDR2UADDR ((u_int32_t)8)
|
||||
extern char ** rpcbproc_taddr2uaddr_3();
|
||||
extern char ** rpcbproc_taddr2uaddr_3_svc();
|
||||
#endif /* Old Style C */
|
||||
#define RPCBVERS4 ((u_int32_t)4)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t * rpcbproc_set_4(rpcb *, CLIENT *);
|
||||
extern "C" bool_t * rpcbproc_set_4_svc(rpcb *, struct svc_req *);
|
||||
extern "C" bool_t * rpcbproc_unset_4(rpcb *, CLIENT *);
|
||||
extern "C" bool_t * rpcbproc_unset_4_svc(rpcb *, struct svc_req *);
|
||||
extern "C" char ** rpcbproc_getaddr_4(rpcb *, CLIENT *);
|
||||
extern "C" char ** rpcbproc_getaddr_4_svc(rpcb *, struct svc_req *);
|
||||
extern "C" rpcblist_ptr * rpcbproc_dump_4(void *, CLIENT *);
|
||||
extern "C" rpcblist_ptr * rpcbproc_dump_4_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_BCAST ((u_int32_t)RPCBPROC_CALLIT)
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_bcast_4(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_bcast_4_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
extern "C" u_int * rpcbproc_gettime_4(void *, CLIENT *);
|
||||
extern "C" u_int * rpcbproc_gettime_4_svc(void *, struct svc_req *);
|
||||
extern "C" struct netbuf * rpcbproc_uaddr2taddr_4(char **, CLIENT *);
|
||||
extern "C" struct netbuf * rpcbproc_uaddr2taddr_4_svc(char **, struct svc_req *);
|
||||
extern "C" char ** rpcbproc_taddr2uaddr_4(struct netbuf *, CLIENT *);
|
||||
extern "C" char ** rpcbproc_taddr2uaddr_4_svc(struct netbuf *, struct svc_req *);
|
||||
#define RPCBPROC_GETVERSADDR ((u_int32_t)9)
|
||||
extern "C" char ** rpcbproc_getversaddr_4(rpcb *, CLIENT *);
|
||||
extern "C" char ** rpcbproc_getversaddr_4_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_INDIRECT ((u_int32_t)10)
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_indirect_4(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern "C" rpcb_rmtcallres * rpcbproc_indirect_4_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
#define RPCBPROC_GETADDRLIST ((u_int32_t)11)
|
||||
extern "C" rpcb_entry_list_ptr * rpcbproc_getaddrlist_4(rpcb *, CLIENT *);
|
||||
extern "C" rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_GETSTAT ((u_int32_t)12)
|
||||
extern "C" rpcb_stat * rpcbproc_getstat_4(void *, CLIENT *);
|
||||
extern "C" rpcb_stat * rpcbproc_getstat_4_svc(void *, struct svc_req *);
|
||||
|
||||
#elif __STDC__
|
||||
extern bool_t * rpcbproc_set_4(rpcb *, CLIENT *);
|
||||
extern bool_t * rpcbproc_set_4_svc(rpcb *, struct svc_req *);
|
||||
extern bool_t * rpcbproc_unset_4(rpcb *, CLIENT *);
|
||||
extern bool_t * rpcbproc_unset_4_svc(rpcb *, struct svc_req *);
|
||||
extern char ** rpcbproc_getaddr_4(rpcb *, CLIENT *);
|
||||
extern char ** rpcbproc_getaddr_4_svc(rpcb *, struct svc_req *);
|
||||
extern rpcblist_ptr * rpcbproc_dump_4(void *, CLIENT *);
|
||||
extern rpcblist_ptr * rpcbproc_dump_4_svc(void *, struct svc_req *);
|
||||
#define RPCBPROC_BCAST ((u_int32_t)RPCBPROC_CALLIT)
|
||||
extern rpcb_rmtcallres * rpcbproc_bcast_4(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern rpcb_rmtcallres * rpcbproc_bcast_4_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
extern u_int * rpcbproc_gettime_4(void *, CLIENT *);
|
||||
extern u_int * rpcbproc_gettime_4_svc(void *, struct svc_req *);
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_4(char **, CLIENT *);
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_4_svc(char **, struct svc_req *);
|
||||
extern char ** rpcbproc_taddr2uaddr_4(struct netbuf *, CLIENT *);
|
||||
extern char ** rpcbproc_taddr2uaddr_4_svc(struct netbuf *, struct svc_req *);
|
||||
#define RPCBPROC_GETVERSADDR ((u_int32_t)9)
|
||||
extern char ** rpcbproc_getversaddr_4(rpcb *, CLIENT *);
|
||||
extern char ** rpcbproc_getversaddr_4_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_INDIRECT ((u_int32_t)10)
|
||||
extern rpcb_rmtcallres * rpcbproc_indirect_4(rpcb_rmtcallargs *, CLIENT *);
|
||||
extern rpcb_rmtcallres * rpcbproc_indirect_4_svc(rpcb_rmtcallargs *, struct svc_req *);
|
||||
#define RPCBPROC_GETADDRLIST ((u_int32_t)11)
|
||||
extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4(rpcb *, CLIENT *);
|
||||
extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc(rpcb *, struct svc_req *);
|
||||
#define RPCBPROC_GETSTAT ((u_int32_t)12)
|
||||
extern rpcb_stat * rpcbproc_getstat_4(void *, CLIENT *);
|
||||
extern rpcb_stat * rpcbproc_getstat_4_svc(void *, struct svc_req *);
|
||||
|
||||
#else /* Old Style C */
|
||||
extern bool_t * rpcbproc_set_4();
|
||||
extern bool_t * rpcbproc_set_4_svc();
|
||||
extern bool_t * rpcbproc_unset_4();
|
||||
extern bool_t * rpcbproc_unset_4_svc();
|
||||
extern char ** rpcbproc_getaddr_4();
|
||||
extern char ** rpcbproc_getaddr_4_svc();
|
||||
extern rpcblist_ptr * rpcbproc_dump_4();
|
||||
extern rpcblist_ptr * rpcbproc_dump_4_svc();
|
||||
#define RPCBPROC_BCAST ((u_int32_t)RPCBPROC_CALLIT)
|
||||
extern rpcb_rmtcallres * rpcbproc_bcast_4();
|
||||
extern rpcb_rmtcallres * rpcbproc_bcast_4_svc();
|
||||
extern u_int * rpcbproc_gettime_4();
|
||||
extern u_int * rpcbproc_gettime_4_svc();
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_4();
|
||||
extern struct netbuf * rpcbproc_uaddr2taddr_4_svc();
|
||||
extern char ** rpcbproc_taddr2uaddr_4();
|
||||
extern char ** rpcbproc_taddr2uaddr_4_svc();
|
||||
#define RPCBPROC_GETVERSADDR ((u_int32_t)9)
|
||||
extern char ** rpcbproc_getversaddr_4();
|
||||
extern char ** rpcbproc_getversaddr_4_svc();
|
||||
#define RPCBPROC_INDIRECT ((u_int32_t)10)
|
||||
extern rpcb_rmtcallres * rpcbproc_indirect_4();
|
||||
extern rpcb_rmtcallres * rpcbproc_indirect_4_svc();
|
||||
#define RPCBPROC_GETADDRLIST ((u_int32_t)11)
|
||||
extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4();
|
||||
extern rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc();
|
||||
#define RPCBPROC_GETSTAT ((u_int32_t)12)
|
||||
extern rpcb_stat * rpcbproc_getstat_4();
|
||||
extern rpcb_stat * rpcbproc_getstat_4_svc();
|
||||
#endif /* Old Style C */
|
||||
|
||||
#endif /* !_RPCB_PROT_H_RPCGEN */
|
||||
553
libtirpc/tirpc/rpc/rpcb_prot.x
Normal file
553
libtirpc/tirpc/rpc/rpcb_prot.x
Normal file
|
|
@ -0,0 +1,553 @@
|
|||
%/*
|
||||
% * $FreeBSD: src/include/rpc/rpcb_prot.x,v 1.3 2002/03/13 10:29:06 obrien Exp $
|
||||
% *
|
||||
% * Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
% * All rights reserved.
|
||||
% *
|
||||
% * Redistribution and use in source and binary forms, with or without
|
||||
% * modification, are permitted provided that the following conditions are met:
|
||||
% * - Redistributions of source code must retain the above copyright notice,
|
||||
% * this list of conditions and the following disclaimer.
|
||||
% * - Redistributions in binary form must reproduce the above copyright notice,
|
||||
% * this list of conditions and the following disclaimer in the documentation
|
||||
% * and/or other materials provided with the distribution.
|
||||
% * - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
% * contributors may be used to endorse or promote products derived
|
||||
% * from this software without specific prior written permission.
|
||||
% *
|
||||
% * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
% * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
% * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
% * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
% * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
% * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
% * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
% * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
% * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
% * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
% * POSSIBILITY OF SUCH DAMAGE.
|
||||
% */
|
||||
%/*
|
||||
% * Copyright (c) 1988 by Sun Microsystems, Inc.
|
||||
% */
|
||||
|
||||
%/* from rpcb_prot.x */
|
||||
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */
|
||||
%
|
||||
%#ifndef _KERNEL
|
||||
%
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rpcb_prot.x
|
||||
* rpcbind protocol, versions 3 and 4, in RPC Language
|
||||
*/
|
||||
%
|
||||
%/*
|
||||
% * The following procedures are supported by the protocol in version 3:
|
||||
% *
|
||||
% * RPCBPROC_NULL() returns ()
|
||||
% * takes nothing, returns nothing
|
||||
% *
|
||||
% * RPCBPROC_SET(rpcb) returns (bool_t)
|
||||
% * TRUE is success, FALSE is failure. Registers the tuple
|
||||
% * [prog, vers, address, owner, netid].
|
||||
% * Finds out owner and netid information on its own.
|
||||
% *
|
||||
% * RPCBPROC_UNSET(rpcb) returns (bool_t)
|
||||
% * TRUE is success, FALSE is failure. Un-registers tuple
|
||||
% * [prog, vers, netid]. addresses is ignored.
|
||||
% * If netid is NULL, unregister all.
|
||||
% *
|
||||
% * RPCBPROC_GETADDR(rpcb) returns (string).
|
||||
% * 0 is failure. Otherwise returns the universal address where the
|
||||
% * triple [prog, vers, netid] is registered. Ignore address and owner.
|
||||
% *
|
||||
% * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
|
||||
% * used to dump the entire rpcbind maps
|
||||
% *
|
||||
% * RPCBPROC_CALLIT(rpcb_rmtcallargs)
|
||||
% * RETURNS (rpcb_rmtcallres);
|
||||
% * Calls the procedure on the remote machine. If it is not registered,
|
||||
% * this procedure is quiet; i.e. it does not return error information!!!
|
||||
% * This routine only passes null authentication parameters.
|
||||
% * It has no interface to xdr routines for RPCBPROC_CALLIT.
|
||||
% *
|
||||
% * RPCBPROC_GETTIME() returns (int).
|
||||
% * Gets the remote machines time
|
||||
% *
|
||||
% * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
|
||||
% * Returns the netbuf address from universal address.
|
||||
% *
|
||||
% * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
|
||||
% * Returns the universal address from netbuf address.
|
||||
% *
|
||||
% * END OF RPCBIND VERSION 3 PROCEDURES
|
||||
% */
|
||||
%/*
|
||||
% * Except for RPCBPROC_CALLIT, the procedures above are carried over to
|
||||
% * rpcbind version 4. Those below are added or modified for version 4.
|
||||
% * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
|
||||
% * AS RPCBPROC_CALLIT.
|
||||
% *
|
||||
% * RPCBPROC_BCAST(rpcb_rmtcallargs)
|
||||
% * RETURNS (rpcb_rmtcallres);
|
||||
% * Calls the procedure on the remote machine. If it is not registered,
|
||||
% * this procedure IS quiet; i.e. it DOES NOT return error information!!!
|
||||
% * This routine should be used for broadcasting and nothing else.
|
||||
% *
|
||||
% * RPCBPROC_GETVERSADDR(rpcb) returns (string).
|
||||
% * 0 is failure. Otherwise returns the universal address where the
|
||||
% * triple [prog, vers, netid] is registered. Ignore address and owner.
|
||||
% * Same as RPCBPROC_GETADDR except that if the given version number
|
||||
% * is not available, the address is not returned.
|
||||
% *
|
||||
% * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
|
||||
% * RETURNS (rpcb_rmtcallres);
|
||||
% * Calls the procedure on the remote machine. If it is not registered,
|
||||
% * this procedure is NOT quiet; i.e. it DOES return error information!!!
|
||||
% * as any normal application would expect.
|
||||
% *
|
||||
% * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
|
||||
% * Same as RPCBPROC_GETADDR except that it returns a list of all the
|
||||
% * addresses registered for the combination (prog, vers) (for all
|
||||
% * transports).
|
||||
% *
|
||||
% * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
|
||||
% * Returns the statistics about the kind of requests received by rpcbind.
|
||||
% */
|
||||
%
|
||||
%/*
|
||||
% * A mapping of (program, version, network ID) to address
|
||||
% */
|
||||
struct rpcb {
|
||||
rpcprog_t r_prog; /* program number */
|
||||
rpcvers_t r_vers; /* version number */
|
||||
string r_netid<>; /* network id */
|
||||
string r_addr<>; /* universal address */
|
||||
string r_owner<>; /* owner of this service */
|
||||
};
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%typedef rpcb RPCB;
|
||||
%
|
||||
#endif
|
||||
%
|
||||
%/*
|
||||
% * A list of mappings
|
||||
% *
|
||||
% * Below are two definitions for the rpcblist structure. This is done because
|
||||
% * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
|
||||
% * struct rpcblist * that rpcgen would produce. One version of the rpcblist
|
||||
% * structure (actually called rp__list) is used with rpcgen, and the other is
|
||||
% * defined only in the header file for compatibility with the specified
|
||||
% * interface.
|
||||
% */
|
||||
|
||||
struct rp__list {
|
||||
rpcb rpcb_map;
|
||||
struct rp__list *rpcb_next;
|
||||
};
|
||||
|
||||
typedef rp__list *rpcblist_ptr; /* results of RPCBPROC_DUMP */
|
||||
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%typedef struct rp__list rpcblist;
|
||||
%typedef struct rp__list RPCBLIST;
|
||||
%
|
||||
%#ifndef __cplusplus
|
||||
%struct rpcblist {
|
||||
% RPCB rpcb_map;
|
||||
% struct rpcblist *rpcb_next;
|
||||
%};
|
||||
%#endif
|
||||
%
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" {
|
||||
%#endif
|
||||
%extern bool_t xdr_rpcblist(XDR *, rpcblist**);
|
||||
%#ifdef __cplusplus
|
||||
%}
|
||||
%#endif
|
||||
%
|
||||
#endif
|
||||
|
||||
%
|
||||
%/*
|
||||
% * Arguments of remote calls
|
||||
% */
|
||||
struct rpcb_rmtcallargs {
|
||||
rpcprog_t prog; /* program number */
|
||||
rpcvers_t vers; /* version number */
|
||||
rpcproc_t proc; /* procedure number */
|
||||
opaque args<>; /* argument */
|
||||
};
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%/*
|
||||
% * Client-side only representation of rpcb_rmtcallargs structure.
|
||||
% *
|
||||
% * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
|
||||
% * opaque arguments in the "args" structure. xdr_rpcb_rmtcallargs() needs to
|
||||
% * be passed the XDR routine that knows the args' structure. This routine
|
||||
% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
|
||||
% * the application being called already knows the args structure. So we use a
|
||||
% * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
|
||||
% * includes the args' XDR routine.
|
||||
% */
|
||||
%struct r_rpcb_rmtcallargs {
|
||||
% rpcprog_t prog;
|
||||
% rpcvers_t vers;
|
||||
% rpcproc_t proc;
|
||||
% struct {
|
||||
% u_int args_len;
|
||||
% char *args_val;
|
||||
% } args;
|
||||
% xdrproc_t xdr_args; /* encodes args */
|
||||
%};
|
||||
%
|
||||
#endif /* def RPC_HDR */
|
||||
%
|
||||
%/*
|
||||
% * Results of the remote call
|
||||
% */
|
||||
struct rpcb_rmtcallres {
|
||||
string addr<>; /* remote universal address */
|
||||
opaque results<>; /* result */
|
||||
};
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%/*
|
||||
% * Client-side only representation of rpcb_rmtcallres structure.
|
||||
% */
|
||||
%struct r_rpcb_rmtcallres {
|
||||
% char *addr;
|
||||
% struct {
|
||||
% u_int32_t results_len;
|
||||
% char *results_val;
|
||||
% } results;
|
||||
% xdrproc_t xdr_res; /* decodes results */
|
||||
%};
|
||||
#endif /* RPC_HDR */
|
||||
%
|
||||
%/*
|
||||
% * rpcb_entry contains a merged address of a service on a particular
|
||||
% * transport, plus associated netconfig information. A list of rpcb_entrys
|
||||
% * is returned by RPCBPROC_GETADDRLIST. See netconfig.h for values used
|
||||
% * in r_nc_* fields.
|
||||
% */
|
||||
struct rpcb_entry {
|
||||
string r_maddr<>; /* merged address of service */
|
||||
string r_nc_netid<>; /* netid field */
|
||||
unsigned int r_nc_semantics; /* semantics of transport */
|
||||
string r_nc_protofmly<>; /* protocol family */
|
||||
string r_nc_proto<>; /* protocol name */
|
||||
};
|
||||
%
|
||||
%/*
|
||||
% * A list of addresses supported by a service.
|
||||
% */
|
||||
struct rpcb_entry_list {
|
||||
rpcb_entry rpcb_entry_map;
|
||||
struct rpcb_entry_list *rpcb_entry_next;
|
||||
};
|
||||
|
||||
typedef rpcb_entry_list *rpcb_entry_list_ptr;
|
||||
|
||||
%
|
||||
%/*
|
||||
% * rpcbind statistics
|
||||
% */
|
||||
%
|
||||
const rpcb_highproc_2 = RPCBPROC_CALLIT;
|
||||
const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
|
||||
const rpcb_highproc_4 = RPCBPROC_GETSTAT;
|
||||
|
||||
const RPCBSTAT_HIGHPROC = 13; /* # of procs in rpcbind V4 plus one */
|
||||
const RPCBVERS_STAT = 3; /* provide only for rpcbind V2, V3 and V4 */
|
||||
const RPCBVERS_4_STAT = 2;
|
||||
const RPCBVERS_3_STAT = 1;
|
||||
const RPCBVERS_2_STAT = 0;
|
||||
%
|
||||
%/* Link list of all the stats about getport and getaddr */
|
||||
struct rpcbs_addrlist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
int success;
|
||||
int failure;
|
||||
string netid<>;
|
||||
struct rpcbs_addrlist *next;
|
||||
};
|
||||
%
|
||||
%/* Link list of all the stats about rmtcall */
|
||||
struct rpcbs_rmtcalllist {
|
||||
rpcprog_t prog;
|
||||
rpcvers_t vers;
|
||||
rpcproc_t proc;
|
||||
int success;
|
||||
int failure;
|
||||
int indirect; /* whether callit or indirect */
|
||||
string netid<>;
|
||||
struct rpcbs_rmtcalllist *next;
|
||||
};
|
||||
|
||||
typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
|
||||
typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
|
||||
typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
|
||||
|
||||
struct rpcb_stat {
|
||||
rpcbs_proc info;
|
||||
int setinfo;
|
||||
int unsetinfo;
|
||||
rpcbs_addrlist_ptr addrinfo;
|
||||
rpcbs_rmtcalllist_ptr rmtinfo;
|
||||
};
|
||||
%
|
||||
%/*
|
||||
% * One rpcb_stat structure is returned for each version of rpcbind
|
||||
% * being monitored.
|
||||
% */
|
||||
|
||||
typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
|
||||
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%/*
|
||||
% * We don't define netbuf in RPCL, since it would contain structure member
|
||||
% * names that would conflict with the definition of struct netbuf in
|
||||
% * <tiuser.h>. Instead we merely declare the XDR routine xdr_netbuf() here,
|
||||
% * and implement it ourselves in rpc/rpcb_prot.c.
|
||||
% */
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
%
|
||||
%#else /* __STDC__ */
|
||||
%extern bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
%
|
||||
%#endif
|
||||
#endif /* def RPC_HDR */
|
||||
|
||||
/*
|
||||
* rpcbind procedures
|
||||
*/
|
||||
program RPCBPROG {
|
||||
version RPCBVERS {
|
||||
bool
|
||||
RPCBPROC_SET(rpcb) = 1;
|
||||
|
||||
bool
|
||||
RPCBPROC_UNSET(rpcb) = 2;
|
||||
|
||||
string
|
||||
RPCBPROC_GETADDR(rpcb) = 3;
|
||||
|
||||
rpcblist_ptr
|
||||
RPCBPROC_DUMP(void) = 4;
|
||||
|
||||
rpcb_rmtcallres
|
||||
RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
|
||||
|
||||
unsigned int
|
||||
RPCBPROC_GETTIME(void) = 6;
|
||||
|
||||
struct netbuf
|
||||
RPCBPROC_UADDR2TADDR(string) = 7;
|
||||
|
||||
string
|
||||
RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
|
||||
} = 3;
|
||||
|
||||
version RPCBVERS4 {
|
||||
bool
|
||||
RPCBPROC_SET(rpcb) = 1;
|
||||
|
||||
bool
|
||||
RPCBPROC_UNSET(rpcb) = 2;
|
||||
|
||||
string
|
||||
RPCBPROC_GETADDR(rpcb) = 3;
|
||||
|
||||
rpcblist_ptr
|
||||
RPCBPROC_DUMP(void) = 4;
|
||||
|
||||
/*
|
||||
* NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
|
||||
* the new name is intended to indicate that this
|
||||
* procedure should be used for broadcast RPC, and
|
||||
* RPCBPROC_INDIRECT should be used for indirect calls.
|
||||
*/
|
||||
rpcb_rmtcallres
|
||||
RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
|
||||
|
||||
unsigned int
|
||||
RPCBPROC_GETTIME(void) = 6;
|
||||
|
||||
struct netbuf
|
||||
RPCBPROC_UADDR2TADDR(string) = 7;
|
||||
|
||||
string
|
||||
RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
|
||||
|
||||
string
|
||||
RPCBPROC_GETVERSADDR(rpcb) = 9;
|
||||
|
||||
rpcb_rmtcallres
|
||||
RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
|
||||
|
||||
rpcb_entry_list_ptr
|
||||
RPCBPROC_GETADDRLIST(rpcb) = 11;
|
||||
|
||||
rpcb_stat_byvers
|
||||
RPCBPROC_GETSTAT(void) = 12;
|
||||
} = 4;
|
||||
} = 100000;
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
%#define RPCBVERS_3 RPCBVERS
|
||||
%#define RPCBVERS_4 RPCBVERS4
|
||||
%
|
||||
%#define _PATH_RPCBINDSOCK "/var/run/rpcbind.sock"
|
||||
%
|
||||
%#else /* ndef _KERNEL */
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" {
|
||||
%#endif
|
||||
%
|
||||
%/*
|
||||
% * A mapping of (program, version, network ID) to address
|
||||
% */
|
||||
%struct rpcb {
|
||||
% rpcprog_t r_prog; /* program number */
|
||||
% rpcvers_t r_vers; /* version number */
|
||||
% char *r_netid; /* network id */
|
||||
% char *r_addr; /* universal address */
|
||||
% char *r_owner; /* owner of the mapping */
|
||||
%};
|
||||
%typedef struct rpcb RPCB;
|
||||
%
|
||||
%/*
|
||||
% * A list of mappings
|
||||
% */
|
||||
%struct rpcblist {
|
||||
% RPCB rpcb_map;
|
||||
% struct rpcblist *rpcb_next;
|
||||
%};
|
||||
%typedef struct rpcblist RPCBLIST;
|
||||
%typedef struct rpcblist *rpcblist_ptr;
|
||||
%
|
||||
%/*
|
||||
% * Remote calls arguments
|
||||
% */
|
||||
%struct rpcb_rmtcallargs {
|
||||
% rpcprog_t prog; /* program number */
|
||||
% rpcvers_t vers; /* version number */
|
||||
% rpcproc_t proc; /* procedure number */
|
||||
% u_int32_t arglen; /* arg len */
|
||||
% caddr_t args_ptr; /* argument */
|
||||
% xdrproc_t xdr_args; /* XDR routine for argument */
|
||||
%};
|
||||
%typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
|
||||
%
|
||||
%/*
|
||||
% * Remote calls results
|
||||
% */
|
||||
%struct rpcb_rmtcallres {
|
||||
% char *addr_ptr; /* remote universal address */
|
||||
% u_int32_t resultslen; /* results length */
|
||||
% caddr_t results_ptr; /* results */
|
||||
% xdrproc_t xdr_results; /* XDR routine for result */
|
||||
%};
|
||||
%typedef struct rpcb_rmtcallres rpcb_rmtcallres;
|
||||
%
|
||||
%struct rpcb_entry {
|
||||
% char *r_maddr;
|
||||
% char *r_nc_netid;
|
||||
% unsigned int r_nc_semantics;
|
||||
% char *r_nc_protofmly;
|
||||
% char *r_nc_proto;
|
||||
%};
|
||||
%typedef struct rpcb_entry rpcb_entry;
|
||||
%
|
||||
%/*
|
||||
% * A list of addresses supported by a service.
|
||||
% */
|
||||
%
|
||||
%struct rpcb_entry_list {
|
||||
% rpcb_entry rpcb_entry_map;
|
||||
% struct rpcb_entry_list *rpcb_entry_next;
|
||||
%};
|
||||
%typedef struct rpcb_entry_list rpcb_entry_list;
|
||||
%
|
||||
%typedef rpcb_entry_list *rpcb_entry_list_ptr;
|
||||
%
|
||||
%/*
|
||||
% * rpcbind statistics
|
||||
% */
|
||||
%
|
||||
%#define rpcb_highproc_2 RPCBPROC_CALLIT
|
||||
%#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR
|
||||
%#define rpcb_highproc_4 RPCBPROC_GETSTAT
|
||||
%#define RPCBSTAT_HIGHPROC 13
|
||||
%#define RPCBVERS_STAT 3
|
||||
%#define RPCBVERS_4_STAT 2
|
||||
%#define RPCBVERS_3_STAT 1
|
||||
%#define RPCBVERS_2_STAT 0
|
||||
%
|
||||
%/* Link list of all the stats about getport and getaddr */
|
||||
%
|
||||
%struct rpcbs_addrlist {
|
||||
% rpcprog_t prog;
|
||||
% rpcvers_t vers;
|
||||
% int success;
|
||||
% int failure;
|
||||
% char *netid;
|
||||
% struct rpcbs_addrlist *next;
|
||||
%};
|
||||
%typedef struct rpcbs_addrlist rpcbs_addrlist;
|
||||
%
|
||||
%/* Link list of all the stats about rmtcall */
|
||||
%
|
||||
%struct rpcbs_rmtcalllist {
|
||||
% rpcprog_t prog;
|
||||
% rpcvers_t vers;
|
||||
% rpcproc_t proc;
|
||||
% int success;
|
||||
% int failure;
|
||||
% int indirect;
|
||||
% char *netid;
|
||||
% struct rpcbs_rmtcalllist *next;
|
||||
%};
|
||||
%typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
|
||||
%
|
||||
%typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
|
||||
%
|
||||
%typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
|
||||
%
|
||||
%typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
|
||||
%
|
||||
%struct rpcb_stat {
|
||||
% rpcbs_proc info;
|
||||
% int setinfo;
|
||||
% int unsetinfo;
|
||||
% rpcbs_addrlist_ptr addrinfo;
|
||||
% rpcbs_rmtcalllist_ptr rmtinfo;
|
||||
%};
|
||||
%typedef struct rpcb_stat rpcb_stat;
|
||||
%
|
||||
%/*
|
||||
% * One rpcb_stat structure is returned for each version of rpcbind
|
||||
% * being monitored.
|
||||
% */
|
||||
%
|
||||
%typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
|
||||
%
|
||||
%#ifdef __cplusplus
|
||||
%}
|
||||
%#endif
|
||||
%
|
||||
%#endif /* ndef _KERNEL */
|
||||
#endif /* RPC_HDR */
|
||||
68
libtirpc/tirpc/rpc/rpcent.h
Normal file
68
libtirpc/tirpc/rpc/rpcent.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: rpcent.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/rpcent.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpcent.h,
|
||||
* For converting rpc program numbers to names etc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RPC_RPCENT_H
|
||||
#define _RPC_RPCENT_H
|
||||
|
||||
/* #pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI" */
|
||||
/* @(#)rpcent.h 1.1 88/12/06 SMI */
|
||||
|
||||
|
||||
struct rpcent {
|
||||
char *r_name; /* name of server for this rpc program */
|
||||
char **r_aliases; /* alias list */
|
||||
int r_number; /* rpc program number */
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
//extern struct rpcent *getrpcbyname_r(const char *, struct rpcent *,
|
||||
// char *, int);
|
||||
//extern struct rpcent *getrpcbynumber_r(int, struct rpcent *, char *, int);
|
||||
//extern struct rpcent *getrpcent_r(struct rpcent *, char *, int);
|
||||
|
||||
/* Old interfaces that return a pointer to a static area; MT-unsafe */
|
||||
//extern struct rpcent *getrpcbyname(char *);
|
||||
//extern struct rpcent *getrpcbynumber(int);
|
||||
//extern struct rpcent *getrpcent(void);
|
||||
extern void setrpcent(int) __THROW;
|
||||
extern void endrpcent(void) __THROW;
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_CENT_H */
|
||||
438
libtirpc/tirpc/rpc/svc.h
Normal file
438
libtirpc/tirpc/rpc/svc.h
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
/* $NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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 _TIRPC_SVC_H
|
||||
#define _TIRPC_SVC_H
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Service control requests
|
||||
*/
|
||||
#define SVCGET_VERSQUIET 1
|
||||
#define SVCSET_VERSQUIET 2
|
||||
#define SVCGET_CONNMAXREC 3
|
||||
#define SVCSET_CONNMAXREC 4
|
||||
|
||||
/*
|
||||
* Operations for rpc_control().
|
||||
*/
|
||||
#define RPC_SVC_CONNMAXREC_SET 0 /* set max rec size, enable nonblock */
|
||||
#define RPC_SVC_CONNMAXREC_GET 1
|
||||
|
||||
enum xprt_stat {
|
||||
XPRT_DIED,
|
||||
XPRT_MOREREQS,
|
||||
XPRT_IDLE
|
||||
};
|
||||
|
||||
/*
|
||||
* Server side transport handle
|
||||
*/
|
||||
typedef struct __rpc_svcxprt {
|
||||
SOCKET xp_fd;
|
||||
u_short xp_port; /* associated port number */
|
||||
const 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,
|
||||
void *);
|
||||
/* 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,
|
||||
void *);
|
||||
/* destroy this struct */
|
||||
void (*xp_destroy)(struct __rpc_svcxprt *);
|
||||
} *xp_ops;
|
||||
int xp_addrlen; /* length of remote address */
|
||||
struct sockaddr_in6 xp_raddr; /* remote addr. (backward ABI compat) */
|
||||
/* XXX - fvdl stick this here for ABI backward compat reasons */
|
||||
const struct xp_ops2 {
|
||||
/* catch-all function */
|
||||
bool_t (*xp_control)(struct __rpc_svcxprt *, const u_int,
|
||||
void *);
|
||||
} *xp_ops2;
|
||||
char *xp_tp; /* transport provider device name */
|
||||
char *xp_netid; /* network token */
|
||||
struct netbuf xp_ltaddr; /* local transport address */
|
||||
struct netbuf xp_rtaddr; /* remote transport address */
|
||||
struct opaque_auth xp_verf; /* raw response verifier */
|
||||
SVCAUTH *xp_auth; /* auth handle of current req */
|
||||
void *xp_p1; /* private: for use by svc ops */
|
||||
void *xp_p2; /* private: for use by svc ops */
|
||||
void *xp_p3; /* private: for use by svc lib */
|
||||
int xp_type; /* transport type */
|
||||
} SVCXPRT;
|
||||
|
||||
/*
|
||||
* Service request
|
||||
*/
|
||||
struct svc_req {
|
||||
/* ORDER: compatibility with legacy RPC */
|
||||
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 */
|
||||
void *rq_clntcred; /* read only cooked cred */
|
||||
SVCXPRT *rq_xprt; /* associated transport */
|
||||
|
||||
/* New with TI-RPC */
|
||||
caddr_t rq_clntname; /* read only client name */
|
||||
caddr_t rq_svcname; /* read only cooked service cred */
|
||||
};
|
||||
|
||||
/*
|
||||
* Approved way of getting address of caller
|
||||
*/
|
||||
#define svc_getrpccaller(x) (&(x)->xp_rtaddr)
|
||||
|
||||
/*
|
||||
* Operations defined on an SVCXPRT handle
|
||||
*
|
||||
* SVCXPRT *xprt;
|
||||
* struct rpc_msg *msg;
|
||||
* xdrproc_t xargs;
|
||||
* void * 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)
|
||||
|
||||
#define SVC_CONTROL(xprt, rq, in) \
|
||||
(*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in))
|
||||
|
||||
/*
|
||||
* Service registration
|
||||
*
|
||||
* svc_reg(xprt, prog, vers, dispatch, nconf)
|
||||
* const SVCXPRT *xprt;
|
||||
* const rpcprog_t prog;
|
||||
* const rpcvers_t vers;
|
||||
* const void (*dispatch)();
|
||||
* const struct netconfig *nconf;
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern bool_t svc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t,
|
||||
void (*)(struct svc_req *, SVCXPRT *),
|
||||
const struct netconfig *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Service un-registration
|
||||
*
|
||||
* svc_unreg(prog, vers)
|
||||
* const rpcprog_t prog;
|
||||
* const rpcvers_t vers;
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void svc_unreg(const rpcprog_t, const rpcvers_t);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* 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 *);
|
||||
extern int rpc_reg(rpcprog_t, rpcvers_t, rpcproc_t,
|
||||
char *(*)(char *), xdrproc_t, xdrproc_t,
|
||||
char *);
|
||||
__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;
|
||||
#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.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void rpctest_service(void);
|
||||
__END_DECLS
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern void svc_getreq(int);
|
||||
extern void svc_getreqset(fd_set *);
|
||||
extern void svc_getreq_common(SOCKET);
|
||||
struct pollfd;
|
||||
extern void svc_getreq_poll(struct pollfd *, int);
|
||||
|
||||
extern void svc_run(void);
|
||||
extern void svc_exit(void);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Socket to use on svcxxx_create call to get default socket
|
||||
*/
|
||||
#define RPC_ANYSOCK INVALID_SOCKET /* -1 */
|
||||
#define RPC_ANYFD RPC_ANYSOCK
|
||||
|
||||
/*
|
||||
* These are the existing service side transport implementations
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Transport independent svc_create routine.
|
||||
*/
|
||||
extern int svc_create(void (*)(struct svc_req *, SVCXPRT *),
|
||||
const rpcprog_t, const rpcvers_t, const char *);
|
||||
/*
|
||||
* void (*dispatch)(); -- dispatch routine
|
||||
* const rpcprog_t prognum; -- program number
|
||||
* const rpcvers_t versnum; -- version number
|
||||
* const char *nettype; -- network type
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Generic server creation routine. It takes a netconfig structure
|
||||
* instead of a nettype.
|
||||
*/
|
||||
|
||||
extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *),
|
||||
const rpcprog_t, const rpcvers_t,
|
||||
const struct netconfig *);
|
||||
/*
|
||||
* void (*dispatch)(); -- dispatch routine
|
||||
* const rpcprog_t prognum; -- program number
|
||||
* const rpcvers_t versnum; -- version number
|
||||
* const struct netconfig *nconf; -- netconfig structure
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Generic TLI create routine
|
||||
*/
|
||||
extern SVCXPRT *svc_tli_create(const SOCKET, const struct netconfig *,
|
||||
const struct t_bind *, const u_int,
|
||||
const u_int);
|
||||
/*
|
||||
* const SOCKET fd; -- connection end point
|
||||
* const struct netconfig *nconf; -- netconfig structure for network
|
||||
* const struct t_bind *bindaddr; -- local bind address
|
||||
* const u_int sendsz; -- max sendsize
|
||||
* const u_int recvsz; -- max recvsize
|
||||
*/
|
||||
|
||||
/*
|
||||
* Connectionless and connectionful create routines
|
||||
*/
|
||||
|
||||
extern SVCXPRT *svc_vc_create(const SOCKET, const u_int, const u_int);
|
||||
/*
|
||||
* const SOCKET 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 *);
|
||||
|
||||
extern SVCXPRT *svc_dg_create(const SOCKET, const u_int, const u_int);
|
||||
/*
|
||||
* const SOCKET fd; -- open connection
|
||||
* const u_int sendsize; -- max send size
|
||||
* const u_int recvsize; -- max recv size
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* the routine takes any *open* connection
|
||||
* descriptor as its first input and is used for open connections.
|
||||
*/
|
||||
extern SVCXPRT *svc_fd_create(const SOCKET, const u_int, const u_int);
|
||||
/*
|
||||
* const SOCKET 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_fd_create().
|
||||
*/
|
||||
extern SVCXPRT *svcunixfd_create(int, u_int, u_int);
|
||||
|
||||
/*
|
||||
* Memory based rpc (for speed check and testing)
|
||||
*/
|
||||
extern SVCXPRT *svc_raw_create(void);
|
||||
|
||||
/*
|
||||
* svc_dg_enable_cache() enables the cache on dg transports.
|
||||
*/
|
||||
int svc_dg_enablecache(SVCXPRT *, const u_int);
|
||||
|
||||
int __rpc_get_local_uid(SVCXPRT *_transp, uid_t *_uid);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/* for backward compatibility */
|
||||
#include <rpc/svc_soc.h>
|
||||
|
||||
|
||||
|
||||
#endif /* !_TIRPC_SVC_H */
|
||||
69
libtirpc/tirpc/rpc/svc_auth.h
Normal file
69
libtirpc/tirpc/rpc/svc_auth.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)svc_auth.h 1.6 86/07/16 SMI
|
||||
* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/svc_auth.h,v 1.14 2002/03/23 17:24:55 imp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* svc_auth.h, Service side of rpc authentication.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_SVC_AUTH_H
|
||||
#define _RPC_SVC_AUTH_H
|
||||
|
||||
/*
|
||||
* Interface to server-side authentication flavors.
|
||||
*/
|
||||
typedef struct __svcauth {
|
||||
struct svc_auth_ops {
|
||||
int (*svc_ah_wrap)(struct __svcauth *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr);
|
||||
int (*svc_ah_unwrap)(struct __svcauth *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr);
|
||||
int (*svc_ah_destroy)(struct __svcauth *auth);
|
||||
} *svc_ah_ops;
|
||||
caddr_t svc_ah_private;
|
||||
} SVCAUTH;
|
||||
|
||||
#define SVCAUTH_DESTROY(cred) ((*(cred)->svc_ah_ops->svc_ah_destroy)())
|
||||
#define svcauth_destroy(cred) ((*(cred)->svc_ah_ops->svc_ah_destroy)())
|
||||
|
||||
/*
|
||||
* Server side authenticator
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *);
|
||||
extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *,
|
||||
struct rpc_msg *));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_SVC_AUTH_H */
|
||||
50
libtirpc/tirpc/rpc/svc_dg.h
Normal file
50
libtirpc/tirpc/rpc/svc_dg.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: svc_dg.h,v 1.1 2000/06/02 23:11:16 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/svc_dg.h,v 1.1 2001/03/19 12:49:47 alfred Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* XXX - this file exists only so that the rpcbind code can pull it in.
|
||||
* This should go away. It should only be include by svc_dg.c and
|
||||
* rpcb_svc_com.c in the rpcbind code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* kept in xprt->xp_p2
|
||||
*/
|
||||
struct svc_dg_data {
|
||||
/* XXX: optbuf should be the first field, used by ti_opts.c code */
|
||||
size_t su_iosz; /* size of send.recv buffer */
|
||||
u_int32_t su_xid; /* transaction id */
|
||||
XDR su_xdrs; /* XDR handle */
|
||||
char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */
|
||||
void *su_cache; /* cached data, NULL if none */
|
||||
};
|
||||
|
||||
#define __rpcb_get_dg_xidp(x) (&((struct svc_dg_data *)(x)->xp_p2)->su_xid)
|
||||
119
libtirpc/tirpc/rpc/svc_soc.h
Normal file
119
libtirpc/tirpc/rpc/svc_soc.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/* $NetBSD: svc_soc.h,v 1.1 2000/06/02 22:57:57 fvdl Exp $ */
|
||||
/* $FreeBSD: src/include/rpc/svc_soc.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* svc.h, Server-side remote procedure call interface.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_SVC_SOC_H
|
||||
#define _RPC_SVC_SOC_H
|
||||
//#include <sys/cdefs.h>
|
||||
|
||||
/* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */
|
||||
/* svc_soc.h 1.8 89/05/01 SMI */
|
||||
|
||||
/*
|
||||
* All the following declarations are only for backward compatibility
|
||||
* with TS-RPC
|
||||
*/
|
||||
|
||||
/*
|
||||
* Approved way of getting address of caller
|
||||
*/
|
||||
#define svc_getcaller(x) (&(x)->xp_raddr)
|
||||
/* Getting address of a caller using netbuf xp_rtaddr */
|
||||
#define svc_getcaller_netbuf(x) (&(x)->xp_rtaddr)
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern bool_t svc_register(SVCXPRT *, u_long, u_long,
|
||||
void (*)(struct svc_req *, SVCXPRT *), int);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Service un-registration
|
||||
*
|
||||
* svc_unregister(prog, vers)
|
||||
* u_long prog;
|
||||
* u_long vers;
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern void svc_unregister(u_long, u_long);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* Memory based rpc for testing and timing.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern SVCXPRT *svcraw_create(void);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* Udp based rpc.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern SVCXPRT *svcudp_create(int);
|
||||
extern SVCXPRT *svcudp_bufcreate(int, u_int, u_int);
|
||||
extern int svcudp_enablecache(SVCXPRT *, u_long);
|
||||
extern SVCXPRT *svcudp6_create(int);
|
||||
extern SVCXPRT *svcudp6_bufcreate(int, u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/*
|
||||
* Tcp based rpc.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern SVCXPRT *svctcp_create(int, u_int, u_int);
|
||||
extern SVCXPRT *svctcp6_create(int, u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* Fd based rpc.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern SVCXPRT *svcfd_create(int, u_int, u_int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_RPC_SVC_SOC_H */
|
||||
138
libtirpc/tirpc/rpc/types.h
Normal file
138
libtirpc/tirpc/rpc/types.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
/* $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)types.h 1.18 87/07/24 SMI
|
||||
* from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/types.h,v 1.10.6.1 2003/12/18 00:59:50 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Rpc additions to <sys/types.h>
|
||||
*/
|
||||
#ifndef _TIRPC_TYPES_H
|
||||
#define _TIRPC_TYPES_H
|
||||
|
||||
#include <sys/types.h>
|
||||
//#include <sys/_null.h>
|
||||
|
||||
// Windows mappings of data types
|
||||
// Fixed size things
|
||||
typedef INT16 int16_t;
|
||||
typedef INT32 int32_t;
|
||||
typedef INT64 int64_t;
|
||||
typedef UINT16 u_int16_t;
|
||||
typedef UINT32 u_int32_t;
|
||||
typedef UINT32 uint32_t;
|
||||
typedef UINT64 u_int64_t;
|
||||
typedef UINT64 uint64_t;
|
||||
typedef PCHAR caddr_t;
|
||||
// Scalable things
|
||||
typedef UCHAR u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef UINT32 u_int;
|
||||
typedef UINT32 uint;
|
||||
|
||||
typedef INT64 quad_t;
|
||||
typedef UINT64 u_quad_t;
|
||||
|
||||
typedef UINT uid_t;
|
||||
typedef UINT gid_t;
|
||||
typedef DWORD pid_t;
|
||||
|
||||
//typedef SIZE_T size_t; //This is causing a "benign redefinition error"
|
||||
typedef SSIZE_T ssize_t;
|
||||
// End of Windows...
|
||||
|
||||
typedef int32_t bool_t;
|
||||
typedef int32_t enum_t;
|
||||
|
||||
typedef u_int32_t rpcprog_t;
|
||||
typedef u_int32_t rpcvers_t;
|
||||
typedef u_int32_t rpcproc_t;
|
||||
typedef u_int32_t rpcprot_t;
|
||||
typedef u_int32_t rpcport_t;
|
||||
typedef int32_t rpc_inline_t;
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
#define __dontcare__ -1
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE (0)
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
# define TRUE (1)
|
||||
#endif
|
||||
|
||||
#define mem_alloc(bsize) calloc(1, bsize)
|
||||
#define mem_free(ptr, bsize) free(ptr)
|
||||
|
||||
//#include <sys/time.h>
|
||||
//#include <sys/param.h>
|
||||
#include <stdlib.h>
|
||||
#include <netconfig.h>
|
||||
|
||||
/*
|
||||
* The netbuf structure is defined here, because FreeBSD / NetBSD only use
|
||||
* it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing
|
||||
* to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The netbuf structure is used for transport-independent address storage.
|
||||
*/
|
||||
struct netbuf {
|
||||
unsigned int maxlen;
|
||||
unsigned int len;
|
||||
void *buf;
|
||||
};
|
||||
|
||||
/*
|
||||
* The format of the addres and options arguments of the XTI t_bind call.
|
||||
* Only provided for compatibility, it should not be used.
|
||||
*/
|
||||
|
||||
struct t_bind {
|
||||
struct netbuf addr;
|
||||
unsigned int qlen;
|
||||
};
|
||||
|
||||
/*
|
||||
* Internal library and rpcbind use. This is not an exported interface, do
|
||||
* not use.
|
||||
*/
|
||||
struct __rpc_sockinfo {
|
||||
ADDRESS_FAMILY si_af;
|
||||
int si_proto;
|
||||
int si_socktype;
|
||||
int si_alen;
|
||||
};
|
||||
|
||||
#endif /* _TIRPC_TYPES_H */
|
||||
367
libtirpc/tirpc/rpc/xdr.h
Normal file
367
libtirpc/tirpc/rpc/xdr.h
Normal file
|
|
@ -0,0 +1,367 @@
|
|||
/* $NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of Sun Microsystems, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)xdr.h 1.19 87/04/22 SMI
|
||||
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/xdr.h,v 1.23 2003/03/07 13:19:40 nectar Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* xdr.h, External Data Representation Serialization Routines.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_XDR_H
|
||||
#define _TIRPC_XDR_H
|
||||
//#include <sys/cdefs.h>
|
||||
#include <stdio.h>
|
||||
//#include <netinet/in.h>
|
||||
// Rajout pour la définition des types
|
||||
#include <rpc/types.h>
|
||||
|
||||
/*
|
||||
* 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;
|
||||
* <type> *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)
|
||||
|
||||
/*
|
||||
* The XDR handle.
|
||||
* Contains operation which is being applied to the stream,
|
||||
* an operations vector for the particular implementation (e.g. see xdr_mem.c),
|
||||
* and two private fields for the use of the particular implementation.
|
||||
*/
|
||||
typedef struct __rpc_xdr {
|
||||
enum xdr_op x_op; /* operation; fast additional param */
|
||||
const struct xdr_ops {
|
||||
/* get a long from underlying stream */
|
||||
bool_t (*x_getlong)(struct __rpc_xdr *, long *);
|
||||
/* put a long to " */
|
||||
bool_t (*x_putlong)(struct __rpc_xdr *, const long *);
|
||||
/* get some bytes from " */
|
||||
bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int);
|
||||
/* put some bytes to " */
|
||||
bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, u_int);
|
||||
/* returns bytes off from beginning */
|
||||
u_int (*x_getpostn)(struct __rpc_xdr *);
|
||||
/* lets you reposition the stream */
|
||||
bool_t (*x_setpostn)(struct __rpc_xdr *, u_int);
|
||||
/* buf quick ptr to buffered data */
|
||||
int32_t *(*x_inline)(struct __rpc_xdr *, u_int);
|
||||
/* free privates of this xdr_stream */
|
||||
void (*x_destroy)(struct __rpc_xdr *);
|
||||
bool_t (*x_control)(struct __rpc_xdr *, int, void *);
|
||||
} *x_ops;
|
||||
char * x_public; /* users' data */
|
||||
void * x_private; /* pointer to private data */
|
||||
char * x_base; /* private used for position info */
|
||||
u_int x_handy; /* extra private word */
|
||||
} XDR;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifdef _KERNEL
|
||||
typedef bool_t (*xdrproc_t)(XDR *, void *, u_int);
|
||||
#else
|
||||
/*
|
||||
* XXX can't actually prototype it, because some take three args!!!
|
||||
*/
|
||||
typedef bool_t (*xdrproc_t)(XDR *, ...);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Operations defined on a XDR handle
|
||||
*
|
||||
* XDR *xdrs;
|
||||
* long *longp;
|
||||
* char * 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)
|
||||
|
||||
static __inline int
|
||||
xdr_getint32(XDR *xdrs, int32_t *ip)
|
||||
{
|
||||
long l;
|
||||
|
||||
if (!xdr_getlong(xdrs, &l))
|
||||
return (FALSE);
|
||||
*ip = (int32_t)l;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
xdr_putint32(XDR *xdrs, int32_t *ip)
|
||||
{
|
||||
long l;
|
||||
|
||||
l = (long)*ip;
|
||||
return xdr_putlong(xdrs, &l);
|
||||
}
|
||||
|
||||
#define XDR_GETINT32(xdrs, int32p) xdr_getint32(xdrs, int32p)
|
||||
#define XDR_PUTINT32(xdrs, int32p) xdr_putint32(xdrs, int32p)
|
||||
|
||||
#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)
|
||||
|
||||
#define XDR_CONTROL(xdrs, req, op) \
|
||||
if ((xdrs)->x_ops->x_control) \
|
||||
(*(xdrs)->x_ops->x_control)(xdrs, req, op)
|
||||
#define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
|
||||
|
||||
/*
|
||||
* Solaris strips the '_t' from these types -- not sure why.
|
||||
* But, let's be compatible.
|
||||
*/
|
||||
#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
|
||||
#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
|
||||
#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
|
||||
#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
|
||||
#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
|
||||
|
||||
/*
|
||||
* Support struct for discriminated unions.
|
||||
* You create an array of xdrdiscrim structures, terminated with
|
||||
* an 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 primitive 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_INT32(buf) ((int32_t)ntohl((u_int32_t)*(buf)++))
|
||||
#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v))
|
||||
#define IXDR_GET_U_INT32(buf) ((u_int32_t)IXDR_GET_INT32(buf))
|
||||
#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v)))
|
||||
|
||||
#define IXDR_GET_LONG(buf) ((long)ntohl((u_int32_t)*(buf)++))
|
||||
#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)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), (v))
|
||||
#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
|
||||
/*
|
||||
* These are the "generic" xdr routines.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
extern bool_t xdr_void(void);
|
||||
extern bool_t xdr_int(XDR *, int *);
|
||||
extern bool_t xdr_u_int(XDR *, u_int *);
|
||||
extern bool_t xdr_long(XDR *, long *);
|
||||
extern bool_t xdr_u_long(XDR *, u_long *);
|
||||
extern bool_t xdr_short(XDR *, short *);
|
||||
extern bool_t xdr_u_short(XDR *, u_short *);
|
||||
extern bool_t xdr_int16_t(XDR *, int16_t *);
|
||||
extern bool_t xdr_u_int16_t(XDR *, u_int16_t *);
|
||||
extern bool_t xdr_int32_t(XDR *, int32_t *);
|
||||
extern bool_t xdr_u_int32_t(XDR *, u_int32_t *);
|
||||
extern bool_t xdr_int64_t(XDR *, int64_t *);
|
||||
extern bool_t xdr_u_int64_t(XDR *, u_int64_t *);
|
||||
extern bool_t xdr_bool(XDR *, bool_t *);
|
||||
extern bool_t xdr_enum(XDR *, enum_t *);
|
||||
extern bool_t xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
|
||||
extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int);
|
||||
extern bool_t xdr_opaque(XDR *, char *, u_int);
|
||||
extern bool_t xdr_string(XDR *, char **, u_int);
|
||||
extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t);
|
||||
extern bool_t xdr_char(XDR *, char *);
|
||||
extern bool_t xdr_u_char(XDR *, u_char *);
|
||||
extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);
|
||||
extern bool_t xdr_float(XDR *, float *);
|
||||
extern bool_t xdr_double(XDR *, double *);
|
||||
extern bool_t xdr_quadruple(XDR *, long double *);
|
||||
extern bool_t xdr_reference(XDR *, char **, u_int, xdrproc_t);
|
||||
extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t);
|
||||
extern bool_t xdr_wrapstring(XDR *, char **);
|
||||
extern void xdr_free(xdrproc_t, void *);
|
||||
extern bool_t xdr_hyper(XDR *, quad_t *);
|
||||
extern bool_t xdr_u_hyper(XDR *, u_quad_t *);
|
||||
extern bool_t xdr_longlong_t(XDR *, quad_t *);
|
||||
extern bool_t xdr_u_longlong_t(XDR *, u_quad_t *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* 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(XDR *, struct netobj *);
|
||||
|
||||
/*
|
||||
* These are the public routines for the various implementations of
|
||||
* xdr streams.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
/* XDR using memory buffers */
|
||||
extern void xdrmem_create(XDR *, char *, u_int, enum xdr_op);
|
||||
|
||||
/* XDR using stdio library */
|
||||
extern void xdrstdio_create(XDR *, FILE *, enum xdr_op);
|
||||
|
||||
/* XDR pseudo records for tcp */
|
||||
extern void xdrrec_create(XDR *, u_int, u_int, void *,
|
||||
int (*)(void *, void *, int),
|
||||
int (*)(void *, void *, int));
|
||||
|
||||
/* make end of xdr record */
|
||||
extern bool_t xdrrec_endofrecord(XDR *, int);
|
||||
|
||||
/* move to beginning of next record */
|
||||
extern bool_t xdrrec_skiprecord(XDR *);
|
||||
extern void xdrrec_setlastfrag(XDR *);
|
||||
|
||||
/* true if no more input */
|
||||
extern bool_t xdrrec_eof(XDR *);
|
||||
extern u_int xdrrec_readbytes(XDR *, caddr_t, u_int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_TIRPC_XDR_H */
|
||||
109
libtirpc/tirpc/rpcsvc/crypt.h
Normal file
109
libtirpc/tirpc/rpcsvc/crypt.h
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Please do not edit this file.
|
||||
* It was generated using rpcgen.
|
||||
*/
|
||||
|
||||
#ifndef _CRYPT_H_RPCGEN
|
||||
#define _CRYPT_H_RPCGEN
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
#ifndef IXDR_GET_INT32
|
||||
#define IXDR_GET_INT32(buf) IXDR_GET_LONG((buf))
|
||||
#endif
|
||||
#ifndef IXDR_PUT_INT32
|
||||
#define IXDR_PUT_INT32(buf, v) IXDR_PUT_LONG((buf), (v))
|
||||
#endif
|
||||
#ifndef IXDR_GET_U_INT32
|
||||
#define IXDR_GET_U_INT32(buf) IXDR_GET_U_LONG((buf))
|
||||
#endif
|
||||
#ifndef IXDR_PUT_U_INT32
|
||||
#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_U_LONG((buf), (v))
|
||||
#endif
|
||||
|
||||
enum des_dir {
|
||||
ENCRYPT_DES = 0,
|
||||
DECRYPT_DES = 1,
|
||||
};
|
||||
typedef enum des_dir des_dir;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_des_dir(XDR *, des_dir*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_des_dir(XDR *, des_dir*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_des_dir();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
enum des_mode {
|
||||
CBC_DES = 0,
|
||||
ECB_DES = 1,
|
||||
};
|
||||
typedef enum des_mode des_mode;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_des_mode(XDR *, des_mode*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_des_mode(XDR *, des_mode*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_des_mode();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
struct desargs {
|
||||
u_char des_key[8];
|
||||
des_dir des_dir;
|
||||
des_mode des_mode;
|
||||
u_char des_ivec[8];
|
||||
struct {
|
||||
u_int desbuf_len;
|
||||
char *desbuf_val;
|
||||
} desbuf;
|
||||
};
|
||||
typedef struct desargs desargs;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_desargs(XDR *, desargs*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_desargs(XDR *, desargs*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_desargs();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
struct desresp {
|
||||
struct {
|
||||
u_int desbuf_len;
|
||||
char *desbuf_val;
|
||||
} desbuf;
|
||||
u_char des_ivec[8];
|
||||
int stat;
|
||||
};
|
||||
typedef struct desresp desresp;
|
||||
#ifdef __cplusplus
|
||||
extern "C" bool_t xdr_desresp(XDR *, desresp*);
|
||||
#elif __STDC__
|
||||
extern bool_t xdr_desresp(XDR *, desresp*);
|
||||
#else /* Old Style C */
|
||||
bool_t xdr_desresp();
|
||||
#endif /* Old Style C */
|
||||
|
||||
|
||||
#define CRYPT_PROG ((u_int32_t)600100029)
|
||||
#define CRYPT_VERS ((u_int32_t)1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define DES_CRYPT ((u_int32_t)1)
|
||||
extern "C" desresp * des_crypt_1(desargs *, CLIENT *);
|
||||
extern "C" desresp * des_crypt_1_svc(desargs *, struct svc_req *);
|
||||
|
||||
#elif __STDC__
|
||||
#define DES_CRYPT ((u_int32_t)1)
|
||||
extern desresp * des_crypt_1(desargs *, CLIENT *);
|
||||
extern desresp * des_crypt_1_svc(desargs *, struct svc_req *);
|
||||
|
||||
#else /* Old Style C */
|
||||
#define DES_CRYPT ((u_int32_t)1)
|
||||
extern desresp * des_crypt_1();
|
||||
extern desresp * des_crypt_1_svc();
|
||||
#endif /* Old Style C */
|
||||
|
||||
#endif /* !_CRYPT_H_RPCGEN */
|
||||
87
libtirpc/tirpc/rpcsvc/crypt.x
Normal file
87
libtirpc/tirpc/rpcsvc/crypt.x
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 1996
|
||||
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bill Paul.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef RPC_HDR
|
||||
%#include <sys/cdefs.h>
|
||||
%__FBSDID("$FreeBSD: src/include/rpcsvc/crypt.x,v 1.5 2003/05/04 02:51:42 obrien Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This protocol definition exists because of the U.S. government and
|
||||
* its stupid export laws. We can't export DES code from the United
|
||||
* States to other countries (even though the code already exists
|
||||
* outside the U.S. -- go figure that one out) but we need to make
|
||||
* Secure RPC work. The normal way around this is to break the DES
|
||||
* code out into a shared library; we can then provide a dummy lib
|
||||
* in the base OS and provide the real lib in the secure dist, which
|
||||
* the user can install later. But we need Secure RPC for NIS+, and
|
||||
* there are several system programs that use NIS+ which are statically
|
||||
* linked. We would have to provide replacements for these programs
|
||||
* in the secure dist, but there are a lot, and this is a pain. The
|
||||
* shared lib trick won't work for these programs, and we can't change
|
||||
* them once they're compiled.
|
||||
*
|
||||
* One solution for this problem is to do the DES encryption as a system
|
||||
* call; no programs need to be changed and we can even supply the DES
|
||||
* support as an LKM. But this bloats the kernel. Maybe if we have
|
||||
* Secure NFS one day this will be worth it, but for now we should keep
|
||||
* this mess in user space.
|
||||
*
|
||||
* So we have this second solution: we provide a server that does the
|
||||
* DES encryption for us. In this case, the server is keyserv (we need
|
||||
* it to make Secure RPC work anyway) and we use this protocol to ship
|
||||
* the data back and forth between keyserv and the application.
|
||||
*/
|
||||
|
||||
enum des_dir { ENCRYPT_DES, DECRYPT_DES };
|
||||
enum des_mode { CBC_DES, ECB_DES };
|
||||
|
||||
struct desargs {
|
||||
u_char des_key[8]; /* key (with low bit parity) */
|
||||
des_dir des_dir; /* direction */
|
||||
des_mode des_mode; /* mode */
|
||||
u_char des_ivec[8]; /* input vector */
|
||||
opaque desbuf<>;
|
||||
};
|
||||
|
||||
struct desresp {
|
||||
opaque desbuf<>;
|
||||
u_char des_ivec[8];
|
||||
int stat;
|
||||
};
|
||||
|
||||
program CRYPT_PROG {
|
||||
version CRYPT_VERS {
|
||||
desresp
|
||||
DES_CRYPT(desargs) = 1;
|
||||
} = 1;
|
||||
} = 600100029;
|
||||
29
libtirpc/tirpc/rpcsvc/nis.h
Normal file
29
libtirpc/tirpc/rpcsvc/nis.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef _RPCSVC_NIS_H
|
||||
#define _RPCSVC_NIS_H
|
||||
|
||||
#define NIS_PK_NONE 0 /* no public key (unix/sys auth) */
|
||||
#define NIS_PK_DH 1 /* Public key is Diffie-Hellman type */
|
||||
#define NIS_PK_RSA 2 /* Public key is RSA type */
|
||||
#define NIS_PK_KERB 3 /* Use kerberos style authentication */
|
||||
|
||||
typedef char * nis_name;
|
||||
struct endpoint {
|
||||
char *uaddr;
|
||||
char *family;
|
||||
char *proto;
|
||||
};
|
||||
typedef struct endpoint endpoint;
|
||||
|
||||
struct nis_server{
|
||||
nis_name name;
|
||||
struct {
|
||||
u_int ep_len;
|
||||
endpoint *ep_val;
|
||||
} ep;
|
||||
uint32_t key_type;
|
||||
netobj pkey;
|
||||
};
|
||||
typedef struct nis_server nis_server;
|
||||
|
||||
#endif /* !_RPCSVC_NIS_H */
|
||||
|
||||
73
libtirpc/tirpc/spinlock.h
Normal file
73
libtirpc/tirpc/spinlock.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by John Birrell.
|
||||
* 4. Neither the name of the author nor the names of any co-contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/spinlock.h,v 1.7 2003/11/05 18:17:30 deischen Exp $
|
||||
*
|
||||
* Lock definitions used in both libc and libpthread.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SPINLOCK_H_
|
||||
#define _SPINLOCK_H_
|
||||
//#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Lock structure with room for debugging information.
|
||||
*/
|
||||
struct _spinlock {
|
||||
volatile long access_lock;
|
||||
volatile long lock_owner;
|
||||
volatile char *fname;
|
||||
volatile int lineno;
|
||||
};
|
||||
typedef struct _spinlock spinlock_t;
|
||||
|
||||
#define _SPINLOCK_INITIALIZER { 0, 0, 0, 0 }
|
||||
|
||||
#define _SPINUNLOCK(_lck) _spinunlock(_lck);
|
||||
#ifdef _LOCK_DEBUG
|
||||
#define _SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, __LINE__)
|
||||
#else
|
||||
#define _SPINLOCK(_lck) _spinlock(_lck)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Thread function prototype definitions:
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
long _atomic_lock(volatile long *);
|
||||
void _spinlock(spinlock_t *);
|
||||
void _spinunlock(spinlock_t *);
|
||||
void _spinlock_debug(spinlock_t *, char *, int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SPINLOCK_H_ */
|
||||
529
libtirpc/tirpc/sys/queue.h
Normal file
529
libtirpc/tirpc/sys/queue.h
Normal file
|
|
@ -0,0 +1,529 @@
|
|||
/* $OpenBSD: queue.h,v 1.32 2007/04/30 18:42:34 pedro Exp $ */
|
||||
/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||
*/
|
||||
|
||||
#ifndef _SYS_QUEUE_H_
|
||||
#define _SYS_QUEUE_H_
|
||||
|
||||
/*
|
||||
* This file defines five types of data structures: singly-linked lists,
|
||||
* lists, simple queues, tail queues, and circular queues.
|
||||
*
|
||||
*
|
||||
* A singly-linked list is headed by a single forward pointer. The elements
|
||||
* are singly linked for minimum space and pointer manipulation overhead at
|
||||
* the expense of O(n) removal for arbitrary elements. New elements can be
|
||||
* added to the list after an existing element or at the head of the list.
|
||||
* Elements being removed from the head of the list should use the explicit
|
||||
* macro for this purpose for optimum efficiency. A singly-linked list may
|
||||
* only be traversed in the forward direction. Singly-linked lists are ideal
|
||||
* for applications with large datasets and few or no removals or for
|
||||
* implementing a LIFO queue.
|
||||
*
|
||||
* A list is headed by a single forward pointer (or an array of forward
|
||||
* pointers for a hash table header). The elements are doubly linked
|
||||
* so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before
|
||||
* or after an existing element or at the head of the list. A list
|
||||
* may only be traversed in the forward direction.
|
||||
*
|
||||
* A simple queue is headed by a pair of pointers, one the head of the
|
||||
* list and the other to the tail of the list. The elements are singly
|
||||
* linked to save space, so elements can only be removed from the
|
||||
* head of the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the
|
||||
* list. A simple queue may only be traversed in the forward direction.
|
||||
*
|
||||
* A tail queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or
|
||||
* after an existing element, at the head of the list, or at the end of
|
||||
* the list. A tail queue may be traversed in either direction.
|
||||
*
|
||||
* A circle queue is headed by a pair of pointers, one to the head of the
|
||||
* list and the other to the tail of the list. The elements are doubly
|
||||
* linked so that an arbitrary element can be removed without a need to
|
||||
* traverse the list. New elements can be added to the list before or after
|
||||
* an existing element, at the head of the list, or at the end of the list.
|
||||
* A circle queue may be traversed in either direction, but has a more
|
||||
* complex end of list detection.
|
||||
*
|
||||
* For details on the use of these macros, see the queue(3) manual page.
|
||||
*/
|
||||
|
||||
#if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
|
||||
#define _Q_INVALIDATE(a) (a) = ((void *)-1)
|
||||
#else
|
||||
#define _Q_INVALIDATE(a)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Singly-linked List definitions.
|
||||
*/
|
||||
#define SLIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *slh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define SLIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define SLIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sle_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Singly-linked List access methods.
|
||||
*/
|
||||
#define SLIST_FIRST(head) ((head)->slh_first)
|
||||
#define SLIST_END(head) NULL
|
||||
#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
|
||||
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
|
||||
|
||||
#define SLIST_FOREACH(var, head, field) \
|
||||
for((var) = SLIST_FIRST(head); \
|
||||
(var) != SLIST_END(head); \
|
||||
(var) = SLIST_NEXT(var, field))
|
||||
|
||||
#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
|
||||
for ((varp) = &SLIST_FIRST((head)); \
|
||||
((var) = *(varp)) != SLIST_END(head); \
|
||||
(varp) = &SLIST_NEXT((var), field))
|
||||
|
||||
/*
|
||||
* Singly-linked List functions.
|
||||
*/
|
||||
#define SLIST_INIT(head) { \
|
||||
SLIST_FIRST(head) = SLIST_END(head); \
|
||||
}
|
||||
|
||||
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
|
||||
(elm)->field.sle_next = (slistelm)->field.sle_next; \
|
||||
(slistelm)->field.sle_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (head)->slh_first; \
|
||||
(head)->slh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_NEXT(head, elm, field) do { \
|
||||
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE_HEAD(head, field) do { \
|
||||
(head)->slh_first = (head)->slh_first->field.sle_next; \
|
||||
} while (0)
|
||||
|
||||
#define SLIST_REMOVE(head, elm, type, field) do { \
|
||||
if ((head)->slh_first == (elm)) { \
|
||||
SLIST_REMOVE_HEAD((head), field); \
|
||||
} else { \
|
||||
struct type *curelm = (head)->slh_first; \
|
||||
\
|
||||
while (curelm->field.sle_next != (elm)) \
|
||||
curelm = curelm->field.sle_next; \
|
||||
curelm->field.sle_next = \
|
||||
curelm->field.sle_next->field.sle_next; \
|
||||
_Q_INVALIDATE((elm)->field.sle_next); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* List definitions.
|
||||
*/
|
||||
#define LIST_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *lh_first; /* first element */ \
|
||||
}
|
||||
|
||||
#define LIST_HEAD_INITIALIZER(head) \
|
||||
{ NULL }
|
||||
|
||||
#define LIST_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *le_next; /* next element */ \
|
||||
struct type **le_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* List access methods
|
||||
*/
|
||||
#define LIST_FIRST(head) ((head)->lh_first)
|
||||
#define LIST_END(head) NULL
|
||||
#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
|
||||
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
|
||||
#define LIST_FOREACH(var, head, field) \
|
||||
for((var) = LIST_FIRST(head); \
|
||||
(var)!= LIST_END(head); \
|
||||
(var) = LIST_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* List functions.
|
||||
*/
|
||||
#define LIST_INIT(head) do { \
|
||||
LIST_FIRST(head) = LIST_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
(listelm)->field.le_next = (elm); \
|
||||
(elm)->field.le_prev = &(listelm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
(listelm)->field.le_prev = &(elm)->field.le_next; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
(elm)->field.le_prev = &(head)->lh_first; \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = (elm)->field.le_next; \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
#define LIST_REPLACE(elm, elm2, field) do { \
|
||||
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
|
||||
(elm2)->field.le_next->field.le_prev = \
|
||||
&(elm2)->field.le_next; \
|
||||
(elm2)->field.le_prev = (elm)->field.le_prev; \
|
||||
*(elm2)->field.le_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.le_prev); \
|
||||
_Q_INVALIDATE((elm)->field.le_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Simple queue definitions.
|
||||
*/
|
||||
#define SIMPLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *sqh_first; /* first element */ \
|
||||
struct type **sqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define SIMPLEQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).sqh_first }
|
||||
|
||||
#define SIMPLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *sqe_next; /* next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Simple queue access methods.
|
||||
*/
|
||||
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
|
||||
#define SIMPLEQ_END(head) NULL
|
||||
#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
|
||||
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
|
||||
|
||||
#define SIMPLEQ_FOREACH(var, head, field) \
|
||||
for((var) = SIMPLEQ_FIRST(head); \
|
||||
(var) != SIMPLEQ_END(head); \
|
||||
(var) = SIMPLEQ_NEXT(var, field))
|
||||
|
||||
/*
|
||||
* Simple queue functions.
|
||||
*/
|
||||
#define SIMPLEQ_INIT(head) do { \
|
||||
(head)->sqh_first = NULL; \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(head)->sqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.sqe_next = NULL; \
|
||||
*(head)->sqh_last = (elm); \
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
|
||||
(head)->sqh_last = &(elm)->field.sqe_next; \
|
||||
(listelm)->field.sqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
|
||||
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
|
||||
(head)->sqh_last = &(head)->sqh_first; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define TAILQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *tqh_first; /* first element */ \
|
||||
struct type **tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define TAILQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *tqe_next; /* next element */ \
|
||||
struct type **tqe_prev; /* address of previous next element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* tail queue access methods
|
||||
*/
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_END(head) NULL
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
/* XXX */
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
#define TAILQ_EMPTY(head) \
|
||||
(TAILQ_FIRST(head) == TAILQ_END(head))
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for((var) = TAILQ_FIRST(head); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_NEXT(var, field))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for((var) = TAILQ_LAST(head, headname); \
|
||||
(var) != TAILQ_END(head); \
|
||||
(var) = TAILQ_PREV(var, headname, field))
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
|
||||
(elm2)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm2)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm2)->field.tqe_next; \
|
||||
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
|
||||
*(elm2)->field.tqe_prev = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.tqe_next); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Circular queue definitions.
|
||||
*/
|
||||
#define CIRCLEQ_HEAD(name, type) \
|
||||
struct name { \
|
||||
struct type *cqh_first; /* first element */ \
|
||||
struct type *cqh_last; /* last element */ \
|
||||
}
|
||||
|
||||
#define CIRCLEQ_HEAD_INITIALIZER(head) \
|
||||
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
|
||||
|
||||
#define CIRCLEQ_ENTRY(type) \
|
||||
struct { \
|
||||
struct type *cqe_next; /* next element */ \
|
||||
struct type *cqe_prev; /* previous element */ \
|
||||
}
|
||||
|
||||
/*
|
||||
* Circular queue access methods
|
||||
*/
|
||||
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
|
||||
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
|
||||
#define CIRCLEQ_END(head) ((void *)(head))
|
||||
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
|
||||
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
|
||||
#define CIRCLEQ_EMPTY(head) \
|
||||
(CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
|
||||
|
||||
#define CIRCLEQ_FOREACH(var, head, field) \
|
||||
for((var) = CIRCLEQ_FIRST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_NEXT(var, field))
|
||||
|
||||
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
|
||||
for((var) = CIRCLEQ_LAST(head); \
|
||||
(var) != CIRCLEQ_END(head); \
|
||||
(var) = CIRCLEQ_PREV(var, field))
|
||||
|
||||
/*
|
||||
* Circular queue functions.
|
||||
*/
|
||||
#define CIRCLEQ_INIT(head) do { \
|
||||
(head)->cqh_first = CIRCLEQ_END(head); \
|
||||
(head)->cqh_last = CIRCLEQ_END(head); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
|
||||
(elm)->field.cqe_prev = (listelm); \
|
||||
if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
|
||||
(listelm)->field.cqe_next = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
|
||||
(elm)->field.cqe_next = (listelm); \
|
||||
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
|
||||
if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
|
||||
(listelm)->field.cqe_prev = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = (head)->cqh_first; \
|
||||
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
|
||||
if ((head)->cqh_last == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm); \
|
||||
else \
|
||||
(head)->cqh_first->field.cqe_prev = (elm); \
|
||||
(head)->cqh_first = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.cqe_next = CIRCLEQ_END(head); \
|
||||
(elm)->field.cqe_prev = (head)->cqh_last; \
|
||||
if ((head)->cqh_first == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm); \
|
||||
else \
|
||||
(head)->cqh_last->field.cqe_next = (elm); \
|
||||
(head)->cqh_last = (elm); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REMOVE(head, elm, field) do { \
|
||||
if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_last = (elm)->field.cqe_prev; \
|
||||
else \
|
||||
(elm)->field.cqe_next->field.cqe_prev = \
|
||||
(elm)->field.cqe_prev; \
|
||||
if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
|
||||
(head)->cqh_first = (elm)->field.cqe_next; \
|
||||
else \
|
||||
(elm)->field.cqe_prev->field.cqe_next = \
|
||||
(elm)->field.cqe_next; \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
||||
#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
|
||||
if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head).cqh_last = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_next->field.cqe_prev = (elm2); \
|
||||
if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
|
||||
CIRCLEQ_END(head)) \
|
||||
(head).cqh_first = (elm2); \
|
||||
else \
|
||||
(elm2)->field.cqe_prev->field.cqe_next = (elm2); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_prev); \
|
||||
_Q_INVALIDATE((elm)->field.cqe_next); \
|
||||
} while (0)
|
||||
|
||||
#endif /* !_SYS_QUEUE_H_ */
|
||||
|
||||
|
||||
153
libtirpc/tirpc/un-namespace.h
Normal file
153
libtirpc/tirpc/un-namespace.h
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/un-namespace.h,v 1.13 2003/05/01 19:03:13 nectar Exp $
|
||||
*/
|
||||
|
||||
#ifndef _UN_NAMESPACE_H_
|
||||
#define _UN_NAMESPACE_H_
|
||||
|
||||
#undef accept
|
||||
#undef __acl_aclcheck_fd
|
||||
#undef __acl_delete_fd
|
||||
#undef __acl_get_fd
|
||||
#undef __acl_set_fd
|
||||
#undef bind
|
||||
#undef __cap_get_fd
|
||||
#undef __cap_set_fd
|
||||
#undef close
|
||||
#undef connect
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef execve
|
||||
#undef fcntl
|
||||
#undef flock
|
||||
#undef flockfile
|
||||
#undef fpathconf
|
||||
#undef fstat
|
||||
#undef fstatfs
|
||||
#undef fsync
|
||||
#undef funlockfile
|
||||
#undef getdirentries
|
||||
#undef getlogin
|
||||
#undef getpeername
|
||||
#undef getprogname
|
||||
#undef getsockname
|
||||
#undef getsockopt
|
||||
#undef ioctl
|
||||
#undef kevent
|
||||
#undef listen
|
||||
#undef nanosleep
|
||||
#undef open
|
||||
#undef poll
|
||||
#undef pthread_cond_broadcast
|
||||
#undef pthread_cond_destroy
|
||||
#undef pthread_cond_init
|
||||
#undef pthread_cond_signal
|
||||
#undef pthread_cond_timedwait
|
||||
#undef pthread_cond_wait
|
||||
#undef pthread_exit
|
||||
#undef pthread_getspecific
|
||||
#undef pthread_key_create
|
||||
#undef pthread_key_delete
|
||||
#undef pthread_main_np
|
||||
#undef pthread_mutex_destroy
|
||||
#undef pthread_mutex_init
|
||||
#undef pthread_mutex_lock
|
||||
#undef pthread_mutex_trylock
|
||||
#undef pthread_mutex_unlock
|
||||
#undef pthread_mutexattr_init
|
||||
#undef pthread_mutexattr_destroy
|
||||
#undef pthread_mutexattr_settype
|
||||
#undef pthread_once
|
||||
#undef pthread_rwlock_destroy
|
||||
#undef pthread_rwlock_init
|
||||
#undef pthread_rwlock_rdlock
|
||||
#undef pthread_rwlock_wrlock
|
||||
#undef pthread_rwlock_tryrdlock
|
||||
#undef pthread_rwlock_trywrlock
|
||||
#undef pthread_rwlock_unlock
|
||||
#undef pthread_self
|
||||
#undef pthread_setspecific
|
||||
#undef pthread_sigmask
|
||||
#undef read
|
||||
#undef readv
|
||||
#undef recvfrom
|
||||
#undef recvmsg
|
||||
#undef select
|
||||
#undef sendmsg
|
||||
#undef sendto
|
||||
#undef setsockopt
|
||||
#undef sigaction
|
||||
#undef sigprocmask
|
||||
#undef sigsuspend
|
||||
#undef socket
|
||||
#undef socketpair
|
||||
#undef wait4
|
||||
#undef waitpid
|
||||
#undef write
|
||||
#undef writev
|
||||
|
||||
#if 0
|
||||
#undef creat
|
||||
#undef fchflags
|
||||
#undef fchmod
|
||||
#undef ftrylockfile
|
||||
#undef msync
|
||||
#undef nfssvc
|
||||
#undef pause
|
||||
#undef pthread_rwlockattr_init
|
||||
#undef pthread_rwlockattr_destroy
|
||||
#undef sched_yield
|
||||
#undef sendfile
|
||||
#undef shutdown
|
||||
#undef sigaltstack
|
||||
#undef sigpending
|
||||
#undef sigreturn
|
||||
#undef sigsetmask
|
||||
#undef sleep
|
||||
#undef system
|
||||
#undef tcdrain
|
||||
#undef wait
|
||||
#endif /* 0 */
|
||||
|
||||
#ifdef _SIGNAL_H_
|
||||
int _sigaction(int, const struct sigaction *, struct sigaction *);
|
||||
#endif
|
||||
|
||||
#ifdef _SYS_EVENT_H_
|
||||
int _kevent(int, const struct kevent *, int, struct kevent *,
|
||||
int, const struct timespec *);
|
||||
#endif
|
||||
|
||||
#ifdef _SYS_FCNTL_H_
|
||||
int _flock(int, int);
|
||||
#endif
|
||||
|
||||
#undef err
|
||||
#undef warn
|
||||
#undef nsdispatch
|
||||
|
||||
#endif /* _UN_NAMESPACE_H_ */
|
||||
101
libtirpc/tirpc/wintirpc.h
Normal file
101
libtirpc/tirpc/wintirpc.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/* Copyright (c) 2010
|
||||
* The Regents of the University of Michigan
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission is granted to use, copy and redistribute this software
|
||||
* for noncommercial education and research purposes, so long as no
|
||||
* fee is charged, and so long as the name of the University of Michigan
|
||||
* is not used in any advertising or publicity pertaining to the use
|
||||
* or distribution of this software without specific, written prior
|
||||
* authorization. Permission to modify or otherwise create derivative
|
||||
* works of this software is not granted.
|
||||
*
|
||||
* This software is provided as is, without representation or warranty
|
||||
* of any kind either express or implied, including without limitation
|
||||
* the implied warranties of merchantability, fitness for a particular
|
||||
* purpose, or noninfringement. The Regents of the University of
|
||||
* Michigan shall not be liable for any damages, including special,
|
||||
* indirect, incidental, or consequential damages, with respect to any
|
||||
* claim arising out of or in connection with the use of the software,
|
||||
* even if it has been or is hereafter advised of the possibility of
|
||||
* such damages.
|
||||
*/
|
||||
|
||||
#ifndef _TIRPC_WINTIRPC_H
|
||||
#define _TIRPC_WINTIRPC_H
|
||||
|
||||
/*
|
||||
* Eliminate warnings about possibly unsafe uses of snprintf and friends
|
||||
* XXX Think about cleaning these up and removing this later XXX
|
||||
*/
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
/* use visual studio's debug heap */
|
||||
# define _CRTDBG_MAP_ALLOC
|
||||
# include <stdlib.h>
|
||||
# include <crtdbg.h>
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* Common Windows includes */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <basetsd.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
//#define vsnprintf _vsnprintf
|
||||
#define strcasecmp _stricmp
|
||||
#define strdup _strdup
|
||||
#define getpid _getpid
|
||||
|
||||
#define bcmp memcmp
|
||||
#define bcopy(d,s,l) memcpy(d,s,l)
|
||||
#define bzero(d,s) memset(d,0,s)
|
||||
#define strtok_r strtok_s
|
||||
|
||||
#define poll WSAPoll
|
||||
#define ioctl ioctlsocket
|
||||
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
#define __THROW
|
||||
|
||||
/*
|
||||
* Hash of Windows Socket Handle values
|
||||
*/
|
||||
#define WINSOCK_HANDLE_HASH_SIZE 1024
|
||||
#define WINSOCK_HANDLE_HASH(x) (((x) >> 2) % WINSOCK_HANDLE_HASH_SIZE)
|
||||
|
||||
/*
|
||||
* Functions imported from BSD
|
||||
*/
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
extern int asprintf(char **str, const char *fmt, ...);
|
||||
|
||||
#define SOL_IPV6 IPPROTO_IPV6
|
||||
|
||||
#define MAXHOSTNAMELEN 256
|
||||
|
||||
struct sockaddr_un {
|
||||
int sun_family;
|
||||
char sun_path[MAX_PATH];
|
||||
};
|
||||
/* Evaluate to actual length of the sockaddr_un structure */
|
||||
/* XXX Should this return size_t or unsigned int ?? */
|
||||
#define SUN_LEN(ptr) ((unsigned int)(sizeof(int) + strlen ((ptr)->sun_path)))
|
||||
|
||||
/* Debugging function */
|
||||
void wintirpc_debug(char *fmt, ...);
|
||||
|
||||
#endif /* !_TIRPC_WINTIRPC_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue