/** @file\r
Common definition for IP4.\r
- \r
-Copyright (c) 2005 - 2006, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
typedef struct _IP4_PROTOCOL IP4_PROTOCOL;\r
typedef struct _IP4_SERVICE IP4_SERVICE;\r
\r
-\r
-typedef enum {\r
- IP4_ETHER_PROTO = 0x0800,\r
-\r
- IP4_PROTO_ICMP = 0x01,\r
- IP4_PROTO_IGMP = 0x02,\r
-\r
- //\r
- // The packet is received as link level broadcast/multicast/promiscuous.\r
- //\r
- IP4_LINK_BROADCAST = 0x00000001,\r
- IP4_LINK_MULTICAST = 0x00000002,\r
- IP4_LINK_PROMISC = 0x00000004,\r
-\r
- //\r
- // IP4 address cast type classfication. Keep it true that any\r
- // type bigger than or equal to LOCAL_BROADCAST is broadcast.\r
- //\r
- IP4_PROMISCUOUS = 1,\r
- IP4_LOCAL_HOST,\r
- IP4_MULTICAST,\r
- IP4_LOCAL_BROADCAST, // Destination is 255.255.255.255\r
- IP4_SUBNET_BROADCAST,\r
- IP4_NET_BROADCAST,\r
-\r
- //\r
- // IP4 header flags\r
- //\r
- IP4_HEAD_DF_MASK = 0x4000,\r
- IP4_HEAD_MF_MASK = 0x2000,\r
- IP4_HEAD_OFFSET_MASK = 0x1fff\r
-} IP_ENUM_TYPES;\r
+#define IP4_ETHER_PROTO 0x0800\r
+\r
+//\r
+// The packet is received as link level broadcast/multicast/promiscuous.\r
+//\r
+#define IP4_LINK_BROADCAST 0x00000001\r
+#define IP4_LINK_MULTICAST 0x00000002\r
+#define IP4_LINK_PROMISC 0x00000004\r
+\r
+//\r
+// IP4 address cast type classfication. Keep it true that any\r
+// type bigger than or equal to LOCAL_BROADCAST is broadcast.\r
+//\r
+#define IP4_PROMISCUOUS 1\r
+#define IP4_LOCAL_HOST 2\r
+#define IP4_MULTICAST 3\r
+#define IP4_LOCAL_BROADCAST 4 // Destination is 255.255.255.255\r
+#define IP4_SUBNET_BROADCAST 5\r
+#define IP4_NET_BROADCAST 6\r
+\r
+//\r
+// IP4 header flags\r
+//\r
+#define IP4_HEAD_DF_MASK 0x4000\r
+#define IP4_HEAD_MF_MASK 0x2000\r
+#define IP4_HEAD_OFFSET_MASK 0x1fff\r
\r
#define IP4_ALLZERO_ADDRESS 0x00000000u\r
#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu\r
#define IP4_FIRST_FRAGMENT(FragmentField) \\r
((BOOLEAN)(((FragmentField) & IP4_HEAD_OFFSET_MASK) == 0))\r
\r
+#define IP4_DO_NOT_FRAGMENT(FragmentField) \\r
+ ((BOOLEAN)(((FragmentField) & IP4_HEAD_DF_MASK) == IP4_HEAD_DF_MASK))\r
+\r
#define IP4_IS_BROADCAST(CastType) ((CastType) >= IP4_LOCAL_BROADCAST)\r
\r
///\r
IN IP4_HEAD *Head\r
);\r
\r
-/**\r
- Set the Ip4 variable data.\r
- \r
- Save the list of all of the IPv4 addresses and subnet masks that are currently\r
- being used to volatile variable storage.\r
-\r
- @param[in] IpSb Ip4 service binding instance\r
-\r
- @retval EFI_SUCCESS Successfully set variable.\r
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.\r
- @retval other Set variable failed.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4SetVariableData (\r
- IN IP4_SERVICE *IpSb\r
- );\r
\r
/**\r
- Clear the variable and free the resource.\r
+ Validate that Ip/Netmask pair is OK to be used as station\r
+ address. Only continuous netmasks are supported. and check\r
+ that StationAddress is a unicast address on the newtwork.\r
\r
- @param[in] IpSb Ip4 service binding instance\r
+ @param[in] Ip The IP address to validate.\r
+ @param[in] Netmask The netmaks of the IP.\r
+\r
+ @retval TRUE The Ip/Netmask pair is valid.\r
+ @retval FALSE The Ip/Netmask pair is invalid.\r
\r
**/\r
-VOID\r
-Ip4ClearVariableData (\r
- IN IP4_SERVICE *IpSb\r
+BOOLEAN\r
+Ip4StationAddressValid (\r
+ IN IP4_ADDR Ip,\r
+ IN IP4_ADDR Netmask\r
);\r
\r
#endif\r