TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Common.h
Go to the documentation of this file.
1
9#ifndef __EFI_IP4_COMMON_H__
10#define __EFI_IP4_COMMON_H__
11
12typedef struct _IP4_INTERFACE IP4_INTERFACE;
13typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
14typedef struct _IP4_SERVICE IP4_SERVICE;
15
16#define IP4_ETHER_PROTO 0x0800
17
18//
19// The packet is received as link level broadcast/multicast/promiscuous.
20//
21#define IP4_LINK_BROADCAST 0x00000001
22#define IP4_LINK_MULTICAST 0x00000002
23#define IP4_LINK_PROMISC 0x00000004
24
25//
26// IP4 address cast type classification. Keep it true that any
27// type bigger than or equal to LOCAL_BROADCAST is broadcast.
28//
29#define IP4_PROMISCUOUS 1
30#define IP4_LOCAL_HOST 2
31#define IP4_MULTICAST 3
32#define IP4_LOCAL_BROADCAST 4 // Destination is 255.255.255.255
33#define IP4_SUBNET_BROADCAST 5
34#define IP4_NET_BROADCAST 6
35
36//
37// IP4 header flags
38//
39#define IP4_HEAD_DF_MASK 0x4000
40#define IP4_HEAD_MF_MASK 0x2000
41#define IP4_HEAD_OFFSET_MASK 0x1fff
42
43#define IP4_ALLZERO_ADDRESS 0x00000000u
44#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
45#define IP4_ALLSYSTEM_ADDRESS 0xE0000001u
46#define IP4_ALLROUTER_ADDRESS 0xE0000002u
47
51#define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
52 ((UINT16)(((Df) ? IP4_HEAD_DF_MASK : 0) | ((Mf) ? IP4_HEAD_MF_MASK : 0) | (((Offset) >> 3) & IP4_HEAD_OFFSET_MASK)))
53
54#define IP4_LAST_FRAGMENT(FragmentField) \
55 (((FragmentField) & IP4_HEAD_MF_MASK) == 0)
56
57#define IP4_FIRST_FRAGMENT(FragmentField) \
58 ((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))
59
60#define IP4_DO_NOT_FRAGMENT(FragmentField) \
61 ((BOOLEAN)(((FragmentField) & IP4_HEAD_DF_MASK) == IP4_HEAD_DF_MASK))
62
63#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)
64
69#define IP4_US_TO_SEC(Us) (((Us) + 999999) / 1000000)
70
86INTN
88 IN IP4_ADDR IpAddr,
89 IN IP4_INTERFACE *IpIf
90 );
91
108INTN
110 IN IP4_SERVICE *IpSb,
111 IN IP4_ADDR Dst,
112 IN IP4_ADDR Src
113 );
114
126 IN IP4_SERVICE *IpSb,
127 IN IP4_ADDR Ip
128 );
129
141 IN IP4_SERVICE *IpSb,
142 IN IP4_ADDR Ip
143 );
144
157 IN IP4_SERVICE *IpSb,
158 IN IP4_ADDR Ip,
159 IN IP4_ADDR Netmask
160 );
161
179 IN IP4_ADDR Multicast,
181 );
182
193IP4_HEAD *
195 IN IP4_HEAD *Head
196 );
197
210BOOLEAN
212 IN IP4_ADDR Ip,
213 IN IP4_ADDR Netmask
214 );
215
216#endif
INT64 INTN
INTN Ip4GetHostCast(IN IP4_SERVICE *IpSb, IN IP4_ADDR Dst, IN IP4_ADDR Src)
Definition: Ip4Common.c:59
IP4_INTERFACE * Ip4FindInterface(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip)
Definition: Ip4Common.c:124
INTN Ip4GetNetCast(IN IP4_ADDR IpAddr, IN IP4_INTERFACE *IpIf)
Definition: Ip4Common.c:26
IP4_HEAD * Ip4NtohHead(IN IP4_HEAD *Head)
Definition: Ip4Common.c:241
IP4_INTERFACE * Ip4FindStationAddress(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip, IN IP4_ADDR Netmask)
Definition: Ip4Common.c:183
BOOLEAN Ip4StationAddressValid(IN IP4_ADDR Ip, IN IP4_ADDR Netmask)
Definition: Ip4Common.c:267
IP4_INTERFACE * Ip4FindNet(IN IP4_SERVICE *IpSb, IN IP4_ADDR Ip)
Definition: Ip4Common.c:153
EFI_STATUS Ip4GetMulticastMac(IN EFI_MANAGED_NETWORK_PROTOCOL *Mnp, IN IP4_ADDR Multicast, OUT EFI_MAC_ADDRESS *Mac)
Definition: Ip4Common.c:218
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29