diff options
Diffstat (limited to 'c')
1431 files changed, 81752 insertions, 10240 deletions
diff --git a/c/Makefile.am b/c/Makefile.am index 949c8171d7..172af7c870 100644 --- a/c/Makefile.am +++ b/c/Makefile.am @@ -4,17 +4,15 @@ AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + ## NOTE: This Makefile.am is rather fragile to the value of RTEMS_BSP -## Esp. make clean and make distclean have unwanted side-effects +## Esp. make clean and make distclean have unwanted side-effects ## if RTEMS_BSP is not properly set up. RTEMS_BSP = $(RTEMS_BSP_LIST) -## The '.' in SUBDIRS ensures that local make-targets (xxx-am) will be +## The '.' in SUBDIRS ensures that local make-targets (xxx-am) will be ## triggered before $(RTEMS_BSP_LIST) subdirectories are made. -SUBDIRS= \ -make \ -. \ -$(RTEMS_BSP) +SUBDIRS = make . $(RTEMS_BSP) ## Use @RTEMS_BSP_LIST@ here, using $(RTEMS_BSP_LIST) would trigger ## this rule for invalid BSPs @@ -30,23 +28,15 @@ $(RTEMS_BSP) done ## Let all RTEMS' make targets depend on ${RTEMS_BSP} -all-am: ${RTEMS_BSP} -debug-am: ${RTEMS_BSP} -profile-am: ${RTEMS_BSP} +all-local: ${RTEMS_BSP} preinstall-am: ${RTEMS_BSP} depend-am: ${RTEMS_BSP} ## Pull in extra files intro the distribution -EXTRA_DIST = \ -ACKNOWLEDGEMENTS \ -README.DOS \ -REQUIRES \ -PROBLEMS \ -TESTED \ -README \ -UPDATE_HELP +EXTRA_DIST = ACKNOWLEDGEMENTS README.DOS REQUIRES PROBLEMS TESTED README \ + UPDATE_HELP DIST_SUBDIRS = ${RTEMS_BSP} ## ------------------------------------------------------- include $(top_srcdir)/../automake/subdirs.am -include $(top_srcdir)/../automake/local.am +include $(top_srcdir)/../automake/host.am diff --git a/c/make/Makefile.am b/c/make/Makefile.am index 104e41cc61..f23ebb804c 100644 --- a/c/make/Makefile.am +++ b/c/make/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal @@ -13,4 +13,4 @@ rtems_make_DATA = $(GENERIC_FILES) EXTRA_DIST = target.cfg.in -include $(top_srcdir)/../../automake/local.am +include $(top_srcdir)/../../automake/host.am diff --git a/c/src/Makefile.am b/c/src/Makefile.am index 8ffae151a7..7dd388782c 100644 --- a/c/src/Makefile.am +++ b/c/src/Makefile.am @@ -5,17 +5,19 @@ AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal -SUBDIRS= @cfg_subdirs@ wrapup tests +SUBDIRS = @cfg_subdirs@ wrapup tests -rtems_bspdir=$(prefix)/@RTEMS_BSP@ +rtems_bspdir = $(prefix)/@RTEMS_BSP@ # NOTE: The wildcard on the install should pick up everything except # the tests directory. This significantly minimizes the install size. install-data-local: - rm -rf $(rtems_bspdir)/[bsl]*; $(mkinstalldirs) $(rtems_bspdir) cd $(PROJECT_ROOT); \ tar cf - @RTEMS_BSP@/[bilsuM]* | (cd $(DESTDIR)$(prefix); tar xpBf - ); +uninstall-local: + rm -rf $(rtems_bspdir)/[bsl]*; + include $(top_srcdir)/../../automake/subdirs.am -include $(top_srcdir)/../../automake/local.am +include $(top_srcdir)/../../automake/host.am diff --git a/c/src/exec/itron/include/Makefile.am b/c/src/exec/itron/include/Makefile.am index a12590301a..66bdf8c9e7 100644 --- a/c/src/exec/itron/include/Makefile.am +++ b/c/src/exec/itron/include/Makefile.am @@ -8,18 +8,15 @@ H_FILES = itron.h noinst_HEADERS = $(H_FILES) -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE) \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE) \ + $(noinst_HEADERS:%=$(PROJECT_INCLUDE)/%) $(PROJECT_INCLUDE): @$(mkinstalldirs) $@ $(PROJECT_INCLUDE)/%.h: %.h $(INSTALL_DATA) $< $@ -all-am: $(PREINSTALL_FILES) -debug-am: $(PREINSTALL_FILES) -profile-am: $(PREINSTALL_FILES) +all-local: $(PREINSTALL_FILES) SUBDIRS = rtems itronsys diff --git a/c/src/exec/itron/include/itronsys/Makefile.am b/c/src/exec/itron/include/itronsys/Makefile.am index 25bcd64a2a..2aa2a0b0ea 100644 --- a/c/src/exec/itron/include/itronsys/Makefile.am +++ b/c/src/exec/itron/include/itronsys/Makefile.am @@ -4,22 +4,19 @@ AUTOMAKE_OPTIONS = foreign 1.4 -H_FILES = eventflags.h fmempool.h intr.h mbox.h msgbuffer.h network.h \ - port.h semaphore.h status.h sysmgmt.h task.h time.h types.h vmempool.h +H_FILES = eventflags.h fmempool.h intr.h mbox.h msgbuffer.h network.h port.h \ + semaphore.h status.h sysmgmt.h task.h time.h types.h vmempool.h noinst_HEADERS = $(H_FILES) -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE)/itronsys \ -$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/itronsys/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE)/itronsys \ + $(noinst_HEADERS:%=$(PROJECT_INCLUDE)/itronsys/%) $(PROJECT_INCLUDE)/itronsys: @$(mkinstalldirs) $@ $(PROJECT_INCLUDE)/itronsys/%.h: %.h $(INSTALL_DATA) $< $@ -all-am: $(PREINSTALL_FILES) -debug-am: $(PREINSTALL_FILES) -profile-am: $(PREINSTALL_FILES) +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/include/rtems/itron/Makefile.am b/c/src/exec/itron/include/rtems/itron/Makefile.am index 542ea135fd..96053cfb9a 100644 --- a/c/src/exec/itron/include/rtems/itron/Makefile.am +++ b/c/src/exec/itron/include/rtems/itron/Makefile.am @@ -5,23 +5,20 @@ AUTOMAKE_OPTIONS = foreign 1.4 H_FILES = config.h eventflags.h fmempool.h intr.h itronapi.h mbox.h \ - msgbuffer.h network.h object.h port.h semaphore.h sysmgmt.h \ - task.h time.h vmempool.h + msgbuffer.h network.h object.h port.h semaphore.h sysmgmt.h task.h \ + time.h vmempool.h noinst_HEADERS = $(H_FILES) -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rtems/itron \ -$(H_FILES:%=$(PROJECT_INCLUDE)/rtems/itron/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/itron \ + $(H_FILES:%=$(PROJECT_INCLUDE)/rtems/itron/%) $(PROJECT_INCLUDE)/rtems/itron: @$(mkinstalldirs) $@ $(PROJECT_INCLUDE)/rtems/itron/%.h: %.h $(INSTALL_DATA) $< $@ -all-am: $(PREINSTALL_FILES) -debug-am: $(PREINSTALL_FILES) -profile-am: $(PREINSTALL_FILES) +all-local: $(PREINSTALL_FILES) EXTRA_DIST = README diff --git a/c/src/exec/itron/inline/rtems/itron/Makefile.am b/c/src/exec/itron/inline/rtems/itron/Makefile.am index 659227b218..f5368fff77 100644 --- a/c/src/exec/itron/inline/rtems/itron/Makefile.am +++ b/c/src/exec/itron/inline/rtems/itron/Makefile.am @@ -3,16 +3,16 @@ ## AUTOMAKE_OPTIONS = foreign 1.4 + if INLINE I_FILES = eventflags.inl fmempool.inl intr.inl mbox.inl msgbuffer.inl \ - network.inl port.inl semaphore.inl sysmgmt.inl task.inl \ - time.inl vmempool.inl + network.inl port.inl semaphore.inl sysmgmt.inl task.inl time.inl \ + vmempool.inl noinst_HEADERS = $(I_FILES) -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rtems/itron \ -$(I_FILES:%=$(PROJECT_INCLUDE)/rtems/itron/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/itron \ + $(I_FILES:%=$(PROJECT_INCLUDE)/rtems/itron/%) $(PROJECT_INCLUDE)/rtems/itron: @$(mkinstalldirs) $@ @@ -20,8 +20,6 @@ $(PROJECT_INCLUDE)/rtems/itron/%.inl: %.inl $(INSTALL_DATA) $< $@ endif -all-am: $(PREINSTALL_FILES) -debug-am: $(PREINSTALL_FILES) -profile-am: $(PREINSTALL_FILES) +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/src/Makefile.am b/c/src/exec/itron/src/Makefile.am index f508440f60..92ae498c69 100644 --- a/c/src/exec/itron/src/Makefile.am +++ b/c/src/exec/itron/src/Makefile.am @@ -18,9 +18,9 @@ EVENTFLAGS_C_FILES = eventflags.c MAILBOX_C_FILES = mbox.c -MSGBUFFER_C_FILES = msgbuffer.c msgbuffertranslatereturncode.c \ - cre_mbf.c del_mbf.c prcv_mbf.c psnd_mbf.c rcv_mbf.c ref_mbf.c snd_mbf.c \ - trcv_mbf.c tsnd_mbf.c +MSGBUFFER_C_FILES = msgbuffer.c msgbuffertranslatereturncode.c cre_mbf.c \ + del_mbf.c prcv_mbf.c psnd_mbf.c rcv_mbf.c ref_mbf.c snd_mbf.c trcv_mbf.c \ + tsnd_mbf.c RENDEZVOUS_C_FILES = port.c @@ -49,20 +49,11 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../../automake/lib.am AM_CPPFLAGS += -D__RTEMS_INSIDE__ -AM_CFLAGS += $(CFLAGS_OS_V) - -all: ${ARCH} ${OBJS} - -UNUSED_C_FILES = \ -cre_mbx.c del_mbx.c \ -mboxtranslatereturncode.c \ -network.c \ -prcv_mbx.c \ -rcv_mbx.c \ -ref_mbx.c \ -snd_mbx.c \ -sysmgmt.c \ -trcv_mbx.c + +all-local: ${ARCH} ${OBJS} + +UNUSED_C_FILES = cre_mbx.c del_mbx.c mboxtranslatereturncode.c network.c \ + prcv_mbx.c rcv_mbx.c ref_mbx.c snd_mbx.c sysmgmt.c trcv_mbx.c EXTRA_DIST = $(C_FILES) $(UNUSED_C_FILES) diff --git a/c/src/exec/itron/src/cre_tsk.c b/c/src/exec/itron/src/cre_tsk.c index 665e158652..250293c026 100644 --- a/c/src/exec/itron/src/cre_tsk.c +++ b/c/src/exec/itron/src/cre_tsk.c @@ -30,7 +30,6 @@ ER cre_tsk( ) { register Thread_Control *the_thread; - char *name = "trn"; boolean status; Priority_Control core_priority; @@ -90,7 +89,7 @@ ER cre_tsk( THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, NULL, /* no budget algorithm callout */ 0, - &name + NULL ); if ( !status ) { diff --git a/c/src/exec/itron/src/eventflags.c b/c/src/exec/itron/src/eventflags.c index b7d974ae37..f1a0858e92 100644 --- a/c/src/exec/itron/src/eventflags.c +++ b/c/src/exec/itron/src/eventflags.c @@ -38,7 +38,7 @@ void _ITRON_Eventflags_Manager_initialization( /* control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ /* name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/fmempool.c b/c/src/exec/itron/src/fmempool.c index ec19e6770c..93bbe56af1 100644 --- a/c/src/exec/itron/src/fmempool.c +++ b/c/src/exec/itron/src/fmempool.c @@ -39,7 +39,7 @@ void _ITRON_Fixed_memory_pool_Manager_initialization( /* size of this object's control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ /* name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/itronsem.c b/c/src/exec/itron/src/itronsem.c index ad9278aec2..83686b4a44 100644 --- a/c/src/exec/itron/src/itronsem.c +++ b/c/src/exec/itron/src/itronsem.c @@ -41,7 +41,7 @@ void _ITRON_Semaphore_Manager_initialization( sizeof( ITRON_Semaphore_Control ), /* size of this object's control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ /* name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/mbox.c b/c/src/exec/itron/src/mbox.c index a8dd9a26ca..6d2deb8819 100644 --- a/c/src/exec/itron/src/mbox.c +++ b/c/src/exec/itron/src/mbox.c @@ -40,7 +40,7 @@ void _ITRON_Mailbox_Manager_initialization( sizeof( ITRON_Mailbox_Control ), /* size of this object's control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ /* name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/msgbuffer.c b/c/src/exec/itron/src/msgbuffer.c index 13c89efba6..e4cb4a4f20 100644 --- a/c/src/exec/itron/src/msgbuffer.c +++ b/c/src/exec/itron/src/msgbuffer.c @@ -43,7 +43,7 @@ void _ITRON_Message_buffer_Manager_initialization( block */ FALSE, /* TRUE if names for this object are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/port.c b/c/src/exec/itron/src/port.c index 0e9d98eb04..df360e155d 100644 --- a/c/src/exec/itron/src/port.c +++ b/c/src/exec/itron/src/port.c @@ -36,7 +36,7 @@ void _ITRON_Port_Manager_initialization( sizeof( ITRON_Port_Control ), /* size of this object's control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/itron/src/vmempool.c b/c/src/exec/itron/src/vmempool.c index d1a7d8a4a7..7f0ee73021 100644 --- a/c/src/exec/itron/src/vmempool.c +++ b/c/src/exec/itron/src/vmempool.c @@ -39,7 +39,7 @@ void _ITRON_Variable_memory_pool_Manager_initialization( /* size of this object's control block */ FALSE, /* TRUE if names for this object */ /* are strings */ - RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ /* name */ FALSE /* TRUE if this class is threads */ ); diff --git a/c/src/exec/libcsupport/Makefile.am b/c/src/exec/libcsupport/Makefile.am index f65729290b..2d2f16cd26 100644 --- a/c/src/exec/libcsupport/Makefile.am +++ b/c/src/exec/libcsupport/Makefile.am @@ -5,8 +5,7 @@ AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal -SUBDIRS = include libc libcpu libbsp \ - $(LIBHWAPI) +SUBDIRS = include libc libcpu libbsp include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libcsupport/include/console.h b/c/src/exec/libcsupport/include/console.h index 7bc6b5e3d4..2d2f380012 100644 --- a/c/src/exec/libcsupport/include/console.h +++ b/c/src/exec/libcsupport/include/console.h @@ -24,10 +24,6 @@ extern "C" { { console_initialize, console_open, console_close, \ console_read, console_write, console_control } -void console_reserve_resources( - rtems_configuration_table *configuration -); - rtems_device_driver console_initialize( rtems_device_major_number, rtems_device_minor_number, diff --git a/c/src/exec/libcsupport/include/rtems/error.h b/c/src/exec/libcsupport/include/rtems/error.h index a0698afb5d..de6e1715db 100644 --- a/c/src/exec/libcsupport/include/rtems/error.h +++ b/c/src/exec/libcsupport/include/rtems/error.h @@ -7,6 +7,10 @@ #ifndef __RTEMS_ERROR_h #define __RTEMS_ERROR_h +#ifdef __cplusplus +extern "C" { +#endif + /* * rtems_error() and rtems_panic() support */ @@ -34,5 +38,10 @@ void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#ifdef __cplusplus +} +#endif + + #endif /* end of include file */ diff --git a/c/src/exec/libcsupport/include/sys/termios.h b/c/src/exec/libcsupport/include/sys/termios.h index bb64d55433..7cc28d7d38 100644 --- a/c/src/exec/libcsupport/include/sys/termios.h +++ b/c/src/exec/libcsupport/include/sys/termios.h @@ -14,6 +14,8 @@ #ifndef TERMIOS_H #define TERMIOS_H +#include <sys/types.h> + #ifdef __cplusplus extern "C" { #endif @@ -174,9 +176,15 @@ struct termios { #define TCSADRAIN 1 #define TCSAFLUSH 2 +int tcdrain(int); +int tcflow(int, int); +int tcflush(int, int); int tcgetattr(int, struct termios *); int tcsetattr(int, int, struct termios *); -int tcdrain(int); +pid_t tcgetprgrp(int); +int tcsetprgrp(int, pid_t); +int tcsendbreak(int, int); + speed_t cfgetospeed(const struct termios *tp); int cfsetospeed(struct termios *tp, speed_t speed); speed_t cfgetispeed(const struct termios *tp); diff --git a/c/src/exec/libcsupport/src/Makefile.am b/c/src/exec/libcsupport/src/Makefile.am index 20893f29eb..54b674b2f7 100644 --- a/c/src/exec/libcsupport/src/Makefile.am +++ b/c/src/exec/libcsupport/src/Makefile.am @@ -48,15 +48,14 @@ LIBC_GLUE_C_FILES = __getpid.c __gettod.c __times.c truncate.c access.c \ UNIX_LIBC_C_FILES = unixlibc.c hosterr.c -COMMON_C_FILES = $(BASE_FS_C_FILES) $(MALLOC_C_FILES) \ - $(TERMIOS_C_FILES) $(ERROR_C_FILES) $(ASSOCIATION_C_FILES) +COMMON_C_FILES = gxx_wrappers.c $(BASE_FS_C_FILES) $(MALLOC_C_FILES) $(TERMIOS_C_FILES) \ + $(ERROR_C_FILES) $(ASSOCIATION_C_FILES) UNIX_C_FILES = $(UNIX_LIBC_C_FILES) imfs_unixstub.c -EMBEDDED_C_FILES = $(LIBC_GLUE_C_FILES) \ - $(PASSWORD_GROUP_C_FILES) $(TERMINAL_IDENTIFICATION_C_FILES) \ - $(SYSTEM_CALL_C_FILES) $(DIRECTORY_SCAN_C_FILES) \ - $(IMFS_C_FILES) +EMBEDDED_C_FILES = $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \ + $(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \ + $(DIRECTORY_SCAN_C_FILES) $(IMFS_C_FILES) if UNIX C_FILES = $(COMMON_C_FILES) $(UNIX_C_FILES) @@ -73,13 +72,10 @@ noinst_HEADERS = libio_.h include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../automake/lib.am -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE) \ -$(PROJECT_INCLUDE)/rtems \ -$(PROJECT_INCLUDE)/sys \ -$(H_FILES:%=$(PROJECT_INCLUDE)/%) \ -$(RTEMS_H_FILES:%=$(PROJECT_INCLUDE)/rtems/%) \ -$(SYS_H_FILES:%=$(PROJECT_INCLUDE)/sys/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/rtems \ + $(PROJECT_INCLUDE)/sys $(H_FILES:%=$(PROJECT_INCLUDE)/%) \ + $(RTEMS_H_FILES:%=$(PROJECT_INCLUDE)/rtems/%) \ + $(SYS_H_FILES:%=$(PROJECT_INCLUDE)/sys/%) $(PROJECT_INCLUDE): @$(mkinstalldirs) $@ @@ -95,8 +91,7 @@ $(PROJECT_INCLUDE)/rtems/%.h: %.h $(PROJECT_INCLUDE)/sys/%.h: %.h $(INSTALL_DATA) $< $@ -TMPINSTALL_FILES += \ -$(PROJECT_RELEASE)/lib/$(LIBNAME)$(LIB_VARIANT).a +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/$(LIBNAME)$(LIB_VARIANT).a OBJS = $(C_O_FILES) @@ -106,7 +101,7 @@ OBJS = $(C_O_FILES) AM_CFLAGS += $(LIBC_DEFINES) -all: ${ARCH} $(TMPINSTALL_FILES) +all-local: ${ARCH} $(TMPINSTALL_FILES) $(LIB): ${OBJS} $(make-library) @@ -116,9 +111,7 @@ $(PROJECT_RELEASE)/lib/$(LIBNAME)$(LIB_VARIANT).a: $(LIB) DOC_FILES = TODO CASES -EXTRA_DIST = \ -$(DOC_FILES) \ -$(COMMON_C_FILES) $(EMBEDDED_C_FILES) $(UNIX_C_FILES) \ -$(H_FILES) $(RTEMS_H_FILES) $(SYS_H_FILES) +EXTRA_DIST = $(DOC_FILES) $(COMMON_C_FILES) $(EMBEDDED_C_FILES) \ + $(UNIX_C_FILES) $(H_FILES) $(RTEMS_H_FILES) $(SYS_H_FILES) include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libcsupport/src/gxx_wrappers.c b/c/src/exec/libcsupport/src/gxx_wrappers.c index e69de29bb2..323da73e7f 100644 --- a/c/src/exec/libcsupport/src/gxx_wrappers.c +++ b/c/src/exec/libcsupport/src/gxx_wrappers.c @@ -0,0 +1,219 @@ +/* + * RTEMS threads compatibily routines for libgcc2. + * + * by: Rosimildo da Silva ( rdasilva@connecttel.com + * + * Used ideas from: + * W. Eric Norum + * Canadian Light Source + * University of Saskatchewan + * Saskatoon, Saskatchewan, CANADA + * eric@cls.usask.ca + * + * Eric sent some e-mail in the rtems-list as a start point for this + * module implementation. + * + * + */ + +/* We might not need, defined just in case */ +#define __RTEMS_INSIDE__ 1 + + +#include <stdlib.h> +#include <stdio.h> + +#include <rtems.h> +#include <rtems/system.h> +#include <rtems/rtems/tasks.h> + +/* + * These typedefs should match with the ones defined in the file + * gcc/gthr-rtems.h in the gcc distribution. + */ +typedef void *__gthread_key_t; +typedef int __gthread_once_t; +typedef void *__gthread_mutex_t; + + +/* uncomment this if you need to debug this interface */ + +/* +#define DEBUG_GXX_WRAPPERS 1 +*/ + + +/* prototype for the terminate() */ +extern void __terminate( void ); + + +#ifdef DEBUG_GXX_WRAPPERS +/* local function to return the ID of the calling thread */ +static rtems_id get_tid( void ) +{ + rtems_id id = 0; + rtems_task_ident( RTEMS_SELF, 0, &id ); + return id; +} +#endif + + +int rtems_gxx_once(__gthread_once_t *once, void (*func) ()) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: once=%x, func=%x\n", *once, func ); +#endif + if( *once == 0 ) + { + /* + * NOTE: could not use the call to disable "preemption", it causes + * one exception. Somebody might want to investiage it further + * sometime later. + */ + _Thread_Disable_dispatch(); + *once = 1; + (*func)(); + _Thread_Enable_dispatch(); + } + return 0; +} + + +int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *)) +{ + /* Ok, this can be a bit tricky. We are going to return a "key" as a + * pointer to the buffer that will hold the value of the key itself. + * We have to to this, becuase the others functions on this interface + * deal with the value of the key, as used with the POSIX API. + */ + /* Do not pull your hair, trust me this works. :-) */ + __gthread_key_t *new_key = ( __gthread_key_t * )malloc( sizeof( __gthread_key_t ) ); + *key = ( __gthread_key_t )new_key; + *new_key = NULL; + +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: create key=%x, dtor=%x, new_key=%x\n", key, dtor, new_key ); +#endif + /* register with RTEMS the buffer that will hold the key values */ + if( rtems_task_variable_add( RTEMS_SELF, (void **)new_key, NULL ) == RTEMS_SUCCESSFUL ) + return 0; + return -1; +} + +int rtems_gxx_key_dtor (__gthread_key_t key, void *ptr) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: dtor key=%x, ptr=%x\n", key, ptr ); +#endif + *(void **)key = 0; + return 0; +} + +int rtems_gxx_key_delete (__gthread_key_t key) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: delete key=%x\n", key ); +#endif + /* register with RTEMS the buffer that will hold the key values */ + if( rtems_task_variable_delete( RTEMS_SELF, (void **)key ) == RTEMS_SUCCESSFUL ) + { + if( key ) free( (void *)key ); + return 0; + } + return 0; +} + + +void *rtems_gxx_getspecific(__gthread_key_t key) +{ + void *p= 0; + + /* register with RTEMS the buffer that will hold the key values */ + if( rtems_task_variable_get( RTEMS_SELF, (void **)key, &p ) == RTEMS_SUCCESSFUL ) + { + /* We do not have to do this, but what the heck ! */ + p= *( void **)key; + } + else + { + /* fisrt time, always set to zero, it is unknown the value that the others + * threads are using at the moment of this call + */ + if( rtems_task_variable_add( RTEMS_SELF, (void **)key, NULL ) != RTEMS_SUCCESSFUL ) + { + __terminate (); + } + *( void ** )key = (void *)0; + } + +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: getspecific key=%x, ptr=%x, id=%x\n", key, p, get_tid() ); +#endif + return p; +} + + +int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: setspecific key=%x, ptr=%x, id=%x\n", key, ptr, get_tid() ); +#endif + /* register with RTEMS the buffer that will hold the key values */ + if( rtems_task_variable_add( RTEMS_SELF, (void **)key, NULL ) == RTEMS_SUCCESSFUL ) + { + /* now let's set the proper value */ + *( void ** )key = (void *)ptr; + return 0; + } + return -1; +} + + +/* + * MUTEX support + */ +void rtems_gxx_mutex_init (__gthread_mutex_t *mutex) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: mutex init =%X\n", *mutex ); +#endif + if( rtems_semaphore_create( rtems_build_name ('G', 'C', 'C', '2'), + 1, + RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE + |RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, + 0, + (rtems_id *)mutex ) != RTEMS_SUCCESSFUL ) + { + __terminate (); + } +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: mutex init complete =%X\n", *mutex ); +#endif +} + +int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: lock mutex=%X\n", *mutex ); +#endif + return ( rtems_semaphore_obtain( (rtems_id)*mutex, + RTEMS_WAIT, RTEMS_NO_TIMEOUT ) == RTEMS_SUCCESSFUL) ? 0 : -1; +} + +int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: trylock mutex=%X\n", *mutex ); +#endif + return (rtems_semaphore_obtain ((rtems_id)*mutex, + RTEMS_NO_WAIT, 0) == RTEMS_SUCCESSFUL) ? 0 : -1; +} + +int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex) +{ +#ifdef DEBUG_GXX_WRAPPERS + printk( "gxx_wrappers: unlock mutex=%X\n", *mutex ); +#endif + return (rtems_semaphore_release( (rtems_id)*mutex ) == RTEMS_SUCCESSFUL) ? 0 :-1; +} + diff --git a/c/src/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c index 9e075c9f0b..c878db6247 100644 --- a/c/src/exec/libcsupport/src/libio.c +++ b/c/src/exec/libcsupport/src/libio.c @@ -260,7 +260,7 @@ int rtems_libio_is_open_files_in_fs( * Look for any active file descriptor entry. */ - for (iop=rtems_libio_iops,i=0; i <= rtems_libio_number_iops; iop++, i++){ + for (iop=rtems_libio_iops,i=0; i < rtems_libio_number_iops; iop++, i++){ if ((iop->flags & LIBIO_FLAGS_OPEN) != 0) { @@ -304,7 +304,7 @@ int rtems_libio_is_file_open( * Look for any active file descriptor entry. */ - for (iop=rtems_libio_iops,i=0; i <= rtems_libio_number_iops; iop++, i++){ + for (iop=rtems_libio_iops,i=0; i < rtems_libio_number_iops; iop++, i++){ if ((iop->flags & LIBIO_FLAGS_OPEN) != 0) { /* diff --git a/c/src/exec/libcsupport/src/malloc.c b/c/src/exec/libcsupport/src/malloc.c index cc63b6c7d0..08660d75cc 100644 --- a/c/src/exec/libcsupport/src/malloc.c +++ b/c/src/exec/libcsupport/src/malloc.c @@ -120,7 +120,7 @@ void RTEMS_Malloc_Initialize( rtems_build_name( 'H', 'E', 'A', 'P' ), starting_address, length, - CPU_ALIGNMENT, + CPU_HEAP_ALIGNMENT, RTEMS_DEFAULT_ATTRIBUTES, &RTEMS_Malloc_Heap ); diff --git a/c/src/exec/libcsupport/src/scandir.c b/c/src/exec/libcsupport/src/scandir.c index 43c7c51747..25f3263187 100644 --- a/c/src/exec/libcsupport/src/scandir.c +++ b/c/src/exec/libcsupport/src/scandir.c @@ -112,7 +112,7 @@ scandir(dirname, namelist, select, dcomp) p->d_ino = d->d_ino; p->d_reclen = d->d_reclen; p->d_namlen = d->d_namlen; - strncpy(p->d_name, d->d_name, p->d_namlen + 1); + strncpy(d->d_name, p->d_name, p->d_namlen + 1); /* * Check to make sure the array has space left and * realloc the maximum size. diff --git a/c/src/exec/libcsupport/src/termios.c b/c/src/exec/libcsupport/src/termios.c index 6d334ecd23..7883e94b63 100644 --- a/c/src/exec/libcsupport/src/termios.c +++ b/c/src/exec/libcsupport/src/termios.c @@ -28,7 +28,6 @@ * FreeBSD does not support a full POSIX termios so we have to help it out */ - #if defined(__FreeBSD__) #define XTABS 0 #define ONLRET 0 @@ -41,6 +40,14 @@ #endif /* + * Cygwin does not define these + */ + +#if defined(__CYGWIN__) +#define ECHOPRT 0 +#endif + +/* * The size of the cooked buffer */ #define CBUFSIZE 256 @@ -238,7 +245,7 @@ rtems_termios_open ( */ tty->termios.c_iflag = BRKINT | ICRNL | IMAXBEL; tty->termios.c_oflag = OPOST | ONLCR | XTABS; - tty->termios.c_cflag = B9600 | CS8 | CREAD; + tty->termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL; tty->termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOK | ECHOE | ECHOCTL; tty->termios.c_cc[VINTR] = '\003'; @@ -256,8 +263,8 @@ rtems_termios_open ( tty->termios.c_cc[VWERASE] = '\027'; tty->termios.c_cc[VLNEXT] = '\026'; - /* setup flow control mode, clear flow control flags */ - tty->flow_ctrl = FL_MDXON; + /* start with no flow control, clear flow control flags */ + tty->flow_ctrl = 0; /* * set low/highwater mark for XON/XOFF support */ diff --git a/c/src/exec/libcsupport/src/termiosreserveresources.c b/c/src/exec/libcsupport/src/termiosreserveresources.c index 2d9c05c988..664bdd1f62 100644 --- a/c/src/exec/libcsupport/src/termiosreserveresources.c +++ b/c/src/exec/libcsupport/src/termiosreserveresources.c @@ -6,15 +6,19 @@ #include <rtems.h> +#if 0 static int first_time; /* assumed to be zeroed by BSS initialization */ +#endif void rtems_termios_reserve_resources ( rtems_configuration_table *configuration, rtems_unsigned32 number_of_devices ) { +#if 0 rtems_api_configuration_table *rtems_config; + if (!configuration) rtems_fatal_error_occurred (0xFFF0F001); rtems_config = configuration->RTEMS_api_configuration; @@ -24,5 +28,6 @@ void rtems_termios_reserve_resources ( rtems_config->maximum_semaphores += 1; first_time = 1; rtems_config->maximum_semaphores += (4 * number_of_devices); +#endif } diff --git a/c/src/exec/libcsupport/src/unmount.c b/c/src/exec/libcsupport/src/unmount.c index c4b6bdae7d..46b11d1848 100644 --- a/c/src/exec/libcsupport/src/unmount.c +++ b/c/src/exec/libcsupport/src/unmount.c @@ -62,7 +62,6 @@ int unmount( int status; rtems_filesystem_location_info_t temp_loc; rtems_filesystem_mount_table_entry_t temp_mt_entry; - int result; /* * Are there any file systems below the mount_path specified @@ -101,7 +100,7 @@ int unmount( /* * Allow the file system being mounted on to do its cleanup. * XXX - Did I change these correctly ??? It looks like either I did - * XXX this backwards or the IMFS_unmount and IMFS_fsumount are swaped. + * XXX this backwards or the IMFS_unmount and IMFS_fsumount are swapped. * XXX Add to the mt_point_node unmount to set the mt_entry back to null * XXX I will step off in space when evaluating past the end of the node. */ @@ -121,12 +120,6 @@ int unmount( } /* - * Allow the file system to clean up. - */ - - result = (*temp_loc.ops->fsunmount_me)( temp_loc.mt_entry ); - - /* * Extract the mount table entry from the chain */ @@ -140,8 +133,7 @@ int unmount( free( temp_loc.mt_entry ); rtems_filesystem_freenode( &temp_loc ); - return result; - + return 0; } diff --git a/c/src/exec/libfs/src/imfs/imfs.h b/c/src/exec/libfs/src/imfs/imfs.h index 38c770a325..3a44c50ee3 100644 --- a/c/src/exec/libfs/src/imfs/imfs.h +++ b/c/src/exec/libfs/src/imfs/imfs.h @@ -157,9 +157,9 @@ struct IMFS_jnode_tt { uid_t st_uid; /* User ID of owner */ gid_t st_gid; /* Group ID of owner */ - time_t st_atime; /* Time of last access */ - time_t st_mtime; /* Time of last modification */ - time_t st_ctime; /* Time of last status change */ + time_t stat_atime; /* Time of last access */ + time_t stat_mtime; /* Time of last modification */ + time_t stat_ctime; /* Time of last status change */ IMFS_jnode_types_t type; /* Type of this entry */ IMFS_types_union info; }; @@ -168,29 +168,29 @@ struct IMFS_jnode_tt { do { \ struct timeval tv; \ gettimeofday( &tv, 0 ); \ - _jnode->st_atime = (time_t) tv.tv_sec; \ + _jnode->stat_atime = (time_t) tv.tv_sec; \ } while (0) #define IMFS_update_mtime( _jnode ) \ do { \ struct timeval tv; \ gettimeofday( &tv, 0 ); \ - _jnode->st_mtime = (time_t) tv.tv_sec; \ + _jnode->stat_mtime = (time_t) tv.tv_sec; \ } while (0) #define IMFS_update_ctime( _jnode ) \ do { \ struct timeval tv; \ gettimeofday( &tv, 0 ); \ - _jnode->st_ctime = (time_t) tv.tv_sec; \ + _jnode->stat_ctime = (time_t) tv.tv_sec; \ } while (0) #define IMFS_atime_mtime_update( _jnode ) \ do { \ struct timeval tv; \ gettimeofday( &tv, 0 ); \ - _jnode->st_mtime = (time_t) tv.tv_sec; \ - _jnode->st_atime = (time_t) tv.tv_sec; \ + _jnode->stat_mtime = (time_t) tv.tv_sec; \ + _jnode->stat_atime = (time_t) tv.tv_sec; \ } while (0) typedef struct { diff --git a/c/src/exec/libfs/src/imfs/imfs_creat.c b/c/src/exec/libfs/src/imfs/imfs_creat.c index 227b5f9300..b60e78540e 100644 --- a/c/src/exec/libfs/src/imfs/imfs_creat.c +++ b/c/src/exec/libfs/src/imfs/imfs_creat.c @@ -72,9 +72,9 @@ IMFS_jnode_t *IMFS_create_node( gettimeofday( &tv, 0 ); - node->st_atime = (time_t) tv.tv_sec; - node->st_mtime = (time_t) tv.tv_sec; - node->st_ctime = (time_t) tv.tv_sec; + node->stat_atime = (time_t) tv.tv_sec; + node->stat_mtime = (time_t) tv.tv_sec; + node->stat_ctime = (time_t) tv.tv_sec; /* * Set the type specific information diff --git a/c/src/exec/libfs/src/imfs/imfs_directory.c b/c/src/exec/libfs/src/imfs/imfs_directory.c index 1f6d9b5ff5..38280c565c 100644 --- a/c/src/exec/libfs/src/imfs/imfs_directory.c +++ b/c/src/exec/libfs/src/imfs/imfs_directory.c @@ -219,9 +219,9 @@ int imfs_dir_lseek( * dirent structure * st_blksize 0 * st_blocks 0 - * st_atime time of last access - * st_mtime time of last modification - * st_ctime time of the last change + * stat_atime time of last access + * stat_mtime time of last modification + * stat_ctime time of the last change * * This information will be returned to the calling function in a -stat- struct * @@ -248,9 +248,9 @@ int imfs_dir_fstat( buf->st_rdev = 0ll; buf->st_blksize = 0; buf->st_blocks = 0; - buf->st_atime = the_jnode->st_atime; - buf->st_mtime = the_jnode->st_mtime; - buf->st_ctime = the_jnode->st_ctime; + buf->st_atime = the_jnode->stat_atime; + buf->st_mtime = the_jnode->stat_mtime; + buf->st_ctime = the_jnode->stat_ctime; buf->st_size = 0; diff --git a/c/src/exec/libfs/src/imfs/imfs_stat.c b/c/src/exec/libfs/src/imfs/imfs_stat.c index 2edc1a9e9b..f5858498c1 100644 --- a/c/src/exec/libfs/src/imfs/imfs_stat.c +++ b/c/src/exec/libfs/src/imfs/imfs_stat.c @@ -50,9 +50,9 @@ int IMFS_stat( buf->st_uid = the_jnode->st_uid; buf->st_gid = the_jnode->st_gid; - buf->st_atime = the_jnode->st_atime; - buf->st_mtime = the_jnode->st_mtime; - buf->st_ctime = the_jnode->st_ctime; + buf->st_atime = the_jnode->stat_atime; + buf->st_mtime = the_jnode->stat_mtime; + buf->st_ctime = the_jnode->stat_ctime; return 0; } diff --git a/c/src/exec/libfs/src/imfs/imfs_utime.c b/c/src/exec/libfs/src/imfs/imfs_utime.c index e20d352c50..c9bd9ddd90 100644 --- a/c/src/exec/libfs/src/imfs/imfs_utime.c +++ b/c/src/exec/libfs/src/imfs/imfs_utime.c @@ -30,8 +30,8 @@ int IMFS_utime( the_jnode = (IMFS_jnode_t *) pathloc->node_access; - the_jnode->st_atime = actime; - the_jnode->st_mtime = modtime; + the_jnode->stat_atime = actime; + the_jnode->stat_mtime = modtime; return 0; } diff --git a/c/src/exec/libnetworking/Makefile.am b/c/src/exec/libnetworking/Makefile.am index ce9cf6c399..7e41fce2b3 100644 --- a/c/src/exec/libnetworking/Makefile.am +++ b/c/src/exec/libnetworking/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal @@ -9,7 +9,7 @@ SUBDIRS = include arpa kern machine sys vm lib libc net netinet nfs rtems \ rtems_servers pppd rtems_webserver wrapup EXTRA_DIST = CHANGELOG bpfilter.h loop.h netdb.h opt_ipfw.h opt_mrouting.h \ - opt_tcpdebug.h poll.h resolv.h syslog.h + opt_tcpdebug.h poll.h resolv.h syslog.h memory.h include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/arpa/Makefile.am b/c/src/exec/libnetworking/arpa/Makefile.am index dba97b83d5..6ee4bfbe74 100644 --- a/c/src/exec/libnetworking/arpa/Makefile.am +++ b/c/src/exec/libnetworking/arpa/Makefile.am @@ -4,6 +4,18 @@ AUTOMAKE_OPTIONS = foreign 1.4 -EXTRA_DIST = ftp.h inet.h nameser.h nameser_compat.h telnet.h +H_FILES = ftp.h inet.h nameser.h nameser_compat.h telnet.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/arpa $(H_FILES:%=$(PROJECT_INCLUDE)/arpa/%) + +$(PROJECT_INCLUDE)/arpa: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/arpa/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/kern/Makefile.am b/c/src/exec/libnetworking/kern/Makefile.am index aedc2bbadf..878f23612e 100644 --- a/c/src/exec/libnetworking/kern/Makefile.am +++ b/c/src/exec/libnetworking/kern/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/exec/libnetworking/lib/Makefile.am b/c/src/exec/libnetworking/lib/Makefile.am index 5f8d151e13..64e3a0e8f4 100644 --- a/c/src/exec/libnetworking/lib/Makefile.am +++ b/c/src/exec/libnetworking/lib/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c b/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c index 11b0cef63a..54974aa332 100644 --- a/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c +++ b/c/src/exec/libnetworking/lib/rtems_bsdnet_ntp.c @@ -111,7 +111,7 @@ rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority) printf ("Can't set socket receive timeout: %s", strerror (errno)); return -1; } - memset (&myAddr, sizeof myAddr, 0); + memset (&myAddr, 0, sizeof myAddr); myAddr.sin_family = AF_INET; myAddr.sin_port = htons (123); myAddr.sin_addr.s_addr = htonl (INADDR_ANY); @@ -126,14 +126,14 @@ rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority) * server out there somewhere. */ if (rtems_bsdnet_ntpserver_count > 0) { - memset (&farAddr, sizeof farAddr, 0); + memset (&farAddr, 0, sizeof farAddr); farAddr.sin_family = AF_INET; farAddr.sin_port = htons (123); /* * For now, try only the first server. */ farAddr.sin_addr = rtems_bsdnet_ntpserver[0]; - memset (&packet, sizeof packet, 0); + memset (&packet, 0, sizeof packet); packet.li_vn_mode = (3 << 3) | 3; /* NTP version 3, client */ i = sendto (s, &packet, sizeof packet, 0, (struct sockaddr *)&farAddr, sizeof farAddr); if (i != sizeof packet) { diff --git a/c/src/exec/libnetworking/libc/Makefile.am b/c/src/exec/libnetworking/libc/Makefile.am index 57b2b412f2..aca9052ee2 100644 --- a/c/src/exec/libnetworking/libc/Makefile.am +++ b/c/src/exec/libnetworking/libc/Makefile.am @@ -1,20 +1,21 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 no-installman LIBNAME = lib.a LIB = $(ARCH)/$(LIBNAME) -C_FILES = base64.c gethostbydns.c gethostbyht.c gethostbynis.c \ - gethostnamadr.c getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \ - getproto.c getprotoent.c getprotoname.c getservbyname.c getservbyport.c \ - getservent.c herror.c inet_addr.c inet_lnaof.c inet_makeaddr.c \ - inet_network.c inet_ntoa.c inet_ntop.c inet_pton.c map_v4v6.c \ - nsap_addr.c ns_name.c ns_netint.c ns_parse.c ns_print.c ns_ttl.c \ - res_comp.c res_data.c res_debug.c res_init.c res_mkquery.c \ - res_mkupdate.c res_query.c res_send.c res_stubs.c res_update.c strsep.c +C_FILES = addr2ascii.c ascii2addr.c base64.c gethostbydns.c gethostbyht.c \ + gethostbynis.c gethostnamadr.c getnetbydns.c getnetbyht.c getnetbynis.c \ + getnetnamadr.c getproto.c getprotoent.c getprotoname.c getservbyname.c \ + getservbyport.c getservent.c herror.c inet_addr.c inet_lnaof.c \ + inet_makeaddr.c inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \ + inet_pton.c linkaddr.c map_v4v6.c nsap_addr.c ns_name.c ns_netint.c \ + ns_parse.c ns_print.c ns_ttl.c res_comp.c res_data.c res_debug.c \ + res_init.c res_mkquery.c res_mkupdate.c res_query.c res_send.c \ + res_stubs.c res_update.c strsep.c C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) OBJS = $(C_O_FILES) @@ -30,8 +31,7 @@ man_MANS = addr2ascii.3 byteorder.3 ethers.3 gethostbyname.3 getnetent.3 \ # Add local stuff here using += # -AM_CPPFLAGS += -DNOPOLL -DNOSELECT -AM_CPPFLAGS += -U__STRICT_ANSI__ +AM_CPPFLAGS += -DNOPOLL -DNOSELECT -U__STRICT_ANSI__ $(LIB): $(OBJS) $(make-library) @@ -47,7 +47,7 @@ EXTRA_DIST = addr2ascii.3 addr2ascii.c ascii2addr.c base64.c byteorder.3 \ getprotoent.c getprotoname.c getservbyname.c getservbyport.c \ getservent.3 getservent.c herror.c inet.3 inet_addr.c inet_lnaof.c \ inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c inet_netof.c \ - inet_network.c inet_ntoa.c inet_ntop.c inet_pton.c iso_addr.3 iso_addr.c \ + inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c inet_pton.c map_v4v6.c \ linkaddr.3 linkaddr.c map_v4v6.c ns.3 ns_addr.c ns_name.c ns_netint.c \ ns_ntoa.c ns_parse.c ns_print.c ns_ttl.c nsap_addr.c rcmd.3 rcmd.c \ recv.c res_comp.c res_config.h res_data.c res_debug.c res_init.c \ diff --git a/c/src/exec/libnetworking/machine/Makefile.am b/c/src/exec/libnetworking/machine/Makefile.am index 11e23bf86c..e703d0b82b 100644 --- a/c/src/exec/libnetworking/machine/Makefile.am +++ b/c/src/exec/libnetworking/machine/Makefile.am @@ -1,10 +1,23 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 -EXTRA_DIST = conf.h cpu.h cpufunc.h endian.h in_cksum.h limits.h param.h \ +H_FILES = conf.h cpu.h cpufunc.h endian.h in_cksum.h limits.h param.h \ types.h vmparam.h +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine \ + $(H_FILES:%=$(PROJECT_INCLUDE)/machine/%) + +$(PROJECT_INCLUDE)/machine: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/machine/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-local: $(PREINSTALL_FILES) + include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/memory.h b/c/src/exec/libnetworking/memory.h index e69de29bb2..7ef4cda388 100644 --- a/c/src/exec/libnetworking/memory.h +++ b/c/src/exec/libnetworking/memory.h @@ -0,0 +1,5 @@ +/* + * Dummy include file for FreeBSD routines + */ + +#include <string.h> diff --git a/c/src/exec/libnetworking/net/Makefile.am b/c/src/exec/libnetworking/net/Makefile.am index d965963974..eda18a9c76 100644 --- a/c/src/exec/libnetworking/net/Makefile.am +++ b/c/src/exec/libnetworking/net/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -26,12 +26,24 @@ AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \ $(LIB): $(OBJS) $(make-library) -all-local: $(ARCH) $(OBJS) $(LIB) +all-local: $(PREINSTALL_FILES) $(ARCH) $(OBJS) $(LIB) .PRECIOUS: $(LIB) -EXTRA_DIST = bpf.h ethernet.h if.c if.h if_arp.h if_dl.h if_ethersubr.c \ - if_llc.h if_loop.c if_ppp.h if_types.h netisr.h ppp-comp.h ppp_defs.h \ - radix.c radix.h raw_cb.c raw_cb.h raw_usrreq.c route.c route.h rtsock.c +EXTRA_DIST = if.c if_ethersubr.c if_loop.c \ + radix.c raw_cb.c raw_usrreq.c route.c rtsock.c + +H_FILES = bpf.h ethernet.h if.h if_arp.h if_dl.h if_llc.h if_ppp.h if_types.h \ + netisr.h ppp-comp.h ppp_defs.h radix.h raw_cb.h route.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/net $(H_FILES:%=$(PROJECT_INCLUDE)/net/%) + +$(PROJECT_INCLUDE)/net: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/net/%.h: %.h + $(INSTALL_DATA) $< $@ include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/net/if_loop.c b/c/src/exec/libnetworking/net/if_loop.c index 3823c28744..345730c729 100644 --- a/c/src/exec/libnetworking/net/if_loop.c +++ b/c/src/exec/libnetworking/net/if_loop.c @@ -118,6 +118,7 @@ rtems_bsdnet_loopattach(dummy) ifp->if_type = IFT_LOOP; ifp->if_hdrlen = 0; ifp->if_addrlen = 0; + ifp->if_snd.ifq_maxlen = ifqmaxlen; if_attach(ifp); #if NBPFILTER > 0 bpfattach(ifp, DLT_NULL, sizeof(u_int)); diff --git a/c/src/exec/libnetworking/netinet/Makefile.am b/c/src/exec/libnetworking/netinet/Makefile.am index f967b65cd7..dedeb31ac7 100644 --- a/c/src/exec/libnetworking/netinet/Makefile.am +++ b/c/src/exec/libnetworking/netinet/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -28,16 +28,30 @@ AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \ $(LIB): $(OBJS) $(make-library) -all-local: $(ARCH) $(OBJS) $(LIB) +all-local: $(PREINSTALL_FILES) $(ARCH) $(OBJS) $(LIB) .PRECIOUS: $(LIB) -EXTRA_DIST = icmp_var.h if_ether.c if_ether.h igmp.c igmp.h igmp_var.h in.c \ - in.h in_cksum.c in_cksum_i386.c in_cksum_m68k.c in_cksum_powerpc.c \ - in_pcb.c in_pcb.h in_proto.c in_rmx.c in_systm.h in_var.h ip.h \ - ip_divert.c ip_fw.c ip_fw.h ip_icmp.c ip_icmp.h ip_input.c ip_mroute.c \ - ip_mroute.h ip_output.c ip_var.h raw_ip.c tcp.h tcp_debug.c tcp_debug.h \ - tcp_fsm.h tcp_input.c tcp_output.c tcp_seq.h tcp_subr.c tcp_timer.c \ - tcp_timer.h tcp_usrreq.c tcp_var.h tcpip.h udp.h udp_usrreq.c udp_var.h +EXTRA_DIST = if_ether.c igmp.c igmp_var.h in.c in_cksum.c in_cksum_i386.c \ + in_cksum_m68k.c in_cksum_powerpc.c in_pcb.c in_proto.c in_rmx.c \ + ip_divert.c ip_fw.c ip_icmp.c ip_input.c ip_mroute.c ip_output.c \ + raw_ip.c tcp_debug.c tcp_input.c tcp_output.c tcp_subr.c tcp_timer.c \ + tcp_usrreq.c udp_usrreq.c + +H_FILES = icmp_var.h if_ether.h igmp.h igmp_var.h in.h \ + in_pcb.h in_systm.h in_var.h ip.h ip_fw.h ip_icmp.h \ + ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_fsm.h tcp_seq.h \ + tcp_timer.h tcp_var.h tcpip.h udp.h udp_var.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/netinet \ + $(H_FILES:%=$(PROJECT_INCLUDE)/netinet/%) + +$(PROJECT_INCLUDE)/netinet: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/netinet/%.h: %.h + $(INSTALL_DATA) $< $@ include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/netinet/in.h b/c/src/exec/libnetworking/netinet/in.h index ba3cbb21cc..36d2d4e867 100644 --- a/c/src/exec/libnetworking/netinet/in.h +++ b/c/src/exec/libnetworking/netinet/in.h @@ -255,6 +255,9 @@ struct in_addr { #define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ #define IN_LOOPBACKNET 127 /* official! */ +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK (u_long)0x7F000001 /* 127.0.0.1 */ +#endif /* * Socket address, internet style. diff --git a/c/src/exec/libnetworking/nfs/Makefile.am b/c/src/exec/libnetworking/nfs/Makefile.am index 51184e47ae..9a8b43e31a 100644 --- a/c/src/exec/libnetworking/nfs/Makefile.am +++ b/c/src/exec/libnetworking/nfs/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -25,11 +25,23 @@ AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \ $(LIB): $(OBJS) $(make-library) -all-local: $(ARCH) $(OBJS) $(LIB) +all-local: $(PREINSTALL_FILES) $(ARCH) $(OBJS) $(LIB) .PRECIOUS: $(LIB) -EXTRA_DIST = bootp_subr.c krpc.h nfs.h nfsdiskless.h nfsproto.h rpcv2.h \ - xdr_subs.h +EXTRA_DIST = bootp_subr.c + +H_FILES = krpc.h nfs.h nfsdiskless.h nfsproto.h rpcv2.h xdr_subs.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/nfs $(H_FILES:%=$(PROJECT_INCLUDE)/nfs/%) + +$(PROJECT_INCLUDE)/nfs: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/nfs/%.h: %.h + $(INSTALL_DATA) $< $@ + include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/rtems/Makefile.am b/c/src/exec/libnetworking/rtems/Makefile.am index 28df4629c4..dfcac20c4b 100644 --- a/c/src/exec/libnetworking/rtems/Makefile.am +++ b/c/src/exec/libnetworking/rtems/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -15,6 +15,19 @@ C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) OBJS = $(C_O_FILES) +H_FILES = rtems_bsdnet.h rtems_bsdnet_internal.h tftp.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems $(H_FILES:%=$(PROJECT_INCLUDE)/rtems/%) + +$(PROJECT_INCLUDE)/rtems: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/rtems/%.h: %.h + $(INSTALL_DATA) $< $@ + + include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg include $(top_srcdir)/../../../automake/lib.am @@ -28,14 +41,12 @@ AM_CPPFLAGS += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS -DDIAGNOSTIC \ $(LIB): $(OBJS) $(make-library) -all-local: $(ARCH) $(OBJS) $(LIB) +all-local: $(PREINSTALL_FILES) $(ARCH) $(OBJS) $(LIB) .PRECIOUS: $(LIB) -EXTRA_DIST = issetugid.c rtems_bootp.c rtems_bsdnet.h \ - rtems_bsdnet_internal.h rtems_glue.c rtems_select.c rtems_showicmpstat.c \ +EXTRA_DIST = issetugid.c rtems_bootp.c rtems_glue.c rtems_select.c rtems_showicmpstat.c \ rtems_showifstat.c rtems_showipstat.c rtems_showmbuf.c rtems_showroute.c \ - rtems_showtcpstat.c rtems_showudpstat.c rtems_syscall.c sghostname.c \ - tftp.h + rtems_showtcpstat.c rtems_showudpstat.c rtems_syscall.c sghostname.c include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/rtems/rtems_syscall.c b/c/src/exec/libnetworking/rtems/rtems_syscall.c index 05217f7212..d04ae95afb 100644 --- a/c/src/exec/libnetworking/rtems/rtems_syscall.c +++ b/c/src/exec/libnetworking/rtems/rtems_syscall.c @@ -136,11 +136,8 @@ connect (int s, struct sockaddr *name, int namelen) return -1; } error = soconnect (so, nam); - if (error) { - errno = error; - rtems_bsdnet_semaphore_release (); - return -1; - } + if (error) + goto bad; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { m_freem(nam); errno = EINPROGRESS; @@ -148,15 +145,20 @@ connect (int s, struct sockaddr *name, int namelen) return -1; } while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { - so->so_error = soconnsleep (so); + error = soconnsleep (so); + if (error) + break; } if (error == 0) { error = so->so_error; so->so_error = 0; } + bad: so->so_state &= ~SS_ISCONNECTING; m_freem (nam); - if (error == 0) + if (error) + errno = error; + else ret = 0; rtems_bsdnet_semaphore_release (); return ret; @@ -605,6 +607,7 @@ getpeersockname (int s, struct sockaddr *name, int *namelen, int pflag) else error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, m); if (error) { + m_freem(m); errno = error; rtems_bsdnet_semaphore_release (); return -1; diff --git a/c/src/exec/libnetworking/sys/Makefile.am b/c/src/exec/libnetworking/sys/Makefile.am index 3fe88aff59..07888ddcc7 100644 --- a/c/src/exec/libnetworking/sys/Makefile.am +++ b/c/src/exec/libnetworking/sys/Makefile.am @@ -4,10 +4,22 @@ AUTOMAKE_OPTIONS = foreign 1.4 -EXTRA_DIST = buf.h callout.h cdefs.h conf.h domain.h filio.h ioccom.h \ +H_FILES = buf.h callout.h cdefs.h conf.h domain.h filio.h ioccom.h \ ioctl.h kernel.h libkern.h malloc.h mbuf.h mount.h param.h proc.h \ protosw.h queue.h reboot.h resourcevar.h rtprio.h select.h signalvar.h \ socket.h socketvar.h sockio.h sysctl.h syslimits.h syslog.h systm.h \ - ttycom.h ttydefaults.h ucred.h uio.h + ttycom.h ttydefaults.h ucred.h uio.h un.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys $(H_FILES:%=$(PROJECT_INCLUDE)/sys/%) + +$(PROJECT_INCLUDE)/sys: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/sys/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/sys/un.h b/c/src/exec/libnetworking/sys/un.h index e69de29bb2..d742bb7d5d 100644 --- a/c/src/exec/libnetworking/sys/un.h +++ b/c/src/exec/libnetworking/sys/un.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1982, 1986, 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. 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. + * + * @(#)un.h 8.3 (Berkeley) 2/19/95 + * $FreeBSD: src/sys/sys/un.h,v 1.17 1999/12/29 04:24:49 peter Exp $ + */ + +#ifndef _SYS_UN_H_ +#define _SYS_UN_H_ + +/* + * Definitions for UNIX IPC domain. + */ +struct sockaddr_un { + u_char sun_len; /* sockaddr len including null */ + u_char sun_family; /* AF_UNIX */ + char sun_path[104]; /* path name (gag) */ +}; + +#ifdef _KERNEL +struct mbuf; +struct socket; + +int uipc_usrreq __P((struct socket *so, int req, struct mbuf *m, + struct mbuf *nam, struct mbuf *control)); +int unp_connect2 __P((struct socket *so, struct socket *so2)); +void unp_dispose __P((struct mbuf *m)); +int unp_externalize __P((struct mbuf *rights)); +void unp_init __P((void)); +extern struct pr_usrreqs uipc_usrreqs; +#else /* !_KERNEL */ + +/* actual length of an initialized sockaddr_un */ +#define SUN_LEN(su) \ + (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path)) + +#endif /* _KERNEL */ + +#endif /* !_SYS_UN_H_ */ diff --git a/c/src/exec/libnetworking/vm/Makefile.am b/c/src/exec/libnetworking/vm/Makefile.am index 3f307c7cfb..b72458f6cc 100644 --- a/c/src/exec/libnetworking/vm/Makefile.am +++ b/c/src/exec/libnetworking/vm/Makefile.am @@ -1,9 +1,22 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 -EXTRA_DIST = vm.h vm_extern.h vm_kern.h vm_param.h +H_FILES = vm.h vm_extern.h vm_kern.h vm_param.h + +noinst_HEADERS = $(H_FILES) + +PREINSTALL_FILES += $(PROJECT_INCLUDE)/vm \ + $(H_FILES:%=$(PROJECT_INCLUDE)/vm/%) + +$(PROJECT_INCLUDE)/vm: + @$(mkinstalldirs) $@ + +$(PROJECT_INCLUDE)/vm/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/libnetworking/wrapup/Makefile.am b/c/src/exec/libnetworking/wrapup/Makefile.am index 5d2a73a05e..5553252d11 100644 --- a/c/src/exec/libnetworking/wrapup/Makefile.am +++ b/c/src/exec/libnetworking/wrapup/Makefile.am @@ -1,12 +1,12 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 if HAS_POSIX POSIX_PIECES = rtems_webserver -endif +endif NET_O_PIECES = kern lib libc net netinet nfs rtems rtems_servers pppd \ $(POSIX_PIECES) diff --git a/c/src/exec/librpc/Makefile.am b/c/src/exec/librpc/Makefile.am index e74c9e748c..d9429399ec 100644 --- a/c/src/exec/librpc/Makefile.am +++ b/c/src/exec/librpc/Makefile.am @@ -7,5 +7,7 @@ ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal SUBDIRS = include src +EXTRA_DIST = README_RTEMS + include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/librpc/README_RTEMS b/c/src/exec/librpc/README_RTEMS index e69de29bb2..e60f8799aa 100644 --- a/c/src/exec/librpc/README_RTEMS +++ b/c/src/exec/librpc/README_RTEMS @@ -0,0 +1,64 @@ +USING RPC/XDR ON RTEMS +====================== +For the most part, programmers using RPC/XDR routines on RTEMS +can proceed as if they were to be using a POSIX/UNIX system. +The only significant changes are those to start the portmapper +and to allow use of RPC/XDR by multiple threads. + +Starting the portmapper +======================= +The SUN portmapper program has been modified to run as an RTEMS +task. Applications which need the portmapper can start this +task by calling: + int rtems_rpc_start_portmapper (int priority); +The return value is an RTEMS status code. + +Multi-threaded operation +======================== +The RPC/XDR package has been modified to allow for multiple RTEMS +tasks to use RPC/XDR routines. If more than one task is to call +an RPC/XDR routine, the additional tasks must call: + int rtems_rpc_task_init(void); +before calling any RPC/XDR routines. For example, the portmapper +calls this routine since the portmapper uses RPC/XDR routines in +a separate thread. +The return value is an RTEMS status code. + + +Porting Notes +============= +Most of the FreeBSD rpc library ports to RTEMS with little +or no modification beyond that required to provide for operation +in a multitasking environment. Multitasking operation was +provided by moving all `static persistence' variables into +a single structure and using an RTEMS task variable to point +to that structure. + +Some of the library, however, has not made it into the RTEMS +implementation. FreeBSD source files which have been left out include: +- Files which provide RPC to the AF_UNIX address family: + clnt_unix.c + svc_unix.c + An `ifndef __rtems__' was added to clnt_generic.c because clnt_unix.c + was omitted. +- Files which need NIS: + auth_time.c +- Files which provide DES authentication: + auth_des.c + authdes_prot.c + crypt_client.c + des_crypt.c + des_soft.c + getpublickey.c + key_call.c + key_prot_xdr.c + svc_auth_des.c + +The FreeBSD xdr source compiles and runs on RTEMS without modification. + +The original source was obtained from: + ftp://ftp.FreeBSD.org/pub/FreeBSD/ + branches/4.0-stable/src/lib/libc/rpc + branches/4.0-stable/src/lib/libc/xdr + branches/4.0-stable/src/include/rpc + branches/4.0-stable/src/include/rpcsvc diff --git a/c/src/exec/librpc/include/Makefile.am b/c/src/exec/librpc/include/Makefile.am index d5385c1f70..bb33b0a8b6 100644 --- a/c/src/exec/librpc/include/Makefile.am +++ b/c/src/exec/librpc/include/Makefile.am @@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = foreign 1.4 -SUBDIRS = rpc +SUBDIRS = rpc rpcsvc include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/librpc/include/rpc/Makefile.am b/c/src/exec/librpc/include/rpc/Makefile.am index 5ca801b3c9..a917bd86dc 100644 --- a/c/src/exec/librpc/include/rpc/Makefile.am +++ b/c/src/exec/librpc/include/rpc/Makefile.am @@ -4,14 +4,15 @@ AUTOMAKE_OPTIONS = foreign 1.4 -H_FILES = auth.h rpc.h svc.h types.h clnt.h rpc_msg.h svc_auth.h xdr.h +H_FILES = auth.h auth_des.h auth_unix.h clnt.h des.h des_crypt.h pmap_clnt.h \ + pmap_prot.h pmap_rmt.h rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h \ + types.h xdr.h noinst_HEADERS = $(H_FILES) if HAS_NETWORKING -PREINSTALL_FILES = \ -$(PROJECT_INCLUDE)/rpc \ -$(H_FILES:%=$(PROJECT_INCLUDE)/rpc/%) +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rpc \ + $(H_FILES:%=$(PROJECT_INCLUDE)/rpc/%) $(PROJECT_INCLUDE)/rpc: @$(mkinstalldirs) $@ @@ -19,8 +20,6 @@ $(PROJECT_INCLUDE)/rpc/%.h: %.h $(INSTALL_DATA) $< $@ endif -all-am: $(PREINSTALL_FILES) -debug-am: $(PREINSTALL_FILES) -profile-am: $(PREINSTALL_FILES) +all-local: $(PREINSTALL_FILES) include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/librpc/include/rpc/auth.h b/c/src/exec/librpc/include/rpc/auth.h index 8f14d144f6..a15be39185 100644 --- a/c/src/exec/librpc/include/rpc/auth.h +++ b/c/src/exec/librpc/include/rpc/auth.h @@ -1,7 +1,3 @@ -#ifndef RPC_AUTH_H -#define RPC_AUTH_H - -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,26 +5,30 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)auth.h 1.17 88/02/08 SMI + * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC + * $FreeBSD: src/include/rpc/auth.h,v 1.15 1999/08/27 23:45:02 peter Exp $ */ /* @@ -41,6 +41,10 @@ * "sessions". */ +#ifndef _RPC_AUTH_H +#define _RPC_AUTH_H +#include <sys/cdefs.h> +#include <sys/socket.h> #define MAX_AUTH_BYTES 400 #define MAXNETNAMELEN 255 /* maximum length of network user's name */ @@ -67,13 +71,15 @@ enum auth_stat { union des_block { struct { - u_int32 high; - u_int32 low; + u_int32_t high; + u_int32_t low; } key; char c[8]; }; typedef union des_block des_block; -extern bool_t xdr_des_block(); +__BEGIN_DECLS +extern bool_t xdr_des_block __P((XDR *, des_block *)); +__END_DECLS /* * Authentication info. Opaque to client. @@ -83,21 +89,29 @@ struct opaque_auth { caddr_t oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; +__BEGIN_DECLS +bool_t xdr_opaque_auth __P((XDR *xdrs, struct opaque_auth *ap)); +__END_DECLS /* * Auth handle, interface to client side authenticators. */ -typedef struct { +typedef struct __rpc_auth { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops { - void (*ah_nextverf)(); - int (*ah_marshal)(); /* nextverf & serialize */ - int (*ah_validate)(); /* validate varifier */ - int (*ah_refresh)(); /* refresh credentials */ - void (*ah_destroy)(); /* destroy this structure */ + void (*ah_nextverf) __P((struct __rpc_auth *)); + /* nextverf & serialize */ + int (*ah_marshal) __P((struct __rpc_auth *, XDR *)); + /* validate verifier */ + int (*ah_validate) __P((struct __rpc_auth *, + struct opaque_auth *)); + /* refresh credentials */ + int (*ah_refresh) __P((struct __rpc_auth *)); + /* destroy this structure */ + void (*ah_destroy) __P((struct __rpc_auth *)); } *ah_ops; caddr_t ah_private; } AUTH; @@ -139,7 +153,6 @@ typedef struct { extern struct opaque_auth _null_auth; - /* * These are the various implementations of client side authenticators. */ @@ -153,15 +166,95 @@ extern struct opaque_auth _null_auth; * int len; * int *aup_gids; */ -extern AUTH *authunix_create(); -extern AUTH *authunix_create_default(); /* takes no parameters */ -extern AUTH *authnone_create(); /* takes no parameters */ -extern AUTH *authdes_create(); +__BEGIN_DECLS +struct sockaddr_in; +extern AUTH *authunix_create __P((char *, int, int, int, int *)); +extern AUTH *authunix_create_default __P((void)); +extern AUTH *authnone_create __P((void)); +__END_DECLS + +/* Forward compatibility with TI-RPC */ +#define authsys_create authunix_create +#define authsys_create_default authunix_create_default + +/* + * DES style authentication + * AUTH *authdes_create(servername, window, timehost, ckey) + * char *servername; - network name of server + * u_int window; - time to live + * struct sockaddr *timehost; - optional hostname to sync with + * des_block *ckey; - optional conversation key to use + */ +__BEGIN_DECLS +extern AUTH *authdes_create __P(( char *, u_int, struct sockaddr *, des_block * )); +#ifdef NOTYET +/* + * TI-RPC supports this call, but it requires the inclusion of + * NIS+-specific headers which would require the inclusion of other + * headers which would result in a tangled mess. For now, the NIS+ + * code prototypes this routine internally. + */ +extern AUTH *authdes_pk_create __P(( char *, netobj *, u_int, + struct sockaddr *, des_block *, + nis_server * )); +#endif +__END_DECLS + +/* + * Netname manipulation routines. + */ +__BEGIN_DECLS +extern int netname2user __P(( char *, uid_t *, gid_t *, int *, gid_t *)); +extern int netname2host __P(( char *, char *, int )); +extern int getnetname __P(( char * )); +extern int user2netname __P(( char *, uid_t, char * )); +extern int host2netname __P(( char *, char *, char * )); +extern void passwd2des __P(( char *, char * )); +__END_DECLS + +/* + * Keyserv interface routines. + * XXX Should not be here. + */ +#ifndef HEXKEYBYTES +#define HEXKEYBYTES 48 +#endif +typedef char kbuf[HEXKEYBYTES]; +typedef char *namestr; + +struct netstarg { + kbuf st_priv_key; + kbuf st_pub_key; + namestr st_netname; +}; + +__BEGIN_DECLS +extern int key_decryptsession __P(( const char *, des_block * )); +extern int key_decryptsession_pk __P(( char *, netobj *, des_block * )); +extern int key_encryptsession __P(( const char *, des_block * )); +extern int key_encryptsession_pk __P(( char *, netobj *, des_block * )); +extern int key_gendes __P(( des_block * )); +extern int key_setsecret __P(( const char * )); +extern int key_secretkey_is_set __P(( void )); +extern int key_setnet __P(( struct netstarg * )); +extern int key_get_conv __P(( char *, des_block * )); +__END_DECLS + +/* + * Publickey routines. + */ +__BEGIN_DECLS +extern int getpublickey __P(( char *, char * )); +extern int getpublicandprivatekey __P(( char *, char * )); +extern int getsecretkey __P(( char *, char *, char * )); +__END_DECLS + #define AUTH_NONE 0 /* no authentication */ #define AUTH_NULL 0 /* backward compatibility */ #define AUTH_UNIX 1 /* unix style (uid, gids) */ +#define AUTH_SYS 1 /* forward compatibility */ #define AUTH_SHORT 2 /* short hand unix style */ #define AUTH_DES 3 /* des style (encrypted timestamps) */ -#endif /* RPC_AUTH_H */ +#endif /* !_RPC_AUTH_H */ diff --git a/c/src/exec/librpc/include/rpc/auth_des.h b/c/src/exec/librpc/include/rpc/auth_des.h index e69de29bb2..a7635f87e1 100644 --- a/c/src/exec/librpc/include/rpc/auth_des.h +++ b/c/src/exec/librpc/include/rpc/auth_des.h @@ -0,0 +1,109 @@ +/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Copyright (c) 1988 by Sun Microsystems, Inc. + */ + +/* + * auth_des.h, Protocol for DES style authentication for RPC + */ + +#ifndef _AUTH_DES_ +#define _AUTH_DES_ + +/* + * 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 */ + des_block key; /* conversation key */ + u_long window; /* associated window */ +}; + + +/* + * A credential + */ +struct authdes_cred { + enum authdes_namekind adc_namekind; + struct authdes_fullname adc_fullname; + u_long 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; +}; + +/* + * 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 + +__BEGIN_DECLS +extern int authdes_getucred __P(( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * )); +__END_DECLS + +#endif /* ndef _AUTH_DES_ */ diff --git a/c/src/exec/librpc/include/rpc/auth_unix.h b/c/src/exec/librpc/include/rpc/auth_unix.h index e69de29bb2..4b015b67ab 100644 --- a/c/src/exec/librpc/include/rpc/auth_unix.h +++ b/c/src/exec/librpc/include/rpc/auth_unix.h @@ -0,0 +1,84 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)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.10 1999/08/27 23:45:03 peter 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 _RPC_AUTH_UNIX_H +#define _RPC_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; + int aup_uid; + int aup_gid; + u_int aup_len; + int *aup_gids; +}; + +#define authsys_parms authunix_parms + +__BEGIN_DECLS +extern bool_t xdr_authunix_parms __P((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 /* !_RPC_AUTH_UNIX_H */ diff --git a/c/src/exec/librpc/include/rpc/clnt.h b/c/src/exec/librpc/include/rpc/clnt.h index faefdb5d50..dc0f12d25c 100644 --- a/c/src/exec/librpc/include/rpc/clnt.h +++ b/c/src/exec/librpc/include/rpc/clnt.h @@ -1,7 +1,3 @@ -#ifndef RPC_CLNT_H -#define RPC_CLNT_H - -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,26 +5,30 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)clnt.h 1.31 88/02/08 SMI + * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/clnt.h,v 1.11 1999/08/27 23:45:03 peter Exp $ */ /* @@ -37,8 +37,10 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef _CLNT_ -#define _CLNT_ +#ifndef _RPC_CLNT_H_ +#define _RPC_CLNT_H_ +#include <sys/cdefs.h> +#include <sys/un.h> /* * Rpc calls return an enum clnt_stat. This should be looked at more, @@ -90,15 +92,15 @@ enum clnt_stat { struct rpc_err { enum clnt_stat re_status; union { - int RE_errno; /* realated system error */ + int RE_errno; /* related system error */ enum auth_stat RE_why; /* why the auth error occurred */ struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ + u_int32_t low; /* lowest verion supported */ + u_int32_t high; /* highest verion supported */ } RE_vers; struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long s2; + int32_t s1; + int32_t s2; } RE_lb; /* life boot & debugging only */ } ru; #define re_errno ru.RE_errno @@ -113,15 +115,26 @@ struct rpc_err { * Created by individual implementations, see e.g. rpc_udp.c. * Client is responsible for initializing auth, see e.g. auth_none.c. */ -typedef struct { +typedef struct __rpc_client { AUTH *cl_auth; /* authenticator */ struct clnt_ops { - enum clnt_stat (*cl_call)(); /* call remote procedure */ - void (*cl_abort)(); /* abort a call */ - void (*cl_geterr)(); /* get specific error code */ - bool_t (*cl_freeres)(); /* frees results */ - void (*cl_destroy)();/* destroy this structure */ - bool_t (*cl_control)();/* the ioctl() of rpc */ + /* call remote procedure */ + enum clnt_stat (*cl_call) __P((struct __rpc_client *, + u_long, xdrproc_t, caddr_t, xdrproc_t, + caddr_t, struct timeval)); + /* abort a call */ + void (*cl_abort) __P((struct __rpc_client *)); + /* get specific error code */ + void (*cl_geterr) __P((struct __rpc_client *, + struct rpc_err *)); + /* frees results */ + bool_t (*cl_freeres) __P((struct __rpc_client *, + xdrproc_t, caddr_t)); + /* destroy this structure */ + void (*cl_destroy) __P((struct __rpc_client *)); + /* the ioctl() of rpc */ + bool_t (*cl_control) __P((struct __rpc_client *, u_int, + void *)); } *cl_ops; caddr_t cl_private; /* private stuff */ } CLIENT; @@ -146,9 +159,11 @@ typedef struct { * 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)) + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \ + xres, (caddr_t)resp, secs)) #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \ + xres, (caddr_t)resp, secs)) /* * void @@ -188,11 +203,30 @@ typedef struct { #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* - * control operations that apply to both udp and tcp transports + * control operations that apply to udp, tcp and unix transports + * + * Note: options marked XXX are no-ops in this implementation of RPC. + * The are present in TI-RPC but can't be implemented here since they + * depend on the presence of STREAMS/TLI, which we don't have. + * */ #define CLSET_TIMEOUT 1 /* set timeout (timeval) */ #define CLGET_TIMEOUT 2 /* get timeout (timeval) */ #define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ +#define CLGET_FD 6 /* get connections file descriptor */ +#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */ +#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ +#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy */ +#define CLGET_XID 10 /* Get xid */ +#define CLSET_XID 11 /* Set xid */ +#define CLGET_VERS 12 /* Get version number */ +#define CLSET_VERS 13 /* Set version number */ +#define CLGET_PROG 14 /* Get program number */ +#define CLSET_PROG 15 /* Set program number */ +#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */ +#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */ +#define CLSET_POP_TIMOD 18 /* pop timod XXX */ + /* * udp only control operations */ @@ -200,6 +234,12 @@ typedef struct { #define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* + * Operations which GSSAPI needs. (Bletch.) + */ +#define CLGET_LOCAL_ADDR 19 /* get local addr (sockaddr) */ + + +/* * void * CLNT_DESTROY(rh); * CLIENT *rh; @@ -209,7 +249,7 @@ typedef struct { /* - * RPCTEST is a test program which is accessable on every rpc + * RPCTEST is a test program which is accessible on every rpc * transport/port. It is used for testing, performance evaluation, * and network administration. */ @@ -227,7 +267,7 @@ typedef struct { /* * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a + * implementations of client side rpc. They can return NULL if a * creation failure occurs. */ @@ -238,21 +278,24 @@ typedef struct { * u_long prog; * u_long vers; */ -extern CLIENT *clntraw_create(); +__BEGIN_DECLS +extern CLIENT *clntraw_create __P((u_long, u_long)); +__END_DECLS /* - * Generic client creation routine. Supported protocols are "udp" and "tcp" + * Generic client creation routine. Supported protocols are "udp", "tcp" + * and "unix". + * CLIENT * + * clnt_create(host, prog, vers, prot); + * char *host; -- hostname + * u_long prog; -- program number + * u_long vers; -- version number + * char *prot; -- protocol */ -extern CLIENT * -clnt_create(/*host, prog, vers, prot*/); /* - char *host; -- hostname - u_long prog; -- program number - u_long vers; -- version number - char *prot; -- protocol -*/ - - +__BEGIN_DECLS +extern CLIENT *clnt_create __P((char *, u_long, u_long, char *)); +__END_DECLS /* @@ -266,7 +309,15 @@ clnt_create(/*host, prog, vers, prot*/); /* * u_int sendsz; * u_int recvsz; */ -extern CLIENT *clnttcp_create(); +__BEGIN_DECLS +extern CLIENT *clnttcp_create __P((struct sockaddr_in *, + u_long, + u_long, + int *, + u_int, + u_int)); +__END_DECLS + /* * UDP based rpc. @@ -289,27 +340,69 @@ extern CLIENT *clnttcp_create(); * u_int sendsz; * u_int recvsz; */ -extern CLIENT *clntudp_create(); -extern CLIENT *clntudp_bufcreate(); +__BEGIN_DECLS +extern CLIENT *clntudp_create __P((struct sockaddr_in *, + u_long, + u_long, + struct timeval, + int *)); +extern CLIENT *clntudp_bufcreate __P((struct sockaddr_in *, + u_long, + u_long, + struct timeval, + int *, + u_int, + u_int)); +__END_DECLS + + +/* + * AF_UNIX based rpc + * CLIENT * + * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) + * struct sockaddr_un *raddr; + * u_long prog; + * u_long version; + * register int *sockp; + * u_int sendsz; + * u_int recvsz; + */ +__BEGIN_DECLS +extern CLIENT *clntunix_create __P((struct sockaddr_un *, + u_long, + u_long, + int *, + u_int, + u_int)); +__END_DECLS + /* * Print why creation failed */ -void clnt_pcreateerror(/* char *msg */); /* stderr */ -char *clnt_spcreateerror(/* char *msg */); /* string */ +__BEGIN_DECLS +extern void clnt_pcreateerror __P((char *)); /* stderr */ +extern char *clnt_spcreateerror __P((char *)); /* string */ +__END_DECLS /* * Like clnt_perror(), but is more verbose in its output - */ -void clnt_perrno(/* enum clnt_stat num */); /* stderr */ + */ +__BEGIN_DECLS +extern void clnt_perrno __P((enum clnt_stat)); /* stderr */ +extern char *clnt_sperrno __P((enum clnt_stat)); /* string */ +__END_DECLS /* * Print an English error message, given the client error code */ -void clnt_perror(/* CLIENT *clnt, char *msg */); /* stderr */ -char *clnt_sperror(/* CLIENT *clnt, char *msg */); /* string */ +__BEGIN_DECLS +extern void clnt_perror __P((CLIENT *, char *)); /* stderr */ +extern char *clnt_sperror __P((CLIENT *, char *)); /* string */ +__END_DECLS -/* + +/* * If a creation fails, the following allows the user to figure out why. */ struct rpc_createerr { @@ -320,17 +413,7 @@ struct rpc_createerr { extern struct rpc_createerr rpc_createerr; - -/* - * Copy error message to buffer. - */ -char *clnt_sperrno(/* enum clnt_stat num */); /* string */ - - - #define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ #define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ -#endif /*!_CLNT_*/ - -#endif /* RPC_CLNT_H */ +#endif /* !_RPC_CLNT_H */ diff --git a/c/src/exec/librpc/include/rpc/des.h b/c/src/exec/librpc/include/rpc/des.h index e69de29bb2..f41e5a7804 100644 --- a/c/src/exec/librpc/include/rpc/des.h +++ b/c/src/exec/librpc/include/rpc/des.h @@ -0,0 +1,82 @@ +/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * 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 __P(( char *, int, struct desparams * )); diff --git a/c/src/exec/librpc/include/rpc/des_crypt.h b/c/src/exec/librpc/include/rpc/des_crypt.h index e69de29bb2..c9458fcf24 100644 --- a/c/src/exec/librpc/include/rpc/des_crypt.h +++ b/c/src/exec/librpc/include/rpc/des_crypt.h @@ -0,0 +1,120 @@ +/* + * @(#)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.2 1999/12/29 05:00:42 peter Exp $ + * + * des_crypt.h, des library routine interface + * Copyright (C) 1986, Sun Microsystems, Inc. + */ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#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 +#ifdef __STDC__ +int cbc_crypt __P(( char *, char *, unsigned int, unsigned int, char *)); +#else +cbc_crypt(/* key, buf, len, mode, ivec */); /* + char *key; + char *buf; + unsigned len; + unsigned mode; + char *ivec; +*/ +#endif + +/* + * Electronic Code Book mode + */ +#ifdef __STDC__ +int ecb_crypt __P(( char *, char *, unsigned int, unsigned int )); +#else +ecb_crypt(/* key, buf, len, mode */); /* + char *key; + char *buf; + unsigned len; + unsigned mode; +*/ +#endif +__END_DECLS + +#ifndef _KERNEL +/* + * Set des parity for a key. + * DES parity is odd and in the low bit of each byte + */ +__BEGIN_DECLS +#ifdef __STDC__ +void des_setparity __P(( char *)); +#else +void +des_setparity(/* key */); /* + char *key; +*/ +#endif +__END_DECLS +#endif diff --git a/c/src/exec/librpc/include/rpc/pmap_clnt.h b/c/src/exec/librpc/include/rpc/pmap_clnt.h index e69de29bb2..2f4a2780dd 100644 --- a/c/src/exec/librpc/include/rpc/pmap_clnt.h +++ b/c/src/exec/librpc/include/rpc/pmap_clnt.h @@ -0,0 +1,85 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)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.11 1999/08/27 23:45:04 peter 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_PMAPCLNT_H +#define _RPC_PMAPCLNT_H +#include <sys/cdefs.h> + +__BEGIN_DECLS +extern bool_t pmap_set __P((u_long, u_long, int, int)); +extern bool_t pmap_unset __P((u_long, u_long)); +extern struct pmaplist *pmap_getmaps __P((struct sockaddr_in *)); +extern enum clnt_stat pmap_rmtcall __P((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 __P((u_long, u_long, u_long, + xdrproc_t, char *, + xdrproc_t, char *, + bool_t (*) __P((caddr_t, + struct sockaddr_in *)))); +extern u_short pmap_getport __P((struct sockaddr_in *, + u_long, u_long, u_int)); +__END_DECLS + +#endif /* !_RPC_PMAPCLNT_H */ diff --git a/c/src/exec/librpc/include/rpc/pmap_prot.h b/c/src/exec/librpc/include/rpc/pmap_prot.h index e69de29bb2..14f0837bfe 100644 --- a/c/src/exec/librpc/include/rpc/pmap_prot.h +++ b/c/src/exec/librpc/include/rpc/pmap_prot.h @@ -0,0 +1,104 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)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.10 1999/08/27 23:45:04 peter 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_PMAPPROT_H +#define _RPC_PMAPPROT_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 __P((XDR *, struct pmap *)); +extern bool_t xdr_pmaplist __P((XDR *, struct pmaplist **)); +__END_DECLS + +#endif /* !_RPC_PMAPPROT_H */ diff --git a/c/src/exec/librpc/include/rpc/pmap_rmt.h b/c/src/exec/librpc/include/rpc/pmap_rmt.h index e69de29bb2..e632f8deca 100644 --- a/c/src/exec/librpc/include/rpc/pmap_rmt.h +++ b/c/src/exec/librpc/include/rpc/pmap_rmt.h @@ -0,0 +1,63 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * from: @(#)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.10 1999/08/27 23:45:05 peter Exp $ + */ + +/* + * Structures and XDR routines for parameters to and replies from + * the portmapper remote-call-service. + * + * Copyright (C) 1986, Sun Microsystems, Inc. + */ + +#ifndef _RPC_PMAPRMT_H +#define _RPC_PMAPRMT_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 __P((XDR *, struct rmtcallargs *)); +extern bool_t xdr_rmtcallres __P((XDR *, struct rmtcallres *)); +__END_DECLS + +#endif /* !_RPC_PMAPRMT_H */ diff --git a/c/src/exec/librpc/include/rpc/rpc.h b/c/src/exec/librpc/include/rpc/rpc.h index 0a0affd82a..f68dc1be89 100644 --- a/c/src/exec/librpc/include/rpc/rpc.h +++ b/c/src/exec/librpc/include/rpc/rpc.h @@ -1,7 +1,3 @@ -#ifndef RPC_H -#define RPC_H - -/* @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC; from 1.9 88/02/08 SMI */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,11 +5,11 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. @@ -29,6 +25,10 @@ * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)rpc.h 1.9 88/02/08 SMI + * from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC + * $FreeBSD: src/include/rpc/rpc.h,v 1.12 2000/01/26 09:02:40 shin Exp $ */ /* @@ -37,12 +37,11 @@ * * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef __RPC_HEADER__ -#define __RPC_HEADER__ +#ifndef _RPC_RPC_H +#define _RPC_RPC_H #include <rpc/types.h> /* some typedefs */ #include <netinet/in.h> -#include <sys/socket.h> /* external data representation interfaces */ #include <rpc/xdr.h> /* generic (de)serializer */ @@ -55,12 +54,12 @@ /* semi-private protocol headers */ #include <rpc/rpc_msg.h> /* protocol for rpc messages */ -/*#include "auth_unix.h" * protocol for unix style cred */ +#include <rpc/auth_unix.h> /* protocol for unix style cred */ /* - * Uncomment-out the next line if you are building the rpc library with + * Uncomment-out the next line if you are building the rpc library with * DES Authentication (see the README file in the secure_rpc/ directory). */ -/*#include "auth_des.h" * protocol for des style cred */ +#include <rpc/auth_des.h> /* protocol for des style cred */ /* Server side only remote procedure callee */ #include <rpc/svc.h> /* service manager and multiplexer */ @@ -79,8 +78,60 @@ struct rpcent { int r_number; /* rpc program number */ }; -struct rpcent *getrpcbyname(), *getrpcbynumber(), *getrpcent(); +__BEGIN_DECLS +extern struct rpcent *getrpcbyname __P((char *)); +extern struct rpcent *getrpcbynumber __P((int)); +extern struct rpcent *getrpcent __P((void)); +extern int getrpcport __P((char *host, int prognum, int versnum, int proto)); +extern void setrpcent __P((int)); +extern void endrpcent __P((void)); + +extern int bindresvport __P((int, struct sockaddr_in *)); +extern int bindresvport_sa __P((int, struct sockaddr *)); +extern int get_myaddress __P((struct sockaddr_in *)); +__END_DECLS + +int rtems_rpc_task_init (void); +int rtems_rpc_start_portmapper (int priority); + +#ifdef _RTEMS_RPC_INTERNAL_ +/* + * Multi-threaded support + * Group all global and static variables into a single spot. + * This area will be allocated on a per-task basis + */ +struct rtems_rpc_task_variables { + int svc_svc_maxfd; + fd_set svc_svc_fdset; + void *svc_xports; + int svc_xportssize; + int svc__svc_fdsetsize; + void *svc__svc_fdset; + void *svc_svc_head; + + void *clnt_perror_buf; + + void *clnt_raw_private; + + void *call_rpc_private; + + void *svc_raw_private; + + void *svc_simple_proglst; + void *svc_simple_pl; + void *svc_simple_transp; + + void *rpcdname_default_domain; + + void *svc_auths_Auths; +}; +extern void *rtems_rpc_task_variables; + +#define svc_maxfd (((struct rtems_rpc_task_variables *)rtems_rpc_task_variables)->svc_svc_maxfd) +#define svc_fdset (((struct rtems_rpc_task_variables *)rtems_rpc_task_variables)->svc_svc_fdset) +#define __svc_fdsetsize (((struct rtems_rpc_task_variables *)rtems_rpc_task_variables)->svc__svc_fdsetsize) +#define __svc_fdset (fd_set *)(((struct rtems_rpc_task_variables *)rtems_rpc_task_variables)->svc__svc_fdset) -#endif /* ndef __RPC_HEADER__ */ +#endif /* _RTEMS_RPC_INTERNAL_ */ -#endif /* RPC_H */ +#endif /* !_RPC_RPC_H */ diff --git a/c/src/exec/librpc/include/rpc/rpc_com.h b/c/src/exec/librpc/include/rpc/rpc_com.h index e69de29bb2..2cf5995d2d 100644 --- a/c/src/exec/librpc/include/rpc/rpc_com.h +++ b/c/src/exec/librpc/include/rpc/rpc_com.h @@ -0,0 +1,78 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* + * 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 + +/* From: #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * File descriptor to be used on xxx_create calls to get default descriptor + */ +#define RPC_ANYSOCK -1 +#define RPC_ANYFD RPC_ANYSOCK +/* + * The max size of the transport, if the size cannot be determined + * by other means. + */ +#define RPC_MAXDATASIZE 9000 +#define RPC_MAXADDRSIZE 1024 + +#if defined(__STDC__) || defined(__cplusplus) +extern u_int __rpc_get_t_size (int, long); +extern u_int __rpc_get_a_size (long); +extern int __rpc_dtbsize (void); +extern int _rpc_dtablesize (void); +extern int _rpc_get_default_domain(char **); +#else +extern u_int __rpc_get_t_size (); +extern u_int __rpc_get_a_size (); +extern int __rpc_dtbsize (); +extern int _rpc_dtablesize (); +extern int _rpc_get_default_domain(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _RPC_RPCCOM_H */ diff --git a/c/src/exec/librpc/include/rpc/rpc_msg.h b/c/src/exec/librpc/include/rpc/rpc_msg.h index 2f34fb614c..bc5dc223fd 100644 --- a/c/src/exec/librpc/include/rpc/rpc_msg.h +++ b/c/src/exec/librpc/include/rpc/rpc_msg.h @@ -1,7 +1,3 @@ -#ifndef RPC_MSG_H -#define RPC_MSG_H - -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,28 +5,31 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)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.12 1999/08/27 23:45:05 peter Exp $ */ -/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ /* * rpc_msg.h @@ -39,6 +38,9 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ +#ifndef _RPC_RPCMSG_H +#define _RPC_RPCMSG_H + #define RPC_MSG_VERSION ((u_long) 2) #define RPC_SERVICE_PORT ((u_short) 2048) @@ -86,8 +88,8 @@ struct accepted_reply { enum accept_stat ar_stat; union { struct { - u_long low; - u_long high; + u_int32_t low; + u_int32_t high; } AR_versions; struct { caddr_t where; @@ -106,8 +108,8 @@ struct rejected_reply { enum reject_stat rj_stat; union { struct { - u_long low; - u_long high; + u_int32_t low; + u_int32_t high; } RJ_versions; enum auth_stat RJ_why; /* why authentication did not work */ } ru; @@ -132,10 +134,10 @@ struct reply_body { * Body of an rpc request call. */ struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; + u_int32_t cb_rpcvers; /* must be equal to two */ + u_int32_t cb_prog; + u_int32_t cb_vers; + u_int32_t cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; /* protocol specific - provided by client */ }; @@ -144,7 +146,7 @@ struct call_body { * The rpc message */ struct rpc_msg { - u_long rm_xid; + u_int32_t rm_xid; enum msg_type rm_direction; union { struct call_body RM_cmb; @@ -156,14 +158,14 @@ struct rpc_msg { #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(); +extern bool_t xdr_callmsg __P((XDR *, struct rpc_msg *)); /* * XDR routine to pre-serialize the static part of a rpc message. @@ -171,7 +173,7 @@ extern bool_t xdr_callmsg(); * XDR *xdrs; * struct rpc_msg *cmsg; */ -extern bool_t xdr_callhdr(); +extern bool_t xdr_callhdr __P((XDR *, struct rpc_msg *)); /* * XDR routine to handle a rpc reply. @@ -179,7 +181,7 @@ extern bool_t xdr_callhdr(); * XDR *xdrs; * struct rpc_msg *rmsg; */ -extern bool_t xdr_replymsg(); +extern bool_t xdr_replymsg __P((XDR *, struct rpc_msg *)); /* * Fills in the error part of a reply message. @@ -187,6 +189,8 @@ extern bool_t xdr_replymsg(); * struct rpc_msg *msg; * struct rpc_err *error; */ -extern void _seterr_reply(); +struct rpc_err; +extern void _seterr_reply __P((struct rpc_msg *, struct rpc_err *)); +__END_DECLS -#endif /* RPC_MSG_H */ +#endif /* !_RPC_RPCMSG_H */ diff --git a/c/src/exec/librpc/include/rpc/svc.h b/c/src/exec/librpc/include/rpc/svc.h index c576b5538b..e57a7454be 100644 --- a/c/src/exec/librpc/include/rpc/svc.h +++ b/c/src/exec/librpc/include/rpc/svc.h @@ -1,8 +1,3 @@ - -#ifndef RPC_SVC_H -#define RPC_SVC_H - -/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -10,26 +5,30 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)svc.h 1.20 88/02/08 SMI + * from: @(#)svc.h 2.2 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/svc.h,v 1.16 1999/12/29 05:00:43 peter Exp $ */ /* @@ -38,8 +37,9 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef __SVC_HEADER__ -#define __SVC_HEADER__ +#ifndef _RPC_SVC_H +#define _RPC_SVC_H +#include <sys/cdefs.h> /* * This interface must manage two items concerning remote procedure calling: @@ -69,19 +69,31 @@ enum xprt_stat { XPRT_IDLE }; +struct rpc_msg; + /* * Server side transport handle */ -typedef struct { +typedef struct __rpc_svcxprt { int xp_sock; u_short xp_port; /* associated port number */ struct xp_ops { - bool_t (*xp_recv)(); /* receive incomming requests */ - enum xprt_stat (*xp_stat)(); /* get transport status */ - bool_t (*xp_getargs)(); /* get arguments */ - bool_t (*xp_reply)(); /* send reply */ - bool_t (*xp_freeargs)();/* free mem allocated for args */ - void (*xp_destroy)(); /* destroy this struct */ + /* receive incoming requests */ + bool_t (*xp_recv) __P((struct __rpc_svcxprt *, + struct rpc_msg *)); + /* get transport status */ + enum xprt_stat (*xp_stat) __P((struct __rpc_svcxprt *)); + /* get arguments */ + bool_t (*xp_getargs) __P((struct __rpc_svcxprt *, xdrproc_t, + caddr_t)); + /* send reply */ + bool_t (*xp_reply) __P((struct __rpc_svcxprt *, + struct rpc_msg *)); + /* free mem allocated for args */ + bool_t (*xp_freeargs) __P((struct __rpc_svcxprt *, xdrproc_t, + caddr_t)); + /* destroy this struct */ + void (*xp_destroy) __P((struct __rpc_svcxprt *)); } *xp_ops; int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ @@ -138,9 +150,9 @@ typedef struct { * Service request */ struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long rq_proc; /* the desired procedure */ + u_int32_t rq_prog; /* service program number */ + u_int32_t rq_vers; /* service protocol version */ + u_int32_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ caddr_t rq_clntcred; /* read only cooked cred */ SVCXPRT *rq_xprt; /* associated transport */ @@ -155,9 +167,12 @@ struct svc_req { * u_long prog; * u_long vers; * void (*dispatch)(); - * int protocol; (like TCP or UDP, zero means do not register) + * int protocol; (like TCP or UDP, zero means do not register) */ -extern bool_t svc_register(); +__BEGIN_DECLS +extern bool_t svc_register __P((SVCXPRT *, u_long, u_long, + void (*) __P((struct svc_req *, SVCXPRT *)), int)); +__END_DECLS /* * Service un-registration @@ -166,7 +181,9 @@ extern bool_t svc_register(); * u_long prog; * u_long vers; */ -extern void svc_unregister(); +__BEGIN_DECLS +extern void svc_unregister __P((u_long, u_long)); +__END_DECLS /* * Transport registration. @@ -174,7 +191,9 @@ extern void svc_unregister(); * xprt_register(xprt) * SVCXPRT *xprt; */ -extern void xprt_register(); +__BEGIN_DECLS +extern void xprt_register __P((SVCXPRT *)); +__END_DECLS /* * Transport un-register @@ -182,7 +201,9 @@ extern void xprt_register(); * xprt_unregister(xprt) * SVCXPRT *xprt; */ -extern void xprt_unregister(); +__BEGIN_DECLS +extern void xprt_unregister __P((SVCXPRT *)); +__END_DECLS @@ -190,7 +211,7 @@ extern void xprt_unregister(); /* * When the service routine is called, it must first check to see if it * knows about the procedure; if not, it should call svcerr_noproc - * and return. If so, it should deserialize its arguments via + * 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 @@ -201,7 +222,7 @@ extern void xprt_unregister(); * 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. + * 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 @@ -213,15 +234,17 @@ extern void xprt_unregister(); * deadlock the caller and server processes! */ -extern bool_t svc_sendreply(); -extern void svcerr_decode(); -extern void svcerr_weakauth(); -extern void svcerr_noproc(); -extern void svcerr_progvers(); -extern void svcerr_auth(); -extern void svcerr_noprog(); -extern void svcerr_systemerr(); - +__BEGIN_DECLS +extern bool_t svc_sendreply __P((SVCXPRT *, xdrproc_t, char *)); +extern void svcerr_decode __P((SVCXPRT *)); +extern void svcerr_weakauth __P((SVCXPRT *)); +extern void svcerr_noproc __P((SVCXPRT *)); +extern void svcerr_progvers __P((SVCXPRT *, u_long, u_long)); +extern void svcerr_auth __P((SVCXPRT *, enum auth_stat)); +extern void svcerr_noprog __P((SVCXPRT *)); +extern void svcerr_systemerr __P((SVCXPRT *)); +__END_DECLS + /* * Lowest level dispatching -OR- who owns this process anyway. * Somebody has to wait for incoming requests and then call the correct @@ -235,24 +258,26 @@ extern void svcerr_systemerr(); /* * Global keeper of rpc service descriptors in use - * dynamic; must be inspected before each call to select + * dynamic; must be inspected before each call to select */ -#ifdef FD_SETSIZE +extern int svc_maxfd; extern fd_set svc_fdset; #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ +#ifndef _KERNEL /* * a small program implemented by the svc_rpc implementation itself; * also see clnt.h for protocol numbers. */ extern void rpctest_service(); +#endif -extern void svc_getreq(); -extern void svc_getreqset(); /* takes fdset instead of int */ -extern void svc_run(); /* never returns */ +__BEGIN_DECLS +extern void svc_getreq __P((int)); +extern void svc_getreqset __P((fd_set *)); +extern void svc_getreqset2 __P((fd_set *, int)); /* XXX: nonstd, undoc */ +extern void svc_run __P((void)); +__END_DECLS /* * Socket to use on svcxxx_create call to get default socket @@ -266,26 +291,34 @@ extern void svc_run(); /* never returns */ /* * Memory based rpc for testing and timing. */ -extern SVCXPRT *svcraw_create(); +__BEGIN_DECLS +extern SVCXPRT *svcraw_create __P((void)); +__END_DECLS + /* * Udp based rpc. */ -extern SVCXPRT *svcudp_create(); -extern SVCXPRT *svcudp_bufcreate(); -extern int svcudp_enablecache(SVCXPRT *transp, u_long size); +__BEGIN_DECLS +extern SVCXPRT *svcudp_create __P((int)); +extern SVCXPRT *svcudp_bufcreate __P((int, u_int, u_int)); +__END_DECLS + /* * Tcp based rpc. */ -extern SVCXPRT *svctcp_create(); - +__BEGIN_DECLS +extern SVCXPRT *svctcp_create __P((int, u_int, u_int)); +extern SVCXPRT *svcfd_create __P((int, u_int, u_int)); +__END_DECLS +/* + * AF_UNIX socket based rpc. + */ +__BEGIN_DECLS +extern SVCXPRT *svcunix_create __P((int, u_int, u_int, char *)); +extern SVCXPRT *svcunixfd_create __P((int, u_int, u_int)); +__END_DECLS -#endif /* !__SVC_HEADER__ */ - -extern int _rpcsvccount; -extern int _rpcsvcstate; -extern int _SERVED; - -#endif /* RPC_SVC_H */ +#endif /* !_RPC_SVC_H */ diff --git a/c/src/exec/librpc/include/rpc/svc_auth.h b/c/src/exec/librpc/include/rpc/svc_auth.h index 5c233a6a47..a203d8cbeb 100644 --- a/c/src/exec/librpc/include/rpc/svc_auth.h +++ b/c/src/exec/librpc/include/rpc/svc_auth.h @@ -1,7 +1,3 @@ -#ifndef RPC_SVC_AUTH_H -#define RPC_SVC_AUTH_H - -/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,39 +5,52 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)svc_auth.h 1.6 86/07/16 SMI + * from: @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/svc_auth.h,v 1.12 1999/08/27 23:45:05 peter Exp $ */ -/* @(#)svc_auth.h 1.6 86/07/16 SMI */ /* * svc_auth.h, Service side of rpc authentication. - * + * * Copyright (C) 1984, Sun Microsystems, Inc. */ +#ifndef _RPC_SVCAUTH_H +#define _RPC_SVCAUTH_H + +struct rpc_msg; +struct svc_req; /* * Server side authenticator */ -extern enum auth_stat _authenticate(); +__BEGIN_DECLS +extern enum auth_stat _authenticate __P((struct svc_req *, struct rpc_msg *)); +extern int svc_auth_reg __P((int, enum auth_stat (*)(struct svc_req *, + struct rpc_msg *))); +extern enum auth_stat _svcauth_des __P((struct svc_req *, struct rpc_msg *)); +__END_DECLS -#endif /* SVC_AUTH_H */ +#endif /* !_RPC_SVCAUTH_H */ diff --git a/c/src/exec/librpc/include/rpc/types.h b/c/src/exec/librpc/include/rpc/types.h index b6d7eb3ccc..c907674c51 100644 --- a/c/src/exec/librpc/include/rpc/types.h +++ b/c/src/exec/librpc/include/rpc/types.h @@ -1,7 +1,3 @@ -#ifndef RPC_TYPES_H -#define RPC_TYPES_H - -/* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,52 +5,52 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)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.9 1999/08/27 23:45:06 peter Exp $ */ -/* @(#)types.h 1.18 87/07/24 SMI */ /* * Rpc additions to <sys/types.h> */ -#ifndef __TYPES_RPC_HEADER__ -#define __TYPES_RPC_HEADER__ +#ifndef _RPC_TYPES_H +#define _RPC_TYPES_H -/*#include <network/types.h>*/ -typedef unsigned long u_int32; /* 32-bit unsigned integers */ +#define bool_t int32_t +#define enum_t int32_t +#define __dontcare__ -1 -#define bool_t int -#define enum_t int #ifndef FALSE -# define FALSE (0) +# define FALSE (0) #endif #ifndef TRUE -# define TRUE (1) +# define TRUE (1) #endif -#define __dontcare__ -1 #ifndef NULL -# define NULL 0 +# define NULL 0 #endif -void *malloc(); #define mem_alloc(bsize) malloc(bsize) #define mem_free(ptr, bsize) free(ptr) @@ -63,13 +59,4 @@ void *malloc(); #endif #include <sys/time.h> -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK (u_long)0x7F000001 -#endif -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -#endif /* ndef __TYPES_RPC_HEADER__ */ - -#endif /* RPC_TYPES_H */ +#endif /* !_RPC_TYPES_H */ diff --git a/c/src/exec/librpc/include/rpc/xdr.h b/c/src/exec/librpc/include/rpc/xdr.h index ef2df51d93..460a1da5fb 100644 --- a/c/src/exec/librpc/include/rpc/xdr.h +++ b/c/src/exec/librpc/include/rpc/xdr.h @@ -1,7 +1,3 @@ -#ifndef RPC_XDR_H -#define RPC_XDR_H - -/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -9,28 +5,31 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * from: @(#)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.14 1999/12/29 05:00:44 peter Exp $ */ -/* @(#)xdr.h 1.19 87/04/22 SMI */ /* * xdr.h, External Data Representation Serialization Routines. @@ -38,8 +37,9 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef __XDR_HEADER__ -#define __XDR_HEADER__ +#ifndef _RPC_XDR_H +#define _RPC_XDR_H +#include <sys/cdefs.h> /* * XDR provides a conventional way for converting between C data @@ -90,33 +90,30 @@ enum xdr_op { * BYTES_PER_XDR_UNIT) /* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t)(); - -/* * The XDR handle. * Contains operation which is being applied to the stream, - * an operations vector for the paticular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular impelementation. + * 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 { +typedef struct __rpc_xdr { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { - bool_t (*x_getlong)(); /* get a long from underlying stream */ - bool_t (*x_putlong)(); /* put a long to " */ - bool_t (*x_getbytes)();/* get some bytes from " */ - bool_t (*x_putbytes)();/* put some bytes to " */ - u_int (*x_getpostn)();/* returns bytes off from beginning */ - bool_t (*x_setpostn)();/* lets you reposition the stream */ - long * (*x_inline)(); /* buf quick ptr to buffered data */ - void (*x_destroy)(); /* free privates of this xdr_stream */ + /* get a long from underlying stream */ + bool_t (*x_getlong) __P((struct __rpc_xdr *, long *)); + /* put a long to underlying stream */ + bool_t (*x_putlong) __P((struct __rpc_xdr *, long *)); + /* get some bytes from underlying stream */ + bool_t (*x_getbytes) __P((struct __rpc_xdr *, caddr_t, u_int)); + /* put some bytes to underlying stream */ + bool_t (*x_putbytes) __P((struct __rpc_xdr *, caddr_t, u_int)); + /* returns bytes off from beginning */ + u_int (*x_getpostn) __P((struct __rpc_xdr *)); + /* lets you reposition the stream */ + bool_t (*x_setpostn) __P((struct __rpc_xdr *, u_int)); + /* buf quick ptr to buffered data */ + int32_t *(*x_inline) __P((struct __rpc_xdr *, u_int)); + /* free privates of this xdr_stream */ + void (*x_destroy) __P((struct __rpc_xdr *)); } *x_ops; caddr_t x_public; /* users' data */ caddr_t x_private; /* pointer to private data */ @@ -125,6 +122,23 @@ typedef struct { } 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) __P((XDR *, void *, u_int)); +#else +/* + * XXX can't actually prototype it, because some take two args!!! + */ +typedef bool_t (*xdrproc_t) __P((/* XDR *, void *, u_int */)); +#endif + +/* * Operations defined on a XDR handle * * XDR *xdrs; @@ -192,7 +206,7 @@ struct xdr_discrim { }; /* - * In-line routines for fast encode/decode of primitve data types. + * 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 @@ -224,52 +238,77 @@ struct xdr_discrim { /* * These are the "generic" xdr routines. */ -extern bool_t xdr_void(); -extern bool_t xdr_int(); -extern bool_t xdr_u_int(); -extern bool_t xdr_long(); -extern bool_t xdr_u_long(); -extern bool_t xdr_short(); -extern bool_t xdr_u_short(); -extern bool_t xdr_bool(); -extern bool_t xdr_enum(); -extern bool_t xdr_array(); -extern bool_t xdr_bytes(); -extern bool_t xdr_opaque(); -extern bool_t xdr_string(); -extern bool_t xdr_union(); -extern bool_t xdr_char(); -extern bool_t xdr_u_char(); -extern bool_t xdr_vector(); -extern bool_t xdr_float(); -extern bool_t xdr_double(); -extern bool_t xdr_reference(); -extern bool_t xdr_pointer(); -extern bool_t xdr_wrapstring(); +__BEGIN_DECLS +extern bool_t xdr_void __P((void)); +extern bool_t xdr_int __P((XDR *, int *)); +extern bool_t xdr_u_int __P((XDR *, u_int *)); +extern bool_t xdr_long __P((XDR *, long *)); +extern bool_t xdr_u_long __P((XDR *, u_long *)); +extern bool_t xdr_short __P((XDR *, short *)); +extern bool_t xdr_u_short __P((XDR *, u_short *)); +extern bool_t xdr_int16_t __P((XDR *, int16_t *)); +extern bool_t xdr_u_int16_t __P((XDR *, u_int16_t *)); +extern bool_t xdr_int32_t __P((XDR *, int32_t *)); +extern bool_t xdr_u_int32_t __P((XDR *, u_int32_t *)); +extern bool_t xdr_int64_t __P((XDR *, int64_t *)); +extern bool_t xdr_u_int64_t __P((XDR *, u_int64_t *)); +extern bool_t xdr_bool __P((XDR *, bool_t *)); +extern bool_t xdr_enum __P((XDR *, enum_t *)); +extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t)); +extern bool_t xdr_bytes __P((XDR *, char **, u_int *, u_int)); +extern bool_t xdr_opaque __P((XDR *, caddr_t, u_int)); +extern bool_t xdr_string __P((XDR *, char **, u_int)); +extern bool_t xdr_union __P((XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t)); +extern unsigned long xdr_sizeof __P((xdrproc_t, void *)); +extern bool_t xdr_char __P((XDR *, char *)); +extern bool_t xdr_u_char __P((XDR *, u_char *)); +extern bool_t xdr_vector __P((XDR *, char *, u_int, u_int, xdrproc_t)); +extern bool_t xdr_float __P((XDR *, float *)); +extern bool_t xdr_double __P((XDR *, double *)); +extern bool_t xdr_reference __P((XDR *, caddr_t *, u_int, xdrproc_t)); +extern bool_t xdr_pointer __P((XDR *, caddr_t *, u_int, xdrproc_t)); +extern bool_t xdr_wrapstring __P((XDR *, char **)); +extern void xdr_free __P((xdrproc_t, char *)); +__END_DECLS /* * Common opaque bytes objects used by many rpc protocols; * declared here due to commonality. */ -#define MAX_NETOBJ_SZ 1024 +#define MAX_NETOBJ_SZ 1024 struct netobj { u_int n_len; char *n_bytes; }; typedef struct netobj netobj; -extern bool_t xdr_netobj(); +extern bool_t xdr_netobj __P((XDR *, struct netobj *)); /* * These are the public routines for the various implementations of * xdr streams. */ -extern void xdrmem_create(); /* XDR using memory buffers */ -extern void xdrstdio_create(); /* XDR using stdio library */ -extern void xdrrec_create(); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(); /* make end of xdr record */ -extern bool_t xdrrec_skiprecord(); /* move to beginning of next record */ -extern bool_t xdrrec_eof(); /* true if no more input */ +__BEGIN_DECLS +/* XDR using memory buffers */ +extern void xdrmem_create __P((XDR *, char *, u_int, enum xdr_op)); + +#ifdef _STDIO_H_ +/* XDR using stdio library */ +extern void xdrstdio_create __P((XDR *, FILE *, enum xdr_op)); +#endif + +/* XDR pseudo records for tcp */ +extern void xdrrec_create __P((XDR *, u_int, u_int, char *, + int (*) __P((caddr_t, caddr_t, int)), + int (*) __P((caddr_t, caddr_t, int)))); + +/* make end of xdr record */ +extern bool_t xdrrec_endofrecord __P((XDR *, int)); + +/* move to beginning of next record */ +extern bool_t xdrrec_skiprecord __P((XDR *)); -#endif /* !__XDR_HEADER__ */ +/* true if no more input */ +extern bool_t xdrrec_eof __P((XDR *)); +__END_DECLS -#endif /* RPC_XDR_H */ +#endif /* !_RPC_XDR_H */ diff --git a/c/src/exec/librpc/include/rpcsvc/.cvsignore b/c/src/exec/librpc/include/rpcsvc/.cvsignore index e69de29bb2..282522db03 100644 --- a/c/src/exec/librpc/include/rpcsvc/.cvsignore +++ b/c/src/exec/librpc/include/rpcsvc/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/exec/librpc/include/rpcsvc/Makefile.am b/c/src/exec/librpc/include/rpcsvc/Makefile.am index e69de29bb2..c5de0f9e6f 100644 --- a/c/src/exec/librpc/include/rpcsvc/Makefile.am +++ b/c/src/exec/librpc/include/rpcsvc/Makefile.am @@ -0,0 +1,13 @@ +## $Id$ + +AUTOMAKE_OPTIONS = foreign 1.4 + +## Currently unused + +EXTRA_DIST = bootparam_prot.x crypt.x key_prot.x klm_prot.x mount.x \ + nfs_prot.x nis.x nis_cache.x nis_callback.x nis_db.h nis_object.x \ + nis_tags.h nislib.h nlm_prot.x pmap_prot.x rex.x rnusers.x rquota.x \ + rstat.x rwall.x sm_inter.x spray.x yp.x yp_prot.h ypclnt.h yppasswd.x \ + ypupdate_prot.x ypxfrd.x + +include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/librpc/include/rpcsvc/bootparam_prot.x b/c/src/exec/librpc/include/rpcsvc/bootparam_prot.x index e69de29bb2..0f74c8f8ad 100644 --- a/c/src/exec/librpc/include/rpcsvc/bootparam_prot.x +++ b/c/src/exec/librpc/include/rpcsvc/bootparam_prot.x @@ -0,0 +1,103 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * RPC for bootparms service. + * There are two procedures: + * WHOAMI takes a net address and returns a client name and also a + * likely net address for routing + * GETFILE takes a client name and file identifier and returns the + * server name, server net address and pathname for the file. + * file identifiers typically include root, swap, pub and dump + */ + +#ifdef RPC_HDR +%#include <rpc/types.h> +%#include <sys/time.h> +%#include <sys/errno.h> +%#include <sys/param.h> +%#include <sys/syslimits.h> +%#include <sys/ucred.h> +#else +%#ifndef lint +%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/ +%/*static char sccsid[] = "from: @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/bootparam_prot.x,v 1.5 1999/08/27 23:45:07 peter Exp $"; +%#endif /* not lint */ +#endif + +const MAX_MACHINE_NAME = 255; +const MAX_PATH_LEN = 1024; +const MAX_FILEID = 32; +const IP_ADDR_TYPE = 1; + +typedef string bp_machine_name_t<MAX_MACHINE_NAME>; +typedef string bp_path_t<MAX_PATH_LEN>; +typedef string bp_fileid_t<MAX_FILEID>; + +struct ip_addr_t { + char net; + char host; + char lh; + char impno; +}; + +union bp_address switch (int address_type) { + case IP_ADDR_TYPE: + ip_addr_t ip_addr; +}; + +struct bp_whoami_arg { + bp_address client_address; +}; + +struct bp_whoami_res { + bp_machine_name_t client_name; + bp_machine_name_t domain_name; + bp_address router_address; +}; + +struct bp_getfile_arg { + bp_machine_name_t client_name; + bp_fileid_t file_id; +}; + +struct bp_getfile_res { + bp_machine_name_t server_name; + bp_address server_address; + bp_path_t server_path; +}; + +program BOOTPARAMPROG { + version BOOTPARAMVERS { + bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1; + bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2; + } = 1; +} = 100026; diff --git a/c/src/exec/librpc/include/rpcsvc/crypt.x b/c/src/exec/librpc/include/rpcsvc/crypt.x index e69de29bb2..8df1654440 100644 --- a/c/src/exec/librpc/include/rpcsvc/crypt.x +++ b/c/src/exec/librpc/include/rpcsvc/crypt.x @@ -0,0 +1,91 @@ +/* + * 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. + * + * $FreeBSD: src/include/rpcsvc/crypt.x,v 1.3 1999/08/27 23:45:08 peter Exp $ + */ + +#ifndef RPC_HDR +%#ifndef lint +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/crypt.x,v 1.3 1999/08/27 23:45:08 peter Exp $"; +%#endif +#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; diff --git a/c/src/exec/librpc/include/rpcsvc/key_prot.x b/c/src/exec/librpc/include/rpcsvc/key_prot.x index e69de29bb2..ab3196cfc0 100644 --- a/c/src/exec/librpc/include/rpcsvc/key_prot.x +++ b/c/src/exec/librpc/include/rpcsvc/key_prot.x @@ -0,0 +1,284 @@ +%/* +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ +/* + * Key server protocol definition + * Copyright (C) 1990, 1991 Sun Microsystems, Inc. + * + * The keyserver is a public key storage/encryption/decryption service + * The encryption method used is based on the Diffie-Hellman exponential + * key exchange technology. + * + * The key server is local to each machine, akin to the portmapper. + * Under TI-RPC, communication with the keyserver is through the + * loopback transport. + * + * NOTE: This .x file generates the USER level headers for the keyserver. + * the KERNEL level headers are created by hand as they kernel has special + * requirements. + */ + +%/* From: #pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" */ +% +%/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ +% +%/* +% * Compiled from key_prot.x using rpcgen. +% * DO NOT EDIT THIS FILE! +% * This is NOT source code! +% */ + +/* + * PROOT and MODULUS define the way the Diffie-Hellman key is generated. + * + * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1, + * where p is also prime. + * + * PROOT satisfies the following two conditions: + * (1) (PROOT ** 2) % MODULUS != 1 + * (2) (PROOT ** p) % MODULUS != 1 + * + */ + +const PROOT = 3; +const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"; + +const HEXKEYBYTES = 48; /* HEXKEYBYTES == strlen(HEXMODULUS) */ +const KEYSIZE = 192; /* KEYSIZE == bit length of key */ +const KEYBYTES = 24; /* byte length of key */ + +/* + * The first 16 hex digits of the encrypted secret key are used as + * a checksum in the database. + */ +const KEYCHECKSUMSIZE = 16; + +/* + * status of operation + */ +enum keystatus { + KEY_SUCCESS, /* no problems */ + KEY_NOSECRET, /* no secret key stored */ + KEY_UNKNOWN, /* unknown netname */ + KEY_SYSTEMERR /* system error (out of memory, encryption failure) */ +}; + +typedef opaque keybuf[HEXKEYBYTES]; /* store key in hex */ + +typedef string netnamestr<MAXNETNAMELEN>; + +/* + * Argument to ENCRYPT or DECRYPT + */ +struct cryptkeyarg { + netnamestr remotename; + des_block deskey; +}; + +/* + * Argument to ENCRYPT_PK or DECRYPT_PK + */ +struct cryptkeyarg2 { + netnamestr remotename; + netobj remotekey; /* Contains a length up to 1024 bytes */ + des_block deskey; +}; + + +/* + * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, and DECRYPT_PK + */ +union cryptkeyres switch (keystatus status) { +case KEY_SUCCESS: + des_block deskey; +default: + void; +}; + +const MAXGIDS = 16; /* max number of gids in gid list */ + +/* + * Unix credential + */ +struct unixcred { + u_int uid; + u_int gid; + u_int gids<MAXGIDS>; +}; + +/* + * Result returned from GETCRED + */ +union getcredres switch (keystatus status) { +case KEY_SUCCESS: + unixcred cred; +default: + void; +}; +/* + * key_netstarg; + */ + +struct key_netstarg { + keybuf st_priv_key; + keybuf st_pub_key; + netnamestr st_netname; +}; + +union key_netstres switch (keystatus status){ +case KEY_SUCCESS: + key_netstarg knet; +default: + void; +}; + +#ifdef RPC_HDR +% +%#ifndef opaque +%#define opaque char +%#endif +% +#endif +program KEY_PROG { + version KEY_VERS { + + /* + * This is my secret key. + * Store it for me. + */ + keystatus + KEY_SET(keybuf) = 1; + + /* + * I want to talk to X. + * Encrypt a conversation key for me. + */ + cryptkeyres + KEY_ENCRYPT(cryptkeyarg) = 2; + + /* + * X just sent me a message. + * Decrypt the conversation key for me. + */ + cryptkeyres + KEY_DECRYPT(cryptkeyarg) = 3; + + /* + * Generate a secure conversation key for me + */ + des_block + KEY_GEN(void) = 4; + + /* + * Get me the uid, gid and group-access-list associated + * with this netname (for kernel which cannot use NIS) + */ + getcredres + KEY_GETCRED(netnamestr) = 5; + } = 1; + version KEY_VERS2 { + + /* + * ####### + * Procedures 1-5 are identical to version 1 + * ####### + */ + + /* + * This is my secret key. + * Store it for me. + */ + keystatus + KEY_SET(keybuf) = 1; + + /* + * I want to talk to X. + * Encrypt a conversation key for me. + */ + cryptkeyres + KEY_ENCRYPT(cryptkeyarg) = 2; + + /* + * X just sent me a message. + * Decrypt the conversation key for me. + */ + cryptkeyres + KEY_DECRYPT(cryptkeyarg) = 3; + + /* + * Generate a secure conversation key for me + */ + des_block + KEY_GEN(void) = 4; + + /* + * Get me the uid, gid and group-access-list associated + * with this netname (for kernel which cannot use NIS) + */ + getcredres + KEY_GETCRED(netnamestr) = 5; + + /* + * I want to talk to X. and I know X's public key + * Encrypt a conversation key for me. + */ + cryptkeyres + KEY_ENCRYPT_PK(cryptkeyarg2) = 6; + + /* + * X just sent me a message. and I know X's public key + * Decrypt the conversation key for me. + */ + cryptkeyres + KEY_DECRYPT_PK(cryptkeyarg2) = 7; + + /* + * Store my public key, netname and private key. + */ + keystatus + KEY_NET_PUT(key_netstarg) = 8; + + /* + * Retrieve my public key, netname and private key. + */ + key_netstres + KEY_NET_GET(void) = 9; + + /* + * Return me the conversation key that is constructed + * from my secret key and this publickey. + */ + + cryptkeyres + KEY_GET_CONV(keybuf) = 10; + + + } = 2; +} = 100029; + + diff --git a/c/src/exec/librpc/include/rpcsvc/klm_prot.x b/c/src/exec/librpc/include/rpcsvc/klm_prot.x index e69de29bb2..c4cfe36d42 100644 --- a/c/src/exec/librpc/include/rpcsvc/klm_prot.x +++ b/c/src/exec/librpc/include/rpcsvc/klm_prot.x @@ -0,0 +1,139 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Kernel/lock manager protocol definition + * Copyright (C) 1986 Sun Microsystems, Inc. + * + * protocol used between the UNIX kernel (the "client") and the + * local lock manager. The local lock manager is a deamon running + * above the kernel. + */ + +#ifndef RPC_HDR +%#ifndef lint +%/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/ +%/*static char sccsid[] = "from: @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/klm_prot.x,v 1.6 1999/08/27 23:45:08 peter Exp $"; +%#endif /* not lint */ +#endif + +const LM_MAXSTRLEN = 1024; + +/* + * lock manager status returns + */ +enum klm_stats { + klm_granted = 0, /* lock is granted */ + klm_denied = 1, /* lock is denied */ + klm_denied_nolocks = 2, /* no lock entry available */ + klm_working = 3 /* lock is being processed */ +}; + +/* + * lock manager lock identifier + */ +struct klm_lock { + string server_name<LM_MAXSTRLEN>; + netobj fh; /* a counted file handle */ + int pid; /* holder of the lock */ + unsigned l_offset; /* beginning offset of the lock */ + unsigned l_len; /* byte length of the lock; + * zero means through end of file */ +}; + +/* + * lock holder identifier + */ +struct klm_holder { + bool exclusive; /* FALSE if shared lock */ + int svid; /* holder of the lock (pid) */ + unsigned l_offset; /* beginning offset of the lock */ + unsigned l_len; /* byte length of the lock; + * zero means through end of file */ +}; + +/* + * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL + */ +struct klm_stat { + klm_stats stat; +}; + +/* + * reply to a KLM_TEST call + */ +union klm_testrply switch (klm_stats stat) { + case klm_denied: + struct klm_holder holder; + default: /* All other cases return no arguments */ + void; +}; + + +/* + * arguments to KLM_LOCK + */ +struct klm_lockargs { + bool block; + bool exclusive; + struct klm_lock alock; +}; + +/* + * arguments to KLM_TEST + */ +struct klm_testargs { + bool exclusive; + struct klm_lock alock; +}; + +/* + * arguments to KLM_UNLOCK + */ +struct klm_unlockargs { + struct klm_lock alock; +}; + +program KLM_PROG { + version KLM_VERS { + + klm_testrply KLM_TEST (struct klm_testargs) = 1; + + klm_stat KLM_LOCK (struct klm_lockargs) = 2; + + klm_stat KLM_CANCEL (struct klm_lockargs) = 3; + /* klm_granted=> the cancel request fails due to lock is already granted */ + /* klm_denied=> the cancel request successfully aborts +lock request */ + + klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4; + } = 1; +} = 100020; diff --git a/c/src/exec/librpc/include/rpcsvc/mount.x b/c/src/exec/librpc/include/rpcsvc/mount.x index e69de29bb2..f68a06fe9b 100644 --- a/c/src/exec/librpc/include/rpcsvc/mount.x +++ b/c/src/exec/librpc/include/rpcsvc/mount.x @@ -0,0 +1,257 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Protocol description for the mount program + */ + +#ifndef RPC_HDR +%#ifndef lint +%/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ +%/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/ +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/mount.x,v 1.6 1999/08/27 23:45:08 peter Exp $"; +%#endif /* not lint */ +#endif + +const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ +const MNTNAMLEN = 255; /* maximum bytes in a name argument */ +const FHSIZE = 32; /* size in bytes of a file handle */ +#ifdef WANT_NFS3 +const FHSIZE3 = 64; /* size in bytes of a file handle (v3) */ +#endif + +/* + * The fhandle is the file handle that the server passes to the client. + * All file operations are done using the file handles to refer to a file + * or a directory. The file handle can contain whatever information the + * server needs to distinguish an individual file. + */ +typedef opaque fhandle[FHSIZE]; +#ifdef WANT_NFS3 +typedef opaque fhandle3<FHSIZE3>; +#endif + +/* + * If a status of zero is returned, the call completed successfully, and + * a file handle for the directory follows. A non-zero status indicates + * some sort of error. The status corresponds with UNIX error numbers. + */ +union fhstatus switch (unsigned fhs_status) { +case 0: + fhandle fhs_fhandle; +default: + void; +}; + +#ifdef WANT_NFS3 +/* + * Status codes returned by the version 3 mount call. + */ +enum mountstat3 { + MNT3_OK = 0, /* no error */ + MNT3ERR_PERM = 1, /* Not owner */ + MNT3ERR_NOENT = 2, /* No such file or directory */ + MNT3ERR_IO = 5, /* I/O error */ + MNT3ERR_ACCES = 13, /* Permission denied */ + MNT3ERR_NOTDIR = 20, /* Not a directory */ + MNT3ERR_INVAL = 22, /* Invalid argument */ + MNT3ERR_NAMETOOLONG = 63, /* Filename too long */ + MNT3ERR_NOTSUPP = 10004, /* Operation not supported */ + MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */ +}; + +struct mountres3_ok { + fhandle3 fhandle; + int auth_flavors<>; +}; + +union mountres3 switch (mountstat3 fhs_status) { +case 0: + mountres3_ok mountinfo; +default: + void; +}; +#endif + +/* + * The type dirpath is the pathname of a directory + */ +typedef string dirpath<MNTPATHLEN>; + +/* + * The type name is used for arbitrary names (hostnames, groupnames) + */ +typedef string name<MNTNAMLEN>; + +/* + * A list of who has what mounted + */ +typedef struct mountbody *mountlist; +struct mountbody { + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; +}; + +/* + * A list of netgroups + */ +typedef struct groupnode *groups; +struct groupnode { + name gr_name; + groups gr_next; +}; + +/* + * A list of what is exported and to whom + */ +typedef struct exportnode *exports; +struct exportnode { + dirpath ex_dir; + groups ex_groups; + exports ex_next; +}; + +program MOUNTPROG { + /* + * Version one of the mount protocol communicates with version two + * of the NFS protocol. Version three communicates with + * version three of the NFS protocol. The only connecting + * point is the fhandle structure, which is the same for both + * protocols. + */ + version MOUNTVERS { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + MOUNTPROC_NULL(void) = 0; + + /* + * If fhs_status is 0, then fhs_fhandle contains the + * file handle for the directory. This file handle may + * be used in the NFS protocol. This procedure also adds + * a new entry to the mount list for this client mounting + * the directory. + * Unix authentication required. + */ + fhstatus + MOUNTPROC_MNT(dirpath) = 1; + + /* + * Returns the list of remotely mounted filesystems. The + * mountlist contains one entry for each hostname and + * directory pair. + */ + mountlist + MOUNTPROC_DUMP(void) = 2; + + /* + * Removes the mount list entry for the directory + * Unix authentication required. + */ + void + MOUNTPROC_UMNT(dirpath) = 3; + + /* + * Removes all of the mount list entries for this client + * Unix authentication required. + */ + void + MOUNTPROC_UMNTALL(void) = 4; + + /* + * Returns a list of all the exported filesystems, and which + * machines are allowed to import it. + */ + exports + MOUNTPROC_EXPORT(void) = 5; + + /* + * Identical to MOUNTPROC_EXPORT above + */ + exports + MOUNTPROC_EXPORTALL(void) = 6; + } = 1; +#ifdef WANT_NFS3 + version MOUNTVERS3 { + /* + * Does no work. It is made available in all RPC services + * to allow server reponse testing and timing + */ + void + MOUNTPROC_NULL(void) = 0; + + /* + * If mountres3.fhs_status is MNT3_OK, then + * mountres3.mountinfo contains the file handle for + * the directory and a list of acceptable + * authentication flavors. This file handle may only + * be used in the NFS version 3 protocol. This + * procedure also results in the server adding a new + * entry to its mount list recording that this client + * has mounted the directory. AUTH_UNIX authentication + * or better is required. + */ + mountres3 + MOUNTPROC_MNT(dirpath) = 1; + + /* + * Returns the list of remotely mounted filesystems. The + * mountlist contains one entry for each hostname and + * directory pair. + */ + mountlist + MOUNTPROC_DUMP(void) = 2; + + /* + * Removes the mount list entry for the directory + * Unix authentication required. + */ + void + MOUNTPROC_UMNT(dirpath) = 3; + + /* + * Removes all of the mount list entries for this client + * Unix authentication required. + */ + void + MOUNTPROC_UMNTALL(void) = 4; + + /* + * Returns a list of all the exported filesystems, and which + * machines are allowed to import it. + */ + exports + MOUNTPROC_EXPORT(void) = 5; + } = 3; +#endif +} = 100005; diff --git a/c/src/exec/librpc/include/rpcsvc/nfs_prot.x b/c/src/exec/librpc/include/rpcsvc/nfs_prot.x index e69de29bb2..01564f895e 100644 --- a/c/src/exec/librpc/include/rpcsvc/nfs_prot.x +++ b/c/src/exec/librpc/include/rpcsvc/nfs_prot.x @@ -0,0 +1,1266 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#ifndef RPC_HDR +%#ifndef lint +%/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/ +%/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/nfs_prot.x,v 1.7 1999/08/27 23:45:08 peter Exp $"; +%#endif /* not lint */ +#endif + +const NFS_PORT = 2049; +const NFS_MAXDATA = 8192; +const NFS_MAXPATHLEN = 1024; +const NFS_MAXNAMLEN = 255; +const NFS_FHSIZE = 32; +const NFS_COOKIESIZE = 4; +const NFS_FIFO_DEV = -1; /* size kludge for named pipes */ + +/* + * File types + */ +const NFSMODE_FMT = 0170000; /* type of file */ +const NFSMODE_DIR = 0040000; /* directory */ +const NFSMODE_CHR = 0020000; /* character special */ +const NFSMODE_BLK = 0060000; /* block special */ +const NFSMODE_REG = 0100000; /* regular */ +const NFSMODE_LNK = 0120000; /* symbolic link */ +const NFSMODE_SOCK = 0140000; /* socket */ +const NFSMODE_FIFO = 0010000; /* fifo */ + +/* + * Error status + */ +enum nfsstat { + NFS_OK= 0, /* no error */ + NFSERR_PERM=1, /* Not owner */ + NFSERR_NOENT=2, /* No such file or directory */ + NFSERR_IO=5, /* I/O error */ + NFSERR_NXIO=6, /* No such device or address */ + NFSERR_ACCES=13, /* Permission denied */ + NFSERR_EXIST=17, /* File exists */ + NFSERR_NODEV=19, /* No such device */ + NFSERR_NOTDIR=20, /* Not a directory*/ + NFSERR_ISDIR=21, /* Is a directory */ + NFSERR_FBIG=27, /* File too large */ + NFSERR_NOSPC=28, /* No space left on device */ + NFSERR_ROFS=30, /* Read-only file system */ + NFSERR_NAMETOOLONG=63, /* File name too long */ + NFSERR_NOTEMPTY=66, /* Directory not empty */ + NFSERR_DQUOT=69, /* Disc quota exceeded */ + NFSERR_STALE=70, /* Stale NFS file handle */ + NFSERR_WFLUSH=99 /* write cache flushed */ +}; + +/* + * File types + */ +enum ftype { + NFNON = 0, /* non-file */ + NFREG = 1, /* regular file */ + NFDIR = 2, /* directory */ + NFBLK = 3, /* block special */ + NFCHR = 4, /* character special */ + NFLNK = 5, /* symbolic link */ + NFSOCK = 6, /* unix domain sockets */ + NFBAD = 7, /* unused */ + NFFIFO = 8 /* named pipe */ +}; + +/* + * File access handle + */ +struct nfs_fh { + opaque data[NFS_FHSIZE]; +}; + +/* + * Timeval + */ +struct nfstime { + unsigned seconds; + unsigned useconds; +}; + + +/* + * File attributes + */ +struct fattr { + ftype type; /* file type */ + unsigned mode; /* protection mode bits */ + unsigned nlink; /* # hard links */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + unsigned blocksize; /* prefered block size */ + unsigned rdev; /* special device # */ + unsigned blocks; /* Kb of disk used by file */ + unsigned fsid; /* device # */ + unsigned fileid; /* inode # */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ + nfstime ctime; /* time of last change */ +}; + +/* + * File attributes which can be set + */ +struct sattr { + unsigned mode; /* protection mode bits */ + unsigned uid; /* owner user id */ + unsigned gid; /* owner group id */ + unsigned size; /* file size in bytes */ + nfstime atime; /* time of last access */ + nfstime mtime; /* time of last modification */ +}; + + +typedef string filename<NFS_MAXNAMLEN>; +typedef string nfspath<NFS_MAXPATHLEN>; + +/* + * Reply status with file attributes + */ +union attrstat switch (nfsstat status) { +case NFS_OK: + fattr attributes; +default: + void; +}; + +struct sattrargs { + nfs_fh file; + sattr attributes; +}; + +/* + * Arguments for directory operations + */ +struct diropargs { + nfs_fh dir; /* directory file handle */ + filename name; /* name (up to NFS_MAXNAMLEN bytes) */ +}; + +struct diropokres { + nfs_fh file; + fattr attributes; +}; + +/* + * Results from directory operation + */ +union diropres switch (nfsstat status) { +case NFS_OK: + diropokres diropres; +default: + void; +}; + +union readlinkres switch (nfsstat status) { +case NFS_OK: + nfspath data; +default: + void; +}; + +/* + * Arguments to remote read + */ +struct readargs { + nfs_fh file; /* handle for file */ + unsigned offset; /* byte offset in file */ + unsigned count; /* immediate read count */ + unsigned totalcount; /* total read count (from this offset)*/ +}; + +/* + * Status OK portion of remote read reply + */ +struct readokres { + fattr attributes; /* attributes, need for pagin*/ + opaque data<NFS_MAXDATA>; +}; + +union readres switch (nfsstat status) { +case NFS_OK: + readokres reply; +default: + void; +}; + +/* + * Arguments to remote write + */ +struct writeargs { + nfs_fh file; /* handle for file */ + unsigned beginoffset; /* beginning byte offset in file */ + unsigned offset; /* current byte offset in file */ + unsigned totalcount; /* total write count (to this offset)*/ + opaque data<NFS_MAXDATA>; +}; + +struct createargs { + diropargs where; + sattr attributes; +}; + +struct renameargs { + diropargs from; + diropargs to; +}; + +struct linkargs { + nfs_fh from; + diropargs to; +}; + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; + + +typedef opaque nfscookie[NFS_COOKIESIZE]; + +/* + * Arguments to readdir + */ +struct readdirargs { + nfs_fh dir; /* directory handle */ + nfscookie cookie; + unsigned count; /* number of directory bytes to read */ +}; + +struct entry { + unsigned fileid; + filename name; + nfscookie cookie; + entry *nextentry; +}; + +struct dirlist { + entry *entries; + bool eof; +}; + +union readdirres switch (nfsstat status) { +case NFS_OK: + dirlist reply; +default: + void; +}; + +struct statfsokres { + unsigned tsize; /* preferred transfer size in bytes */ + unsigned bsize; /* fundamental file system block size */ + unsigned blocks; /* total blocks in file system */ + unsigned bfree; /* free blocks in fs */ + unsigned bavail; /* free blocks avail to non-superuser */ +}; + +union statfsres switch (nfsstat status) { +case NFS_OK: + statfsokres reply; +default: + void; +}; + +#ifdef WANT_NFS3 + +/* + * NFSv3 constants and types + */ +const NFS3_FHSIZE = 64; /* maximum size in bytes of a file handle */ +const NFS3_COOKIEVERFSIZE = 8; /* size of a cookie verifier for READDIR */ +const NFS3_CREATEVERFSIZE = 8; /* size of the verifier used for CREATE */ +const NFS3_WRITEVERFSIZE = 8; /* size of the verifier used for WRITE */ + +typedef unsigned hyper uint64; +typedef hyper int64; +typedef unsigned long uint32; +typedef long int32; +typedef string filename3<>; +typedef string nfspath3<>; +typedef uint64 fileid3; +typedef uint64 cookie3; +typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE]; +typedef opaque createverf3[NFS3_CREATEVERFSIZE]; +typedef opaque writeverf3[NFS3_WRITEVERFSIZE]; +typedef uint32 uid3; +typedef uint32 gid3; +typedef uint64 size3; +typedef uint64 offset3; +typedef uint32 mode3; +typedef uint32 count3; + +/* + * Error status (v3) + */ +enum nfsstat3 { + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008 +}; + +/* + * File types (v3) + */ +enum ftype3 { + NF3REG = 1, /* regular file */ + NF3DIR = 2, /* directory */ + NF3BLK = 3, /* block special */ + NF3CHR = 4, /* character special */ + NF3LNK = 5, /* symbolic link */ + NF3SOCK = 6, /* unix domain sockets */ + NF3FIFO = 7 /* named pipe */ +}; + +struct specdata3 { + uint32 specdata1; + uint32 specdata2; +}; + +/* + * File access handle (v3) + */ +struct nfs_fh3 { + opaque data<NFS3_FHSIZE>; +}; + +/* + * Timeval (v3) + */ +struct nfstime3 { + uint32 seconds; + uint32 nseconds; +}; + + +/* + * File attributes (v3) + */ +struct fattr3 { + ftype3 type; /* file type */ + mode3 mode; /* protection mode bits */ + uint32 nlink; /* # hard links */ + uid3 uid; /* owner user id */ + gid3 gid; /* owner group id */ + size3 size; /* file size in bytes */ + size3 used; /* prefered block size */ + specdata3 rdev; /* special device # */ + uint64 fsid; /* device # */ + fileid3 fileid; /* inode # */ + nfstime3 atime; /* time of last access */ + nfstime3 mtime; /* time of last modification */ + nfstime3 ctime; /* time of last change */ +}; + +union post_op_attr switch (bool attributes_follow) { +case TRUE: + fattr3 attributes; +case FALSE: + void; +}; + +struct wcc_attr { + size3 size; + nfstime3 mtime; + nfstime3 ctime; +}; + +union pre_op_attr switch (bool attributes_follow) { +case TRUE: + wcc_attr attributes; +case FALSE: + void; +}; + +struct wcc_data { + pre_op_attr before; + post_op_attr after; +}; + +union post_op_fh3 switch (bool handle_follows) { +case TRUE: + nfs_fh3 handle; +case FALSE: + void; +}; + +/* + * File attributes which can be set (v3) + */ +enum time_how { + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2 +}; + +union set_mode3 switch (bool set_it) { +case TRUE: + mode3 mode; +default: + void; +}; + +union set_uid3 switch (bool set_it) { +case TRUE: + uid3 uid; +default: + void; +}; + +union set_gid3 switch (bool set_it) { +case TRUE: + gid3 gid; +default: + void; +}; + +union set_size3 switch (bool set_it) { +case TRUE: + size3 size; +default: + void; +}; + +union set_atime switch (time_how set_it) { +case SET_TO_CLIENT_TIME: + nfstime3 atime; +default: + void; +}; + +union set_mtime switch (time_how set_it) { +case SET_TO_CLIENT_TIME: + nfstime3 mtime; +default: + void; +}; + +struct sattr3 { + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; +}; + +/* + * Arguments for directory operations (v3) + */ +struct diropargs3 { + nfs_fh3 dir; /* directory file handle */ + filename3 name; /* name (up to NFS_MAXNAMLEN bytes) */ +}; + +/* + * Arguments to getattr (v3). + */ +struct GETATTR3args { + nfs_fh3 object; +}; + +struct GETATTR3resok { + fattr3 obj_attributes; +}; + +union GETATTR3res switch (nfsstat3 status) { +case NFS3_OK: + GETATTR3resok resok; +default: + void; +}; + +/* + * Arguments to setattr (v3). + */ +union sattrguard3 switch (bool check) { +case TRUE: + nfstime3 obj_ctime; +case FALSE: + void; +}; + +struct SETATTR3args { + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; +}; + +struct SETATTR3resok { + wcc_data obj_wcc; +}; + +struct SETATTR3resfail { + wcc_data obj_wcc; +}; + +union SETATTR3res switch (nfsstat3 status) { +case NFS3_OK: + SETATTR3resok resok; +default: + SETATTR3resfail resfail; +}; + +/* + * Arguments to lookup (v3). + */ +struct LOOKUP3args { + diropargs3 what; +}; + +struct LOOKUP3resok { + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; +}; + +struct LOOKUP3resfail { + post_op_attr dir_attributes; +}; + +union LOOKUP3res switch (nfsstat3 status) { +case NFS3_OK: + LOOKUP3resok resok; +default: + LOOKUP3resfail resfail; +}; + +/* + * Arguments to access (v3). + */ +const ACCESS3_READ = 0x0001; +const ACCESS3_LOOKUP = 0x0002; +const ACCESS3_MODIFY = 0x0004; +const ACCESS3_EXTEND = 0x0008; +const ACCESS3_DELETE = 0x0010; +const ACCESS3_EXECUTE = 0x0020; + +struct ACCESS3args { + nfs_fh3 object; + uint32 access; +}; + +struct ACCESS3resok { + post_op_attr obj_attributes; + uint32 access; +}; + +struct ACCESS3resfail { + post_op_attr obj_attributes; +}; + +union ACCESS3res switch (nfsstat3 status) { +case NFS3_OK: + ACCESS3resok resok; +default: + ACCESS3resfail resfail; +}; + +/* + * Arguments to readlink (v3). + */ +struct READLINK3args { + nfs_fh3 symlink; +}; + +struct READLINK3resok { + post_op_attr symlink_attributes; + nfspath3 data; +}; + +struct READLINK3resfail { + post_op_attr symlink_attributes; +}; + +union READLINK3res switch (nfsstat3 status) { +case NFS3_OK: + READLINK3resok resok; +default: + READLINK3resfail resfail; +}; + +/* + * Arguments to read (v3). + */ +struct READ3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; + +struct READ3resok { + post_op_attr file_attributes; + count3 count; + bool eof; + opaque data<>; +}; + +struct READ3resfail { + post_op_attr file_attributes; +}; + +/* XXX: solaris 2.6 uses ``nfsstat'' here */ +union READ3res switch (nfsstat3 status) { +case NFS3_OK: + READ3resok resok; +default: + READ3resfail resfail; +}; + +/* + * Arguments to write (v3). + */ +enum stable_how { + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2 +}; + +struct WRITE3args { + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + opaque data<>; +}; + +struct WRITE3resok { + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; +}; + +struct WRITE3resfail { + wcc_data file_wcc; +}; + +union WRITE3res switch (nfsstat3 status) { +case NFS3_OK: + WRITE3resok resok; +default: + WRITE3resfail resfail; +}; + +/* + * Arguments to create (v3). + */ +enum createmode3 { + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2 +}; + +union createhow3 switch (createmode3 mode) { +case UNCHECKED: +case GUARDED: + sattr3 obj_attributes; +case EXCLUSIVE: + createverf3 verf; +}; + +struct CREATE3args { + diropargs3 where; + createhow3 how; +}; + +struct CREATE3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct CREATE3resfail { + wcc_data dir_wcc; +}; + +union CREATE3res switch (nfsstat3 status) { +case NFS3_OK: + CREATE3resok resok; +default: + CREATE3resfail resfail; +}; + +/* + * Arguments to mkdir (v3). + */ +struct MKDIR3args { + diropargs3 where; + sattr3 attributes; +}; + +struct MKDIR3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct MKDIR3resfail { + wcc_data dir_wcc; +}; + +union MKDIR3res switch (nfsstat3 status) { +case NFS3_OK: + MKDIR3resok resok; +default: + MKDIR3resfail resfail; +}; + +/* + * Arguments to symlink (v3). + */ +struct symlinkdata3 { + sattr3 symlink_attributes; + nfspath3 symlink_data; +}; + +struct SYMLINK3args { + diropargs3 where; + symlinkdata3 symlink; +}; + +struct SYMLINK3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct SYMLINK3resfail { + wcc_data dir_wcc; +}; + +union SYMLINK3res switch (nfsstat3 status) { +case NFS3_OK: + SYMLINK3resok resok; +default: + SYMLINK3resfail resfail; +}; + +/* + * Arguments to mknod (v3). + */ +struct devicedata3 { + sattr3 dev_attributes; + specdata3 spec; +}; + +union mknoddata3 switch (ftype3 type) { +case NF3CHR: +case NF3BLK: + devicedata3 device; +case NF3SOCK: +case NF3FIFO: + sattr3 pipe_attributes; +default: + void; +}; + +struct MKNOD3args { + diropargs3 where; + mknoddata3 what; +}; + +struct MKNOD3resok { + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; +}; + +struct MKNOD3resfail { + wcc_data dir_wcc; +}; + +union MKNOD3res switch (nfsstat3 status) { +case NFS3_OK: + MKNOD3resok resok; +default: + MKNOD3resfail resfail; +}; + +/* + * Arguments to remove (v3). + */ +struct REMOVE3args { + diropargs3 object; +}; + +struct REMOVE3resok { + wcc_data dir_wcc; +}; + +struct REMOVE3resfail { + wcc_data dir_wcc; +}; + +union REMOVE3res switch (nfsstat3 status) { +case NFS3_OK: + REMOVE3resok resok; +default: + REMOVE3resfail resfail; +}; + +/* + * Arguments to rmdir (v3). + */ +struct RMDIR3args { + diropargs3 object; +}; + +struct RMDIR3resok { + wcc_data dir_wcc; +}; + +struct RMDIR3resfail { + wcc_data dir_wcc; +}; + +union RMDIR3res switch (nfsstat3 status) { +case NFS3_OK: + RMDIR3resok resok; +default: + RMDIR3resfail resfail; +}; + +/* + * Arguments to rename (v3). + */ +struct RENAME3args { + diropargs3 from; + diropargs3 to; +}; + +struct RENAME3resok { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; + +struct RENAME3resfail { + wcc_data fromdir_wcc; + wcc_data todir_wcc; +}; + +union RENAME3res switch (nfsstat3 status) { +case NFS3_OK: + RENAME3resok resok; +default: + RENAME3resfail resfail; +}; + +/* + * Arguments to link (v3). + */ +struct LINK3args { + nfs_fh3 file; + diropargs3 link; +}; + +struct LINK3resok { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; + +struct LINK3resfail { + post_op_attr file_attributes; + wcc_data linkdir_wcc; +}; + +union LINK3res switch (nfsstat3 status) { +case NFS3_OK: + LINK3resok resok; +default: + LINK3resfail resfail; +}; + +/* + * Arguments to readdir (v3). + */ +struct READDIR3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; +}; + +struct entry3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + entry3 *nextentry; +}; + +struct dirlist3 { + entry3 *entries; + bool eof; +}; + +struct READDIR3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; +}; + +struct READDIR3resfail { + post_op_attr dir_attributes; +}; + +union READDIR3res switch (nfsstat3 status) { +case NFS3_OK: + READDIR3resok resok; +default: + READDIR3resfail resfail; +}; + +/* + * Arguments to readdirplus (v3). + */ +struct READDIRPLUS3args { + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; +}; + +struct entryplus3 { + fileid3 fileid; + filename3 name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + entryplus3 *nextentry; +}; + +struct dirlistplus3 { + entryplus3 *entries; + bool eof; +}; + +struct READDIRPLUS3resok { + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistplus3 reply; +}; + +struct READDIRPLUS3resfail { + post_op_attr dir_attributes; +}; + +union READDIRPLUS3res switch (nfsstat3 status) { +case NFS3_OK: + READDIRPLUS3resok resok; +default: + READDIRPLUS3resfail resfail; +}; + +/* + * Arguments to fsstat (v3). + */ +struct FSSTAT3args { + nfs_fh3 fsroot; +}; + +struct FSSTAT3resok { + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + uint32 invarsec; +}; + +struct FSSTAT3resfail { + post_op_attr obj_attributes; +}; + +union FSSTAT3res switch (nfsstat3 status) { +case NFS3_OK: + FSSTAT3resok resok; +default: + FSSTAT3resfail resfail; +}; + +/* + * Arguments to fsinfo (v3). + */ +const FSF3_LINK = 0x0001; +const FSF3_SYMLINK = 0x0002; +const FSF3_HOMOGENEOUS = 0x0008; +const FSF3_CANSETTIME = 0x0010; + +struct FSINFO3args { + nfs_fh3 fsroot; +}; + +struct FSINFO3resok { + post_op_attr obj_attributes; + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; +}; + +struct FSINFO3resfail { + post_op_attr obj_attributes; +}; + +union FSINFO3res switch (nfsstat3 status) { +case NFS3_OK: + FSINFO3resok resok; +default: + FSINFO3resfail resfail; +}; + +/* + * Arguments to pathconf (v3). + */ +struct PATHCONF3args { + nfs_fh3 object; +}; + +struct PATHCONF3resok { + post_op_attr obj_attributes; + uint32 linkmax; + uint32 name_max; + bool no_trunc; + bool chown_restricted; + bool case_insensitive; + bool case_preserving; +}; + +struct PATHCONF3resfail { + post_op_attr obj_attributes; +}; + +union PATHCONF3res switch (nfsstat3 status) { +case NFS3_OK: + PATHCONF3resok resok; +default: + PATHCONF3resfail resfail; +}; + +/* + * Arguments to commit (v3). + */ +struct COMMIT3args { + nfs_fh3 file; + offset3 offset; + count3 count; +}; + +struct COMMIT3resok { + wcc_data file_wcc; + writeverf3 verf; +}; + +struct COMMIT3resfail { + wcc_data file_wcc; +}; + +union COMMIT3res switch (nfsstat3 status) { +case NFS3_OK: + COMMIT3resok resok; +default: + COMMIT3resfail resfail; +}; + +#endif /* WANT_NFS3 */ + +/* + * Remote file service routines + */ +program NFS_PROGRAM { + version NFS_VERSION { + void + NFSPROC_NULL(void) = 0; + + attrstat + NFSPROC_GETATTR(nfs_fh) = 1; + + attrstat + NFSPROC_SETATTR(sattrargs) = 2; + + void + NFSPROC_ROOT(void) = 3; + + diropres + NFSPROC_LOOKUP(diropargs) = 4; + + readlinkres + NFSPROC_READLINK(nfs_fh) = 5; + + readres + NFSPROC_READ(readargs) = 6; + + void + NFSPROC_WRITECACHE(void) = 7; + + attrstat + NFSPROC_WRITE(writeargs) = 8; + + diropres + NFSPROC_CREATE(createargs) = 9; + + nfsstat + NFSPROC_REMOVE(diropargs) = 10; + + nfsstat + NFSPROC_RENAME(renameargs) = 11; + + nfsstat + NFSPROC_LINK(linkargs) = 12; + + nfsstat + NFSPROC_SYMLINK(symlinkargs) = 13; + + diropres + NFSPROC_MKDIR(createargs) = 14; + + nfsstat + NFSPROC_RMDIR(diropargs) = 15; + + readdirres + NFSPROC_READDIR(readdirargs) = 16; + + statfsres + NFSPROC_STATFS(nfs_fh) = 17; + } = 2; +} = 100003; +#ifdef WANT_NFS3 +program NFS3_PROGRAM { + version NFS_V3 { + void + NFSPROC3_NULL(void) = 0; + + GETATTR3res + NFSPROC3_GETATTR(GETATTR3args) = 1; + + SETATTR3res + NFSPROC3_SETATTR(SETATTR3args) = 2; + + LOOKUP3res + NFSPROC3_LOOKUP(LOOKUP3args) = 3; + + ACCESS3res + NFSPROC3_ACCESS(ACCESS3args) = 4; + + READLINK3res + NFSPROC3_READLINK(READLINK3args) = 5; + + READ3res + NFSPROC3_READ(READ3args) = 6; + + WRITE3res + NFSPROC3_WRITE(WRITE3args) = 7; + + CREATE3res + NFSPROC3_CREATE(CREATE3args) = 8; + + MKDIR3res + NFSPROC3_MKDIR(MKDIR3args) = 9; + + SYMLINK3res + NFSPROC3_SYMLINK(SYMLINK3args) = 10; + + MKNOD3res + NFSPROC3_MKNOD(MKNOD3args) = 11; + + REMOVE3res + NFSPROC3_REMOVE(REMOVE3args) = 12; + + RMDIR3res + NFSPROC3_RMDIR(RMDIR3args) = 13; + + RENAME3res + NFSPROC3_RENAME(RENAME3args) = 14; + + LINK3res + NFSPROC3_LINK(LINK3args) = 15; + + READDIR3res + NFSPROC3_READDIR(READDIR3args) = 16; + + READDIRPLUS3res + NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17; + + FSSTAT3res + NFSPROC3_FSSTAT(FSSTAT3args) = 18; + + FSINFO3res + NFSPROC3_FSINFO(FSINFO3args) = 19; + + PATHCONF3res + NFSPROC3_PATHCONF(PATHCONF3args) = 20; + + COMMIT3res + NFSPROC3_COMMIT(COMMIT3args) = 21; + } = 3; +} = 100003; +#endif + diff --git a/c/src/exec/librpc/include/rpcsvc/nis.x b/c/src/exec/librpc/include/rpcsvc/nis.x index e69de29bb2..ba6c6d1576 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis.x +++ b/c/src/exec/librpc/include/rpcsvc/nis.x @@ -0,0 +1,466 @@ +%/* +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user or with the express written consent of +% * Sun Microsystems, Inc. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ + +#ifndef RPC_HDR +%#ifndef lint +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/nis.x,v 1.3 1999/08/27 23:45:09 peter Exp $"; +%#endif /* not lint */ +#endif + +/* + * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems + * + * RPC Language Protocol description file for NIS Plus + * This version : 1.61 + * Last Modified : 3/19/91 + */ +#ifdef RPC_HDR +%/* +% * nis.h +% * +% * This file is the main include file for NIS clients. It contains +% * both the client library function defines and the various data +% * structures used by the NIS service. It includes the file nis_tags.h +% * which defines the tag values. This allows the tags to change without +% * having to change the nis.x file. +% * +% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when +% * rpcgen is run on the nis.x file. Note that there is a +% * simple sed script to remove some unneeded lines. (See the +% * Makefile target nis.h) +% * +% */ +%#include <rpcsvc/nis_tags.h> +#endif + +/* This gets stuffed into the source files. */ +#if RPC_HDR +%#include <rpc/xdr.h> +#endif +/* + * This is just pointless. + */ +#ifdef SUN_STUPIDITY +#if RPC_SVC +%#include "nis_svc.h" +#endif +#endif + +/* Include the RPC Language description of NIS objects */ +#include "nis_object.x" + +/* Errors that can be returned by the service */ +enum nis_error { + NIS_SUCCESS = 0, /* A-ok, let's rock n roll */ + NIS_S_SUCCESS = 1, /* Name found (maybe) */ + NIS_NOTFOUND = 2, /* Name definitely not found */ + NIS_S_NOTFOUND = 3, /* Name maybe not found */ + NIS_CACHEEXPIRED = 4, /* Name exists but cache out of date */ + NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */ + NIS_UNKNOWNOBJ = 6, /* Object type is bogus */ + NIS_TRYAGAIN = 7, /* I'm busy, call back */ + NIS_SYSTEMERROR = 8, /* Out of band failure */ + NIS_CHAINBROKEN = 9, /* First/Next warning */ + NIS_PERMISSION = 10, /* Not enough permission to access */ + NIS_NOTOWNER = 11, /* You don't own it, sorry */ + NIS_NOT_ME = 12, /* I don't serve this name */ + NIS_NOMEMORY = 13, /* Outta VM! Help! */ + NIS_NAMEEXISTS = 14, /* Can't create over another name */ + NIS_NOTMASTER = 15, /* I'm justa secondaray, don't ask me */ + NIS_INVALIDOBJ = 16, /* Object is broken somehow */ + NIS_BADNAME = 17, /* Unparsable name */ + NIS_NOCALLBACK = 18, /* Couldn't talk to call back proc */ + NIS_CBRESULTS = 19, /* Results being called back to you */ + NIS_NOSUCHNAME = 20, /* Name unknown */ + NIS_NOTUNIQUE = 21, /* Value is not uniques (entry) */ + NIS_IBMODERROR = 22, /* Inf. Base. Modify error. */ + NIS_NOSUCHTABLE = 23, /* Name for table was wrong */ + NIS_TYPEMISMATCH = 24, /* Entry and table type mismatch */ + NIS_LINKNAMEERROR = 25, /* Link points to bogus name */ + NIS_PARTIAL = 26, /* Partial success, found table */ + NIS_TOOMANYATTRS = 27, /* Too many attributes */ + NIS_RPCERROR = 28, /* RPC error encountered */ + NIS_BADATTRIBUTE = 29, /* Bad or invalid attribute */ + NIS_NOTSEARCHABLE = 30, /* Non-searchable object searched */ + NIS_CBERROR = 31, /* Error during callback (svc crash) */ + NIS_FOREIGNNS = 32, /* Foreign Namespace */ + NIS_BADOBJECT = 33, /* Malformed object structure */ + NIS_NOTSAMEOBJ = 34, /* Object swapped during deletion */ + NIS_MODFAIL = 35, /* Failure during a Modify. */ + NIS_BADREQUEST = 36, /* Illegal query for table */ + NIS_NOTEMPTY = 37, /* Attempt to remove a non-empty tbl */ + NIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */ + NIS_RESYNC = 39, /* Transaction log too far out of date */ + NIS_FAIL = 40, /* NIS operation failed. */ + NIS_UNAVAIL = 41, /* NIS+ service is unavailable (client) */ + NIS_RES2BIG = 42, /* NIS+ result too big for datagram */ + NIS_SRVAUTH = 43, /* NIS+ server wasn't authenticated. */ + NIS_CLNTAUTH = 44, /* NIS+ Client wasn't authenticated. */ + NIS_NOFILESPACE = 45, /* NIS+ server ran out of disk space */ + NIS_NOPROC = 46, /* NIS+ server couldn't create new proc */ + NIS_DUMPLATER = 47 /* NIS+ server already has dump child */ +}; + + +/* + * Structure definitions for the parameters and results of the actual + * NIS RPC calls. + * + * This is the standard result (in the protocol) of most of the nis + * requests. + */ + +struct nis_result { + nis_error status; /* Status of the response */ + nis_object objects<>; /* objects found */ + netobj cookie; /* Cookie Data */ + u_long zticks; /* server ticks */ + u_long dticks; /* DBM ticks. */ + u_long aticks; /* Cache (accel) ticks */ + u_long cticks; /* Client ticks */ +}; + +/* + * A Name Service request + * This request is used to access the name space, ns_name is the name + * of the object within the namespace and the object is it's value, for + * add/modify, a copy of the original for remove. + */ + +struct ns_request { + nis_name ns_name; /* Name in the NIS name space */ + nis_object ns_object<1>; /* Optional Object (add/remove) */ +}; + +/* + * An information base request + * This request includes the NIS name of the table we wish to search, the + * search criteria in the form of attribute/value pairs and an optional + * callback program number. If the callback program number is provided + * the server will send back objects one at a time, otherwise it will + * return them all in the response. + */ + +struct ib_request { + nis_name ibr_name; /* The name of the Table */ + nis_attr ibr_srch<>; /* The search critereia */ + u_long ibr_flags; /* Optional flags */ + nis_object ibr_obj<1>; /* optional object (add/modify) */ + nis_server ibr_cbhost<1>; /* Optional callback info */ + u_long ibr_bufsize; /* Optional first/next bufsize */ + netobj ibr_cookie; /* The first/next cookie */ +}; + +/* + * This argument to the PING call notifies the replicas that something in + * a directory has changed and this is it's timestamp. The replica will use + * the timestamp to determine if its resync operation was successful. + */ +struct ping_args { + nis_name dir; /* Directory that had the change */ + u_long stamp; /* timestamp of the transaction */ +}; + +/* + * These are the type of entries that are stored in the transaction log, + * note that modifications will appear as two entries, for names, they have + * a "OLD" entry followed by a "NEW" entry. For entries in tables, there + * is a remove followed by an add. It is done this way so that we can read + * the log backwards to back out transactions and forwards to propogate + * updated. + */ +enum log_entry_t { + LOG_NOP = 0, + ADD_NAME = 1, /* Name Added to name space */ + REM_NAME = 2, /* Name removed from name space */ + MOD_NAME_OLD = 3, /* Name was modified in the name space */ + MOD_NAME_NEW = 4, /* Name was modified in the name space */ + ADD_IBASE = 5, /* Entry added to information base */ + REM_IBASE = 6, /* Entry removed from information base */ + MOD_IBASE = 7, /* Entry was modified in information base */ + UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */ +}; + +/* + * This result is returned from the name service when it is requested to + * dump logged entries from its transaction log. Information base updates + * will have the name of the information base in the le_name field and + * a canonical set of attribute/value pairs to fully specify the entry's + * 'name'. + */ +struct log_entry { + u_long le_time; /* Time in seconds */ + log_entry_t le_type; /* Type of log entry */ + nis_name le_princp; /* Principal making the change */ + nis_name le_name; /* Name of table/dir involved */ + nis_attr le_attrs<>; /* List of AV pairs. */ + nis_object le_object; /* Actual object value */ +}; + +struct log_result { + nis_error lr_status; /* The status itself */ + netobj lr_cookie; /* Used by the dump callback */ + log_entry lr_entries<>; /* zero or more entries */ +}; + +struct cp_result { + nis_error cp_status; /* Status of the checkpoint */ + u_long cp_zticks; /* Service 'ticks' */ + u_long cp_dticks; /* Database 'ticks' */ +}; + +/* + * This structure defines a generic NIS tag list. The taglist contains + * zero or tags, each of which is a type and a value. (u_long). + * These are used to report statistics (see tag definitions below) + * and to set or reset state variables. + */ +struct nis_tag { + u_long tag_type; /* Statistic tag (may vary) */ + string tag_val<1024>; /* Statistic value may also vary */ +}; + +struct nis_taglist { + nis_tag tags<>; /* List of tags */ +}; + +struct dump_args { + nis_name da_dir; /* Directory to dump */ + u_long da_time; /* From this timestamp */ + nis_server da_cbhost<1>; /* Callback to use. */ +}; + +struct fd_args { + nis_name dir_name; /* The directory we're looking for */ + nis_name requester; /* Host principal name for signature */ +}; + +struct fd_result { + nis_error status; /* Status returned by function */ + nis_name source; /* Source of this answer */ + opaque dir_data<>; /* Directory Data (XDR'ed) */ + opaque signature<>; /* Signature of the source */ +}; + + +/* + * What's going on here? Well, it's like this. When the service + * is being compiled it wants to have the service definition specific + * info included, and when the client is being compiled it wants that + * info. This includes the appropriate file which was generated by + * make in the protocols directory (probably /usr/include/rpcsvc). + * + * Uhm... guys? With RPC, you aren't supposed to have seperate + * server-specific and client-specific header files. You have one header + * file that's suitable for both. If your code doesn't work using just + * the one header file, I submit to you that it's broken. + * -Bill + */ +#ifdef SUN_STUPIDITY +#ifdef RPC_SVC +%#include "nis_svc.h" +#endif +#ifdef RPC_CLNT +%#include "nis_clnt.h" +#endif +#endif + +program NIS_PROG { + + /* RPC Language description of the NIS+ protocol */ + version NIS_VERSION { + /* The name service functions */ + nis_result NIS_LOOKUP(ns_request) = 1; + nis_result NIS_ADD(ns_request) = 2; + nis_result NIS_MODIFY(ns_request) = 3; + nis_result NIS_REMOVE(ns_request) = 4; + + /* The information base functions */ + nis_result NIS_IBLIST(ib_request) = 5; + nis_result NIS_IBADD(ib_request) = 6; + nis_result NIS_IBMODIFY(ib_request) = 7; + nis_result NIS_IBREMOVE(ib_request) = 8; + nis_result NIS_IBFIRST(ib_request) = 9; + nis_result NIS_IBNEXT(ib_request) = 10; + + /* NIS Administrative functions */ + fd_result NIS_FINDDIRECTORY(fd_args) = 12; + + /* If fetch and optionally reset statistics */ + nis_taglist NIS_STATUS(nis_taglist) = 14; + + /* Dump changes to directory since time in da_time */ + log_result NIS_DUMPLOG(dump_args) = 15; + + /* Dump contents of directory named */ + log_result NIS_DUMP(dump_args) = 16; + + /* Check status of callback thread */ + bool NIS_CALLBACK(netobj) = 17; + + /* Return last update time for named dir */ + u_long NIS_CPTIME(nis_name) = 18; + + /* Checkpoint directory or table named */ + cp_result NIS_CHECKPOINT(nis_name) = 19; + + /* Send 'status changed' ping to replicates */ + void NIS_PING(ping_args) = 20; + + /* Modify server behaviour (such as debugging) */ + nis_taglist NIS_SERVSTATE(nis_taglist) = 21; + + /* Create a Directory */ + nis_error NIS_MKDIR(nis_name) = 22; + + /* Remove a Directory */ + nis_error NIS_RMDIR(nis_name) = 23; + + /* Update public keys of a directory object */ + nis_error NIS_UPDKEYS(nis_name) = 24; + } = 3; +} = 100300; + +/* + * Included below are the defines that become part of nis.h, + * they are technically not part of the protocol, but do define + * key aspects of the implementation and are therefore useful + * in building a conforming server or client. + */ +#if RPC_HDR +%/* +% * Generic "hash" datastructures, used by all types of hashed data. +% */ +%struct nis_hash_data { +% nis_name name; /* NIS name of hashed item */ +% int keychain; /* It's hash key (for pop) */ +% struct nis_hash_data *next; /* Hash collision pointer */ +% struct nis_hash_data *prv_item; /* A serial, doubly linked list */ +% struct nis_hash_data *nxt_item; /* of items in the hash table */ +%}; +%typedef struct nis_hash_data NIS_HASH_ITEM; +% +%struct nis_hash_table { +% NIS_HASH_ITEM *keys[64]; /* A hash table of items */ +% NIS_HASH_ITEM *first; /* The first "item" in serial list */ +%}; +%typedef struct nis_hash_table NIS_HASH_TABLE; +% +%/* Structure for storing dynamically allocated static data */ +%struct nis_sdata { +% void *buf; /* Memory allocation pointer */ +% u_long size; /* Buffer size */ +%}; +% +%/* Generic client creating flags */ +%#define ZMH_VC 1 +%#define ZMH_DG 2 +%#define ZMH_AUTH 4 +% +%/* Testing Access rights for objects */ +% +%#define NIS_READ_ACC 1 +%#define NIS_MODIFY_ACC 2 +%#define NIS_CREATE_ACC 4 +%#define NIS_DESTROY_ACC 8 +%/* Test macros. a == access rights, m == desired rights. */ +%#define WORLD(a, m) (((a) & (m)) != 0) +%#define GROUP(a, m) (((a) & ((m) << 8)) != 0) +%#define OWNER(a, m) (((a) & ((m) << 16)) != 0) +%#define NOBODY(a, m) (((a) & ((m) << 24)) != 0) +% +%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype) +%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) +%#define WORLD_DEFAULT (NIS_READ_ACC) +%#define GROUP_DEFAULT (NIS_READ_ACC << 8) +%#define OWNER_DEFAULT ((NIS_READ_ACC +\ + NIS_MODIFY_ACC +\ + NIS_CREATE_ACC +\ + NIS_DESTROY_ACC) << 16) +%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) +% +%/* Result manipulation defines ... */ +%#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len) +%#define NIS_RES_OBJECT(x) ((x)->objects.objects_val) +%#define NIS_RES_COOKIE(x) ((x)->cookie) +%#define NIS_RES_STATUS(x) ((x)->status) +% +%/* These defines make getting at the variant part of the object easier. */ +%#define TA_data zo_data.objdata_u.ta_data +%#define EN_data zo_data.objdata_u.en_data +%#define DI_data zo_data.objdata_u.di_data +%#define LI_data zo_data.objdata_u.li_data +%#define GR_data zo_data.objdata_u.gr_data +% +%#define __type_of(o) ((o)->zo_data.zo_type) +% +%/* Declarations for the internal subroutines in nislib.c */ +%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME}; +%typedef enum name_pos name_pos; +% +%/* +% * Defines for getting at column data in entry objects. Because RPCGEN +% * generates some rather wordy structures, we create some defines that +% * collapse the needed keystrokes to access a particular value using +% * these definitions they take an nis_object *, and an int and return +% * a u_char * for Value, and an int for length. +% */ +%#define ENTRY_VAL(obj, col) \ + (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +%#define ENTRY_LEN(obj, col) \ + (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len +% +%#ifdef __cplusplus +%} +%#endif +% +%/* Prototypes, and extern declarations for the NIS library functions. */ +%#include <rpcsvc/nislib.h> +%#endif /* __NIS_RPCGEN_H */ +%/* EDIT_START */ +% +%/* +% * nis_3.h +% * +% * This file contains definitions that are only of interest to the actual +% * service daemon and client stubs. Normal users of NIS will not include +% * this file. +% * +% * NOTE : This include file is automatically created by a combination +% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead +% * and then remake this file. +% */ +%#ifndef __nis_3_h +%#define __nis_3_h +%#ifdef __cplusplus +%extern "C" { +%#endif +#endif diff --git a/c/src/exec/librpc/include/rpcsvc/nis_cache.x b/c/src/exec/librpc/include/rpcsvc/nis_cache.x index e69de29bb2..8343cfd050 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis_cache.x +++ b/c/src/exec/librpc/include/rpcsvc/nis_cache.x @@ -0,0 +1,87 @@ +%/* +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user or with the express written consent of +% * Sun Microsystems, Inc. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ + +/* + * nis_cache.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +/* From: %#pragma ident "@(#)nis_cache.x 1.11 94/05/03 SMI" */ + +#ifndef RPC_HDR +%#ifndef lint +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/nis_cache.x,v 1.3 1999/08/27 23:45:09 peter Exp $"; +%#endif /* not lint */ +#endif + +#ifdef RPC_HDR +%#include <rpc/types.h> +%#include <rpcsvc/nis.h> +% +%/* default cache file */ +%#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE" +% +%/* clients have to read-lock the cache file, and SVR4 locking requires that */ +%/* the file be writable, but we don't want a world-writable cache file. */ +%/* So... everyone agrees to use a different, world-writable file for the */ +%/* locking operations, but the data is in CACHEFILE. */ +%#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK" +% +%/* the file containing one trusted XDR'ed directory object. +% * This has to be present for the system to work. +% */ +%#define COLD_START_FILE "/var/nis/NIS_COLD_START" +% +%enum pc_status {HIT, MISS, NEAR_MISS}; +% +%extern int __nis_debuglevel; +% +% +#endif + +#ifdef RPC_CLNT +#ifdef SOLARIS +%#include "../gen/nis_clnt.h" +#else +%#include "nis.h" +#endif +#endif + +program CACHEPROG { + version CACHE_VER_1 { + void NIS_CACHE_ADD_ENTRY(fd_result) = 1; + void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2; + void NIS_CACHE_READ_COLDSTART(void) = 3; + void NIS_CACHE_REFRESH_ENTRY(string<>) = 4; + } = 1; +} = 100301; diff --git a/c/src/exec/librpc/include/rpcsvc/nis_callback.x b/c/src/exec/librpc/include/rpcsvc/nis_callback.x index e69de29bb2..4e74aa0a2e 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis_callback.x +++ b/c/src/exec/librpc/include/rpcsvc/nis_callback.x @@ -0,0 +1,76 @@ +%/* +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user or with the express written consent of +% * Sun Microsystems, Inc. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ + +/* + * nis_callback.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +/* From: %#pragma ident "@(#)nis_callback.x 1.7 94/05/03 SMI" */ + +#ifndef RPC_HDR +%#ifndef lint +%static const char rcsid[] = +% "$FreeBSD: src/include/rpcsvc/nis_callback.x,v 1.3 1999/08/27 23:45:09 peter Exp $"; +%#endif /* not lint */ +#endif + +/* + * "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro" + * + * RPCL description of the Callback Service. + */ + +#ifdef RPC_HDR +%#include <rpcsvc/nis.h> +#endif +#ifdef RPC_XDR +#ifdef SOLARIS +%#include "nis_clnt.h" +#else +%#include "nis.h" +#endif +#endif + +typedef nis_object *obj_p; + +struct cback_data { + obj_p entries<>; /* List of objects */ +}; + +program CB_PROG { + version CB_VERS { + bool CBPROC_RECEIVE(cback_data) = 1; + void CBPROC_FINISH(void) = 2; + void CBPROC_ERROR(nis_error) = 3; + } = 1; +} = 100302; diff --git a/c/src/exec/librpc/include/rpcsvc/nis_db.h b/c/src/exec/librpc/include/rpcsvc/nis_db.h index e69de29bb2..dbdee5aac8 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis_db.h +++ b/c/src/exec/librpc/include/rpcsvc/nis_db.h @@ -0,0 +1,162 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + * + * $FreeBSD: src/include/rpcsvc/nis_db.h,v 1.5 1999/08/27 23:45:09 peter Exp $ + */ + +/* + * Copyright (c) 1991, by Sun Microsystems Inc. + */ + +/* + * This header file defines the interface to the NIS database. All + * implementations of the database must export at least these routines. + * They must also follow the conventions set herein. See the implementors + * guide for specific semantics that are required. + */ + +#ifndef _RPCSVC_NIS_DB_H +#define _RPCSVC_NIS_DB_H + + +/* From: #pragma ident "@(#)nis_db.h 1.8 94/05/03 SMI" */ + +/* + * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris + * 2.5/2.5.x is actually older than this one (according to the ident + * string), it contains changes and a few added functions. Those changes + * have been hand merged into this file to bring it up to date. + */ + +#include <rpc/rpc.h> +#include <rpcsvc/nis.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum db_status { + DB_SUCCESS = 0, + DB_NOTFOUND = 1, + DB_NOTUNIQUE = 2, + DB_BADTABLE = 3, + DB_BADQUERY = 4, + DB_BADOBJECT = 5, + DB_MEMORY_LIMIT = 6, + DB_STORAGE_LIMIT = 7, + DB_INTERNAL_ERROR = 8 +}; +typedef enum db_status db_status; + +enum db_action { + DB_LOOKUP = 0, + DB_REMOVE = 1, + DB_ADD = 2, + DB_FIRST = 3, + DB_NEXT = 4, + DB_ALL = 5, + DB_RESET_NEXT = 6 +}; +typedef enum db_action db_action; + +typedef entry_obj *entry_object_p; + +typedef struct { + u_int db_next_desc_len; + char *db_next_desc_val; +} db_next_desc; + +struct db_result { + db_status status; + db_next_desc nextinfo; + struct { + u_int objects_len; + entry_object_p *objects_val; + } objects; + long ticks; +}; +typedef struct db_result db_result; + +/* + * Prototypes for the database functions. + */ + +#if (__STDC__) + +extern bool_t db_initialize(char *); +#ifdef ORIGINAL_DECLS +extern bool_t db_create_table(char *, table_obj *); +extern bool_t db_destroy_table(char *); +#else +extern db_status db_create_table(char *, table_obj *); +extern db_status db_destroy_table(char *); +#endif +extern db_result *db_first_entry(char *, int, nis_attr *); +extern db_result *db_next_entry(char *, db_next_desc *); +extern db_result *db_reset_next_entry(char *, db_next_desc *); +extern db_result *db_list_entries(char *, int, nis_attr *); +extern db_result *db_add_entry(char *, int, nis_attr *, entry_obj *); +extern db_result *db_remove_entry(char *, int, nis_attr *); +extern db_status db_checkpoint(char *); +extern db_status db_standby(char *); +#ifndef ORIGINAL_DECLS +extern db_status db_table_exists(char *); +extern db_status db_unload_table(char *); +extern void db_free_result(db_result *); +#endif + +#else /* Non-prototype definitions */ + +extern bool_t db_initialize(); +#ifdef ORIGINAL_DECLS +extern bool_t db_create_table(); +extern bool_t db_destroy_table(); +#else +extern db_status db_create_table(); +extern db_status db_destroy_table(); +#endif +extern db_result *db_first_entry(); +extern db_result *db_next_entry(); +extern db_result *db_reset_next_entry(); +extern db_result *db_list_entries(); +extern db_result *db_add_entry(); +extern db_result *db_remove_entry(); +extern db_status db_checkpoint(); +extern db_status db_standby(); +#ifndef ORIGINAL_DECLS +extern db_status db_table_exists(); +extern db_status db_unload_table(); +extern void db_free_result(); +#endif +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _RPCSVC_NIS_DB_H */ diff --git a/c/src/exec/librpc/include/rpcsvc/nis_object.x b/c/src/exec/librpc/include/rpcsvc/nis_object.x index e69de29bb2..3156724f1b 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis_object.x +++ b/c/src/exec/librpc/include/rpcsvc/nis_object.x @@ -0,0 +1,317 @@ +%/* +% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for +% * unrestricted use provided that this legend is included on all tape +% * media and as a part of the software program in whole or part. Users +% * may copy or modify Sun RPC without charge, but are not authorized +% * to license or distribute it to anyone else except as part of a product or +% * program developed by the user or with the express written consent of +% * Sun Microsystems, Inc. +% * +% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE +% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +% * +% * Sun RPC is provided with no support and without any obligation on the +% * part of Sun Microsystems, Inc. to assist in its use, correction, +% * modification or enhancement. +% * +% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE +% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC +% * OR ANY PART THEREOF. +% * +% * In no event will Sun Microsystems, Inc. be liable for any lost revenue +% * or profits or other special, indirect and consequential damages, even if +% * Sun has been advised of the possibility of such damages. +% * +% * Sun Microsystems, Inc. +% * 2550 Garcia Avenue +% * Mountain View, California 94043 +% */ + +/* + * nis_object.x + * + * Copyright (c) 1988-1992 Sun Microsystems Inc + * All Rights Reserved. + */ + +/* From: %#pragma ident "@(#)nis_object.x 1.10 94/05/03 SMI" */ + +#if RPC_HDR +% +%#ifndef __nis_object_h +%#define __nis_object_h +% +#endif +/* + * This file defines the format for a NIS object in RPC language. + * It is included by the main .x file and the database access protocol + * file. It is common because both of them need to deal with the same + * type of object. Generating the actual code though is a bit messy because + * the nis.x file and the nis_dba.x file will generate xdr routines to + * encode/decode objects when only one set is needed. Such is life when + * one is using rpcgen. + * + * Note, the protocol doesn't specify any limits on such things as + * maximum name length, number of attributes, etc. These are enforced + * by the database backend. When you hit them you will no. Also see + * the db_getlimits() function for fetching the limit values. + * + */ + +/* Some manifest constants, chosen to maximize flexibility without + * plugging the wire full of data. + */ +const NIS_MAXSTRINGLEN = 255; +const NIS_MAXNAMELEN = 1024; +const NIS_MAXATTRNAME = 32; +const NIS_MAXATTRVAL = 2048; +const NIS_MAXCOLUMNS = 64; +const NIS_MAXATTR = 16; +const NIS_MAXPATH = 1024; +const NIS_MAXREPLICAS = 128; +const NIS_MAXLINKS = 16; + +const NIS_PK_NONE = 0; /* no public key (unix/sys auth) */ +const NIS_PK_DH = 1; /* Public key is Diffie-Hellman type */ +const NIS_PK_RSA = 2; /* Public key if RSA type */ +const NIS_PK_KERB = 3; /* Use kerberos style authentication */ + +/* + * The fundamental name type of NIS. The name may consist of two parts, + * the first being the fully qualified name, and the second being an + * optional set of attribute/value pairs. + */ +struct nis_attr { + string zattr_ndx<>; /* name of the index */ + opaque zattr_val<>; /* Value for the attribute. */ +}; + +typedef string nis_name<>; /* The NIS name itself. */ + +/* NIS object types are defined by the following enumeration. The numbers + * they use are based on the following scheme : + * 0 - 1023 are reserved for Sun, + * 1024 - 2047 are defined to be private to a particular tree. + * 2048 - 4095 are defined to be user defined. + * 4096 - ... are reserved for future use. + */ + +enum zotypes { + BOGUS_OBJ = 0, /* Uninitialized object structure */ + NO_OBJ = 1, /* NULL object (no data) */ + DIRECTORY_OBJ = 2, /* Directory object describing domain */ + GROUP_OBJ = 3, /* Group object (a list of names) */ + TABLE_OBJ = 4, /* Table object (a database schema) */ + ENTRY_OBJ = 5, /* Entry object (a database record) */ + LINK_OBJ = 6, /* A name link. */ + PRIVATE_OBJ = 7 /* Private object (all opaque data) */ +}; + +/* + * The types of Name services NIS knows about. They are enumerated + * here. The Binder code will use this type to determine if it has + * a set of library routines that will access the indicated name service. + */ +enum nstype { + UNKNOWN = 0, + NIS = 1, /* Nis Plus Service */ + SUNYP = 2, /* Old NIS Service */ + IVY = 3, /* Nis Plus Plus Service */ + DNS = 4, /* Domain Name Service */ + X500 = 5, /* ISO/CCCIT X.500 Service */ + DNANS = 6, /* Digital DECNet Name Service */ + XCHS = 7, /* Xerox ClearingHouse Service */ + CDS= 8 +}; + +/* + * DIRECTORY - The name service object. These objects identify other name + * servers that are serving some portion of the name space. Each has a + * type associated with it. The resolver library will note whether or not + * is has the needed routines to access that type of service. + * The oarmask structure defines an access rights mask on a per object + * type basis for the name spaces. The only bits currently used are + * create and destroy. By enabling or disabling these access rights for + * a specific object type for a one of the accessor entities (owner, + * group, world) the administrator can control what types of objects + * may be freely added to the name space and which require the + * administrator's approval. + */ +struct oar_mask { + u_long oa_rights; /* Access rights mask */ + zotypes oa_otype; /* Object type */ +}; + +struct endpoint { + string uaddr<>; + string family<>; /* Transport family (INET, OSI, etc) */ + string proto<>; /* Protocol (TCP, UDP, CLNP, etc) */ +}; + +/* + * Note: pkey is a netobj which is limited to 1024 bytes which limits the + * keysize to 8192 bits. This is consider to be a reasonable limit for + * the expected lifetime of this service. + */ +struct nis_server { + nis_name name; /* Principal name of the server */ + endpoint ep<>; /* Universal addr(s) for server */ + u_long key_type; /* Public key type */ + netobj pkey; /* server's public key */ +}; + +struct directory_obj { + nis_name do_name; /* Name of the directory being served */ + nstype do_type; /* one of NIS, DNS, IVY, YP, or X.500 */ + nis_server do_servers<>; /* <0> == Primary name server */ + u_long do_ttl; /* Time To Live (for caches) */ + oar_mask do_armask<>; /* Create/Destroy rights by object type */ +}; + +/* + * ENTRY - This is one row of data from an information base. + * The type value is used by the client library to convert the entry to + * it's internal structure representation. The Table name is a back pointer + * to the table where the entry is stored. This allows the client library + * to determine where to send a request if the client wishes to change this + * entry but got to it through a LINK rather than directly. + * If the entry is a "standalone" entry then this field is void. + */ +const EN_BINARY = 1; /* Indicates value is binary data */ +const EN_CRYPT = 2; /* Indicates the value is encrypted */ +const EN_XDR = 4; /* Indicates the value is XDR encoded */ +const EN_MODIFIED = 8; /* Indicates entry is modified. */ +const EN_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct entry_col { + u_long ec_flags; /* Flags for this value */ + opaque ec_value<>; /* It's textual value */ +}; + +struct entry_obj { + string en_type<>; /* Type of entry such as "passwd" */ + entry_col en_cols<>; /* Value for the entry */ +}; + +/* + * GROUP - The group object contains a list of NIS principal names. Groups + * are used to authorize principals. Each object has a set of access rights + * for members of its group. Principal names in groups are in the form + * name.directory and recursive groups are expressed as @groupname.directory + */ +struct group_obj { + u_long gr_flags; /* Flags controlling group */ + nis_name gr_members<>; /* List of names in group */ +}; + +/* + * LINK - This is the LINK object. It is quite similar to a symbolic link + * in the UNIX filesystem. The attributes in the main object structure are + * relative to the LINK data and not what it points to (like the file system) + * "modify" privleges here indicate the right to modify what the link points + * at and not to modify that actual object pointed to by the link. + */ +struct link_obj { + zotypes li_rtype; /* Real type of the object */ + nis_attr li_attrs<>; /* Attribute/Values for tables */ + nis_name li_name; /* The object's real NIS name */ +}; + +/* + * TABLE - This is the table object. It implements a simple + * data base that applications and use for configuration or + * administration purposes. The role of the table is to group together + * a set of related entries. Tables are the simple database component + * of NIS. Like many databases, tables are logically divided into columns + * and rows. The columns are labeled with indexes and each ENTRY makes + * up a row. Rows may be addressed within the table by selecting one + * or more indexes, and values for those indexes. Each row which has + * a value for the given index that matches the desired value is returned. + * Within the definition of each column there is a flags variable, this + * variable contains flags which determine whether or not the column is + * searchable, contains binary data, and access rights for the entry objects + * column value. + */ + +const TA_BINARY = 1; /* Means table data is binary */ +const TA_CRYPT = 2; /* Means value should be encrypted */ +const TA_XDR = 4; /* Means value is XDR encoded */ +const TA_SEARCHABLE = 8; /* Means this column is searchable */ +const TA_CASE = 16; /* Means this column is Case Sensitive */ +const TA_MODIFIED = 32; /* Means this columns attrs are modified*/ +const TA_ASN1 = 64; /* Means contents use ASN.1 encoding */ + +struct table_col { + string tc_name<64>; /* Column Name */ + u_long tc_flags; /* control flags */ + u_long tc_rights; /* Access rights mask */ +}; + +struct table_obj { + string ta_type<64>; /* Table type such as "passwd" */ + int ta_maxcol; /* Total number of columns */ + u_char ta_sep; /* Separator character */ + table_col ta_cols<>; /* The number of table indexes */ + string ta_path<>; /* A search path for this table */ +}; + +/* + * This union joins together all of the currently known objects. + */ +union objdata switch (zotypes zo_type) { + case DIRECTORY_OBJ : + struct directory_obj di_data; + case GROUP_OBJ : + struct group_obj gr_data; + case TABLE_OBJ : + struct table_obj ta_data; + case ENTRY_OBJ: + struct entry_obj en_data; + case LINK_OBJ : + struct link_obj li_data; + case PRIVATE_OBJ : + opaque po_data<>; + case NO_OBJ : + void; + case BOGUS_OBJ : + void; + default : + void; +}; + +/* + * This is the basic NIS object data type. It consists of a generic part + * which all objects contain, and a specialized part which varies depending + * on the type of the object. All of the specialized sections have been + * described above. You might have wondered why they all start with an + * integer size, followed by the useful data. The answer is, when the + * server doesn't recognize the type returned it treats it as opaque data. + * And the definition for opaque data is {int size; char *data;}. In this + * way, servers and utility routines that do not understand a given type + * may still pass it around. One has to be careful in setting + * this variable accurately, it must take into account such things as + * XDR padding of structures etc. The best way to set it is to note one's + * position in the XDR encoding stream, encode the structure, look at the + * new position and calculate the size. + */ +struct nis_oid { + u_long ctime; /* Time of objects creation */ + u_long mtime; /* Time of objects modification */ +}; + +struct nis_object { + nis_oid zo_oid; /* object identity verifier. */ + nis_name zo_name; /* The NIS name for this object */ + nis_name zo_owner; /* NIS name of object owner. */ + nis_name zo_group; /* NIS name of access group. */ + nis_name zo_domain; /* The administrator for the object */ + u_long zo_access; /* Access rights (owner, group, world) */ + u_long zo_ttl; /* Object's time to live in seconds. */ + objdata zo_data; /* Data structure for this type */ +}; +#if RPC_HDR +% +%#endif /* if __nis_object_h */ +% +#endif diff --git a/c/src/exec/librpc/include/rpcsvc/nis_tags.h b/c/src/exec/librpc/include/rpcsvc/nis_tags.h index e69de29bb2..0eaee6d442 100644 --- a/c/src/exec/librpc/include/rpcsvc/nis_tags.h +++ b/c/src/exec/librpc/include/rpcsvc/nis_tags.h @@ -0,0 +1,137 @@ +/* + * Sun RPC is a product of Sun Microsystems, Inc. and is provided for + * unrestricted use provided that this legend is included on all tape + * media and as a part of the software program in whole or part. Users + * may copy or modify Sun RPC without charge, but are not authorized + * to license or distribute it to anyone else except as part of a product or + * program developed by the user. + * + * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun RPC is provided with no support and without any obligation on the + * part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * Copyright (c) 1991, Sun Microsystems Inc. + */ + +/* + * nis_tags.h + * + * This file contains the tags and statistics definitions. It is + * automatically included by nis.h + */ + +#ifndef _RPCSVC_NIS_TAGS_H +#define _RPCSVC_NIS_TAGS_H + +/* From: #pragma ident "@(#)nis_tags.h 1.10 94/05/03 SMI" */ +/* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ORIGINAL_DECLS +#define NIS_DIR "data" +#endif + +/* Lookup and List function flags */ +#define FOLLOW_LINKS (1<<0) /* Follow link objects */ +#define FOLLOW_PATH (1<<1) /* Follow the path in a table */ +#define HARD_LOOKUP (1<<2) /* Block until successful */ +#define ALL_RESULTS (1<<3) /* Retrieve all results */ +#define NO_CACHE (1<<4) /* Do not return 'cached' results */ +#define MASTER_ONLY (1<<5) /* Get value only from master server */ +#define EXPAND_NAME (1<<6) /* Expand partitially qualified names */ + +/* Semantic modification for table operations flags */ +#define RETURN_RESULT (1<<7) /* Return resulting object to client */ +#define ADD_OVERWRITE (1<<8) /* Allow overwrites on ADD */ +#define REM_MULTIPLE (1<<9) /* Allow wildcard deletes */ +#define MOD_SAMEOBJ (1< |