efiip.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. #ifndef _EFI_IP_H
  2. #define _EFI_IP_H
  3. /*++
  4. Copyright (c) 2013 Intel Corporation
  5. --*/
  6. #define EFI_IP4_SERVICE_BINDING_PROTOCOL \
  7. {0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}}
  8. #define EFI_IP4_PROTOCOL \
  9. {0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}}
  10. #define EFI_IP6_SERVICE_BINDING_PROTOCOL \
  11. {0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}}
  12. #define EFI_IP6_PROTOCOL \
  13. {0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}}
  14. INTERFACE_DECL(_EFI_IP4);
  15. INTERFACE_DECL(_EFI_IP6);
  16. typedef struct {
  17. EFI_HANDLE InstanceHandle;
  18. EFI_IPv4_ADDRESS Ip4Address;
  19. EFI_IPv4_ADDRESS SubnetMask;
  20. } EFI_IP4_ADDRESS_PAIR;
  21. typedef struct {
  22. EFI_HANDLE DriverHandle;
  23. UINT32 AddressCount;
  24. EFI_IP4_ADDRESS_PAIR AddressPairs[1];
  25. } EFI_IP4_VARIABLE_DATA;
  26. typedef struct {
  27. UINT8 DefaultProtocol;
  28. BOOLEAN AcceptAnyProtocol;
  29. BOOLEAN AcceptIcmpErrors;
  30. BOOLEAN AcceptBroadcast;
  31. BOOLEAN AcceptPromiscuous;
  32. BOOLEAN UseDefaultAddress;
  33. EFI_IPv4_ADDRESS StationAddress;
  34. EFI_IPv4_ADDRESS SubnetMask;
  35. UINT8 TypeOfService;
  36. UINT8 TimeToLive;
  37. BOOLEAN DoNotFragment;
  38. BOOLEAN RawData;
  39. UINT32 ReceiveTimeout;
  40. UINT32 TransmitTimeout;
  41. } EFI_IP4_CONFIG_DATA;
  42. typedef struct {
  43. EFI_IPv4_ADDRESS SubnetAddress;
  44. EFI_IPv4_ADDRESS SubnetMask;
  45. EFI_IPv4_ADDRESS GatewayAddress;
  46. } EFI_IP4_ROUTE_TABLE;
  47. typedef struct {
  48. UINT8 Type;
  49. UINT8 Code;
  50. } EFI_IP4_ICMP_TYPE;
  51. typedef struct {
  52. BOOLEAN IsStarted;
  53. UINT32 MaxPacketSize;
  54. EFI_IP4_CONFIG_DATA ConfigData;
  55. BOOLEAN IsConfigured;
  56. UINT32 GroupCount;
  57. EFI_IPv4_ADDRESS *GroupTable;
  58. UINT32 RouteCount;
  59. EFI_IP4_ROUTE_TABLE *RouteTable;
  60. UINT32 IcmpTypeCount;
  61. EFI_IP4_ICMP_TYPE *IcmpTypeList;
  62. } EFI_IP4_MODE_DATA;
  63. typedef
  64. EFI_STATUS
  65. (EFIAPI *EFI_IP4_GET_MODE_DATA) (
  66. IN struct _EFI_IP4 *This,
  67. OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
  68. OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
  69. OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
  70. );
  71. typedef
  72. EFI_STATUS
  73. (EFIAPI *EFI_IP4_CONFIGURE) (
  74. IN struct _EFI_IP4 *This,
  75. IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
  76. );
  77. typedef
  78. EFI_STATUS
  79. (EFIAPI *EFI_IP4_GROUPS) (
  80. IN struct _EFI_IP4 *This,
  81. IN BOOLEAN JoinFlag,
  82. IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
  83. );
  84. typedef
  85. EFI_STATUS
  86. (EFIAPI *EFI_IP4_ROUTES) (
  87. IN struct _EFI_IP4 *This,
  88. IN BOOLEAN DeleteRoute,
  89. IN EFI_IPv4_ADDRESS *SubnetAddress,
  90. IN EFI_IPv4_ADDRESS *SubnetMask,
  91. IN EFI_IPv4_ADDRESS *GatewayAddress
  92. );
  93. #pragma pack(1)
  94. typedef struct {
  95. UINT8 HeaderLength:4;
  96. UINT8 Version:4;
  97. UINT8 TypeOfService;
  98. UINT16 TotalLength;
  99. UINT16 Identification;
  100. UINT16 Fragmentation;
  101. UINT8 TimeToLive;
  102. UINT8 Protocol;
  103. UINT16 Checksum;
  104. EFI_IPv4_ADDRESS SourceAddress;
  105. EFI_IPv4_ADDRESS DestinationAddress;
  106. } EFI_IP4_HEADER;
  107. #pragma pack()
  108. typedef struct {
  109. UINT32 FragmentLength;
  110. VOID *FragmentBuffer;
  111. } EFI_IP4_FRAGMENT_DATA;
  112. typedef struct {
  113. EFI_TIME TimeStamp;
  114. EFI_EVENT RecycleSignal;
  115. UINT32 HeaderLength;
  116. EFI_IP4_HEADER *Header;
  117. UINT32 OptionsLength;
  118. VOID *Options;
  119. UINT32 DataLength;
  120. UINT32 FragmentCount;
  121. EFI_IP4_FRAGMENT_DATA FragmentTable[1];
  122. } EFI_IP4_RECEIVE_DATA;
  123. typedef struct {
  124. EFI_IPv4_ADDRESS SourceAddress;
  125. EFI_IPv4_ADDRESS GatewayAddress;
  126. UINT8 Protocol;
  127. UINT8 TypeOfService;
  128. UINT8 TimeToLive;
  129. BOOLEAN DoNotFragment;
  130. } EFI_IP4_OVERRIDE_DATA;
  131. typedef struct {
  132. EFI_IPv4_ADDRESS DestinationAddress;
  133. EFI_IP4_OVERRIDE_DATA *OverrideData;
  134. UINT32 OptionsLength;
  135. VOID *OptionsBuffer;
  136. UINT32 TotalDataLength;
  137. UINT32 FragmentCount;
  138. EFI_IP4_FRAGMENT_DATA FragmentTable[1];
  139. } EFI_IP4_TRANSMIT_DATA;
  140. typedef struct {
  141. EFI_EVENT Event;
  142. EFI_STATUS Status;
  143. union {
  144. EFI_IP4_RECEIVE_DATA *RxData;
  145. EFI_IP4_TRANSMIT_DATA *TxData;
  146. } Packet;
  147. } EFI_IP4_COMPLETION_TOKEN;
  148. typedef
  149. EFI_STATUS
  150. (EFIAPI *EFI_IP4_TRANSMIT) (
  151. IN struct _EFI_IP4 *This,
  152. IN EFI_IP4_COMPLETION_TOKEN *Token
  153. );
  154. typedef
  155. EFI_STATUS
  156. (EFIAPI *EFI_IP4_RECEIVE) (
  157. IN struct _EFI_IP4 *This,
  158. IN EFI_IP4_COMPLETION_TOKEN *Token
  159. );
  160. typedef
  161. EFI_STATUS
  162. (EFIAPI *EFI_IP4_CANCEL)(
  163. IN struct _EFI_IP4 *This,
  164. IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
  165. );
  166. typedef
  167. EFI_STATUS
  168. (EFIAPI *EFI_IP4_POLL) (
  169. IN struct _EFI_IP4 *This
  170. );
  171. typedef struct _EFI_IP4 {
  172. EFI_IP4_GET_MODE_DATA GetModeData;
  173. EFI_IP4_CONFIGURE Configure;
  174. EFI_IP4_GROUPS Groups;
  175. EFI_IP4_ROUTES Routes;
  176. EFI_IP4_TRANSMIT Transmit;
  177. EFI_IP4_RECEIVE Receive;
  178. EFI_IP4_CANCEL Cancel;
  179. EFI_IP4_POLL Poll;
  180. } EFI_IP4;
  181. typedef struct {
  182. UINT8 DefaultProtocol;
  183. BOOLEAN AcceptAnyProtocol;
  184. BOOLEAN AcceptIcmpErrors;
  185. BOOLEAN AcceptPromiscuous;
  186. EFI_IPv6_ADDRESS DestinationAddress;
  187. EFI_IPv6_ADDRESS StationAddress;
  188. UINT8 TrafficClass;
  189. UINT8 HopLimit;
  190. UINT32 FlowLabel;
  191. UINT32 ReceiveTimeout;
  192. UINT32 TransmitTimeout;
  193. } EFI_IP6_CONFIG_DATA;
  194. typedef struct {
  195. EFI_IPv6_ADDRESS Address;
  196. UINT8 PrefixLength;
  197. } EFI_IP6_ADDRESS_INFO;
  198. typedef struct {
  199. EFI_IPv6_ADDRESS Gateway;
  200. EFI_IPv6_ADDRESS Destination;
  201. UINT8 PrefixLength;
  202. } EFI_IP6_ROUTE_TABLE;
  203. typedef enum {
  204. EfiNeighborInComplete,
  205. EfiNeighborReachable,
  206. EfiNeighborStale,
  207. EfiNeighborDelay,
  208. EfiNeighborProbe
  209. } EFI_IP6_NEIGHBOR_STATE;
  210. typedef struct {
  211. EFI_IPv6_ADDRESS Neighbor;
  212. EFI_MAC_ADDRESS LinkAddress;
  213. EFI_IP6_NEIGHBOR_STATE State;
  214. } EFI_IP6_NEIGHBOR_CACHE;
  215. typedef struct {
  216. UINT8 Type;
  217. UINT8 Code;
  218. } EFI_IP6_ICMP_TYPE;
  219. //***********************************************************
  220. // ICMPv6 type definitions for error messages
  221. //***********************************************************
  222. #define ICMP_V6_DEST_UNREACHABLE 0x1
  223. #define ICMP_V6_PACKET_TOO_BIG 0x2
  224. #define ICMP_V6_TIME_EXCEEDED 0x3
  225. #define ICMP_V6_PARAMETER_PROBLEM 0x4
  226. //***********************************************************
  227. // ICMPv6 type definition for informational messages
  228. //***********************************************************
  229. #define ICMP_V6_ECHO_REQUEST 0x80
  230. #define ICMP_V6_ECHO_REPLY 0x81
  231. #define ICMP_V6_LISTENER_QUERY 0x82
  232. #define ICMP_V6_LISTENER_REPORT 0x83
  233. #define ICMP_V6_LISTENER_DONE 0x84
  234. #define ICMP_V6_ROUTER_SOLICIT 0x85
  235. #define ICMP_V6_ROUTER_ADVERTISE 0x86
  236. #define ICMP_V6_NEIGHBOR_SOLICIT 0x87
  237. #define ICMP_V6_NEIGHBOR_ADVERTISE 0x88
  238. #define ICMP_V6_REDIRECT 0x89
  239. #define ICMP_V6_LISTENER_REPORT_2 0x8F
  240. //***********************************************************
  241. // ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE
  242. //***********************************************************
  243. #define ICMP_V6_NO_ROUTE_TO_DEST 0x0
  244. #define ICMP_V6_COMM_PROHIBITED 0x1
  245. #define ICMP_V6_BEYOND_SCOPE 0x2
  246. #define ICMP_V6_ADDR_UNREACHABLE 0x3
  247. #define ICMP_V6_PORT_UNREACHABLE 0x4
  248. #define ICMP_V6_SOURCE_ADDR_FAILED 0x5
  249. #define ICMP_V6_ROUTE_REJECTED 0x6
  250. //***********************************************************
  251. // ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED
  252. //***********************************************************
  253. #define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0
  254. #define ICMP_V6_TIMEOUT_REASSEMBLE 0x1
  255. //***********************************************************
  256. // ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM
  257. //***********************************************************
  258. #define ICMP_V6_ERRONEOUS_HEADER 0x0
  259. #define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1
  260. #define ICMP_V6_UNRECOGNIZE_OPTION 0x2
  261. typedef struct {
  262. BOOLEAN IsStarted;
  263. UINT32 MaxPacketSize;
  264. EFI_IP6_CONFIG_DATA ConfigData;
  265. BOOLEAN IsConfigured;
  266. UINT32 AddressCount;
  267. EFI_IP6_ADDRESS_INFO *AddressList;
  268. UINT32 GroupCount;
  269. EFI_IPv6_ADDRESS *GroupTable;
  270. UINT32 RouteCount;
  271. EFI_IP6_ROUTE_TABLE *RouteTable;
  272. UINT32 NeighborCount;
  273. EFI_IP6_NEIGHBOR_CACHE *NeighborCache;
  274. UINT32 PrefixCount;
  275. EFI_IP6_ADDRESS_INFO *PrefixTable;
  276. UINT32 IcmpTypeCount;
  277. EFI_IP6_ICMP_TYPE *IcmpTypeList;
  278. } EFI_IP6_MODE_DATA;
  279. typedef
  280. EFI_STATUS
  281. (EFIAPI *EFI_IP6_GET_MODE_DATA) (
  282. IN struct _EFI_IP6 *This,
  283. OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL,
  284. OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
  285. OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
  286. );
  287. typedef
  288. EFI_STATUS
  289. (EFIAPI *EFI_IP6_CONFIGURE) (
  290. IN struct _EFI_IP6 *This,
  291. IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL
  292. );
  293. typedef
  294. EFI_STATUS
  295. (EFIAPI *EFI_IP6_GROUPS) (
  296. IN struct _EFI_IP6 *This,
  297. IN BOOLEAN JoinFlag,
  298. IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL
  299. );
  300. typedef
  301. EFI_STATUS
  302. (EFIAPI *EFI_IP6_ROUTES) (
  303. IN struct _EFI_IP6 *This,
  304. IN BOOLEAN DeleteRoute,
  305. IN EFI_IPv6_ADDRESS *Destination OPTIONAL,
  306. IN UINT8 PrefixLength,
  307. IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL
  308. );
  309. typedef
  310. EFI_STATUS
  311. (EFIAPI *EFI_IP6_NEIGHBORS) (
  312. IN struct _EFI_IP6 *This,
  313. IN BOOLEAN DeleteFlag,
  314. IN EFI_IPv6_ADDRESS *TargetIp6Address,
  315. IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL,
  316. IN UINT32 Timeout,
  317. IN BOOLEAN Override
  318. );
  319. typedef struct _EFI_IP6_FRAGMENT_DATA {
  320. UINT32 FragmentLength;
  321. VOID *FragmentBuffer;
  322. } EFI_IP6_FRAGMENT_DATA;
  323. typedef struct _EFI_IP6_OVERRIDE_DATA {
  324. UINT8 Protocol;
  325. UINT8 HopLimit;
  326. UINT32 FlowLabel;
  327. } EFI_IP6_OVERRIDE_DATA;
  328. typedef struct _EFI_IP6_TRANSMIT_DATA {
  329. EFI_IPv6_ADDRESS DestinationAddress;
  330. EFI_IP6_OVERRIDE_DATA *OverrideData;
  331. UINT32 ExtHdrsLength;
  332. VOID *ExtHdrs;
  333. UINT8 NextHeader;
  334. UINT32 DataLength;
  335. UINT32 FragmentCount;
  336. EFI_IP6_FRAGMENT_DATA FragmentTable[1];
  337. } EFI_IP6_TRANSMIT_DATA;
  338. #pragma pack(1)
  339. typedef struct _EFI_IP6_HEADER {
  340. UINT8 TrafficClassH:4;
  341. UINT8 Version:4;
  342. UINT8 FlowLabelH:4;
  343. UINT8 TrafficClassL:4;
  344. UINT16 FlowLabelL;
  345. UINT16 PayloadLength;
  346. UINT8 NextHeader;
  347. UINT8 HopLimit;
  348. EFI_IPv6_ADDRESS SourceAddress;
  349. EFI_IPv6_ADDRESS DestinationAddress;
  350. } EFI_IP6_HEADER;
  351. #pragma pack()
  352. typedef struct _EFI_IP6_RECEIVE_DATA {
  353. EFI_TIME TimeStamp;
  354. EFI_EVENT RecycleSignal;
  355. UINT32 HeaderLength;
  356. EFI_IP6_HEADER *Header;
  357. UINT32 DataLength;
  358. UINT32 FragmentCount;
  359. EFI_IP6_FRAGMENT_DATA FragmentTable[1];
  360. } EFI_IP6_RECEIVE_DATA;
  361. typedef struct {
  362. EFI_EVENT Event;
  363. EFI_STATUS Status;
  364. union {
  365. EFI_IP6_RECEIVE_DATA *RxData;
  366. EFI_IP6_TRANSMIT_DATA *TxData;
  367. } Packet;
  368. } EFI_IP6_COMPLETION_TOKEN;
  369. typedef
  370. EFI_STATUS
  371. (EFIAPI *EFI_IP6_TRANSMIT) (
  372. IN struct _EFI_IP6 *This,
  373. IN EFI_IP6_COMPLETION_TOKEN *Token
  374. );
  375. typedef
  376. EFI_STATUS
  377. (EFIAPI *EFI_IP6_RECEIVE) (
  378. IN struct _EFI_IP6 *This,
  379. IN EFI_IP6_COMPLETION_TOKEN *Token
  380. );
  381. typedef
  382. EFI_STATUS
  383. (EFIAPI *EFI_IP6_CANCEL)(
  384. IN struct _EFI_IP6 *This,
  385. IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL
  386. );
  387. typedef
  388. EFI_STATUS
  389. (EFIAPI *EFI_IP6_POLL) (
  390. IN struct _EFI_IP6 *This
  391. );
  392. typedef struct _EFI_IP6 {
  393. EFI_IP6_GET_MODE_DATA GetModeData;
  394. EFI_IP6_CONFIGURE Configure;
  395. EFI_IP6_GROUPS Groups;
  396. EFI_IP6_ROUTES Routes;
  397. EFI_IP6_NEIGHBORS Neighbors;
  398. EFI_IP6_TRANSMIT Transmit;
  399. EFI_IP6_RECEIVE Receive;
  400. EFI_IP6_CANCEL Cancel;
  401. EFI_IP6_POLL Poll;
  402. } EFI_IP6;
  403. #endif /* _EFI_IP_H */