home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / nserve.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  4.5 KB  |  128 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ident    "@(#)/usr/include/nserve.h.sl 1.1 4.0 12/08/90 25802 AT&T-USL"
  11.  
  12. #ifndef _NSERVE_H
  13. #define _NSERVE_H
  14.  
  15. #ifndef _SYS_NSERVE_H
  16. #include <sys/nserve.h>
  17. #endif
  18. /*
  19.  *
  20.  *    name server header file.  contains defines necessary for
  21.  *    any program that wants to talk with the name server.
  22.  *
  23.  */
  24. #define NSVERSION    1    /* coincides with load n7 SVR3        */
  25.  
  26. /*
  27.  * Pathname defines:
  28.  */
  29.  
  30. #define NSPID      "/etc/rfs/nspid"    /* lock file for ns, also has pid    */
  31. #define NS_PIPE   "/etc/rfs/nspip"    /* stream pipe for ns        */
  32. #define NSDIR      "/etc/rfs"        /* name server working directory.    */
  33. #define DOMMASTER "/etc/rfs/dom.master"    /* file for outside domains     */
  34. #define SAVEDB      "/etc/rfs/save.db"        /* saves database when ns exits    */
  35. #define PASSFILE  "/etc/rfs/%s/loc.passwd"    /* location of local passwd    */
  36. #define VERPASSWD "/etc/rfs/verify/%s/passwd"    /* passwd for verification  */
  37. #define DOMPASSWD "/etc/rfs/auth.info/%s/passwd"    /* passwd for dom  "%s"  */
  38.                             /* contains the domain name.    */
  39. #define NSDOM      "/etc/rfs/domain"    /* place to save domain name    */
  40.  
  41. /* other defines    */
  42. #define PRIMENAME "PRIMARY"    /* default name for unknown primary    */
  43. #define CORRECT      "correct"    /* message stating password is correct    */
  44. #define INCORRECT "sorry"    /* message stating password is wrong    */
  45. #define REC_TIME  10
  46.  
  47. /* sizes    */
  48.  
  49. #define    SZ_RES    14    /* maximum size of resource name              */
  50. #define SZ_MACH    9    /* maximum size of machine name.             */
  51. #define SZ_PATH 64    /* size of "pathname" of resource             */
  52. #define SZ_DESC    32    /* size of description                     */
  53. #define SZ_DELEMENT 14    /* max size of one element of a domain name         */
  54.  
  55. /* types    */
  56. #define FILE_TREE 1    /* sharable file tree    */
  57.  
  58. /* flags    */
  59. #define READONLY  1
  60. #define READWRITE 2
  61.  
  62. /* command types    */
  63. #define NS_SNDBACK    0    /* actually a "null" type    */
  64. #define    NS_ADV        1    /* advertise a resource        */
  65. #define NS_UNADV    2    /* unadvertise a resource    */
  66. #define NS_GET        3    /* unused query            */
  67. #define NS_QUERY    4    /* query by name and type.    */
  68. #define NS_INIT        5    /* called to setup name service */
  69. #define NS_SENDPASS    7    /* register passwd w/ primary    */
  70. #define NS_VERIFY    8    /* verify validity of your pwd    */
  71. #define NS_MODADV    9    /* modify an advertisement    */
  72. #define NS_BYMACHINE    10    /* inv query by owner and type    */
  73. #define NS_IQUERY    11    /* general inverse query    */
  74. #define NS_IM_P        12    /* I am primary poll        */
  75. #define NS_IM_NP    13    /* I am secondary poll        */
  76. #define NS_FINDP    14    /* find which machine is prime    */
  77. #define NS_REL        15    /* relinquish being primary    */
  78.  
  79. /* return codes    */
  80. #define FAILURE        0
  81. #define SUCCESS        1
  82. #define MORE_DATA     2    /* or'ed into return when more coming */
  83.  
  84. /* error codes returned by the name server             */
  85.  
  86. #define R_NOERR  0    /* no error                */
  87. #define R_FORMAT 1    /* format error                */
  88. #define R_NSFAIL 2    /* name server failure            */
  89. #define R_NONAME 3    /* name does not exist            */
  90. #define R_IMP     4    /* request type not implemented or bad    */
  91. #define R_PERM     5    /* no permission for this operation    */
  92. #define R_DUP     6    /* name not unique (for advertise)    */
  93. #define R_SYS     7    /* a system call failed in name server  */
  94. #define R_EPASS  8    /* error accessing primary passwd file    */
  95. #define R_INVPW  9       /* invalid password            */
  96. #define R_NOPW   10    /* no passwd in primary passwd file    */
  97. #define R_SETUP  11    /* error in ns_setup()            */
  98. #define R_SEND   12    /* error in ns_send()            */
  99. #define R_RCV    13    /* error in ns_rcv()            */
  100. #define R_INREC     14    /* in recovery, try again        */
  101. #define R_FAIL     15    /* unknown failure            */
  102.  
  103. /* name server request structure    */
  104.  
  105. struct nssend {
  106.     short    ns_code;    /* request code (e.g., NS_ADV)    */
  107.     short    ns_type;    /* type of data, unused for now    */
  108.     short    ns_flag;    /* read/write flag        */
  109.     char    *ns_name;    /* name of resource        */
  110.     char    *ns_desc;    /* description of resource    */
  111.     char    *ns_path;    /* local pathname of resource    */
  112.     struct address    *ns_addr; /* address of resource's owner*/
  113.     char    **ns_mach;    /* list of client machines    */
  114. };
  115.  
  116. /* function declarations    */
  117.  
  118. int    ns_setup();
  119. int    ns_close();
  120. int    ns_send();
  121. struct nssend    *ns_rcv();
  122.  
  123. /* macros    */
  124. #define    SET_NODELAY(f)    fcntl(f,F_SETFL,fcntl(f,F_GETFL,0)|O_NDELAY)
  125. #define    CLR_NODELAY(f)    fcntl(f,F_SETFL,fcntl(f,F_GETFL,0)&~O_NDELAY)
  126.  
  127. #endif     /* _NSERVE_H */
  128.