Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:37

0001 /*
0002  * This file contains symbols and structures defining the rpc protocol
0003  * between the NIS clients and the NIS servers.  The servers
0004  * are the NIS database servers, and the NIS binders.
0005  */
0006 
0007 #ifndef _RPCSVC_YP_PROT_H
0008 #define _RPCSVC_YP_PROT_H
0009 
0010 #include <rpc/rpc.h>
0011 #include <rpcsvc/ypclnt.h>
0012 
0013 #ifdef __cplusplus
0014 extern "C" {
0015 #endif
0016 
0017 
0018 /*
0019  * The following procedures are supported by the protocol:
0020  *
0021  * YPPROC_NULL() returns () takes nothing, returns nothing.  This indicates
0022  * that the NIS server is alive.
0023  *
0024  * YPPROC_DOMAIN (char *) returns (bool_t) TRUE.  Indicates that the
0025  * responding NIS server does serve the named domain; FALSE indicates no
0026  * support.
0027  *
0028  * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
0029  * the named domain, otherwise does not return.  Used in the broadcast case.
0030  *
0031  * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val).  Returns the
0032  * right-hand value for a passed left-hand key, within a named map and
0033  * domain.
0034  *
0035  * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
0036  * Returns the first key-value pair from a named domain and map.
0037  *
0038  * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val).  Returns
0039  * the key-value pair following a passed key-value pair within a named
0040  * domain and map.
0041  *
0042  * YPPROC_XFR (struct ypreq_xfr) returns nothing.  Indicates to a server that
0043  * a map should be updated.
0044  *
0045  * YPPROC_NEWXFR (struct ypreq_newxfr) returns nothing.  Indicates to a server
0046  * that a map should be updated. Uses protocol independent request struct.
0047  *
0048  * YPPROC_CLEAR takes nothing, returns nothing.  Instructs a NIS server to
0049  * close the current map, so that old versions of the disk file don't get
0050  * held open.
0051  *
0052  * YPPROC_ALL (struct ypreq_nokey), returns
0053  *  union switch (bool_t more) {
0054  *      TRUE:   (struct ypresp_key_val);
0055  *      FALSE:  (struct) {};
0056  *  }
0057  *
0058  * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
0059  *
0060  * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
0061  *
0062  * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
0063  */
0064 
0065 /* Program and version symbols, magic numbers */
0066 
0067 #define YPPROG          100004
0068 #define YPVERS      2
0069 #define YPVERS_ORIG 1
0070 #define YPMAXRECORD 1024
0071 #define YPMAXDOMAIN 256
0072 #define YPMAXMAP    64
0073 #define YPMAXPEER   256
0074 
0075 /* byte size of a large NIS packet */
0076 #define YPMSGSZ     1600
0077 
0078 typedef struct keydat {
0079   u_int keydat_len;
0080   char *keydat_val;
0081 } keydat_t;
0082 
0083 typedef struct valdat {
0084   u_int valdat_len;
0085   char *valdat_val;
0086 } valdat_t;
0087 
0088 struct ypmap_parms {
0089   char *domain;         /* Null string means not available */
0090   char *map;            /* Null string means not available */
0091   unsigned int ordernum;    /* 0 means not available */
0092   char *owner;          /* Null string means not available */
0093 };
0094 typedef struct ypmap_parms ypmap_parms;
0095 
0096 /*
0097  * Request parameter structures
0098  */
0099 
0100 struct ypreq_key {
0101   char *domain;
0102   char *map;
0103   keydat_t keydat;
0104 };
0105 typedef struct ypreq_key ypreq_key;
0106 
0107 struct ypreq_nokey {
0108   char *domain;
0109   char *map;
0110 };
0111 typedef struct ypreq_nokey ypreq_nokey;
0112 
0113 struct ypreq_xfr {
0114   struct ypmap_parms map_parms;
0115   u_int transid;
0116   u_int proto;
0117   u_int port;
0118 };
0119 typedef struct ypreq_xfr ypreq_xfr;
0120 
0121 struct ypreq_newxfr {
0122   struct ypmap_parms map_parms;
0123   u_int transid;
0124   u_int proto;
0125   char *name;
0126 };
0127 typedef struct ypreq_newxfr ypreq_newxfr;
0128 
0129 #define ypxfr_domain map_parms.domain
0130 #define ypxfr_map map_parms.map
0131 #define ypxfr_ordernum map_parms.ordernum
0132 #define ypxfr_owner map_parms.owner
0133 
0134 /* Return status values */
0135 
0136 enum ypstat {
0137   YP_TRUE = 1,      /* General purpose success code */
0138 #define YP_TRUE YP_TRUE
0139   YP_NOMORE = 2,    /* No more entries in map */
0140 #define YP_NOMORE YP_NOMORE
0141   YP_FALSE = 0,     /* General purpose failure code */
0142 #define YP_FALSE YP_FALSE
0143   YP_NOMAP = -1,    /* No such map in domain */
0144 #define YP_NOMAP YP_NOMAP
0145   YP_NODOM = -2,    /* Domain not supported */
0146 #define YP_NODOM YP_NODOM
0147   YP_NOKEY = -3,    /* No such key in map */
0148 #define YP_NOKEY YP_NOKEY
0149   YP_BADOP = -4,    /* Invalid operation */
0150 #define YP_BADOP YP_BADOP
0151   YP_BADDB = -5,    /* Server data base is bad */
0152 #define YP_BADDB YP_BADDB
0153   YP_YPERR = -6,    /* NIS server error */
0154 #define YP_YPERR YP_YPERR
0155   YP_BADARGS = -7,  /* Request arguments bad */
0156 #define YP_BADARGS YP_BADARGS
0157   YP_VERS = -8      /* NIS server version mismatch - server can't supply
0158                requested service. */
0159 #define YP_VERS YP_VERS
0160 };
0161 typedef enum ypstat ypstat;
0162 
0163 
0164 enum ypxfrstat {
0165   YPXFR_SUCC = 1,
0166   YPXFR_AGE = 2,
0167   YPXFR_NOMAP = -1,
0168   YPXFR_NODOM = -2,
0169   YPXFR_RSRC = -3,
0170   YPXFR_RPC = -4,
0171   YPXFR_MADDR = -5,
0172   YPXFR_YPERR = -6,
0173   YPXFR_BADARGS = -7,
0174   YPXFR_DBM = -8,
0175   YPXFR_FILE = -9,
0176   YPXFR_SKEW = -10,
0177   YPXFR_CLEAR = -11,
0178   YPXFR_FORCE = -12,
0179   YPXFR_XFRERR = -13,
0180   YPXFR_REFUSED = -14
0181 };
0182 typedef enum ypxfrstat ypxfrstat;
0183 
0184 /*
0185  * Response parameter structures
0186  */
0187 
0188 struct ypresp_val {
0189   ypstat status;
0190   valdat_t valdat;
0191 };
0192 typedef struct ypresp_val ypresp_val;
0193 
0194 struct ypresp_key_val {
0195   ypstat status;
0196   valdat_t valdat;
0197   keydat_t keydat;
0198 };
0199 typedef struct ypresp_key_val ypresp_key_val;
0200 
0201 struct ypresp_master {
0202   ypstat status;
0203   char *master;
0204 };
0205 typedef struct ypresp_master ypresp_master;
0206 
0207 struct ypresp_order {
0208   ypstat status;
0209   unsigned int ordernum;
0210 };
0211 typedef struct ypresp_order ypresp_order;
0212 
0213 struct ypresp_xfr {
0214         u_int transid;
0215         ypxfrstat xfrstat;
0216 };
0217 typedef struct ypresp_xfr ypresp_xfr;
0218 
0219 struct ypmaplist {
0220   char *map;
0221 #define ypml_name map
0222   struct ypmaplist *next;
0223 #define ypml_next next
0224 };
0225 typedef struct ypmaplist ypmaplist;
0226 
0227 struct ypresp_maplist {
0228   ypstat status;
0229   struct ypmaplist *list;
0230 };
0231 typedef struct ypresp_maplist ypresp_maplist;
0232 
0233 
0234 /*
0235  * Procedure symbols.  YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
0236  * must keep the same values (0, 1, and 2) that they had in the first version
0237  * of the protocol.
0238  */
0239 
0240 #define YPPROC_NULL 0
0241 #define YPPROC_DOMAIN   1
0242 #define YPPROC_DOMAIN_NONACK 2
0243 #define YPPROC_MATCH    3
0244 #define YPPROC_FIRST    4
0245 #define YPPROC_NEXT 5
0246 #define YPPROC_XFR  6
0247 #define YPPROC_CLEAR    7
0248 #define YPPROC_ALL  8
0249 #define YPPROC_MASTER   9
0250 #define YPPROC_ORDER    10
0251 #define YPPROC_MAPLIST  11
0252 #define YPPROC_NEWXFR   12
0253 
0254 /*
0255  *      Protocol between clients and NIS binder servers
0256  */
0257 
0258 /*
0259  * The following procedures are supported by the protocol:
0260  *
0261  * YPBINDPROC_NULL() returns ()
0262  *  takes nothing, returns nothing
0263  *
0264  * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind2_resp)
0265  *
0266  * YPBINDPROC_SETDOM takes (struct ypbind2_setdom) returns nothing
0267  */
0268 
0269 /* Program and version symbols, magic numbers */
0270 
0271 #define YPBINDPROG      100007
0272 #define YPBINDVERS      3
0273 #define YPBINDVERS_2        2
0274 #define YPBINDVERS_1        1
0275 
0276 /* Procedure symbols */
0277 
0278 #define YPBINDPROC_NULL     0
0279 #define YPBINDPROC_DOMAIN   1
0280 #define YPBINDPROC_SETDOM   2
0281 
0282 /*
0283  * Request and response structures and overall result status codes.
0284  * Success and failure represent two separate response message types.
0285  */
0286 
0287 enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2};
0288 typedef enum ypbind_resptype ypbind_resptype;
0289 
0290 struct ypbind2_binding {
0291   struct in_addr ypbind_binding_addr;           /* In network order */
0292   unsigned short int ypbind_binding_port;   /* In network order */
0293 };
0294 typedef struct ypbind2_binding ypbind2_binding;
0295 
0296 struct ypbind2_resp {
0297   enum ypbind_resptype ypbind_status;
0298   union {
0299     u_int ypbind_error;
0300     struct ypbind2_binding ypbind_bindinfo;
0301   } ypbind_respbody;
0302 };
0303 typedef struct ypbind2_resp ypbind2_resp;
0304 #define ypbind2_error ypbind_respbody.ypbind_error
0305 #define ypbind2_bindinfo ypbind_respbody.ypbind_bindinfo
0306 #define ypbind2_addr ypbind_respbody.ypbind_bindinfo.ypbind_binding_addr
0307 #define ypbind2_port ypbind_respbody.ypbind_bindinfo.ypbind_binding_port
0308 
0309 struct ypbind_oldsetdom {
0310         char ypoldsetdom_domain[YPMAXDOMAIN];
0311         ypbind2_binding ypoldsetdom_binding;
0312 };
0313 typedef struct ypbind_oldsetdom ypbind_oldsetdom;
0314 #define ypoldsetdom_addr ypoldsetdom_binding.ypbind_binding_addr
0315 #define ypoldsetdom_port ypoldsetdom_binding.ypbind_binding_port
0316 
0317 struct ypbind2_setdom {
0318   char *ypsetdom_domain;
0319   struct ypbind2_binding ypsetdom_binding;
0320   u_int ypsetdom_vers;
0321 };
0322 typedef struct ypbind2_setdom ypbind2_setdom;
0323 #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
0324 #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
0325 
0326 struct ypbind3_binding {
0327   struct netconfig *ypbind_nconf;
0328   struct netbuf *ypbind_svcaddr;
0329   char *ypbind_servername;
0330   /* that's the highest version number that the used
0331      ypserv supports, normally YPVERS */
0332   rpcvers_t ypbind_hi_vers;
0333   /* the lowest version number that the used
0334      ypserv supports, on Solaris 0 or YPVERS, too */
0335   rpcvers_t ypbind_lo_vers;
0336 };
0337 typedef struct ypbind3_binding ypbind3_binding;
0338 
0339 struct ypbind3_resp {
0340   enum ypbind_resptype ypbind_status;
0341   union {
0342     u_long ypbind_error;
0343     struct ypbind3_binding *ypbind_bindinfo;
0344   } ypbind_respbody;
0345 };
0346 typedef struct ypbind3_resp ypbind3_resp;
0347 #define ypbind3_error ypbind_respbody.ypbind_error
0348 #define ypbind3_bindinfo ypbind_respbody.ypbind_bindinfo
0349 #define ypbind3_nconf ypbind_respbody.ypbind_bindinfo->ypbind_nconf
0350 #define ypbind3_svcaddr ypbind_respbody.ypbind_bindinfo->ypbind_svcaddr
0351 #define ypbind3_servername ypbind_respbody.ypbind_bindinfo->ypbind_servername
0352 #define ypbind3_hi_vers ypbind_respbody.ypbind_bindinfo->ypbind_hi_vers
0353 #define ypbind3_lo_vers ypbind_respbody.ypbind_bindinfo->ypbind_lo_vers
0354 
0355 struct ypbind3_setdom {
0356   char *ypsetdom_domain;
0357   struct ypbind3_binding *ypsetdom_bindinfo;
0358 };
0359 typedef struct ypbind3_setdom ypbind3_setdom;
0360 #define ypsetdom3_nconf ypsetdom_bindinfo->ypbind_nconf
0361 #define ypsetdom3_svcaddr ypsetdom_bindinfo->ypbind_svcaddr
0362 #define ypsetdom3_servername ypsetdom_bindinfo->ypbind_servername
0363 #define ypsetdom3_hi_vers ypsetdom_bindinfo->ypbind_hi_vers
0364 #define ypsetdom3_lo_vers ypsetdom_bindinfo->ypbind_lo_vers
0365 
0366 
0367 /* Detailed failure reason codes for response field ypbind_error*/
0368 
0369 #define YPBIND_ERR_ERR 1        /* Internal error */
0370 #define YPBIND_ERR_NOSERV 2     /* No bound server for passed domain */
0371 #define YPBIND_ERR_RESC 3       /* System resource allocation failure */
0372 #define YPBIND_ERR_NODOMAIN 4   /* Domain doesn't exist */
0373 
0374 /*
0375  *      Protocol between clients (ypxfr, only) and yppush
0376  *      yppush speaks a protocol in the transient range, which
0377  *      is supplied to ypxfr as a command-line parameter when it
0378  *      is activated by ypserv.
0379  */
0380 #define YPPUSHVERS      1
0381 #define YPPUSHVERS_ORIG     1
0382 
0383 /* Procedure symbols */
0384 
0385 #define YPPUSHPROC_NULL     0
0386 #define YPPUSHPROC_XFRRESP  1
0387 
0388 /* Status values for yppushresp_xfr.status */
0389 
0390 enum yppush_status {
0391   YPPUSH_SUCC = 1,      /* Success */
0392 #define YPPUSH_SUCC YPPUSH_SUCC
0393   YPPUSH_AGE = 2,       /* Master's version not newer */
0394 #define YPPUSH_AGE  YPPUSH_AGE
0395   YPPUSH_NOMAP = -1,        /* Can't find server for map */
0396 #define YPPUSH_NOMAP    YPPUSH_NOMAP
0397   YPPUSH_NODOM = -2,        /* Domain not supported */
0398 #define YPPUSH_NODOM    YPPUSH_NODOM
0399   YPPUSH_RSRC = -3,     /* Local resouce alloc failure */
0400 #define YPPUSH_RSRC     YPPUSH_RSRC
0401   YPPUSH_RPC = -4,      /* RPC failure talking to server */
0402 #define YPPUSH_RPC  YPPUSH_RPC
0403   YPPUSH_MADDR = -5,        /* Can't get master address */
0404 #define YPPUSH_MADDR    YPPUSH_MADDR
0405   YPPUSH_YPERR = -6,        /* NIS server/map db error */
0406 #define YPPUSH_YPERR    YPPUSH_YPERR
0407   YPPUSH_BADARGS = -7,      /* Request arguments bad */
0408 #define YPPUSH_BADARGS  YPPUSH_BADARGS
0409   YPPUSH_DBM = -8,      /* Local dbm operation failed */
0410 #define YPPUSH_DBM  YPPUSH_DBM
0411   YPPUSH_FILE = -9,     /* Local file I/O operation failed */
0412 #define YPPUSH_FILE YPPUSH_FILE
0413   YPPUSH_SKEW = -10,        /* Map version skew during transfer */
0414 #define YPPUSH_SKEW YPPUSH_SKEW
0415   YPPUSH_CLEAR = -11,       /* Can't send "Clear" req to local ypserv */
0416 #define YPPUSH_CLEAR    YPPUSH_CLEAR
0417   YPPUSH_FORCE = -12,       /* No local order number in map - use -f flag*/
0418 #define YPPUSH_FORCE    YPPUSH_FORCE
0419   YPPUSH_XFRERR = -13,      /* ypxfr error */
0420 #define YPPUSH_XFRERR   YPPUSH_XFRERR
0421   YPPUSH_REFUSED = -14,     /* Transfer request refused by ypserv */
0422 #define YPPUSH_REFUSED  YPPUSH_REFUSED
0423   YPPUSH_NOALIAS = -15      /* Alias not found for map or domain */
0424 #define YPPUSH_NOALIAS  YPPUSH_NOALIAS
0425 };
0426 typedef enum yppush_status yppush_status;
0427 
0428 struct yppushresp_xfr {
0429   u_int transid;
0430   yppush_status status;
0431 };
0432 typedef struct yppushresp_xfr yppushresp_xfr;
0433 
0434 struct ypresp_all {
0435   bool_t more;
0436   union {
0437     struct ypresp_key_val val;
0438   } ypresp_all_u;
0439 };
0440 typedef struct ypresp_all ypresp_all;
0441 
0442 extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp);
0443 extern bool_t xdr_keydat (XDR *__xdrs, keydat_t *__objp);
0444 extern bool_t xdr_valdat (XDR *__xdrs, valdat_t *__objp);
0445 extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp);
0446 extern bool_t xdr_ypbind2_binding (XDR *__xdrs, struct ypbind2_binding * __objp);
0447 extern bool_t xdr_ypbind2_resp (XDR *__xdrs, struct ypbind2_resp * __objp);
0448 extern bool_t xdr_ypbind2_setdom (XDR *__xdrs, struct ypbind2_setdom * __objp);
0449 extern bool_t xdr_ypbind3_binding (XDR *__xdrs, struct ypbind3_binding * __objp);
0450 extern bool_t xdr_ypbind3_resp (XDR *__xdrs, struct ypbind3_resp * __objp);
0451 extern bool_t xdr_ypbind3_setdom (XDR *__xdrs, struct ypbind3_setdom * __objp);
0452 extern bool_t xdr_ypbind_oldsetdom (XDR *__xdrs, struct ypbind_oldsetdom * __objp);
0453 extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp);
0454 extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp);
0455 extern bool_t xdr_ypmaplist (XDR *__xdrs, struct ypmaplist *__objp);
0456 extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp);
0457 extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp);
0458 extern bool_t xdr_ypreq_newxfr (XDR *__xdrs, struct ypreq_newxfr * __objp);
0459 extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp);
0460 extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp);
0461 extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all  * __objp);
0462 extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp);
0463 extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp);
0464 extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp);
0465 extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order  * __objp);
0466 extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp);
0467 extern bool_t xdr_ypresp_xfr (XDR *__xdrs, struct ypresp_xfr *__objp);
0468 extern bool_t xdr_ypstat (XDR *__xdrs, enum ypstat * __objp);
0469 extern bool_t xdr_ypxfrstat (XDR *__xdrs, enum ypxfrstat *__objp);
0470 
0471 /* Not really for this, but missing better place: */
0472 extern const char *taddr2host (const struct netconfig *__nconf,
0473                    const struct netbuf *__nbuf,
0474                            char *__host, size_t __hostlen);
0475 extern const char *taddr2ipstr (const struct netconfig *__nconf,
0476                                 const struct netbuf *__nbuf,
0477                                 char *__buf, size_t __buflen);
0478 extern unsigned short taddr2port (const struct netconfig *__nconf,
0479                                   const struct netbuf *__nbuf);
0480 
0481 #ifdef __cplusplus
0482 }
0483 #endif
0484 
0485 
0486 #endif  /* _RPCSVC_YP_PROT_H */