Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


yp_prot.h
001: /*
002:  * This file contains symbols and structures defining the rpc protocol
003:  * between the NIS clients and the NIS servers.  The servers
004:  * are the NIS database servers, and the NIS binders.
005:  */
006: 
007: #ifndef _RPCSVC_YP_PROT_H
008: #define _RPCSVC_YP_PROT_H
009: 
010: #include <features.h>
011: 
012: #include <rpc/rpc.h>
013: #include <rpcsvc/ypclnt.h>
014: 
015: __BEGIN_DECLS
016: 
017: /*
018:  * The following procedures are supported by the protocol:
019:  *
020:  * YPPROC_NULL() returns () takes nothing, returns nothing.  This indicates
021:  * that the NIS server is alive.
022:  *
023:  * YPPROC_DOMAIN (char *) returns (bool_t) TRUE.  Indicates that the
024:  * responding NIS server does serve the named domain; FALSE indicates no
025:  * support.
026:  *
027:  * YPPROC_DOMAIN_NONACK (char *) returns (TRUE) if the NIS server does serve
028:  * the named domain, otherwise does not return.  Used in the broadcast case.
029:  *
030:  * YPPROC_MATCH (struct ypreq_key) returns (struct ypresp_val).  Returns the
031:  * right-hand value for a passed left-hand key, within a named map and
032:  * domain.
033:  *
034:  * YPPROC_FIRST (struct ypreq_nokey) returns (struct ypresp_key_val).
035:  * Returns the first key-value pair from a named domain and map.
036:  *
037:  * YPPROC_NEXT (struct ypreq_key) returns (struct ypresp_key_val).  Returns
038:  * the key-value pair following a passed key-value pair within a named
039:  * domain and map.
040:  *
041:  * YPPROC_XFR (struct ypreq_xfr) returns nothing.  Indicates to a server that
042:  * a map should be updated.
043:  *
044:  * YPPROC_CLEAR takes nothing, returns nothing.  Instructs a NIS server to
045:  * close the current map, so that old versions of the disk file don't get
046:  * held open.
047:  *
048:  * YPPROC_ALL (struct ypreq_nokey), returns
049:  *      union switch (bool_t more) {
050:  *              TRUE:   (struct ypresp_key_val);
051:  *              FALSE:  (struct) {};
052:  *      }
053:  *
054:  * YPPROC_MASTER (struct ypreq_nokey), returns (ypresp_master)
055:  *
056:  * YPPROC_ORDER (struct ypreq_nokey), returns (ypresp_order)
057:  *
058:  * YPPROC_MAPLIST (char *), returns (struct ypmaplist *)
059:  */
060: 
061: /* Program and version symbols, magic numbers */
062: 
063: #define YPPROG          100004
064: #define YPVERS          2
065: #define YPVERS_ORIG     1
066: #define YPMAXRECORD     1024
067: #define YPMAXDOMAIN     64 /* XXX orig. yp_prot.h defines 256 */
068: #define YPMAXMAP        64
069: #define YPMAXPEER       64 /* XXX orig. yp_prot.h defines 256 */
070: 
071: /* byte size of a large NIS packet */
072: #define YPMSGSZ         1600
073: 
074: typedef struct {
075:   u_int keydat_len;
076:   char *keydat_val;
077: } keydat_t;
078: 
079: typedef struct {
080:   u_int valdat_len;
081:   char *valdat_val;
082: } valdat_t;
083: 
084: struct ypmap_parms {
085:   char *domain;                 /* Null string means not available */
086:   char *map;                    /* Null string means not available */
087:   unsigned int ordernum;        /* 0 means not available */
088:   char *owner;                  /* Null string means not available */
089: };
090: 
091: /*
092:  * Request parameter structures
093:  */
094: 
095: struct ypreq_key {
096:   const char *domain;
097:   const char *map;
098:   keydat_t keydat;
099: };
100: 
101: struct ypreq_nokey {
102:   char *domain;
103:   char *map;
104: };
105: 
106: struct ypreq_xfr {
107:   struct ypmap_parms map_parms;
108:   u_int transid;
109:   u_int proto;
110:   u_int port;
111: };
112: 
113: #define ypxfr_domain map_parms.domain
114: #define ypxfr_map map_parms.map
115: #define ypxfr_ordernum map_parms.ordernum
116: #define ypxfr_owner map_parms.owner
117: 
118: /* Return status values */
119: 
120: enum ypstat {
121:   YP_TRUE = 1,          /* General purpose success code */
122: #define YP_TRUE YP_TRUE
123:   YP_NOMORE = 2,        /* No more entries in map */
124: #define YP_NOMORE YP_NOMORE
125:   YP_FALSE = 0,         /* General purpose failure code */
126: #define YP_FALSE YP_FALSE
127:   YP_NOMAP = -1,        /* No such map in domain */
128: #define YP_NOMAP YP_NOMAP
129:   YP_NODOM = -2,        /* Domain not supported */
130: #define YP_NODOM YP_NODOM
131:   YP_NOKEY = -3,        /* No such key in map */
132: #define YP_NOKEY YP_NOKEY
133:   YP_BADOP = -4,        /* Invalid operation */
134: #define YP_BADOP YP_BADOP
135:   YP_BADDB = -5,        /* Server data base is bad */
136: #define YP_BADDB YP_BADDB
137:   YP_YPERR = -6,        /* NIS server error */
138: #define YP_YPERR YP_YPERR
139:   YP_BADARGS = -7,      /* Request arguments bad */
140: #define YP_BADARGS YP_BADARGS
141:   YP_VERS = -8,         /* NIS server version mismatch - server can't supply
142:                            requested service. */
143: #define YP_VERS YP_VERS
144: };
145: 
146: /*
147:  * Response parameter structures
148:  */
149: 
150: typedef enum ypstat ypstat;
151: 
152: struct ypresp_val {
153:   ypstat status;
154:   valdat_t valdat;
155: };
156: 
157: struct ypresp_key_val {
158:   ypstat status;
159: #ifdef STUPID_SUN_BUG
160:   /* This is the form as distributed by Sun.  But even the Sun NIS
161:      servers expect the values in the other order.  So their
162:      implementation somehow must change the order internally.  We
163:      don't want to follow this bad example since the user should be
164:      able to use rpcgen on this file.  */
165:   keydat_t keydat;
166:   valdat_t valdat;
167: #else
168:   valdat_t valdat;
169:   keydat_t keydat;
170: #endif
171: };
172: 
173: struct ypresp_master {
174:   ypstat status;
175:   char *master;
176: };
177: 
178: struct ypresp_order {
179:   ypstat status;
180:   u_int ordernum;
181: };
182: 
183: struct ypmaplist {
184:   char *map;
185: #define ypml_name map
186:   struct ypmaplist *next;
187: #define ypml_next next
188: };
189: 
190: struct ypresp_maplist {
191:   ypstat status;
192:   struct ypmaplist *list;
193: };
194: 
195: /*
196:  * Procedure symbols.  YPPROC_NULL, YPPROC_DOMAIN, and YPPROC_DOMAIN_NONACK
197:  * must keep the same values (0, 1, and 2) that they had in the first version
198:  * of the protocol.
199:  */
200: 
201: #define YPPROC_NULL     0
202: #define YPPROC_DOMAIN   1
203: #define YPPROC_DOMAIN_NONACK 2
204: #define YPPROC_MATCH    3
205: #define YPPROC_FIRST    4
206: #define YPPROC_NEXT     5
207: #define YPPROC_XFR      6
208: #define YPPROC_CLEAR    7
209: #define YPPROC_ALL      8
210: #define YPPROC_MASTER   9
211: #define YPPROC_ORDER    10
212: #define YPPROC_MAPLIST  11
213: #define YPPROC_NEWXFR   12
214: 
215: /*
216:  *              Protocol between clients and NIS binder servers
217:  */
218: 
219: /*
220:  * The following procedures are supported by the protocol:
221:  *
222:  * YPBINDPROC_NULL() returns ()
223:  *      takes nothing, returns nothing
224:  *
225:  * YPBINDPROC_DOMAIN takes (char *) returns (struct ypbind_resp)
226:  *
227:  * YPBINDPROC_SETDOM takes (struct ypbind_setdom) returns nothing
228:  */
229: 
230: /* Program and version symbols, magic numbers */
231: 
232: #define YPBINDPROG              100007
233: #define YPBINDVERS              2
234: #define YPBINDVERS_ORIG         1
235: 
236: /* Procedure symbols */
237: 
238: #define YPBINDPROC_NULL         0
239: #define YPBINDPROC_DOMAIN       1
240: #define YPBINDPROC_SETDOM       2
241: /*
242:  * Response structure and overall result status codes.  Success and failure
243:  * represent two separate response message types.
244:  */
245: 
246: enum ypbind_resptype {YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2};
247: 
248: struct ypbind_binding {
249:   struct in_addr ypbind_binding_addr;           /* In network order */
250:   unsigned short int ypbind_binding_port;       /* In network order */
251: };
252: 
253: struct ypbind_resp {
254:   enum ypbind_resptype ypbind_status;
255:   union {
256:     u_int ypbind_error;
257:     struct ypbind_binding ypbind_bindinfo;
258:   } ypbind_respbody;
259: };
260: 
261: 
262: /* Detailed failure reason codes for response field ypbind_error*/
263: 
264: #define YPBIND_ERR_ERR 1                /* Internal error */
265: #define YPBIND_ERR_NOSERV 2             /* No bound server for passed domain */
266: #define YPBIND_ERR_RESC 3               /* System resource allocation failure */
267: 
268: /*
269:  * Request data structure for ypbind "Set domain" procedure.
270:  */
271: struct ypbind_setdom {
272:   char *ypsetdom_domain;
273:   struct ypbind_binding ypsetdom_binding;
274:   u_int ypsetdom_vers;
275: };
276: #define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
277: #define ypsetdom_port ypsetdom_binding.ypbind_binding_port
278: 
279: /*
280:  *              Protocol between clients (ypxfr, only) and yppush
281:  *              yppush speaks a protocol in the transient range, which
282:  *              is supplied to ypxfr as a command-line parameter when it
283:  *              is activated by ypserv.
284:  */
285: #define YPPUSHVERS              1
286: #define YPPUSHVERS_ORIG         1
287: 
288: /* Procedure symbols */
289: 
290: #define YPPUSHPROC_NULL         0
291: #define YPPUSHPROC_XFRRESP      1
292: 
293: /* Status values for yppushresp_xfr.status */
294: 
295: enum yppush_status {
296:   YPPUSH_SUCC = 1,              /* Success */
297: #define YPPUSH_SUCC     YPPUSH_SUCC
298:   YPPUSH_AGE = 2,               /* Master's version not newer */
299: #define YPPUSH_AGE      YPPUSH_AGE
300:   YPPUSH_NOMAP = -1,            /* Can't find server for map */
301: #define YPPUSH_NOMAP    YPPUSH_NOMAP
302:   YPPUSH_NODOM = -2,            /* Domain not supported */
303: #define YPPUSH_NODOM    YPPUSH_NODOM
304:   YPPUSH_RSRC = -3,             /* Local resouce alloc failure */
305: #define YPPUSH_RSRC     YPPUSH_RSRC
306:   YPPUSH_RPC = -4,              /* RPC failure talking to server */
307: #define YPPUSH_RPC      YPPUSH_RPC
308:   YPPUSH_MADDR = -5,            /* Can't get master address */
309: #define YPPUSH_MADDR    YPPUSH_MADDR
310:   YPPUSH_YPERR = -6,            /* NIS server/map db error */
311: #define YPPUSH_YPERR    YPPUSH_YPERR
312:   YPPUSH_BADARGS = -7,          /* Request arguments bad */
313: #define YPPUSH_BADARGS  YPPUSH_BADARGS
314:   YPPUSH_DBM = -8,              /* Local dbm operation failed */
315: #define YPPUSH_DBM      YPPUSH_DBM
316:   YPPUSH_FILE = -9,             /* Local file I/O operation failed */
317: #define YPPUSH_FILE     YPPUSH_FILE
318:   YPPUSH_SKEW = -10,            /* Map version skew during transfer */
319: #define YPPUSH_SKEW     YPPUSH_SKEW
320:   YPPUSH_CLEAR = -11,           /* Can't send "Clear" req to local ypserv */
321: #define YPPUSH_CLEAR    YPPUSH_CLEAR
322:   YPPUSH_FORCE = -12,           /* No local order number in map - use -f flag*/
323: #define YPPUSH_FORCE    YPPUSH_FORCE
324:   YPPUSH_XFRERR = -13,          /* ypxfr error */
325: #define YPPUSH_XFRERR   YPPUSH_XFRERR
326:   YPPUSH_REFUSED = -14,         /* Transfer request refused by ypserv */
327: #define YPPUSH_REFUSED  YPPUSH_REFUSED
328:   YPPUSH_NOALIAS = -15          /* Alias not found for map or domain */
329: #define YPPUSH_NOALIAS  YPPUSH_NOALIAS
330: };
331: typedef enum yppush_status yppush_status;
332: 
333: struct yppushresp_xfr {
334:   u_int transid;
335:   yppush_status status;
336: };
337: 
338: struct ypresp_all {
339:   bool_t more;
340:   union {
341:     struct ypresp_key_val val;
342:   } ypresp_all_u;
343: };
344: 
345: extern bool_t xdr_ypreq_key (XDR *__xdrs, struct ypreq_key * __objp);
346: extern bool_t xdr_ypreq_nokey (XDR *__xdrs, struct ypreq_nokey * __objp);
347: extern bool_t xdr_ypreq_xfr (XDR *__xdrs, struct ypreq_xfr * __objp);
348: extern bool_t xdr_ypresp_val (XDR *__xdrs, struct ypresp_val * __objp);
349: extern bool_t xdr_ypresp_key_val (XDR *__xdrs, struct ypresp_key_val * __objp);
350: extern bool_t xdr_ypbind_resp (XDR *__xdrs, struct ypbind_resp * __objp);
351: extern bool_t xdr_ypbind_setdom (XDR *__xdrs, struct ypbind_setdom * __objp);
352: extern bool_t xdr_ypmap_parms (XDR *__xdrs, struct ypmap_parms * __objp);
353: extern bool_t xdr_yppushresp_xfr (XDR *__xdrs, struct yppushresp_xfr * __objp);
354: extern bool_t xdr_ypresp_order (XDR *__xdrs, struct ypresp_order  * __objp);
355: extern bool_t xdr_ypresp_master (XDR *__xdrs, struct ypresp_master * __objp);
356: extern bool_t xdr_ypall (XDR *__xdrs, struct ypall_callback * __objp);
357: extern bool_t xdr_ypresp_maplist (XDR *__xdrs, struct ypresp_maplist * __objp);
358: extern bool_t xdr_ypbind_binding (XDR *__xdrs, struct ypbind_binding * __objp);
359: extern bool_t xdr_ypbind_resptype (XDR *__xdrs, enum ypbind_resptype * __objp);
360: extern bool_t xdr_ypstat (XDR *__xdrs, enum ypbind_resptype * __objp);
361: extern bool_t xdr_ypresp_all (XDR *__xdrs, struct ypresp_all  * __objp);
362: extern bool_t xdr_domainname (XDR *__xdrs, char ** __objp);
363: 
364: __END_DECLS
365: 
366: #endif  /* _RPCSVC_YP_PROT_H */
367: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/