Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.8 KiB

  1. //============================================================================
  2. // Copyright (c) 1995, Microsoft Corporation
  3. //
  4. // File: defs.h
  5. //
  6. // History:
  7. // Abolade Gbadegesin September 8, 1995 Created
  8. //
  9. // Contains miscellaneous declarations and definitions
  10. //============================================================================
  11. #ifndef _DEFS_H_
  12. #define _DEFS_H_
  13. //----------------------------------------------------------------------------
  14. // TYPE DEFINITIONS FOR IPBOOTP NETWORK PACKET TEMPLATES
  15. //
  16. // constants defining maximum lengths for array fields
  17. //
  18. #define MAX_MACADDR_LENGTH 16
  19. #define MAX_HOSTNAME_LENGTH 64
  20. #define MAX_BOOTFILENAME_LENGTH 128
  21. #include <pshpack1.h>
  22. // the structure of the BOOTP packet, as defined by RFC 1542;
  23. // the option field which appears at the end of each packet
  24. // is excluded since the relay agent does no options-processing
  25. //
  26. typedef struct _IPBOOTP_PACKET {
  27. BYTE IP_Operation;
  28. BYTE IP_MacAddrType;
  29. BYTE IP_MacAddrLength;
  30. BYTE IP_HopCount;
  31. DWORD IP_TransactionID;
  32. WORD IP_SecondsSinceBoot;
  33. WORD IP_Flags;
  34. DWORD IP_ClientAddress;
  35. DWORD IP_OfferedAddress;
  36. DWORD IP_ServerAddress;
  37. DWORD IP_AgentAddress;
  38. BYTE IP_MacAddr[16];
  39. BYTE IP_HostName[64];
  40. BYTE IP_BootFileName[128];
  41. } IPBOOTP_PACKET, *PIPBOOTP_PACKET;
  42. typedef struct _DHCP_PACKET {
  43. UCHAR Cookie[4];
  44. UCHAR Tag;
  45. UCHAR Length;
  46. UCHAR Option[];
  47. } DHCP_PACKET, *PDHCP_PACKET;
  48. #include <poppack.h>
  49. // constants for the IBP_Operation field
  50. //
  51. #define IPBOOTP_OPERATION_REQUEST 1
  52. #define IPBOOTP_OPERATION_REPLY 2
  53. //
  54. #define IPBOOTP_MAX_HOP_COUNT 16
  55. // constants for the IBP_Flags field
  56. //
  57. #define IPBOOTP_FLAG_BROADCAST 0x8000
  58. // constants for the DHCP portion of the packet
  59. //
  60. #define DHCP_MAGIC_COOKIE ((99 << 24) | (83 << 16) | (130 << 8) | (99))
  61. #define DHCP_TAG_MESSAGE_TYPE 53
  62. #define DHCP_MESSAGE_INFORM 8
  63. // structure size constants
  64. //
  65. #define MIN_PACKET_SIZE (sizeof(IPBOOTP_PACKET) + 64)
  66. #define MAX_PACKET_SIZE 576
  67. // INET constants
  68. //
  69. #define IPBOOTP_SERVER_PORT 67
  70. #define IPBOOTP_CLIENT_PORT 68
  71. // This macro compares two IP addresses in network order by
  72. // masking off each pair of octets and doing a subtraction;
  73. // the result of the final subtraction is stored in the third argument
  74. //
  75. #define INET_CMP(a,b,c) \
  76. (((c) = (((a) & 0x000000ff) - ((b) & 0x000000ff))) ? (c) : \
  77. (((c) = (((a) & 0x0000ff00) - ((b) & 0x0000ff00))) ? (c) : \
  78. (((c) = (((a) & 0x00ff0000) - ((b) & 0x00ff0000))) ? (c) : \
  79. (((c) = (((a) & 0xff000000) - ((b) & 0xff000000))) ? (c) : (c)))))
  80. #endif // _DEFS_H_