home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / bsd / netinet / bootp.h next >
Text File  |  1992-07-29  |  2KB  |  90 lines

  1. /*
  2.  * Bootstrap Protocol (BOOTP).  RFC 951.
  3.  */
  4.  
  5. #define iaddr_t struct in_addr
  6.  
  7. struct bootp {
  8.     u_char    bp_op;        /* packet opcode type */
  9. #define    BOOTREQUEST    1
  10. #define    BOOTREPLY    2
  11.     u_char    bp_htype;    /* hardware addr type */
  12.     u_char    bp_hlen;    /* hardware addr length */
  13.     u_char    bp_hops;    /* gateway hops */
  14.     u_long    bp_xid;        /* transaction ID */
  15.     u_short    bp_secs;    /* seconds since boot began */    
  16.     u_short    bp_unused;
  17.     iaddr_t    bp_ciaddr;    /* client IP address */
  18.     iaddr_t    bp_yiaddr;    /* 'your' IP address */
  19.     iaddr_t    b@addr;    /* server IP address */
  20.     iaddr_t    bp_giaddr;    /* gateway IP address */
  21.     u_char    bp_chaddr[16];    /* client hardware address */
  22.     u_char    bp_sname[64];    /* server host name */
  23.     u_char    bp_file[128];    /* boot file name */
  24.     u_char    bp_vend[64];    /* vendor-specific area */
  25. };
  26.  
  27. /*
  28.  * UDP port numbers, server and client.
  29.  */
  30. #define    IPPORT_BOOTPS        67
  31. #define    IPPORT_BOOTPC        68
  32.  
  33. /*
  34.  * "vendor" data permitted for Stanford boot clients.
  35.  */
  36. struct vend {
  37.     u_char    v_magic[4];    /* magic number */
  38.     u_long    v_flags;    /* flags/opcodes, etc. */
  39.     u_char    v_unused[56];    /* currently unused */
  40. };
  41. #define    VM_STANFORD    "STAN"    /* v_magic for Stanford */
  42.  
  43. /* v_flags values */
  44. #define    VF_PCBOOT    1    /* an IBMPC or Mac wants environment info */
  45. #define    VF_HELP        2    /* help me, I'm not registered */
  46.  
  47. #define    NVMAXTEXT    56    /* don't change this, it just fits RFC951 */
  48. struct nextvend {
  49.     u_char nv_magic[4];    /* Magic number for vendor specificity */
  50.     u_char nv_version;    /* NeXT protocol version */
  51.     union {
  52.         u_char NV0[59];
  53.         struct {
  54.             u_char NV1_opcode;    /* opcode - Version 1 */
  55.             u_char NV1_xid;    /* transcation id */
  56.             u_char NV1_text[NVMAXTEXT];    /* text */
  57.             u_char NV1_null;    /* null terminator */
  58.         } NV1;
  59.     } nv_U;
  60. };
  61. #define    nv_unused    nv_U.NV0
  62. #define    nv_opcode    nv_U.NV1.NV1_opcode
  63. #define    nv_xid        nv_U.NV1.NV1_xid
  64. #define    nv_text        nv_U.NV1.NV1_text
  65. #define nv_null        nv_U.NV1.NV1_null
  66.  
  67. /* Magic number */
  68. #define VM_NEXT        "NeXT"    /* v_magic for NeXT, Inc. */
  69.  
  70. /* Opcodes */
  71. #define    BPOP_OK        0
  72. #define BPOP_QUERY    1
  73. #define    BPOP_QUERY_NE    2
  74. #define    BPOP_ERROR    3
  75.  
  76. struct bootp_packet {
  77.     struct ether_header bp_ether;
  78.     struct ip bp_ip;
  79.     struct udphdr bp_udp;
  80.     struct bootp bp_bootp;
  81. };
  82.  
  83. #define    BOOTP_PKTSIZE (sizeof (struct bootp_packet))
  84.  
  85. /* backoffs must be masks */
  86. #define    BOOTP_MIN_BACKOFF    0x7ff        /* 2.048 sec */
  87. #define    BOOTP_MAX_BACKOFF    0xffff        /* 65.535 sec */
  88. #define    BOOTP_RETRY        6        /* # retries */
  89.  
  90.