home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / netinfo / ni_prot.%05 < prev    next >
Encoding:
Text File  |  1991-08-07  |  8.5 KB  |  477 lines

  1. /* 
  2.  * NetInfo protocol specification
  3.  * Copyright (C) 1989 by NeXT, Inc.
  4.  */
  5.  
  6. /* Preamble appearing on all generated output */
  7. #ifndef NOPREAMBLE
  8. %/*
  9. % * Output of the RPC protocol compiler: DO NOT EDIT
  10. % * Copyright (C) 1989 by NeXT, Inc.
  11. % */
  12. #endif
  13.  
  14. #ifndef RPC_HDR
  15. %#include <stdio.h>
  16. %#include <sys/time.h>
  17. %#include "clib.h"
  18. #endif
  19. const NI_NAME_MAXLEN = 65535;
  20. const NI_NAMELIST_MAXLEN = 65535;
  21. const NI_PROPLIST_MAXLEN = 65535;
  22. const NI_IDLIST_MAXLEN = 1048576;
  23.  
  24. /*
  25.  * Every object has a unique ID. One part of the ID identifies the object
  26.  * itself. The other identifies the instance of the object. Every time
  27.  * an object is written or an object is destroyed and then reallocated, 
  28.  * its instance is incremented. 
  29.  *
  30.  * All read operations ignore the instance field. All write operations 
  31.  * refuse to operate on the object if there is an instance mismatch.
  32.  */
  33.  
  34. /*
  35.  * Don't go through unnecessary overhead for xdr_ni_index using typedef
  36.  * rpcgen needs an optimizer so we don't have to do this!
  37.  */
  38. #ifdef RPC_HDR
  39. %typedef unsigned long ni_index;
  40. #endif
  41. #define ni_index unsigned long
  42.  
  43. struct ni_id {
  44.     ni_index nii_object;
  45.     ni_index nii_instance;
  46. };
  47.  
  48.  
  49. /*
  50.  * Names are assumed to contain human-readable ASCII characters.
  51.  */
  52. typedef string ni_name<NI_NAME_MAXLEN>;
  53.  
  54.  
  55. typedef ni_name ni_namelist<NI_NAMELIST_MAXLEN>;
  56.  
  57. /*
  58.  * A property
  59.  */
  60. struct ni_property {
  61.     ni_name nip_name;
  62.     ni_namelist nip_val;
  63. };
  64.  
  65. /*
  66.  * A list of properties
  67.  */
  68. typedef ni_property ni_proplist<NI_PROPLIST_MAXLEN>;
  69.  
  70. /*
  71.  * A list of IDs (yet another variable-length array)
  72.  */
  73. typedef ni_index ni_idlist<NI_IDLIST_MAXLEN>;
  74.  
  75.  
  76. /*
  77.  * A name object
  78.  */
  79. struct ni_object {
  80.     ni_id nio_id;
  81.     ni_proplist nio_props;
  82.     ni_index nio_parent;
  83.     ni_idlist nio_children;
  84. };
  85.  
  86.  
  87. /*
  88.  * All operations return a status indicating either that the requested 
  89.  * operation succeeded or why it failed.
  90.  */
  91. enum ni_status {
  92.     NI_V3    /* Operation succeeded */
  93.     NI_BADID,    /* ID is invalid */
  94.     NI_STALE,    /* Write attempted on stale version of object */
  95.     NI_NOSPACE,    /* No space available for write operation */
  96.     NI_PERM,    /* Permission denied */
  97.     NI_NODIR,    /* No such directory */
  98.     NI_NOPROP,    /* No such property */
  99.     NI_NONAME,    /* No such name */
  100.     NI_NOTEMPTY,    /* Cannot delete name object with children */
  101.     NI_UNRELATED,    /* Object is not child of parent: cannot destroy */
  102.     NI_SERIAL,    /* Serialization error */
  103.     NI_NETROOT,    /* Hit network root directory */
  104.     NI_NORESPONSE,    /* No response from remote parent */
  105.     NI_RDONLY,    /* No writes allowed: all objects are read-only */
  106.     NI_SYSTEMERR,    /* generic remote error */
  107.     NI_ALIVE,    /* Can't regenerate: already in use */
  108.     NI_NOTMASTER,    /* Operation makes no sense on clone */
  109.     NI_CANTFINDADDRESS, /* Can't find address of server */
  110.     NI_DUPTAG,    /* Duplicate domain tag: can't serve it */
  111.     NI_NOTAG,    /* No such tag */
  112.     NI_AUTHERROR,    /* Authentication error */
  113.     NI_NOUSER,    /* No such user */
  114.     NI_MASTERBUSY,    /* Master server is busy */
  115.     NI_FAILED = 9999    /* generic local error */
  116. };
  117.  
  118. /*
  119.  * Wrappers needed to handle arguments and results
  120.  */
  121. union ni_id_res switch (ni_status status) {
  122. case NI_OK:
  123.     ni_id id;
  124. default:
  125.     void;
  126. };
  127.  
  128. struct ni_parent_stuff {
  129.     ni_index object_id;
  130.     ni_id self_id;
  131. };
  132.  
  133. union ni_parent_res switch (ni_status status) {
  134. case NI_OK:
  135.     struct ni_parent_stuff stuff;
  136. default:
  137.     void;
  138. };
  139.  
  140. struct ni_children_stuff {
  141.     ni_idlist children;
  142.     ni_id self_id;
  143. };
  144.  
  145. union ni_children_res switch (ni_status status) {
  146. case NI_OK:
  147.     ni_children_stuff stuff;
  148. default:
  149.     void;
  150. };
  151.  
  152. struct ni_entry {
  153.     ni_index id;
  154.     ni_namelist *names;
  155. };
  156.  
  157. typedef ni_entry ni_entrylist<NI_IDLIST_MAXLEN>;
  158.  
  159. struct ni_list_stuff {
  160.     ni_entrylist entries;
  161.     ni_id self_id;
  162. };
  163.  
  164. union ni_list_res switch (ni_status status) {
  165. case NI_OK:
  166.     ni_list_stuff stuff;
  167. default:
  168.     void;
  169. };
  170.  
  171. struct ni_proplist_stuff {
  172.     ni_id id;
  173.     ni_proplist props;
  174. };
  175.  
  176. struct ni_create_args {
  177.     ni_id id;
  178.     ni_proplist props;
  179.     ni_index where;
  180.     ni_id *target_id;
  181. };
  182.  
  183. union ni_proplist_res switch (ni_status status) {
  184. case NI_OK:
  185.     ni_proplist_stuff stuff;
  186. default:
  187.     void;
  188. };
  189.     
  190. struct ni_create_stuff {
  191.     ni_id id;
  192.     ni_id self_id;
  193. };
  194.  
  195. union ni_create_res switch (ni_status status) {
  196. case NI_OK:
  197.     ni_create_stuff stuff;
  198. default:
  199.     void;
  200. };
  201.  
  202. struct ni_destroy_args {
  203.     ni_id parent_id;
  204.     ni_id self_id;
  205. };V4ruct ni_lookup_args {
  206.     ni_id id;
  207.     ni_name key;
  208.     ni_name value;
  209. };
  210.  
  211. struct ni_lookup_stuff {
  212.     ni_idlist idlist;
  213.     ni_id self_id;
  214. };
  215.  
  216. union ni_lookup_res switch (ni_status status) {
  217. case NI_OK:
  218.     ni_lookup_stuff stuff;
  219. default:
  220.     void;
  221. };
  222.  
  223.  
  224. struct ni_name_args {
  225.     ni_id id;
  226.     ni_name name;
  227. };
  228.  
  229. struct ni_createprop_args {
  230.     ni_id id;
  231.     ni_property prop;
  232.     ni_index where;
  233. };
  234.  
  235. struct ni_writeprop_args {
  236.     ni_id id;
  237.     ni_index prop_index;
  238.     ni_namelist values;
  239. };
  240.  
  241. struct ni_prop_args {
  242.     ni_id id;
  243.     ni_index prop_index;
  244. };
  245.  
  246. struct ni_namelist_stuff {
  247.     ni_namelist values;
  248.     ni_id self_id;
  249. };
  250.  
  251. union ni_namelist_res switch (ni_status status) {
  252. case NI_OK:
  253.     ni_namelist_stuff stuff;
  254. default:
  255.     void;
  256. };
  257.  
  258. struct ni_propname_args {
  259.     ni_id id;
  260.     ni_index prop_index;
  261.     ni_name name;
  262. };
  263.  
  264. struct ni_createname_args {
  265.     ni_id id;
  266.     ni_index prop_index;
  267.     ni_name name;
  268.     ni_index where;
  269. };
  270.  
  271. struct ni_nameindex_args {
  272.     ni_id id;
  273.     ni_index prop_index;
  274.     ni_index name_index;
  275. };
  276.  
  277. struct ni_writename_args {
  278.     ni_id id;
  279.     ni_index prop_index;
  280.     ni_index name_index;
  281.     ni_name name;
  282. };
  283.  
  284. struct ni_readname_stuff {
  285.     ni_id id;
  286.     ni_name name;
  287. };
  288.  
  289. union ni_readname_res switch (ni_status status) {
  290. case NI_OK:
  291.     ni_readname_stuff stuff;
  292. default:
  293.     void;
  294. };
  295.  
  296. struct ni_binding {
  297.     ni_name tag;
  298.     unsigned addr;
  299. };
  300.  
  301. union ni_rparent_res switch (ni_status status) {
  302. case NI_OK:
  303.     ni_binding binding;
  304. default:
  305.     void;
  306. };
  307.  
  308. typedef struct ni_object_node *ni_object_list;
  309. struct ni_object_node {
  310.     ni_object object;
  311.     ni_object_list next;
  312. };
  313.  
  314. struct ni_readall_stuff {
  315.     unsigned checksum;
  316.     ni_index highestid;
  317.     ni_object_list list;
  318. };
  319.     
  320. union ni_readall_res switch (ni_status status) {
  321. case NI_OK:
  322.     ni_readall_stuff stuff;
  323. default:
  324.     void;
  325. };
  326.  
  327. typedef ni_proplist ni_proplist_list<NI_IDLIST_MAXLEN>;
  328.  
  329. struct ni_listall_stuff {
  330.     ni_id self_id;
  331.     ni_proplist_list entries;
  332. };
  333.  
  334. union ni_listall_res switch (ni_status status) {
  335. case NI_OK:
  336.     ni_listall_stuff stuff;
  337. default:
  338.     void;
  339. };
  340.  
  341.  
  342. program NI_PROG {
  343.     version NI_VERS {
  344.         void
  345.         _NI_PING(void) = 0;
  346.         /*
  347.          * Get various server statistics
  348.          */
  349.         ni_proplist
  350.         _NI_STATISTICS(void) = 1;
  351.  
  352.         /*
  353.          * Procedures dealing with nodes
  354.          */
  355.         ni_id_res
  356.         _NI_ROOT(void) = 2;
  357.  
  358.         ni_id_res
  359.         _NI_SELF(ni_id) = 3;
  360.  
  361.         ni_parent_res
  362.         _NI_PARENT(ni_id) = 4;    
  363.  
  364.         ni_create_res
  365.         _NI_CREATE(ni_create_args) = 5;    
  366.  
  367.         ni_id_res
  368.         _NI_DESTROY(ni_destroy_args) = 6; 
  369.  
  370.         ni_proV5t_res
  371.         _NI_READ(ni_id) = 7;
  372.  
  373.         ni_id_res
  374.         _NI_WRITE(ni_proplist_stuff) = 8;
  375.  
  376.         ni_children_res
  377.         _NI_CHILDREN(ni_id) = 9;
  378.  
  379.         ni_lookup_res
  380.         _NI_LOOKUP(ni_lookup_args) = 10; 
  381.  
  382.         ni_list_res
  383.         _NI_LIST(ni_name_args) = 11;
  384.  
  385.         /*
  386.          * Procedures dealing with properties
  387.          */
  388.         ni_id_res
  389.         _NI_CREATEPROP(ni_createprop_args) = 12; 
  390.         
  391.         ni_id_res
  392.         _NI_DESTROYPROP(ni_prop_args) = 13; 
  393.  
  394.         ni_namelist_res
  395.         _NI_READPROP(ni_prop_args) = 14;    
  396.  
  397.         ni_id_res
  398.         _NI_WRITEPROP(ni_writeprop_args) = 15;
  399.  
  400.         ni_id_res
  401.         _NI_RENAMEPROP(ni_propname_args) = 16;
  402.         
  403.         ni_namelist_res
  404.         _NI_LISTPROPS(ni_id) = 17;
  405.  
  406.         /*
  407.          * Procedures dealing with names
  408.          */
  409.         ni_id_res
  410.         _NI_CREATENAME(ni_createname_args) = 18;
  411.  
  412.         ni_id_res
  413.         _NI_DESTROYNAME(ni_nameindex_args) = 19;
  414.  
  415.         ni_readname_res
  416.         _NI_READNAME(ni_nameindex_args) = 20;
  417.  
  418.         ni_id_res
  419.         _NI_WRITENAME(ni_writename_args) = 21;
  420.  
  421.         /*
  422.          * Returns the address of this domain's remote parent
  423.          */
  424.         ni_rparent_res
  425.         _NI_RPARENT(void) = 22;
  426.  
  427.         /*
  428.          * List all properties of each subdirectory, not just
  429.          * just a single named property.
  430.          *
  431.          * WARNING: this routine is dangerous and may be
  432.          * removed from future implementations of the protocol.
  433.          * While it is good the the network in that there is
  434.          * less data on it because a lot is done in a single call, 
  435.          * it is bad for the server because it ties it up and locks 
  436.          * others out.
  437.          */
  438.         ni_listall_res
  439.         _NI_LISTALL(ni_id) = 23;
  440.  
  441.         /*
  442.          * Answers only if the given binding is served
  443.          */
  444.         void
  445.         _NI_BIND(ni_binding) = 24;
  446.         
  447.         /*
  448.          * Read the entire database if the checksum is different
  449.          * Implemented by master only.
  450.          */
  451.         ni_readall_res
  452.         _NI_READALL(unsigned) = 25;
  453.  
  454.         /*
  455.          * Informs server that master has crashed. Hands out
  456.          * latest checksum.
  457.          */
  458.         void
  459.         _NI_CRASHED(unsigned) = 26;
  460.  
  461.         /*
  462.          * If master, force clones to resync.
  463.          * If clone, resync with master.
  464.          */
  465.         ni_status
  466.         _NI_RESYNC(void) = 27; 
  467.  
  468.  
  469.         /*
  470.          * Extra proceduV(dded for performance
  471.          * Terminates on first hit, returns proplist
  472.           */
  473.         ni_proplist_res
  474.         _NI_LOOKUPREAD(ni_lookup_args) = 28;
  475.     } = 2;
  476. } = 200100000;
  477.