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.

205 lines
6.2 KiB

  1. typedef unsigned char uchar;
  2. typedef unsigned short ushort;
  3. typedef unsigned short u_int16_t;
  4. typedef unsigned long u_int32_t;
  5. typedef short int16_t;
  6. /* RSVP message types */
  7. #define RSVP_PATH 1
  8. #define RSVP_RESV 2
  9. #define RSVP_PATH_ERR 3
  10. #define RSVP_RESV_ERR 4
  11. #define RSVP_PATH_TEAR 5
  12. #define RSVP_RESV_TEAR 6
  13. #define RSVP_CONFIRM 7
  14. #define RSVP_REPORT 8
  15. #define RSVP_MAX_MSGTYPE 8
  16. /*
  17. * Define object classes: Class-Num values
  18. */
  19. #define class_NULL 0
  20. #define class_SESSION 1
  21. #define class_SESSION_GROUP 2
  22. #define class_RSVP_HOP 3
  23. #define class_INTEGRITY 4
  24. #define class_TIME_VALUES 5
  25. #define class_ERROR_SPEC 6
  26. #define class_SCOPE 7
  27. #define class_STYLE 8
  28. #define class_FLOWSPEC 9 // these two are the same
  29. #define class_IS_FLOWSPEC 9 // since we added IS in front of the name
  30. #define class_FILTER_SPEC 10
  31. #define class_SENDER_TEMPLATE 11
  32. #define class_SENDER_TSPEC 12
  33. #define class_ADSPEC 13
  34. #define class_POLICY_DATA 14
  35. #define class_CONFIRM 15
  36. #define class_MAX 15
  37. #define ICMP_ECHO 8
  38. #define ICMP_ECHOREPLY 0
  39. #define ICMP_MIN 8 // minimum 8 byte icmp packet (just header)
  40. /* The IP header */
  41. typedef struct iphdr {
  42. unsigned char h_len:4; // length of the header
  43. unsigned char version:4; // Version of IP
  44. unsigned char tos; // Type of service
  45. unsigned short total_len; // total length of the packet
  46. unsigned short ident; // unique identifier
  47. unsigned short frag_and_flags; // flags
  48. unsigned char ttl;
  49. unsigned char proto; // protocol (TCP, UDP etc)
  50. unsigned short checksum; // IP checksum
  51. unsigned int sourceIP;
  52. unsigned int destIP;
  53. }IpHeader;
  54. //
  55. // ICMP header
  56. //
  57. typedef struct _ihdr {
  58. BYTE i_type;
  59. BYTE i_code; /* type sub code */
  60. USHORT i_cksum;
  61. ULONG Unused;
  62. }IcmpHeader;
  63. #define STATUS_FAILED 0xFFFF
  64. #define DEF_PACKET_SIZE 32
  65. #define MAX_PACKET 1024
  66. typedef struct {
  67. u_char rsvp_verflags; /* version and common flags */
  68. u_char rsvp_type; /* message type (defined above) */
  69. u_int16_t rsvp_cksum; /* checksum */
  70. u_char rsvp_snd_TTL; /* Send TTL */
  71. u_char rsvp_unused; /* Reserved octet */
  72. int16_t rsvp_length; /* Message length in bytes */
  73. } common_header;
  74. /*
  75. * Standard format of an object header
  76. */
  77. typedef struct {
  78. u_int16_t obj_length; /* Length in bytes */
  79. u_char obj_class; /* Class (values defined below) */
  80. u_char obj_ctype; /* C-Type (values defined below) */
  81. } Object_header;
  82. void WINAPI QoSCheckRSVP(ULONG begin, ULONG end);
  83. void WINAPI QoSDiagRSVP(ULONG begin, ULONG end, BOOLEAN RouterAlert);
  84. void WINAPI QoSCheck8021P(ULONG DstAddr, ULONG ulhopCount);
  85. /*
  86. * ERROR_SPEC object class
  87. */
  88. #define ctype_ERROR_SPEC_ipv4 1
  89. #define ctype_ERROR_SPEC_ipv6 2
  90. typedef struct {
  91. struct in_addr errs_errnode; /* Error Node Address */
  92. u_char errs_flags; /* Flags: */
  93. #define ERROR_SPECF_InPlace 0x01 /* Left resv in place */
  94. #define ERROR_SPECF_NotGuilty 0x02 /* This rcvr not guilty */
  95. u_char errs_code; /* Error Code (def'd below) */
  96. u_int16_t errs_value; /* Error Value */
  97. #define ERR_FORWARD_OK 0x8000 /* Flag: OK to forward state */
  98. #define Error_Usage(x) (((x)>>12)&3)
  99. #define ERR_Usage_globl 0x00 /* Globally-defined sub-code */
  100. #define ERR_Usage_local 0x10 /* Locally-defined sub-code */
  101. #define ERR_Usage_serv 0x11 /* Service-defined sub-code */
  102. #define ERR_global_mask 0x0fff /* Sub-code bits in Error Val */
  103. } Error_Spec_IPv4;
  104. typedef struct {
  105. Object_header errs_header;
  106. union {
  107. Error_Spec_IPv4 errs_ipv4;
  108. /* Error_Spec_IPv6 errs_ipv6; */
  109. } errs_u;
  110. } ERROR_SPEC;
  111. #define errspec4_enode errs_u.errs_ipv4.errs_errnode
  112. #define errspec4_code errs_u.errs_ipv4.errs_code
  113. #define errspec4_value errs_u.errs_ipv4.errs_value
  114. #define errspec4_flags errs_u.errs_ipv4.errs_flags
  115. typedef struct {
  116. struct in_addr sess_destaddr; /* DestAddress */
  117. u_char sess_protid; /* Protocol Id */
  118. u_char sess_flags;
  119. #define SESSFLG_E_Police 0x01 /* E_Police: Entry policing flag*/
  120. u_int16_t sess_destport; /* DestPort */
  121. } Session_IPv4;
  122. typedef struct {
  123. Object_header sess_header;
  124. union {
  125. Session_IPv4 sess_ipv4;
  126. /* Session_IPv6 sess_ipv6; */
  127. } sess_u;
  128. } SESSION;
  129. #define sess4_addr sess_u.sess_ipv4.sess_destaddr
  130. #define sess4_port sess_u.sess_ipv4.sess_destport
  131. #define sess4_prot sess_u.sess_ipv4.sess_protid
  132. #define sess4_flgs sess_u.sess_ipv4.sess_flags
  133. #define sess4_orig_port sess_u.sess_ipv4.orig_destport
  134. #define sess4_orig_prot sess_u.sess_ipv4.orig_protid
  135. typedef struct {
  136. struct in_addr hop_ipaddr; /* Next/Previous Hop Address */
  137. u_int32_t hop_LIH; /* Logical Interface Handle */
  138. } Rsvp_Hop_IPv4;
  139. typedef struct {
  140. Object_header hop_header;
  141. union {
  142. Rsvp_Hop_IPv4 hop_ipv4;
  143. /* Rsvp_hop_IPv6 hop_ipv6; */
  144. } hop_u;
  145. } RSVP_HOP;
  146. #define hop4_LIH hop_u.hop_ipv4.hop_LIH
  147. #define hop4_addr hop_u.hop_ipv4.hop_ipaddr
  148. typedef struct {
  149. struct in_addr filt_ipaddr; /* IPv4 SrcAddress */
  150. u_int16_t filt_unused;
  151. u_int16_t filt_port; /* SrcPort */
  152. } Filter_Spec_IPv4;
  153. typedef struct {
  154. struct in_addr filt_ipaddr; /* IPv4 SrcAddress */
  155. u_int32_t filt_gpi; /* Generalized Port Id */
  156. } Filter_Spec_IPv4GPI;
  157. typedef struct {
  158. Object_header filt_header;
  159. union {
  160. Filter_Spec_IPv4 filt_ipv4;
  161. Filter_Spec_IPv4GPI filt_ipv4gpi;
  162. /* Filter_Spec_IPv6 filt_ipv6; */
  163. /* Filter_Spec_IPv6FL filt_ipv6fl; */
  164. /* Filter_Spec_IPv6GPI filt_ipv6gpi; */
  165. } filt_u;
  166. } FILTER_SPEC, SENDER_TEMPLATE;
  167. #define filt_srcaddr filt_u.filt_ipv4.filt_ipaddr
  168. #define filt_srcport filt_u.filt_ipv4.filt_port
  169. #define filt_srcgpiaddr filt_u.filt_ipv4gpi.filt_ipaddr
  170. #define filt_srcgpi filt_u.filt_ipv4gpi.filt_gpi