home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / bootp.2.2+FdC.tar.Z / bootp.2.2+FdC.tar / bootpd.h < prev    next >
C/C++ Source or Header  |  1993-03-31  |  6KB  |  231 lines

  1. #ifndef _BLURB_
  2. #define _BLURB_
  3. /************************************************************************
  4.           Copyright 1988, 1991 by Carnegie Mellon University
  5.  
  6.                           All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its
  9. documentation for any purpose and without fee is hereby granted, provided
  10. that the above copyright notice appear in all copies and that both that
  11. copyright notice and this permission notice appear in supporting
  12. documentation, and that the name of Carnegie Mellon University not be used
  13. in advertising or publicity pertaining to distribution of the software
  14. without specific, written prior permission.
  15.  
  16. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  17. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  18. IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  19. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  20. PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  21. ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23. ************************************************************************/
  24. #endif /* _BLURB_ */
  25.  
  26.  
  27. /*
  28.  * bootpd.h -- common header file for all the modules of the bootpd program.
  29.  */
  30.  
  31.  
  32. #ifndef TRUE
  33. #define TRUE    1
  34. #endif
  35. #ifndef FALSE
  36. #define FALSE    0
  37. #endif
  38.  
  39. #ifndef PRIVATE
  40. #define PRIVATE static
  41. #endif
  42.  
  43. #ifndef SIGUSR1
  44. #define SIGUSR1             30    /* From 4.3 <signal.h> */
  45. #endif
  46.  
  47. #define MAXHTYPES          7    /* Number of htypes defined */
  48. #define MAXHADDRLEN          6    /* Max hw address length in bytes */
  49. #define MAXSTRINGLEN         80    /* Max string length */
  50.  
  51. /*
  52.  * Return the length in bytes of a hardware address of the given type.
  53.  * Return the canonical name of the network of the given type.
  54.  */
  55. #define haddrlength(type)    ((hwinfolist[(int) (type)]).hlen)
  56. #define netname(type)        ((hwinfolist[(int) (type)]).name)
  57.  
  58.  
  59. /*
  60.  * Return pointer to static string which gives full network error message.
  61.  */
  62. #define get_network_errmsg get_errmsg
  63.  
  64.  
  65. /*
  66.  * Variables shared among modules.
  67.  */
  68.  
  69. extern int debug;
  70. extern char *bootptab;
  71.  
  72.  
  73. /*
  74.  * This structure holds information about a specific network type.  The
  75.  * length of the network hardware address is stored in "hlen".
  76.  * The string pointed to by "name" is the cononical name of the network.
  77.  */
  78.  
  79. struct hwinfo {
  80.     unsigned hlen;
  81.     char *name;
  82. };
  83.  
  84.  
  85. extern struct hwinfo hwinfolist[MAXHTYPES + 1];
  86.  
  87. extern hash_tbl *hwhashtable;
  88. extern hash_tbl *iphashtable;
  89. extern hash_tbl *nmhashtable;
  90. extern unsigned char vm_cmu[4];
  91. extern unsigned char vm_rfc1048[4];
  92.  
  93.  
  94. /*
  95.  * Functions shared among modules
  96.  */
  97.  
  98. extern void report();
  99. extern char *get_errmsg();
  100. extern char *haddrtoa();
  101. extern int readtab();
  102.  
  103.  
  104.  
  105. /*
  106.  * Nice typedefs. . .
  107.  */
  108.  
  109. typedef int boolean;
  110. typedef unsigned char byte;
  111.  
  112.  
  113. /*
  114.  * Data structure used to hold an arbitrary-lengthed list of IP addresses.
  115.  * The list may be shared among multiple hosts by setting the linkcount
  116.  * appropriately.
  117.  */
  118.  
  119. struct in_addr_list {
  120.     unsigned        linkcount, addrcount;
  121.     struct in_addr    addr[1];        /* Dynamically extended */
  122. };
  123.  
  124.  
  125. /*
  126.  * Data structures used to hold shared strings and shared binary data.
  127.  * The linkcount must be set appropriately.
  128.  */
  129.  
  130. struct shared_string {
  131.     unsigned        linkcount;
  132.     char        string[1];        /* Dynamically extended */
  133. };
  134.  
  135. struct shared_bindata {
  136.     unsigned        linkcount, length;
  137.     byte        data[1];        /* Dynamically extended */
  138. };
  139.  
  140.  
  141. /*
  142.  * Flag structure which indicates which symbols have been defined for a
  143.  * given host.  This information is used to determine which data should or
  144.  * should not be reported in the bootp packet vendor info field.
  145.  */
  146.  
  147. struct flag {
  148.     unsigned    bootfile    :1,
  149.         bootserver    :1,
  150.         bootsize    :1,
  151.         bootsize_auto    :1,
  152.         cookie_server    :1,
  153.         domain_server    :1,
  154.         gateway        :1,
  155.         generic        :1,
  156.         haddr        :1,
  157.         homedir        :1,
  158.         htype        :1,
  159.         impress_server    :1,
  160.         iaddr        :1,
  161.         log_server    :1,
  162.         lpr_server    :1,
  163.         name_server    :1,
  164.         name_switch    :1,
  165.         rlp_server    :1,
  166.         send_name    :1,
  167.         subnet_mask    :1,
  168.         tftpdir        :1,
  169.         time_offset    :1,
  170.         timeoff_auto    :1,
  171.         time_server    :1,
  172.         vendor_magic    :1,
  173.         vm_auto        :1,
  174.         merit_dump_file    :1, /* RFC1395 */
  175.         domain_name    :1, /* RFC1395 */
  176.         swap_server    :1, /* RFC1395 */
  177.         root_path    :1; /* RFC1395 */
  178. };
  179.  
  180.  
  181.  
  182. /*
  183.  * The flags structure contains TRUE flags for all the fields which
  184.  * are considered valid, regardless of whether they were explicitly
  185.  * specified or indirectly inferred from another entry.
  186.  *
  187.  * The gateway and the various server fields all point to a shared list of
  188.  * IP addresses.
  189.  *
  190.  * The hostname, home directory, and bootfile are all shared strings.
  191.  *
  192.  * The generic data field is a shared binary data structure.  It is used to
  193.  * hold future RFC1048 vendor data until bootpd is updated to understand it.
  194.  *
  195.  * The vm_cookie field specifies the four-octet vendor magic cookie to use
  196.  * if it is desired to always send the same response to a given host.
  197.  *
  198.  * Hopefully, the rest is self-explanatory.
  199.  */
  200.  
  201. struct host {
  202.     struct flag            flags;        /* ALL valid fields */
  203.     struct in_addr_list        *cookie_server,
  204.                 *domain_server,
  205.                 *gateway,
  206.                 *impress_server,
  207.                 *log_server,
  208.                 *lpr_server,
  209.                 *name_server,
  210.                 *rlp_server,
  211.                 *time_server,
  212.                 *swap_server;     /* RFC1395 */
  213.     struct shared_string    *bootfile,
  214.                 *hostname,
  215.                 *homedir,
  216.                 *tftpdir,
  217.                 *merit_dump_file, /* RFC1395 */
  218.                 *domain_name,     /* RFC1395 */
  219.                 *root_path;       /* RFC1395 */
  220.     struct shared_bindata   *generic;
  221.     byte            vm_cookie[4],
  222.                 htype,  /* RFC826 says this should be 16-bits but
  223.                        RFC951 only allocates 1 byte. . . */
  224.                 haddr[MAXHADDRLEN];
  225.     long            time_offset;
  226.     unsigned int        bootsize;
  227.     struct in_addr        bootserver,
  228.                 iaddr,
  229.                 subnet_mask;
  230. };
  231.