Back to index

glibc  2.9
yp_prot.h
Go to the documentation of this file.
00001 /*
00002  * This file contains symbols and structures defining the rpc protocol
00003  * between the NIS clients and the NIS servers.  The servers
00004  * are the NIS database servers, and the NIS binders.
00005  */
00006 
00007 #ifndef _RPCSVC_YP_PROT_H
00008 #define _RPCSVC_YP_PROT_H
00009 
00010 #include <features.h>
00011 
00012 #include <rpc/rpc.h>
00013 #include <rpcsvc/ypclnt.h>
00014 
00015 __BEGIN_DECLS
00016 
00017 /*
00018  * The following procedures are supported by the protocol:
00019  *
00020  * YPPROC_NULL() returns () takes nothing, returns nothing.  This indicates
00021  * that the NIS server is alive.
00022  *
00023  * YPPROC_DOMAIN (char *) returns (bool_t) TRUE.  Indicates that the
00024  * responding NIS server does serve the named domain; FALSE indicates no
00025  * support.
00026  *
00027  * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
00028  * the named domain, otherwise does not return.  Used in the broadcast case.
00029  *
00030  * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val).  Returns the
00031  * right-hand value for a passed left-hand key, within a named map and
00032  * domain.
00033  *
00034  * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
00035  * Returns the first key-value pair from a named domain and map.
00036  *
00037  * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val).  Returns
00038  * the key-value pair following a passed key-value pair within a named
00039  * domain and map.
00040  *
00041  * YPPROC_XFR (struct ypreq_xfr) returns nothing.  Indicates to a server that
00042  * a map should be updated.
00043  *
00044  * YPPROC_CLEAR      takes nothing, returns nothing.  Instructs a NIS server to
00045  * close the current map, so that old versions of the disk file don't get
00046  * held open.
00047  *
00048  * YPPROC_ALL (struct ypreq_nokey), returns
00049  *     union switch (bool_t more) {
00050  *            TRUE:  (struct ypresp_key_val);
00051  *            FALSE: (struct) {};
00052  *     }
00053  *
00054  * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
00055  *
00056  * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
00057  *
00058  * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
00059  */
00060 
00061 /* Program and version symbols, magic numbers */
00062 
00063 #define YPPROG              100004
00064 #define YPVERS              2
00065 #define YPVERS_ORIG  1
00066 #define YPMAXRECORD  1024
00067 #define YPMAXDOMAIN  64 /* XXX orig. yp_prot.h defines 256 */
00068 #define YPMAXMAP     64
00069 #define YPMAXPEER    64 /* XXX orig. yp_prot.h defines 256 */
00070 
00071 /* byte size of a large NIS packet */
00072 #define YPMSGSZ             1600
00073 
00074 typedef struct {
00075   u_int keydat_len;
00076   char *keydat_val;
00077 } keydat_t;
00078 
00079 typedef struct {
00080   u_int valdat_len;
00081   char *valdat_val;
00082 } valdat_t;
00083 
00084 struct ypmap_parms {
00085   char *domain;                    /* Null string means not available */
00086   char *map;                /* Null string means not available */
00087   unsigned int ordernum;    /* 0 means not available */
00088   char *owner;                     /* Null string means not available */
00089 };
00090 
00091 /*
00092  * Request parameter structures
00093  */
00094 
00095 struct ypreq_key {
00096   const char *domain;
00097   const char *map;
00098   keydat_t keydat;
00099 };
00100 
00101 struct ypreq_nokey {
00102   char *domain;
00103   char *map;
00104 };
00105 
00106 struct ypreq_xfr {
00107   struct ypmap_parms map_parms;
00108   u_int transid;
00109   u_int proto;
00110   u_int port;
00111 };
00112 
00113 #define ypxfr_domain map_parms.domain
00114 #define ypxfr_map map_parms.map
00115 #define ypxfr_ordernum map_parms.ordernum
00116 #define ypxfr_owner map_parms.owner
00117 
00118 /* Return status values */
00119 
00120 enum ypstat {
00121   YP_TRUE = 1,              /* General purpose success code */
00122 #define YP_TRUE YP_TRUE
00123   YP_NOMORE = 2,     /* No more entries in map */
00124 #define YP_NOMORE YP_NOMORE
00125   YP_FALSE = 0,             /* General purpose failure code */
00126 #define YP_FALSE YP_FALSE
00127   YP_NOMAP = -1,     /* No such map in domain */
00128 #define YP_NOMAP YP_NOMAP
00129   YP_NODOM = -2,     /* Domain not supported */
00130 #define YP_NODOM YP_NODOM
00131   YP_NOKEY = -3,     /* No such key in map */
00132 #define YP_NOKEY YP_NOKEY
00133   YP_BADOP = -4,     /* Invalid operation */
00134 #define YP_BADOP YP_BADOP
00135   YP_BADDB = -5,     /* Server data base is bad */
00136 #define YP_BADDB YP_BADDB
00137   YP_YPERR = -6,     /* NIS server error */
00138 #define YP_YPERR YP_YPERR
00139   YP_BADARGS = -7,   /* Request arguments bad */
00140 #define YP_BADARGS YP_BADARGS
00141   YP_VERS = -8,             /* NIS server version mismatch - server can't supply
00142                         requested service. */
00143 #define YP_VERS YP_VERS
00144 };
00145 
00146 /*
00147  * Response parameter structures
00148  */
00149 
00150 typedef enum ypstat ypstat;
00151 
00152 struct ypresp_val {
00153   ypstat status;
00154   valdat_t valdat;
00155 };
00156 
00157 struct ypresp_key_val {
00158   ypstat status;
00159 #ifdef STUPID_SUN_BUG
00160   /* This is the form as distributed by Sun.  But even the Sun NIS
00161      servers expect the values in the other order.  So their
00162      implementation somehow must change the order internally.  We
00163      don't want to follow this bad example since the user should be
00164      able to use rpcgen on this file.  */
00165   keydat_t keydat;
00166   valdat_t valdat;
00167 #else
00168   valdat_t valdat;
00169   keydat_t keydat;
00170 #endif
00171 };
00172 
00173 struct ypresp_master {
00174   ypstat status;
00175   char *master;
00176 };
00177 
00178 struct ypresp_order {
00179   ypstat status;
00180   u_int ordernum;
00181 };
00182 
00183 struct ypmaplist {
00184   char *map;
00185 #define ypml_name map
00186   struct ypmaplist *next;
00187 #define ypml_next next
00188 };
00189 
00190 struct ypresp_maplist {
00191   ypstat status;
00192   struct ypmaplist *list;
00193 };
00194 
00195 /*
00196  * Procedure symbols.  YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
00197  * must keep the same values (0, 1, and 2) that they had in the first version
00198  * of the protocol.
00199  */
00200 
00201 #define YPPROC_NULL  0
00202 #define YPPROC_DOMAIN       1
00203 #define YPPROC_DOMAIN_NONACK 2
00204 #define YPPROC_MATCH 3
00205 #define YPPROC_FIRST 4
00206 #define YPPROC_NEXT  5
00207 #define YPPROC_XFR   6
00208 #define YPPROC_CLEAR 7
00209 #define YPPROC_ALL   8
00210 #define YPPROC_MASTER       9
00211 #define YPPROC_ORDER 10
00212 #define YPPROC_MAPLIST      11
00213 #define       YPPROC_NEWXFR 12
00214 
00215 /*
00216  *            Protocol between clients and NIS binder servers
00217  */
00218 
00219 /*
00220  * The following procedures are supported by the protocol:
00221  *
00222  * YPBINDPROC_NULL() returns ()
00223  *     takes nothing, returns nothing
00224  *
00225  * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp)
00226  *
00227  * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
00228  */
00229 
00230 /* Program and version symbols, magic numbers */
00231 
00232 #define YPBINDPROG          100007
00233 #define YPBINDVERS          2
00234 #define YPBINDVERS_ORIG            1
00235 
00236 /* Procedure symbols */
00237 
00238 #define YPBINDPROC_NULL            0
00239 #define YPBINDPROC_DOMAIN   1
00240 #define YPBINDPROC_SETDOM   2
00241 /*
00242  * Response structure and overall result status codes.  Success and failure
00243  * represent two separate response message types.
00244  */
00245 
00246 enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2};
00247 
00248 struct ypbind_binding {
00249   struct in_addr ypbind_binding_addr;             /* In network order */
00250   unsigned short int ypbind_binding_port; /* In network order */
00251 };
00252 
00253 struct ypbind_resp {
00254   enum ypbind_resptype ypbind_status;
00255   union {
00256     u_int ypbind_error;
00257     struct ypbind_binding ypbind_bindinfo;
00258   } ypbind_respbody;
00259 };
00260 
00261 
00262 /* Detailed failure reason codes for response field ypbind_error*/
00263 
00264 #define YPBIND_ERR_ERR 1           /* Internal error */
00265 #define YPBIND_ERR_NOSERV 2        /* No bound server for passed domain */
00266 #define YPBIND_ERR_RESC 3          /* System resource allocation failure */
00267 
00268 /*
00269  * Request data structure for ypbind "Set domain" procedure.
00270  */
00271 struct ypbind_setdom {
00272   char *ypsetdom_domain;
00273   struct ypbind_binding ypsetdom_binding;
00274   u_int ypsetdom_vers;
00275 };
00276 #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
00277 #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
00278 
00279 /*
00280  *            Protocol between clients (ypxfr, only) and yppush
00281  *            yppush speaks a protocol in the transient range, which
00282  *            is supplied to ypxfr as a command-line parameter when it
00283  *            is activated by ypserv.
00284  */
00285 #define YPPUSHVERS          1
00286 #define YPPUSHVERS_ORIG            1
00287 
00288 /* Procedure symbols */
00289 
00290 #define YPPUSHPROC_NULL            0
00291 #define YPPUSHPROC_XFRRESP  1
00292 
00293 /* Status values for yppushresp_xfr.status */
00294 
00295 enum yppush_status {
00296   YPPUSH_SUCC = 1,          /* Success */
00297 #define YPPUSH_SUCC  YPPUSH_SUCC
00298   YPPUSH_AGE = 2,           /* Master's version not newer */
00299 #define YPPUSH_AGE   YPPUSH_AGE
00300   YPPUSH_NOMAP = -1,        /* Can't find server for map */
00301 #define YPPUSH_NOMAP        YPPUSH_NOMAP
00302   YPPUSH_NODOM = -2,        /* Domain not supported */
00303 #define YPPUSH_NODOM        YPPUSH_NODOM
00304   YPPUSH_RSRC = -3,         /* Local resouce alloc failure */
00305 #define YPPUSH_RSRC  YPPUSH_RSRC
00306   YPPUSH_RPC = -4,          /* RPC failure talking to server */
00307 #define YPPUSH_RPC   YPPUSH_RPC
00308   YPPUSH_MADDR = -5,        /* Can't get master address */
00309 #define YPPUSH_MADDR YPPUSH_MADDR
00310   YPPUSH_YPERR = -6,        /* NIS server/map db error */
00311 #define YPPUSH_YPERR        YPPUSH_YPERR
00312   YPPUSH_BADARGS = -7,             /* Request arguments bad */
00313 #define YPPUSH_BADARGS      YPPUSH_BADARGS
00314   YPPUSH_DBM = -8,          /* Local dbm operation failed */
00315 #define YPPUSH_DBM   YPPUSH_DBM
00316   YPPUSH_FILE = -9,         /* Local file I/O operation failed */
00317 #define YPPUSH_FILE  YPPUSH_FILE
00318   YPPUSH_SKEW = -10,        /* Map version skew during transfer */
00319 #define YPPUSH_SKEW  YPPUSH_SKEW
00320   YPPUSH_CLEAR = -11,              /* Can't send "Clear" req to local ypserv */
00321 #define YPPUSH_CLEAR YPPUSH_CLEAR
00322   YPPUSH_FORCE = -12,              /* No local order number in map - use -f flag*/
00323 #define YPPUSH_FORCE YPPUSH_FORCE
00324   YPPUSH_XFRERR = -13,             /* ypxfr error */
00325 #define YPPUSH_XFRERR       YPPUSH_XFRERR
00326   YPPUSH_REFUSED = -14,            /* Transfer request refused by ypserv */
00327 #define YPPUSH_REFUSED      YPPUSH_REFUSED
00328   YPPUSH_NOALIAS = -15             /* Alias not found for map or domain */
00329 #define       YPPUSH_NOALIAS       YPPUSH_NOALIAS
00330 };
00331 typedef enum yppush_status yppush_status;
00332 
00333 struct yppushresp_xfr {
00334   u_int transid;
00335   yppush_status status;
00336 };
00337 
00338 struct ypresp_all {
00339   bool_t more;
00340   union {
00341     struct ypresp_key_val val;
00342   } ypresp_all_u;
00343 };
00344 
00345 extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp);
00346 extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp);
00347 extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp);
00348 extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp);
00349 extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp);
00350 extern bool_t xdr_ypbind_resp (XDR *__xdrs, struct ypbind_resp * __objp);
00351 extern bool_t xdr_ypbind_setdom (XDR *__xdrs, struct ypbind_setdom * __objp);
00352 extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp);
00353 extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp);
00354 extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order  * __objp);
00355 extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp);
00356 extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp);
00357 extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp);
00358 extern bool_t xdr_ypbind_binding (XDR *__xdrs, struct ypbind_binding * __objp);
00359 extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp);
00360 extern bool_t xdr_ypstat (XDR *__xdrs, enum ypbind_resptype * __objp);
00361 extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all  * __objp);
00362 extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp);
00363 
00364 __END_DECLS
00365 
00366 #endif /* _RPCSVC_YP_PROT_H */