1 /* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30 #ifndef __RPCSVC_YP_H__ 31 #define __RPCSVC_YP_H__ 32 33 #include <features.h> 34 #include <rpc/rpc.h> 35 36 #define YPMAXRECORD 1024 37 #define YPMAXDOMAIN 64 38 #define YPMAXMAP 64 39 #define YPMAXPEER 64 40 41 enum ypstat { 42 YP_TRUE = 1, 43 YP_NOMORE = 2, 44 YP_FALSE = 0, 45 YP_NOMAP = -1, 46 YP_NODOM = -2, 47 YP_NOKEY = -3, 48 YP_BADOP = -4, 49 YP_BADDB = -5, 50 YP_YPERR = -6, 51 YP_BADARGS = -7, 52 YP_VERS = -8, 53 }; 54 typedef enum ypstat ypstat; 55 56 enum ypxfrstat { 57 YPXFR_SUCC = 1, 58 YPXFR_AGE = 2, 59 YPXFR_NOMAP = -1, 60 YPXFR_NODOM = -2, 61 YPXFR_RSRC = -3, 62 YPXFR_RPC = -4, 63 YPXFR_MADDR = -5, 64 YPXFR_YPERR = -6, 65 YPXFR_BADARGS = -7, 66 YPXFR_DBM = -8, 67 YPXFR_FILE = -9, 68 YPXFR_SKEW = -10, 69 YPXFR_CLEAR = -11, 70 YPXFR_FORCE = -12, 71 YPXFR_XFRERR = -13, 72 YPXFR_REFUSED = -14, 73 }; 74 typedef enum ypxfrstat ypxfrstat; 75 76 typedef char *domainname; 77 typedef char *mapname; 78 typedef char *peername; 79 80 typedef struct { 81 u_int keydat_len; 82 char *keydat_val; 83 } keydat; 84 85 typedef struct { 86 u_int valdat_len; 87 char *valdat_val; 88 } valdat; 89 90 struct ypmap_parms { 91 domainname domain; 92 mapname map; 93 u_int ordernum; 94 peername peer; 95 }; 96 typedef struct ypmap_parms ypmap_parms; 97 98 struct ypreq_key { 99 domainname domain; 100 mapname map; 101 keydat key; 102 }; 103 typedef struct ypreq_key ypreq_key; 104 105 struct ypreq_nokey { 106 domainname domain; 107 mapname map; 108 }; 109 typedef struct ypreq_nokey ypreq_nokey; 110 111 struct ypreq_xfr { 112 ypmap_parms map_parms; 113 u_int transid; 114 u_int prog; 115 u_int port; 116 }; 117 typedef struct ypreq_xfr ypreq_xfr; 118 119 struct ypresp_val { 120 ypstat stat; 121 valdat val; 122 }; 123 typedef struct ypresp_val ypresp_val; 124 125 struct ypresp_key_val { 126 ypstat stat; 127 #ifdef STUPID_SUN_BUG 128 /* This is the form as distributed by Sun. But even the Sun NIS 129 servers expect the values in the other order. So their 130 implementation somehow must change the order internally. We 131 don't want to follow this bad example since the user should be 132 able to use rpcgen on this file. */ 133 keydat key; 134 valdat val; 135 #else 136 valdat val; 137 keydat key; 138 #endif 139 }; 140 typedef struct ypresp_key_val ypresp_key_val; 141 142 struct ypresp_master { 143 ypstat stat; 144 peername peer; 145 }; 146 typedef struct ypresp_master ypresp_master; 147 148 struct ypresp_order { 149 ypstat stat; 150 u_int ordernum; 151 }; 152 typedef struct ypresp_order ypresp_order; 153 154 struct ypresp_all { 155 bool_t more; 156 union { 157 ypresp_key_val val; 158 } ypresp_all_u; 159 }; 160 typedef struct ypresp_all ypresp_all; 161 162 struct ypresp_xfr { 163 u_int transid; 164 ypxfrstat xfrstat; 165 }; 166 typedef struct ypresp_xfr ypresp_xfr; 167 168 struct ypmaplist { 169 mapname map; 170 struct ypmaplist *next; 171 }; 172 typedef struct ypmaplist ypmaplist; 173 174 struct ypresp_maplist { 175 ypstat stat; 176 ypmaplist *maps; 177 }; 178 typedef struct ypresp_maplist ypresp_maplist; 179 180 enum yppush_status { 181 YPPUSH_SUCC = 1, 182 YPPUSH_AGE = 2, 183 YPPUSH_NOMAP = -1, 184 YPPUSH_NODOM = -2, 185 YPPUSH_RSRC = -3, 186 YPPUSH_RPC = -4, 187 YPPUSH_MADDR = -5, 188 YPPUSH_YPERR = -6, 189 YPPUSH_BADARGS = -7, 190 YPPUSH_DBM = -8, 191 YPPUSH_FILE = -9, 192 YPPUSH_SKEW = -10, 193 YPPUSH_CLEAR = -11, 194 YPPUSH_FORCE = -12, 195 YPPUSH_XFRERR = -13, 196 YPPUSH_REFUSED = -14, 197 }; 198 typedef enum yppush_status yppush_status; 199 200 struct yppushresp_xfr { 201 u_int transid; 202 yppush_status status; 203 }; 204 typedef struct yppushresp_xfr yppushresp_xfr; 205 206 enum ypbind_resptype { 207 YPBIND_SUCC_VAL = 1, 208 YPBIND_FAIL_VAL = 2, 209 }; 210 typedef enum ypbind_resptype ypbind_resptype; 211 212 struct ypbind_binding { 213 char ypbind_binding_addr[4]; 214 char ypbind_binding_port[2]; 215 }; 216 typedef struct ypbind_binding ypbind_binding; 217 218 struct ypbind_resp { 219 ypbind_resptype ypbind_status; 220 union { 221 u_int ypbind_error; 222 ypbind_binding ypbind_bindinfo; 223 } ypbind_resp_u; 224 }; 225 typedef struct ypbind_resp ypbind_resp; 226 227 #define YPBIND_ERR_ERR 1 228 #define YPBIND_ERR_NOSERV 2 229 #define YPBIND_ERR_RESC 3 230 231 struct ypbind_setdom { 232 domainname ypsetdom_domain; 233 ypbind_binding ypsetdom_binding; 234 u_int ypsetdom_vers; 235 }; 236 typedef struct ypbind_setdom ypbind_setdom; 237 238 __BEGIN_DECLS 239 240 #define YPPROG 100004 241 #define YPVERS 2 242 243 #define YPPROC_NULL 0 244 extern void *ypproc_null_2 (void *, CLIENT *); 245 extern void *ypproc_null_2_svc (void *, struct svc_req *); 246 #define YPPROC_DOMAIN 1 247 extern bool_t *ypproc_domain_2 (domainname *, CLIENT *); 248 extern bool_t *ypproc_domain_2_svc (domainname *, struct svc_req *); 249 #define YPPROC_DOMAIN_NONACK 2 250 extern bool_t *ypproc_domain_nonack_2 (domainname *, CLIENT *); 251 extern bool_t *ypproc_domain_nonack_2_svc (domainname *, struct svc_req *); 252 #define YPPROC_MATCH 3 253 extern ypresp_val *ypproc_match_2 (ypreq_key *, CLIENT *); 254 extern ypresp_val *ypproc_match_2_svc (ypreq_key *, struct svc_req *); 255 #define YPPROC_FIRST 4 256 extern ypresp_key_val *ypproc_first_2 (ypreq_key *, CLIENT *); 257 extern ypresp_key_val *ypproc_first_2_svc (ypreq_key *, struct svc_req *); 258 #define YPPROC_NEXT 5 259 extern ypresp_key_val *ypproc_next_2 (ypreq_key *, CLIENT *); 260 extern ypresp_key_val *ypproc_next_2_svc (ypreq_key *, struct svc_req *); 261 #define YPPROC_XFR 6 262 extern ypresp_xfr *ypproc_xfr_2 (ypreq_xfr *, CLIENT *); 263 extern ypresp_xfr *ypproc_xfr_2_svc (ypreq_xfr *, struct svc_req *); 264 #define YPPROC_CLEAR 7 265 extern void *ypproc_clear_2 (void *, CLIENT *); 266 extern void *ypproc_clear_2_svc (void *, struct svc_req *); 267 #define YPPROC_ALL 8 268 extern ypresp_all *ypproc_all_2 (ypreq_nokey *, CLIENT *); 269 extern ypresp_all *ypproc_all_2_svc (ypreq_nokey *, struct svc_req *); 270 #define YPPROC_MASTER 9 271 extern ypresp_master *ypproc_master_2 (ypreq_nokey *, CLIENT *); 272 extern ypresp_master *ypproc_master_2_svc (ypreq_nokey *, struct svc_req *); 273 #define YPPROC_ORDER 10 274 extern ypresp_order *ypproc_order_2 (ypreq_nokey *, CLIENT *); 275 extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *); 276 #define YPPROC_MAPLIST 11 277 extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *); 278 extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *); 279 extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); 280 281 282 #define YPPUSH_XFRRESPPROG (0x40000000) 283 #define YPPUSH_XFRRESPVERS 1 284 285 #define YPPUSHPROC_NULL 0 286 extern void *yppushproc_null_1 (void *, CLIENT *); 287 extern void *yppushproc_null_1_svc (void *, struct svc_req *); 288 #define YPPUSHPROC_XFRRESP 1 289 extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *); 290 extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *); 291 extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); 292 293 294 #define YPBINDPROG 100007 295 #define YPBINDVERS 2 296 297 #define YPBINDPROC_NULL 0 298 extern void *ypbindproc_null_2 (void *, CLIENT *); 299 extern void *ypbindproc_null_2_svc (void *, struct svc_req *); 300 #define YPBINDPROC_DOMAIN 1 301 extern ypbind_resp *ypbindproc_domain_2 (domainname *, CLIENT *); 302 extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *); 303 #define YPBINDPROC_SETDOM 2 304 extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *); 305 extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *); 306 extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); 307 308 309 extern bool_t xdr_ypstat (XDR *, ypstat*); 310 extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*); 311 extern bool_t xdr_domainname (XDR *, domainname*); 312 extern bool_t xdr_mapname (XDR *, mapname*); 313 extern bool_t xdr_peername (XDR *, peername*); 314 extern bool_t xdr_keydat (XDR *, keydat*); 315 extern bool_t xdr_valdat (XDR *, valdat*); 316 extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*); 317 extern bool_t xdr_ypreq_key (XDR *, ypreq_key*); 318 extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*); 319 extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*); 320 extern bool_t xdr_ypresp_val (XDR *, ypresp_val*); 321 extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*); 322 extern bool_t xdr_ypresp_master (XDR *, ypresp_master*); 323 extern bool_t xdr_ypresp_order (XDR *, ypresp_order*); 324 extern bool_t xdr_ypresp_all (XDR *, ypresp_all*); 325 extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*); 326 extern bool_t xdr_ypmaplist (XDR *, ypmaplist*); 327 extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*); 328 extern bool_t xdr_yppush_status (XDR *, yppush_status*); 329 extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*); 330 extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*); 331 extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*); 332 extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*); 333 extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*); 334 335 __END_DECLS 336 337 #endif /* !__RPCSVC_YP_H__ */ 338