Home | History | Annotate | Line # | Download | only in librpcsvc
yp.x revision 1.1
      1  1.1  jtc /*
      2  1.1  jtc  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      3  1.1  jtc  * unrestricted use provided that this legend is included on all tape
      4  1.1  jtc  * media and as a part of the software program in whole or part.  Users
      5  1.1  jtc  * may copy or modify Sun RPC without charge, but are not authorized
      6  1.1  jtc  * to license or distribute it to anyone else except as part of a product or
      7  1.1  jtc  * program developed by the user.
      8  1.1  jtc  *
      9  1.1  jtc  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     10  1.1  jtc  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     11  1.1  jtc  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     12  1.1  jtc  *
     13  1.1  jtc  * Sun RPC is provided with no support and without any obligation on the
     14  1.1  jtc  * part of Sun Microsystems, Inc. to assist in its use, correction,
     15  1.1  jtc  * modification or enhancement.
     16  1.1  jtc  *
     17  1.1  jtc  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     18  1.1  jtc  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     19  1.1  jtc  * OR ANY PART THEREOF.
     20  1.1  jtc  *
     21  1.1  jtc  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     22  1.1  jtc  * or profits or other special, indirect and consequential damages, even if
     23  1.1  jtc  * Sun has been advised of the possibility of such damages.
     24  1.1  jtc  *
     25  1.1  jtc  * Sun Microsystems, Inc.
     26  1.1  jtc  * 2550 Garcia Avenue
     27  1.1  jtc  * Mountain View, California  94043
     28  1.1  jtc  */
     29  1.1  jtc 
     30  1.1  jtc /*
     31  1.1  jtc  * Protocol description file for the Yellow Pages Service
     32  1.1  jtc  */
     33  1.1  jtc 
     34  1.1  jtc #ifndef RPC_HDR
     35  1.1  jtc %#ifndef lint
     36  1.1  jtc %/*static char sccsid[] = "from: @(#)yp.x	2.1 88/08/01 4.0 RPCSRC";*/
     37  1.1  jtc %static char rcsid[] = "$Id: yp.x,v 1.1 1995/01/12 19:40:00 jtc Exp $";
     38  1.1  jtc %#endif /* not lint */
     39  1.1  jtc #endif
     40  1.1  jtc 
     41  1.1  jtc const YPMAXRECORD = 1024;
     42  1.1  jtc const YPMAXDOMAIN = 64;
     43  1.1  jtc const YPMAXMAP = 64;
     44  1.1  jtc const YPMAXPEER = 64;
     45  1.1  jtc 
     46  1.1  jtc 
     47  1.1  jtc enum ypstat {
     48  1.1  jtc 	YP_TRUE		=  1,
     49  1.1  jtc 	YP_NOMORE	=  2,
     50  1.1  jtc 	YP_FALSE	=  0,
     51  1.1  jtc 	YP_NOMAP	= -1,
     52  1.1  jtc 	YP_NODOM	= -2,
     53  1.1  jtc 	YP_NOKEY	= -3,
     54  1.1  jtc 	YP_BADOP	= -4,
     55  1.1  jtc 	YP_BADDB	= -5,
     56  1.1  jtc 	YP_YPERR	= -6,
     57  1.1  jtc 	YP_BADARGS	= -7,
     58  1.1  jtc 	YP_VERS		= -8
     59  1.1  jtc };
     60  1.1  jtc 
     61  1.1  jtc 
     62  1.1  jtc enum ypxfrstat {
     63  1.1  jtc 	YPXFR_SUCC	=  1,
     64  1.1  jtc 	YPXFR_AGE	=  2,
     65  1.1  jtc 	YPXFR_NOMAP	= -1,
     66  1.1  jtc 	YPXFR_NODOM	= -2,
     67  1.1  jtc 	YPXFR_RSRC	= -3,
     68  1.1  jtc 	YPXFR_RPC	= -4,
     69  1.1  jtc 	YPXFR_MADDR	= -5,
     70  1.1  jtc 	YPXFR_YPERR	= -6,
     71  1.1  jtc 	YPXFR_BADARGS	= -7,
     72  1.1  jtc 	YPXFR_DBM	= -8,
     73  1.1  jtc 	YPXFR_FILE	= -9,
     74  1.1  jtc 	YPXFR_SKEW	= -10,
     75  1.1  jtc 	YPXFR_CLEAR	= -11,
     76  1.1  jtc 	YPXFR_FORCE	= -12,
     77  1.1  jtc 	YPXFR_XFRERR	= -13,
     78  1.1  jtc 	YPXFR_REFUSED	= -14
     79  1.1  jtc };
     80  1.1  jtc 
     81  1.1  jtc 
     82  1.1  jtc typedef string domainname<YPMAXDOMAIN>;
     83  1.1  jtc typedef string mapname<YPMAXMAP>;
     84  1.1  jtc typedef string peername<YPMAXPEER>;
     85  1.1  jtc typedef opaque keydat<YPMAXRECORD>;
     86  1.1  jtc typedef opaque valdat<YPMAXRECORD>;
     87  1.1  jtc 
     88  1.1  jtc 
     89  1.1  jtc struct ypmap_parms {
     90  1.1  jtc 	domainname domain;
     91  1.1  jtc 	mapname map;
     92  1.1  jtc 	unsigned int ordernum;
     93  1.1  jtc 	peername peer;
     94  1.1  jtc };
     95  1.1  jtc 
     96  1.1  jtc struct ypreq_key {
     97  1.1  jtc 	domainname domain;
     98  1.1  jtc 	mapname map;
     99  1.1  jtc 	keydat key;
    100  1.1  jtc };
    101  1.1  jtc 
    102  1.1  jtc struct ypreq_nokey {
    103  1.1  jtc 	domainname domain;
    104  1.1  jtc 	mapname map;
    105  1.1  jtc };
    106  1.1  jtc 
    107  1.1  jtc struct ypreq_xfr {
    108  1.1  jtc 	ypmap_parms map_parms;
    109  1.1  jtc 	unsigned int transid;
    110  1.1  jtc 	unsigned int prog;
    111  1.1  jtc 	unsigned int port;
    112  1.1  jtc };
    113  1.1  jtc 
    114  1.1  jtc 
    115  1.1  jtc struct ypresp_val {
    116  1.1  jtc 	ypstat stat;
    117  1.1  jtc 	valdat val;
    118  1.1  jtc };
    119  1.1  jtc 
    120  1.1  jtc struct ypresp_key_val {
    121  1.1  jtc 	ypstat stat;
    122  1.1  jtc 	keydat key;
    123  1.1  jtc 	valdat val;
    124  1.1  jtc };
    125  1.1  jtc 
    126  1.1  jtc 
    127  1.1  jtc struct ypresp_master {
    128  1.1  jtc 	ypstat stat;
    129  1.1  jtc 	peername peer;
    130  1.1  jtc };
    131  1.1  jtc 
    132  1.1  jtc struct ypresp_order {
    133  1.1  jtc 	ypstat stat;
    134  1.1  jtc 	unsigned int ordernum;
    135  1.1  jtc };
    136  1.1  jtc 
    137  1.1  jtc union ypresp_all switch (bool more) {
    138  1.1  jtc case TRUE:
    139  1.1  jtc 	ypresp_key_val val;
    140  1.1  jtc case FALSE:
    141  1.1  jtc 	void;
    142  1.1  jtc };
    143  1.1  jtc 
    144  1.1  jtc struct ypresp_xfr {
    145  1.1  jtc 	unsigned int transid;
    146  1.1  jtc 	ypxfrstat xfrstat;
    147  1.1  jtc };
    148  1.1  jtc 
    149  1.1  jtc struct ypmaplist {
    150  1.1  jtc 	mapname map;
    151  1.1  jtc 	ypmaplist *next;
    152  1.1  jtc };
    153  1.1  jtc 
    154  1.1  jtc struct ypresp_maplist {
    155  1.1  jtc 	ypstat stat;
    156  1.1  jtc 	ypmaplist *maps;
    157  1.1  jtc };
    158  1.1  jtc 
    159  1.1  jtc enum yppush_status {
    160  1.1  jtc 	YPPUSH_SUCC	=  1,	/* Success */
    161  1.1  jtc 	YPPUSH_AGE 	=  2,	/* Master's version not newer */
    162  1.1  jtc 	YPPUSH_NOMAP	= -1,	/* Can't find server for map */
    163  1.1  jtc 	YPPUSH_NODOM	= -2,	/* Domain not supported */
    164  1.1  jtc 	YPPUSH_RSRC	= -3,	/* Local resource alloc failure */
    165  1.1  jtc 	YPPUSH_RPC	= -4,	/* RPC failure talking to server */
    166  1.1  jtc 	YPPUSH_MADDR 	= -5,	/* Can't get master address */
    167  1.1  jtc 	YPPUSH_YPERR	= -6,	/* YP server/map db error */
    168  1.1  jtc 	YPPUSH_BADARGS	= -7,	/* Request arguments bad */
    169  1.1  jtc 	YPPUSH_DBM	= -8,	/* Local dbm operation failed */
    170  1.1  jtc 	YPPUSH_FILE	= -9,	/* Local file I/O operation failed */
    171  1.1  jtc 	YPPUSH_SKEW	= -10,	/* Map version skew during transfer */
    172  1.1  jtc 	YPPUSH_CLEAR	= -11,	/* Can't send "Clear" req to local ypserv */
    173  1.1  jtc 	YPPUSH_FORCE	= -12,	/* No local order number in map  use -f flag. */
    174  1.1  jtc 	YPPUSH_XFRERR 	= -13,	/* ypxfr error */
    175  1.1  jtc 	YPPUSH_REFUSED	= -14 	/* Transfer request refused by ypserv */
    176  1.1  jtc };
    177  1.1  jtc 
    178  1.1  jtc struct yppushresp_xfr {
    179  1.1  jtc 	unsigned transid;
    180  1.1  jtc 	yppush_status status;
    181  1.1  jtc };
    182  1.1  jtc 
    183  1.1  jtc /*
    184  1.1  jtc  * Response structure and overall result status codes.  Success and failure
    185  1.1  jtc  * represent two separate response message types.
    186  1.1  jtc  */
    187  1.1  jtc 
    188  1.1  jtc enum ypbind_resptype {
    189  1.1  jtc 	YPBIND_SUCC_VAL = 1,
    190  1.1  jtc 	YPBIND_FAIL_VAL = 2
    191  1.1  jtc };
    192  1.1  jtc 
    193  1.1  jtc struct ypbind_binding {
    194  1.1  jtc     opaque ypbind_binding_addr[4]; /* In network order */
    195  1.1  jtc     opaque ypbind_binding_port[2]; /* In network order */
    196  1.1  jtc };
    197  1.1  jtc 
    198  1.1  jtc union ypbind_resp switch (ypbind_resptype ypbind_status) {
    199  1.1  jtc case YPBIND_FAIL_VAL:
    200  1.1  jtc         unsigned ypbind_error;
    201  1.1  jtc case YPBIND_SUCC_VAL:
    202  1.1  jtc         ypbind_binding ypbind_bindinfo;
    203  1.1  jtc };
    204  1.1  jtc 
    205  1.1  jtc /* Detailed failure reason codes for response field ypbind_error*/
    206  1.1  jtc 
    207  1.1  jtc const YPBIND_ERR_ERR    = 1;	/* Internal error */
    208  1.1  jtc const YPBIND_ERR_NOSERV = 2;	/* No bound server for passed domain */
    209  1.1  jtc const YPBIND_ERR_RESC   = 3;	/* System resource allocation failure */
    210  1.1  jtc 
    211  1.1  jtc 
    212  1.1  jtc /*
    213  1.1  jtc  * Request data structure for ypbind "Set domain" procedure.
    214  1.1  jtc  */
    215  1.1  jtc struct ypbind_setdom {
    216  1.1  jtc 	domainname ypsetdom_domain;
    217  1.1  jtc 	ypbind_binding ypsetdom_binding;
    218  1.1  jtc 	unsigned ypsetdom_vers;
    219  1.1  jtc };
    220  1.1  jtc 
    221  1.1  jtc 
    222  1.1  jtc /*
    223  1.1  jtc  * YP access protocol
    224  1.1  jtc  */
    225  1.1  jtc program YPPROG {
    226  1.1  jtc 	version YPVERS {
    227  1.1  jtc 		void
    228  1.1  jtc 		YPPROC_NULL(void) = 0;
    229  1.1  jtc 
    230  1.1  jtc 		bool
    231  1.1  jtc 		YPPROC_DOMAIN(domainname) = 1;
    232  1.1  jtc 
    233  1.1  jtc 		bool
    234  1.1  jtc 		YPPROC_DOMAIN_NONACK(domainname) = 2;
    235  1.1  jtc 
    236  1.1  jtc 		ypresp_val
    237  1.1  jtc 		YPPROC_MATCH(ypreq_key) = 3;
    238  1.1  jtc 
    239  1.1  jtc 		ypresp_key_val
    240  1.1  jtc 		YPPROC_FIRST(ypreq_key) = 4;
    241  1.1  jtc 
    242  1.1  jtc 		ypresp_key_val
    243  1.1  jtc 		YPPROC_NEXT(ypreq_key) = 5;
    244  1.1  jtc 
    245  1.1  jtc 		ypresp_xfr
    246  1.1  jtc 		YPPROC_XFR(ypreq_xfr) = 6;
    247  1.1  jtc 
    248  1.1  jtc 		void
    249  1.1  jtc 		YPPROC_CLEAR(void) = 7;
    250  1.1  jtc 
    251  1.1  jtc 		ypresp_all
    252  1.1  jtc 		YPPROC_ALL(ypreq_nokey) = 8;
    253  1.1  jtc 
    254  1.1  jtc 		ypresp_master
    255  1.1  jtc 		YPPROC_MASTER(ypreq_nokey) = 9;
    256  1.1  jtc 
    257  1.1  jtc 		ypresp_order
    258  1.1  jtc 		YPPROC_ORDER(ypreq_nokey) = 10;
    259  1.1  jtc 
    260  1.1  jtc 		ypresp_maplist
    261  1.1  jtc 		YPPROC_MAPLIST(domainname) = 11;
    262  1.1  jtc 	} = 2;
    263  1.1  jtc } = 100004;
    264  1.1  jtc 
    265  1.1  jtc 
    266  1.1  jtc /*
    267  1.1  jtc  * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
    268  1.1  jtc  */
    269  1.1  jtc program YPPUSH_XFRRESPPROG {
    270  1.1  jtc 	version YPPUSH_XFRRESPVERS {
    271  1.1  jtc 		void
    272  1.1  jtc 		YPPUSHPROC_NULL(void) = 0;
    273  1.1  jtc 
    274  1.1  jtc 		yppushresp_xfr
    275  1.1  jtc 		YPPUSHPROC_XFRRESP(void) = 1;
    276  1.1  jtc 	} = 1;
    277  1.1  jtc } = 0x40000000;	/* transient: could be anything up to 0x5fffffff */
    278  1.1  jtc 
    279  1.1  jtc 
    280  1.1  jtc /*
    281  1.1  jtc  * YP binding protocol
    282  1.1  jtc  */
    283  1.1  jtc program YPBINDPROG {
    284  1.1  jtc 	version YPBINDVERS {
    285  1.1  jtc 		void
    286  1.1  jtc 		YPBINDPROC_NULL(void) = 0;
    287  1.1  jtc 
    288  1.1  jtc 		ypbind_resp
    289  1.1  jtc 		YPBINDPROC_DOMAIN(domainname) = 1;
    290  1.1  jtc 
    291  1.1  jtc 		void
    292  1.1  jtc 		YPBINDPROC_SETDOM(ypbind_setdom) = 2;
    293  1.1  jtc 	} = 2;
    294  1.1  jtc } = 100007;
    295  1.1  jtc 
    296  1.1  jtc 
    297