yp.x 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */
  2. /*
  3. * Copyright (c) 2010, Oracle America, Inc.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are
  7. * met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above
  12. * copyright notice, this list of conditions and the following
  13. * disclaimer in the documentation and/or other materials
  14. * provided with the distribution.
  15. * * Neither the name of the "Oracle America, Inc." nor the names of its
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  26. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  29. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. /*
  33. * Protocol description file for the Yellow Pages Service
  34. */
  35. const YPMAXRECORD = 1024;
  36. const YPMAXDOMAIN = 64;
  37. const YPMAXMAP = 64;
  38. const YPMAXPEER = 64;
  39. enum ypstat {
  40. YP_TRUE = 1,
  41. YP_NOMORE = 2,
  42. YP_FALSE = 0,
  43. YP_NOMAP = -1,
  44. YP_NODOM = -2,
  45. YP_NOKEY = -3,
  46. YP_BADOP = -4,
  47. YP_BADDB = -5,
  48. YP_YPERR = -6,
  49. YP_BADARGS = -7,
  50. YP_VERS = -8
  51. };
  52. enum ypxfrstat {
  53. YPXFR_SUCC = 1,
  54. YPXFR_AGE = 2,
  55. YPXFR_NOMAP = -1,
  56. YPXFR_NODOM = -2,
  57. YPXFR_RSRC = -3,
  58. YPXFR_RPC = -4,
  59. YPXFR_MADDR = -5,
  60. YPXFR_YPERR = -6,
  61. YPXFR_BADARGS = -7,
  62. YPXFR_DBM = -8,
  63. YPXFR_FILE = -9,
  64. YPXFR_SKEW = -10,
  65. YPXFR_CLEAR = -11,
  66. YPXFR_FORCE = -12,
  67. YPXFR_XFRERR = -13,
  68. YPXFR_REFUSED = -14
  69. };
  70. typedef string domainname<YPMAXDOMAIN>;
  71. typedef string mapname<YPMAXMAP>;
  72. typedef string peername<YPMAXPEER>;
  73. typedef opaque keydat<YPMAXRECORD>;
  74. typedef opaque valdat<YPMAXRECORD>;
  75. struct ypmap_parms {
  76. domainname domain;
  77. mapname map;
  78. unsigned int ordernum;
  79. peername peer;
  80. };
  81. struct ypreq_key {
  82. domainname domain;
  83. mapname map;
  84. keydat key;
  85. };
  86. struct ypreq_nokey {
  87. domainname domain;
  88. mapname map;
  89. };
  90. struct ypreq_xfr {
  91. ypmap_parms map_parms;
  92. unsigned int transid;
  93. unsigned int prog;
  94. unsigned int port;
  95. };
  96. struct ypresp_val {
  97. ypstat stat;
  98. valdat val;
  99. };
  100. struct ypresp_key_val {
  101. ypstat stat;
  102. #ifdef STUPID_SUN_BUG
  103. /* This is the form as distributed by Sun. But even the Sun NIS
  104. servers expect the values in the other order. So their
  105. implementation somehow must change the order internally. We
  106. don't want to follow this bad example since the user should be
  107. able to use rpcgen on this file. */
  108. keydat key;
  109. valdat val;
  110. #else
  111. valdat val;
  112. keydat key;
  113. #endif
  114. };
  115. struct ypresp_master {
  116. ypstat stat;
  117. peername peer;
  118. };
  119. struct ypresp_order {
  120. ypstat stat;
  121. unsigned int ordernum;
  122. };
  123. union ypresp_all switch (bool more) {
  124. case TRUE:
  125. ypresp_key_val val;
  126. case FALSE:
  127. void;
  128. };
  129. struct ypresp_xfr {
  130. unsigned int transid;
  131. ypxfrstat xfrstat;
  132. };
  133. struct ypmaplist {
  134. mapname map;
  135. ypmaplist *next;
  136. };
  137. struct ypresp_maplist {
  138. ypstat stat;
  139. ypmaplist *maps;
  140. };
  141. enum yppush_status {
  142. YPPUSH_SUCC = 1, /* Success */
  143. YPPUSH_AGE = 2, /* Master's version not newer */
  144. YPPUSH_NOMAP = -1, /* Can't find server for map */
  145. YPPUSH_NODOM = -2, /* Domain not supported */
  146. YPPUSH_RSRC = -3, /* Local resource alloc failure */
  147. YPPUSH_RPC = -4, /* RPC failure talking to server */
  148. YPPUSH_MADDR = -5, /* Can't get master address */
  149. YPPUSH_YPERR = -6, /* YP server/map db error */
  150. YPPUSH_BADARGS = -7, /* Request arguments bad */
  151. YPPUSH_DBM = -8, /* Local dbm operation failed */
  152. YPPUSH_FILE = -9, /* Local file I/O operation failed */
  153. YPPUSH_SKEW = -10, /* Map version skew during transfer */
  154. YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */
  155. YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */
  156. YPPUSH_XFRERR = -13, /* ypxfr error */
  157. YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */
  158. };
  159. struct yppushresp_xfr {
  160. unsigned transid;
  161. yppush_status status;
  162. };
  163. /*
  164. * Response structure and overall result status codes. Success and failure
  165. * represent two separate response message types.
  166. */
  167. enum ypbind_resptype {
  168. YPBIND_SUCC_VAL = 1,
  169. YPBIND_FAIL_VAL = 2
  170. };
  171. struct ypbind_binding {
  172. opaque ypbind_binding_addr[4]; /* In network order */
  173. opaque ypbind_binding_port[2]; /* In network order */
  174. };
  175. union ypbind_resp switch (ypbind_resptype ypbind_status) {
  176. case YPBIND_FAIL_VAL:
  177. unsigned ypbind_error;
  178. case YPBIND_SUCC_VAL:
  179. ypbind_binding ypbind_bindinfo;
  180. };
  181. /* Detailed failure reason codes for response field ypbind_error*/
  182. const YPBIND_ERR_ERR = 1; /* Internal error */
  183. const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */
  184. const YPBIND_ERR_RESC = 3; /* System resource allocation failure */
  185. /*
  186. * Request data structure for ypbind "Set domain" procedure.
  187. */
  188. struct ypbind_setdom {
  189. domainname ypsetdom_domain;
  190. ypbind_binding ypsetdom_binding;
  191. unsigned ypsetdom_vers;
  192. };
  193. /*
  194. * YP access protocol
  195. */
  196. program YPPROG {
  197. version YPVERS {
  198. void
  199. YPPROC_NULL(void) = 0;
  200. bool
  201. YPPROC_DOMAIN(domainname) = 1;
  202. bool
  203. YPPROC_DOMAIN_NONACK(domainname) = 2;
  204. ypresp_val
  205. YPPROC_MATCH(ypreq_key) = 3;
  206. ypresp_key_val
  207. YPPROC_FIRST(ypreq_key) = 4;
  208. ypresp_key_val
  209. YPPROC_NEXT(ypreq_key) = 5;
  210. ypresp_xfr
  211. YPPROC_XFR(ypreq_xfr) = 6;
  212. void
  213. YPPROC_CLEAR(void) = 7;
  214. ypresp_all
  215. YPPROC_ALL(ypreq_nokey) = 8;
  216. ypresp_master
  217. YPPROC_MASTER(ypreq_nokey) = 9;
  218. ypresp_order
  219. YPPROC_ORDER(ypreq_nokey) = 10;
  220. ypresp_maplist
  221. YPPROC_MAPLIST(domainname) = 11;
  222. } = 2;
  223. } = 100004;
  224. /*
  225. * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR
  226. */
  227. program YPPUSH_XFRRESPPROG {
  228. version YPPUSH_XFRRESPVERS {
  229. void
  230. YPPUSHPROC_NULL(void) = 0;
  231. #ifdef STUPID_SUN_BUG
  232. /* This is the form as distributed by Sun. But even
  233. the Sun NIS servers expect the values in the other
  234. order. So their implementation somehow must change
  235. the order internally. We don't want to follow this
  236. bad example since the user should be able to use
  237. rpcgen on this file. */
  238. yppushresp_xfr
  239. YPPUSHPROC_XFRRESP(void) = 1;
  240. #else
  241. void
  242. YPPUSHPROC_XFRRESP(yppushresp_xfr) = 1;
  243. #endif
  244. } = 1;
  245. } = 0x40000000; /* transient: could be anything up to 0x5fffffff */
  246. /*
  247. * YP binding protocol
  248. */
  249. program YPBINDPROG {
  250. version YPBINDVERS {
  251. void
  252. YPBINDPROC_NULL(void) = 0;
  253. ypbind_resp
  254. YPBINDPROC_DOMAIN(domainname) = 1;
  255. void
  256. YPBINDPROC_SETDOM(ypbind_setdom) = 2;
  257. } = 2;
  258. } = 100007;