bootp.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* $OpenBSD: bootp.h,v 1.5 2003/08/11 06:23:09 deraadt Exp $ */
  2. /* $NetBSD: bootp.h,v 1.3 1996/09/26 23:22:01 cgd Exp $ */
  3. /*
  4. * Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
  5. *
  6. * This file specifies the "implementation-independent" BOOTP protocol
  7. * information which is common to both client and server.
  8. *
  9. * Copyright 1988 by Carnegie Mellon.
  10. *
  11. * Permission to use, copy, modify, and distribute this program for any
  12. * purpose and without fee is hereby granted, provided that this copyright
  13. * and permission notice appear on all copies and supporting documentation,
  14. * the name of Carnegie Mellon not be used in advertising or publicity
  15. * pertaining to distribution of the program without specific prior
  16. * permission, and notice be given in supporting documentation that copying
  17. * and distribution is by permission of Carnegie Mellon and Stanford
  18. * University. Carnegie Mellon makes no representations about the
  19. * suitability of this software for any purpose. It is provided "as is"
  20. * without express or implied warranty.
  21. */
  22. #define BP_CHADDR_LEN 16
  23. #define BP_SNAME_LEN 64
  24. #define BP_FILE_LEN 128
  25. #define BP_VEND_LEN 64
  26. #define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */
  27. struct bootp {
  28. u_char bp_op; /* packet opcode type */
  29. u_char bp_htype; /* hardware addr type */
  30. u_char bp_hlen; /* hardware addr length */
  31. u_char bp_hops; /* gateway hops */
  32. u_int bp_xid; /* transaction ID */
  33. u_short bp_secs; /* seconds since boot began */
  34. u_short bp_flags; /* RFC1532 broadcast, etc. */
  35. struct in_addr bp_ciaddr; /* client IP address */
  36. struct in_addr bp_yiaddr; /* 'your' IP address */
  37. struct in_addr bp_siaddr; /* server IP address */
  38. struct in_addr bp_giaddr; /* gateway IP address */
  39. u_char bp_chaddr[BP_CHADDR_LEN];/* client hardware address */
  40. u_char bp_sname[BP_SNAME_LEN]; /* server host name */
  41. u_char bp_file[BP_FILE_LEN]; /* boot file name */
  42. u_char bp_vend[BP_VEND_LEN]; /* vendor-specific area */
  43. };
  44. /*
  45. * UDP port numbers, server and client.
  46. */
  47. #define IPPORT_BOOTPS 67
  48. #define IPPORT_BOOTPC 68
  49. #define BOOTREPLY 2
  50. #define BOOTREQUEST 1
  51. /*
  52. * Hardware types from Assigned Numbers RFC.
  53. */
  54. #define HTYPE_ETHERNET 1
  55. #define HTYPE_EXP_ETHERNET 2
  56. #define HTYPE_AX25 3
  57. #define HTYPE_PRONET 4
  58. #define HTYPE_CHAOS 5
  59. #define HTYPE_IEEE802 6
  60. #define HTYPE_ARCNET 7
  61. /*
  62. * Vendor magic cookie (v_magic) for CMU
  63. */
  64. #define VM_CMU "CMU"
  65. /*
  66. * Vendor magic cookie (v_magic) for RFC1048
  67. */
  68. #define VM_RFC1048 { 99, 130, 83, 99 }
  69. /*
  70. * RFC1048 tag values used to specify what information is being supplied in
  71. * the vendor field of the packet.
  72. */
  73. #define TAG_PAD ((unsigned char) 0)
  74. #define TAG_SUBNET_MASK ((unsigned char) 1)
  75. #define TAG_TIME_OFFSET ((unsigned char) 2)
  76. #define TAG_GATEWAY ((unsigned char) 3)
  77. #define TAG_TIME_SERVER ((unsigned char) 4)
  78. #define TAG_NAME_SERVER ((unsigned char) 5)
  79. #define TAG_DOMAIN_SERVER ((unsigned char) 6)
  80. #define TAG_LOG_SERVER ((unsigned char) 7)
  81. #define TAG_COOKIE_SERVER ((unsigned char) 8)
  82. #define TAG_LPR_SERVER ((unsigned char) 9)
  83. #define TAG_IMPRESS_SERVER ((unsigned char) 10)
  84. #define TAG_RLP_SERVER ((unsigned char) 11)
  85. #define TAG_HOSTNAME ((unsigned char) 12)
  86. #define TAG_BOOTSIZE ((unsigned char) 13)
  87. #define TAG_DUMPFILE ((unsigned char) 14)
  88. #define TAG_DOMAINNAME ((unsigned char) 15)
  89. #define TAG_SWAPSERVER ((unsigned char) 16)
  90. #define TAG_ROOTPATH ((unsigned char) 17)
  91. #define TAG_EXTEN_FILE ((unsigned char) 18)
  92. #define TAG_NIS_DOMAIN ((unsigned char) 40)
  93. #define TAG_NIS_SERVER ((unsigned char) 41)
  94. #define TAG_NTP_SERVER ((unsigned char) 42)
  95. #define TAG_MAX_MSGSZ ((unsigned char) 57)
  96. #define TAG_END ((unsigned char) 255)
  97. /*
  98. * "vendor" data permitted for CMU bootp clients.
  99. */
  100. struct cmu_vend {
  101. unsigned char v_magic[4]; /* magic number */
  102. unsigned int v_flags; /* flags/opcodes, etc. */
  103. struct in_addr v_smask; /* Subnet mask */
  104. struct in_addr v_dgate; /* Default gateway */
  105. struct in_addr v_dns1, v_dns2; /* Domain name servers */
  106. struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */
  107. struct in_addr v_ts1, v_ts2; /* Time servers */
  108. unsigned char v_unused[25]; /* currently unused */
  109. };
  110. /* v_flags values */
  111. #define VF_SMASK 1 /* Subnet mask field contains valid data */
  112. void bootp(int);