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.

315 lines
11 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. rfc.h
  5. Abstract:
  6. Structures and constants from the IP/1394 RFC 2734, which can be found at:
  7. http://www.ietf.org/rfc/rfc2734.txt
  8. Revision History:
  9. Who When What
  10. -------- -------- ----
  11. josephj 03-28-99 created, based on draft version 14.
  12. --*/
  13. #pragma pack (push, 1)
  14. // ARP request/response pkt, including the unfragmented encapsulation header.
  15. //
  16. typedef struct _IP1394_ARP_PKT
  17. {
  18. NIC1394_UNFRAGMENTED_HEADER header;
  19. // hardware_type is a constant that identifies IEEE1394. This field must be set
  20. // to IP1394_HARDWARE_TYPE, defined below. This field must be byte-swapped
  21. // before the packet is sent out over the wire.
  22. //
  23. USHORT hardware_type;
  24. #define IP1394_HARDWARE_TYPE 0x0018
  25. // protocol_type is a constant that identifies this ARP packet as being an
  26. // IPV4 ARP packet. This field must be set to IP1394_PROTOCOL_TYPE, defined
  27. // below. This field must be byte-swapped before the packet is sent out over the
  28. // wire.
  29. //
  30. USHORT protocol_type;
  31. #define IP1394_PROTOCOL_TYPE 0x0800
  32. // hw_addr_len is the size (in octets) of the senders hw address, which
  33. // consists of the following:
  34. // sender_unique_ID (8 bytes)
  35. // sender_maxrec (1 byte)
  36. // sspd (1 byte)
  37. // sender_unicast_FIFO_hi (2 bytes)
  38. // sender_unicast_FIFO_lo (4 bytes)
  39. // This field must be set to IP1394_HW_ADDR_LEN, defined below.
  40. //
  41. UCHAR hw_addr_len;
  42. #define IP1394_HW_ADDR_LEN 16
  43. // IP_addr_len is the size of the IP address field. It must be set to
  44. // sizeof (ULONG).
  45. //
  46. UCHAR IP_addr_len;
  47. // opcode should be set to either IP1394_ARP_REQUEST (for ARP request packets)
  48. // or to IP1394_ARP_RESPONSE (for ARP response packets). Both constants are
  49. // defined below. This field must be byte-swapped before the packet is sent out
  50. // over the wire.
  51. //
  52. USHORT opcode;
  53. #define IP1394_ARP_REQUEST 1
  54. #define IP1394_ARP_RESPONSE 2
  55. //
  56. // The following 5 fields constitute the sender's hardware address.
  57. //
  58. // sender_unique_ID is the sender's unique ID, in network byte order.
  59. //
  60. UINT64 sender_unique_ID;
  61. // sender_maxrec is the value of max_rec in the sender's configuration ROM
  62. // bus information block. The following formula converts from max_rec to
  63. // size in bytes (from "FireWire System Architecture", 1st ed, pp 225 (or look
  64. // for max_rec in the index)):
  65. // size = 2^(max_rec+1)
  66. // The minimum value of max_rec is 0x1.
  67. // The maximun value of max_rec is 0xD.
  68. //
  69. // The macros immediately below may be used to convert from max_rec to
  70. // bytes, and to verify that max_rec is within the valid range.
  71. //
  72. UCHAR sender_maxrec;
  73. #define IP1394_MAXREC_TO_SIZE(_max_rec) (2 << ((_max_rec)+1))
  74. #define IP1394_IS_VALID_MAXREC(_max_rec) ((_max_rec)>0 && (_max_rec)<0xE)
  75. // sspd encodes "sender speed", which is the lesser of the sender's link speed
  76. // and the PHY speed. ssped must be set to one of the IP1394_SSPD_* constants,
  77. // defined below.
  78. //
  79. UCHAR sspd;
  80. #define IP1394_SSPD_S100 0
  81. #define IP1394_SSPD_S200 1
  82. #define IP1394_SSPD_S400 2
  83. #define IP1394_SSPD_S800 3
  84. #define IP1394_SSPD_S1600 4
  85. #define IP1394_SSPD_S3200 5
  86. #define IP1394_IS_VALID_SSPD(_sspd) ((_sspd)<=5)
  87. // sender_unicast_FIFO_hi is the high 16-bits of the sender's 48-bit FIFO
  88. // address offset, in network byte order.
  89. //
  90. USHORT sender_unicast_FIFO_hi;
  91. // sender_unicast_FIFO_lo is the low 32-bits of the sender's 48-bit FIFO
  92. // address offset, in network byte order.
  93. //
  94. ULONG sender_unicast_FIFO_lo;
  95. // sender_IP_address is the sender's IP address, in network byte order.
  96. //
  97. ULONG sender_IP_address;
  98. // target_IP_address is the target's IP address, in network byte order.
  99. // This field is ignored if opcode is set to IP1394_ARP_RESPONSE
  100. //
  101. ULONG target_IP_address;
  102. } IP1394_ARP_PKT, *PIP1394_ARP_PKT;
  103. // MCAP group descriptor format (one or more per MCAP packet)
  104. //
  105. typedef struct _IP1394_MCAP_GD
  106. {
  107. // size, in octets, of this descriptor.
  108. //
  109. UCHAR length;
  110. // Type of descriptor. One of the IP1394_MCAP_GD_TYPE_* values below
  111. //
  112. UCHAR type;
  113. #define IP1394_MCAP_GD_TYPE_V1 1 // IP multicast MCAP Ver 1.
  114. // Reserved
  115. //
  116. USHORT reserved;
  117. // Expiration (TTL) in seconds
  118. //
  119. UCHAR expiration;
  120. // Channel number
  121. //
  122. UCHAR channel;
  123. // Speed code.
  124. //
  125. UCHAR speed;
  126. // Reserved
  127. //
  128. UCHAR reserved2;
  129. // Bandwidth (unused)
  130. //
  131. ULONG bandwidth;
  132. // IP multicast group address
  133. // (In theory it could be of arbitrary length, computed by
  134. // looking at the "length" field above. However for our purposes
  135. // (type==1) we expect the group_address size to be 4.
  136. //
  137. ULONG group_address;
  138. } IP1394_MCAP_GD, *PIP1394_MCAP_GD;
  139. // MCAP message format, including the unfragmented encapsulation header.
  140. //
  141. typedef struct _IP1394_MCAP_PKT
  142. {
  143. NIC1394_UNFRAGMENTED_HEADER header;
  144. // size, in octets, of the entire MCAP message (NOT including the
  145. // encapsulation header).
  146. //
  147. USHORT length;
  148. // Reserved
  149. //
  150. UCHAR reserved;
  151. // Opcode -- one of the IP1394_MCAP_OP* values below.
  152. //
  153. UCHAR opcode;
  154. #define IP1394_MCAP_OP_ADVERTISE 0
  155. #define IP1394_MCAP_OP_SOLICIT 1
  156. // zero or more group address descriptors
  157. //
  158. IP1394_MCAP_GD group_descriptors[1];
  159. } IP1394_MCAP_PKT, *PIP1394_MCAP_PKT;
  160. /*
  161. RFC NOTES and COMMENTS
  162. 1. No max channel expiery. Min expiery is 60sec
  163. Extracts from the RFC re MCAP:
  164. speed: This field is valid only for advertise messages, in which
  165. case it SHALL specify the speed at which stream packets for the
  166. indicated channel are transmitted. Table 2 specifies the encoding
  167. used for speed.
  168. A recipient of an MCAP
  169. message SHALL examine the most significant ten bits of source_ID from
  170. the GASP header; if they are not equal to either 0x3FF or the most
  171. significant ten bits of the recipient's NODE_IDS register, the
  172. recipient SHALL IGNORE the message.
  173. Subsequent to sending a solicitation request, the
  174. originator SHALL NOT send another MCAP solicitation request until ten
  175. seconds have elapsed.
  176. If no MCAP advertise message is received for a particular group
  177. address within ten seconds, no multicast source(s) are active for
  178. channel(s) other than the default. Either there is there is no
  179. multicast data or it is being transmitted on the default channel.
  180. Once 100 ms elapses subsequent to the initial
  181. advertisement of a newly allocated channel number , the multicast
  182. source may transmit IP datagrams using the channel number advertised.
  183. Except when a channel owner intends to relinquish ownership (as
  184. described in 9.7 below), the expiration time SHALL be at least 60
  185. seconds in the future measured from the time the advertisement is
  186. transmitted.
  187. No more than ten seconds SHALL elapse from the transmission of its
  188. most recent advertisement before the owner of a channel mapping
  189. initiates transmission of the subsequent advertisement. The owner of
  190. a channel mapping SHOULD transmit an MCAP advertisement in response
  191. to a solicitation as soon as possible after the receipt of the
  192. request.
  193. MCAP advertisements whose
  194. expiration field has a value less than 60 SHALL be ignored for the
  195. purpose of overlapped channel detection.
  196. The channel numbers
  197. advertised by owners with smaller physical IDs are invalid; their
  198. owners SHALL cease transmission of both IP datagrams and MCAP
  199. advertisements that use the invalid channel numbers. As soon as these
  200. channel mappings expire , their owners SHALL deallocate any unused
  201. channel numbers as described in 9.8 below.
  202. If the original owner
  203. observes an MCAP advertisement for the channel to be relinquished
  204. before its own timer has expired, it SHALL NOT deallocate the channel
  205. number.
  206. If the
  207. intended owner of the channel mapping observes an MCAP advertisement
  208. whose expiration field is zero, orderly transfer of the channel(s)
  209. from the former owner has failed.
  210. A channel mapping expires when expiration seconds have elapsed since
  211. the most recent MCAP advertisement. At this time, multicast
  212. recipients SHALL stop reception on the expired channel number(s).
  213. Also at this time, the owner of the channel mapping(s) SHALL transmit
  214. an MCAP advertisement with expiration cleared to zero and SHALL
  215. continue to transmit such advertisements until 30 seconds have
  216. elapsed since the expiration of the channel mapping.
  217. If an IP-capable device observes an MCAP advertisement whose
  218. expiration field is zero, it SHALL NOT attempt to allocate any of the
  219. channel number(s) specified until 30 seconds have elapsed since the
  220. most recent such advertisement.
  221. 9.10 Bus reset
  222. A bus reset SHALL invalidate all multicast channel mappings and SHALL
  223. cause all multicast recipients and senders to zero all MCAP
  224. advertisement interval timers.
  225. Intended or prior recipients or transmitters of multicast on other
  226. than the default channel SHALL NOT transmit MCAP solicitation
  227. requests until at least ten seconds have elapsed since the completion
  228. of the bus reset. Multicast data on other than the default channel
  229. SHALL NOT be received or transmitted until an MCAP advertisement is
  230. observed or transmitted for the IP multicast group address.
  231. Intended or prior transmitters of multicast on other than the default
  232. channel that did not own a channel mapping for the IP multicast group
  233. address prior to the bus reset SHALL NOT attempt to allocate a
  234. channel number from the isochronous resource manager's
  235. CHANNELS_AVAILABLE register until at least ten seconds have elapsed
  236. since the completion of the bus reset.
  237. */
  238. #pragma pack (pop)