TianoCore EDK2 master
Loading...
Searching...
No Matches
Udp4Impl.h
Go to the documentation of this file.
1
9#ifndef _UDP4_IMPL_H_
10#define _UDP4_IMPL_H_
11
12#include <Uefi.h>
13
14#include <Protocol/Ip4.h>
15#include <Protocol/Udp4.h>
16
17#include <Library/IpIoLib.h>
18#include <Library/DebugLib.h>
22#include <Library/BaseLib.h>
23#include <Library/UefiLib.h>
26#include <Library/TimerLib.h>
27#include <Library/DpcLib.h>
28#include <Library/PrintLib.h>
29
30#include "Udp4Driver.h"
31
32extern EFI_COMPONENT_NAME_PROTOCOL gUdp4ComponentName;
33extern EFI_COMPONENT_NAME2_PROTOCOL gUdp4ComponentName2;
34extern EFI_UNICODE_STRING_TABLE *gUdpControllerNameTable;
35extern EFI_SERVICE_BINDING_PROTOCOL mUdp4ServiceBinding;
36extern EFI_UDP4_PROTOCOL mUdp4Protocol;
37extern UINT16 mUdp4RandomPort;
38
39#define ICMP_ERROR_PACKET_LENGTH 8
40
41#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
42
43#define UDP4_HEADER_SIZE sizeof (EFI_UDP_HEADER)
44#define UDP4_MAX_DATA_SIZE 65507
45
46#define UDP4_PORT_KNOWN 1024
47
48#define UDP4_SERVICE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', '4')
49
50#define UDP4_SERVICE_DATA_FROM_THIS(a) \
51 CR ( \
52 (a), \
53 UDP4_SERVICE_DATA, \
54 ServiceBinding, \
55 UDP4_SERVICE_DATA_SIGNATURE \
56 )
57
58typedef struct _UDP4_SERVICE_DATA_ {
59 UINT32 Signature;
60 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
61 EFI_HANDLE ImageHandle;
62 EFI_HANDLE ControllerHandle;
63 LIST_ENTRY ChildrenList;
64 UINTN ChildrenNumber;
65 IP_IO *IpIo;
66
67 EFI_EVENT TimeoutEvent;
69
70#define UDP4_INSTANCE_DATA_SIGNATURE SIGNATURE_32('U', 'd', 'p', 'I')
71
72#define UDP4_INSTANCE_DATA_FROM_THIS(a) \
73 CR ( \
74 (a), \
75 UDP4_INSTANCE_DATA, \
76 Udp4Proto, \
77 UDP4_INSTANCE_DATA_SIGNATURE \
78 )
79
80typedef struct _UDP4_INSTANCE_DATA_ {
81 UINT32 Signature;
82 LIST_ENTRY Link;
83
84 UDP4_SERVICE_DATA *Udp4Service;
85 EFI_UDP4_PROTOCOL Udp4Proto;
86 EFI_UDP4_CONFIG_DATA ConfigData;
87 EFI_HANDLE ChildHandle;
88 BOOLEAN Configured;
89 BOOLEAN IsNoMapping;
90
91 NET_MAP TxTokens;
92 NET_MAP RxTokens;
93
94 NET_MAP McastIps;
95
96 LIST_ENTRY RcvdDgramQue;
97 LIST_ENTRY DeliveredDgramQue;
98
99 UINT16 HeadSum;
100
101 EFI_STATUS IcmpError;
102
103 IP_IO_IP_INFO *IpInfo;
104
105 BOOLEAN InDestroy;
107
108typedef struct _UDP4_RXDATA_WRAP_ {
109 LIST_ENTRY Link;
110 NET_BUF *Packet;
111 UINT32 TimeoutTick;
114
115typedef struct {
116 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
117 UINTN NumberOfChildren;
118 EFI_HANDLE *ChildHandleBuffer;
120
142EFIAPI
144 IN EFI_UDP4_PROTOCOL *This,
145 OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL,
146 OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
147 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
148 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
149 );
150
185EFIAPI
187 IN EFI_UDP4_PROTOCOL *This,
188 IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
189 );
190
221EFIAPI
223 IN EFI_UDP4_PROTOCOL *This,
224 IN BOOLEAN JoinFlag,
225 IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
226 );
227
267EFIAPI
269 IN EFI_UDP4_PROTOCOL *This,
270 IN BOOLEAN DeleteRoute,
271 IN EFI_IPv4_ADDRESS *SubnetAddress,
272 IN EFI_IPv4_ADDRESS *SubnetMask,
273 IN EFI_IPv4_ADDRESS *GatewayAddress
274 );
275
307EFIAPI
309 IN EFI_UDP4_PROTOCOL *This,
311 );
312
343EFIAPI
345 IN EFI_UDP4_PROTOCOL *This,
347 );
348
378EFIAPI
380 IN EFI_UDP4_PROTOCOL *This,
381 IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
382 );
383
405EFIAPI
406Udp4Poll (
408 );
409
425 IN OUT UDP4_SERVICE_DATA *Udp4Service,
426 IN EFI_HANDLE ImageHandle,
427 IN EFI_HANDLE ControllerHandle
428 );
429
436VOID
438 IN UDP4_SERVICE_DATA *Udp4Service
439 );
440
448VOID
450 IN UDP4_SERVICE_DATA *Udp4Service,
451 IN OUT UDP4_INSTANCE_DATA *Instance
452 );
453
460VOID
462 IN UDP4_INSTANCE_DATA *Instance
463 );
464
482Udp4Bind (
483 IN LIST_ENTRY *InstanceList,
484 IN OUT EFI_UDP4_CONFIG_DATA *ConfigData
485 );
486
499BOOLEAN
501 IN EFI_UDP4_CONFIG_DATA *OldConfigData,
502 IN EFI_UDP4_CONFIG_DATA *NewConfigData
503 );
504
512VOID
514 IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData,
515 IN OUT EFI_IP4_CONFIG_DATA *Ip4ConfigData
516 );
517
546 IN UDP4_INSTANCE_DATA *Instance,
548 );
549
564EFIAPI
566 IN NET_MAP *Map,
567 IN NET_MAP_ITEM *Item,
568 IN VOID *Context
569 );
570
582UINT16
584 IN NET_BUF *Packet,
585 IN UINT16 HeadSum
586 );
587
600 IN OUT NET_MAP *TokenMap,
602 );
603
618EFIAPI
620 IN OUT NET_MAP *Map,
621 IN NET_MAP_ITEM *Item,
622 IN VOID *Arg OPTIONAL
623 );
624
631VOID
633 IN UDP4_INSTANCE_DATA *Instance
634 );
635
649 IN UDP4_INSTANCE_DATA *Instance,
650 IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
651 );
652
659VOID
661 IN UDP4_INSTANCE_DATA *Instance
662 );
663
670VOID
672 IN UDP4_INSTANCE_DATA *Instance
673 );
674
682VOID
683EFIAPI
685 VOID *Context
686 );
687
688#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS Udp4ValidateTxToken(IN UDP4_INSTANCE_DATA *Instance, IN EFI_UDP4_COMPLETION_TOKEN *TxToken)
Definition: Udp4Impl.c:767
EFI_STATUS Udp4CreateService(IN OUT UDP4_SERVICE_DATA *Udp4Service, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
Definition: Udp4Impl.c:262
EFI_STATUS EFIAPI Udp4Configure(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL)
Definition: Udp4Main.c:123
EFI_STATUS Udp4RemoveToken(IN OUT NET_MAP *TokenMap, IN EFI_UDP4_COMPLETION_TOKEN *Token)
Definition: Udp4Impl.c:948
EFI_STATUS EFIAPI Udp4GetModeData(IN EFI_UDP4_PROTOCOL *This, OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
Definition: Udp4Main.c:44
EFI_STATUS EFIAPI Udp4LeaveGroup(IN OUT NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
Definition: Udp4Impl.c:1069
EFI_STATUS EFIAPI Udp4Routes(IN EFI_UDP4_PROTOCOL *This, IN BOOLEAN DeleteRoute, IN EFI_IPv4_ADDRESS *SubnetAddress, IN EFI_IPv4_ADDRESS *SubnetMask, IN EFI_IPv4_ADDRESS *GatewayAddress)
Definition: Udp4Main.c:421
EFI_STATUS EFIAPI Udp4Groups(IN EFI_UDP4_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL)
Definition: Udp4Main.c:314
BOOLEAN Udp4IsReconfigurable(IN EFI_UDP4_CONFIG_DATA *OldConfigData, IN EFI_UDP4_CONFIG_DATA *NewConfigData)
Definition: Udp4Impl.c:641
VOID Udp4InstanceDeliverDgram(IN UDP4_INSTANCE_DATA *Instance)
Definition: Udp4Impl.c:1483
EFI_STATUS EFIAPI Udp4Transmit(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token)
Definition: Udp4Main.c:486
EFI_STATUS EFIAPI Udp4Poll(IN EFI_UDP4_PROTOCOL *This)
Definition: Udp4Main.c:875
EFI_STATUS Udp4Bind(IN LIST_ENTRY *InstanceList, IN OUT EFI_UDP4_CONFIG_DATA *ConfigData)
Definition: Udp4Impl.c:566
VOID Udp4InitInstance(IN UDP4_SERVICE_DATA *Udp4Service, IN OUT UDP4_INSTANCE_DATA *Instance)
Definition: Udp4Impl.c:444
VOID EFIAPI Udp4NetVectorExtFree(VOID *Context)
Definition: Udp4Impl.c:1882
VOID Udp4BuildIp4ConfigData(IN EFI_UDP4_CONFIG_DATA *Udp4ConfigData, IN OUT EFI_IP4_CONFIG_DATA *Ip4ConfigData)
Definition: Udp4Impl.c:720
EFI_STATUS Udp4InstanceCancelToken(IN UDP4_INSTANCE_DATA *Instance, IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Udp4Impl.c:1201
UINT16 Udp4Checksum(IN NET_BUF *Packet, IN UINT16 HeadSum)
Definition: Udp4Impl.c:922
EFI_STATUS EFIAPI Udp4TokenExist(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
Definition: Udp4Impl.c:887
EFI_STATUS EFIAPI Udp4Cancel(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL)
Definition: Udp4Main.c:813
VOID Udp4ReportIcmpError(IN UDP4_INSTANCE_DATA *Instance)
Definition: Udp4Impl.c:1839
VOID Udp4FlushRcvdDgram(IN UDP4_INSTANCE_DATA *Instance)
Definition: Udp4Impl.c:1170
EFI_STATUS EFIAPI Udp4Receive(IN EFI_UDP4_PROTOCOL *This, IN EFI_UDP4_COMPLETION_TOKEN *Token)
Definition: Udp4Main.c:714
VOID Udp4CleanService(IN UDP4_SERVICE_DATA *Udp4Service)
Definition: Udp4Impl.c:355
VOID Udp4CleanInstance(IN UDP4_INSTANCE_DATA *Instance)
Definition: Udp4Impl.c:486
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33