[Change summary]:

1. Update NetLib to a combined NetLib support dual network stack:
1) Add Network Debug facility for IPv4 stack.
2) Extend the library APIs to support IPv6 stack:
   a. NetIp6IsUnspecifiedAddr
   b. NetIp6IsLinkLocalAddr   
   c. NetIp6IsNetEqual
   d. NetLibCreateIPv6DPathNode.
   e. NetIp6PseudoHeadChecksum
   f. NetIp6IsValidUnicast
3) Update the structure definitions:
   a. Update NET_BUF to add EFI_IP6_HEADER and EFI_UDP_HEADER
   b. Add NET_IP6_PSEUDO_HDR
4) Update Ip4IsUnicast to NetIp4IsUnicast

2. Update the impacted modules to adopt the combined NetLib.

3. Clean up coding style errors in all network drivers and libraries.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9391 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
tye
2009-11-04 08:18:34 +00:00
parent 7be273b7f5
commit f6b7393ceb
54 changed files with 1603 additions and 809 deletions

View File

@@ -1,7 +1,7 @@
/** @file
To validate, parse and process the DHCP options.
Copyright (c) 2006, Intel Corporation.<BR>
Copyright (c) 2006 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -18,136 +18,133 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
///
/// DHCP option tags (types)
///
typedef enum {
//
// RFC1497 vendor extensions
//
DHCP_TAG_PAD = 0, // Pad Option
DHCP_TAG_EOP = 255, // End Option
DHCP_TAG_NETMASK = 1, // Subnet Mask
DHCP_TAG_TIME_OFFSET = 2, // Time Offset from UTC
DHCP_TAG_ROUTER = 3, // Router option,
DHCP_TAG_TIME_SERVER = 4, // Time Server
DHCP_TAG_NAME_SERVER = 5, // Name Server
DHCP_TAG_DNS_SERVER = 6, // Domain Name Server
DHCP_TAG_LOG_SERVER = 7, // Log Server
DHCP_TAG_COOKIE_SERVER = 8, // Cookie Server
DHCP_TAG_LPR_SERVER = 9, // LPR Print Server
DHCP_TAG_IMPRESS_SERVER = 10, // Impress Server
DHCP_TAG_RL_SERVER = 11, // Resource Location Server
DHCP_TAG_HOSTNAME = 12, // Host Name
DHCP_TAG_BOOTFILE_LEN = 13, // Boot File Size
DHCP_TAG_DUMP = 14, // Merit Dump File
DHCP_TAG_DOMAINNAME = 15, // Domain Name
DHCP_TAG_SWAP_SERVER = 16, // Swap Server
DHCP_TAG_ROOTPATH = 17, // Root path
DHCP_TAG_EXTEND_PATH = 18, // Extensions Path
//
// IP Layer Parameters per Host
//
DHCP_TAG_IPFORWARD = 19, // IP Forwarding Enable/Disable
DHCP_TAG_NONLOCAL_SRR = 20, // on-Local Source Routing Enable/Disable
DHCP_TAG_POLICY_SRR = 21, // Policy Filter
DHCP_TAG_EMTU = 22, // Maximum Datagram Reassembly Size
DHCP_TAG_TTL = 23, // Default IP Time-to-live
DHCP_TAG_PATHMTU_AGE = 24, // Path MTU Aging Timeout
DHCP_TAG_PATHMTU_PLATEAU = 25, // Path MTU Plateau Table
//
// RFC1497 vendor extensions
//
#define DHCP_TAG_PAD 0 // Pad Option
#define DHCP_TAG_EOP 255 // End Option
#define DHCP_TAG_NETMASK 1 // Subnet Mask
#define DHCP_TAG_TIME_OFFSET 2 // Time Offset from UTC
#define DHCP_TAG_ROUTER 3 // Router option,
#define DHCP_TAG_TIME_SERVER 4 // Time Server
#define DHCP_TAG_NAME_SERVER 5 // Name Server
#define DHCP_TAG_DNS_SERVER 6 // Domain Name Server
#define DHCP_TAG_LOG_SERVER 7 // Log Server
#define DHCP_TAG_COOKIE_SERVER 8 // Cookie Server
#define DHCP_TAG_LPR_SERVER 9 // LPR Print Server
#define DHCP_TAG_IMPRESS_SERVER 10 // Impress Server
#define DHCP_TAG_RL_SERVER 11 // Resource Location Server
#define DHCP_TAG_HOSTNAME 12 // Host Name
#define DHCP_TAG_BOOTFILE_LEN 13 // Boot File Size
#define DHCP_TAG_DUMP 14 // Merit Dump File
#define DHCP_TAG_DOMAINNAME 15 // Domain Name
#define DHCP_TAG_SWAP_SERVER 16 // Swap Server
#define DHCP_TAG_ROOTPATH 17 // Root path
#define DHCP_TAG_EXTEND_PATH 18 // Extensions Path
//
// IP Layer Parameters per Interface
//
DHCP_TAG_IFMTU = 26, // Interface MTU
DHCP_TAG_SUBNET_LOCAL = 27, // All Subnets are Local
DHCP_TAG_BROADCAST = 28, // Broadcast Address
DHCP_TAG_DISCOVER_MASK = 29, // Perform Mask Discovery
DHCP_TAG_SUPPLY_MASK = 30, // Mask Supplier
DHCP_TAG_DISCOVER_ROUTE = 31, // Perform Router Discovery
DHCP_TAG_ROUTER_SOLICIT = 32, // Router Solicitation Address
DHCP_TAG_STATIC_ROUTE = 33, // Static Route
//
// IP Layer Parameters per Host
//
#define DHCP_TAG_IPFORWARD 19 // IP Forwarding Enable/Disable
#define DHCP_TAG_NONLOCAL_SRR 20 // on-Local Source Routing Enable/Disable
#define DHCP_TAG_POLICY_SRR 21 // Policy Filter
#define DHCP_TAG_EMTU 22 // Maximum Datagram Reassembly Size
#define DHCP_TAG_TTL 23 // Default IP Time-to-live
#define DHCP_TAG_PATHMTU_AGE 24 // Path MTU Aging Timeout
#define DHCP_TAG_PATHMTU_PLATEAU 25 // Path MTU Plateau Table
//
// Link Layer Parameters per Interface
//
DHCP_TAG_TRAILER = 34, // Trailer Encapsulation
DHCP_TAG_ARPAGE = 35, // ARP Cache Timeout
DHCP_TAG_ETHER_ENCAP = 36, // Ethernet Encapsulation
//
// IP Layer Parameters per Interface
//
#define DHCP_TAG_IFMTU 26 // Interface MTU
#define DHCP_TAG_SUBNET_LOCAL 27 // All Subnets are Local
#define DHCP_TAG_BROADCAST 28 // Broadcast Address
#define DHCP_TAG_DISCOVER_MASK 29 // Perform Mask Discovery
#define DHCP_TAG_SUPPLY_MASK 30 // Mask Supplier
#define DHCP_TAG_DISCOVER_ROUTE 31 // Perform Router Discovery
#define DHCP_TAG_ROUTER_SOLICIT 32 // Router Solicitation Address
#define DHCP_TAG_STATIC_ROUTE 33 // Static Route
//
// TCP Parameters
//
DHCP_TAG_TCP_TTL = 37, // TCP Default TTL
DHCP_TAG_KEEP_INTERVAL = 38, // TCP Keepalive Interval
DHCP_TAG_KEEP_GARBAGE = 39, // TCP Keepalive Garbage
//
// Link Layer Parameters per Interface
//
#define DHCP_TAG_TRAILER 34 // Trailer Encapsulation
#define DHCP_TAG_ARPAGE 35 // ARP Cache Timeout
#define DHCP_TAG_ETHER_ENCAP 36 // Ethernet Encapsulation
//
// Application and Service Parameters
//
DHCP_TAG_NIS_DOMAIN = 40, // Network Information Service Domain
DHCP_TAG_NIS_SERVER = 41, // Network Information Servers
DHCP_TAG_NTP_SERVER = 42, // Network Time Protocol Servers
DHCP_TAG_VENDOR = 43, // Vendor Specific Information
DHCP_TAG_NBNS = 44, // NetBIOS over TCP/IP Name Server
DHCP_TAG_NBDD = 45, // NetBIOS Datagram Distribution Server
DHCP_TAG_NBTYPE = 46, // NetBIOS over TCP/IP Node Type
DHCP_TAG_NBSCOPE = 47, // NetBIOS over TCP/IP Scope
DHCP_TAG_XFONT = 48, // X Window System Font Server
DHCP_TAG_XDM = 49, // X Window System Display Manager
DHCP_TAG_NISPLUS = 64, // Network Information Service+ Domain
DHCP_TAG_NISPLUS_SERVER = 65, // Network Information Service+ Servers
DHCP_TAG_MOBILEIP = 68, // Mobile IP Home Agent
DHCP_TAG_SMTP = 69, // Simple Mail Transport Protocol Server
DHCP_TAG_POP3 = 70, // Post Office Protocol (POP3) Server
DHCP_TAG_NNTP = 71, // Network News Transport Protocol Server
DHCP_TAG_WWW = 72, // Default World Wide Web (WWW) Server
DHCP_TAG_FINGER = 73, // Default Finger Server
DHCP_TAG_IRC = 74, // Default Internet Relay Chat (IRC) Server
DHCP_TAG_STTALK = 75, // StreetTalk Server
DHCP_TAG_STDA = 76, // StreetTalk Directory Assistance Server
DHCP_TAG_CLASSLESS_ROUTE = 121, // Classless Route
//
// TCP Parameters
//
#define DHCP_TAG_TCP_TTL 37 // TCP Default TTL
#define DHCP_TAG_KEEP_INTERVAL 38 // TCP Keepalive Interval
#define DHCP_TAG_KEEP_GARBAGE 39 // TCP Keepalive Garbage
//
// DHCP Extensions
//
DHCP_TAG_REQUEST_IP = 50, // Requested IP Address
DHCP_TAG_LEASE = 51, // IP Address Lease Time
DHCP_TAG_OVERLOAD = 52, // Option Overload
DHCP_TAG_TFTP = 66, // TFTP server name
DHCP_TAG_BOOTFILE = 67, // Bootfile name
DHCP_TAG_TYPE = 53, // DHCP Message Type
DHCP_TAG_SERVER_ID = 54, // Server Identifier
DHCP_TAG_PARA_LIST = 55, // Parameter Request List
DHCP_TAG_MESSAGE = 56, // Message
DHCP_TAG_MAXMSG = 57, // Maximum DHCP Message Size
DHCP_TAG_T1 = 58, // Renewal (T1) Time Value
DHCP_TAG_T2 = 59, // Rebinding (T2) Time Value
DHCP_TAG_VENDOR_CLASS = 60, // Vendor class identifier
DHCP_TAG_CLIENT_ID = 61 // Client-identifier
} DHCP_TAGS;
//
// Application and Service Parameters
//
#define DHCP_TAG_NIS_DOMAIN 40 // Network Information Service Domain
#define DHCP_TAG_NIS_SERVER 41 // Network Information Servers
#define DHCP_TAG_NTP_SERVER 42 // Network Time Protocol Servers
#define DHCP_TAG_VENDOR 43 // Vendor Specific Information
#define DHCP_TAG_NBNS 44 // NetBIOS over TCP/IP Name Server
#define DHCP_TAG_NBDD 45 // NetBIOS Datagram Distribution Server
#define DHCP_TAG_NBTYPE 46 // NetBIOS over TCP/IP Node Type
#define DHCP_TAG_NBSCOPE 47 // NetBIOS over TCP/IP Scope
#define DHCP_TAG_XFONT 48 // X Window System Font Server
#define DHCP_TAG_XDM 49 // X Window System Display Manager
#define DHCP_TAG_NISPLUS 64 // Network Information Service+ Domain
#define DHCP_TAG_NISPLUS_SERVER 65 // Network Information Service+ Servers
#define DHCP_TAG_MOBILEIP 68 // Mobile IP Home Agent
#define DHCP_TAG_SMTP 69 // Simple Mail Transport Protocol Server
#define DHCP_TAG_POP3 70 // Post Office Protocol (POP3) Server
#define DHCP_TAG_NNTP 71 // Network News Transport Protocol Server
#define DHCP_TAG_WWW 72 // Default World Wide Web (WWW) Server
#define DHCP_TAG_FINGER 73 // Default Finger Server
#define DHCP_TAG_IRC 74 // Default Internet Relay Chat (IRC) Server
#define DHCP_TAG_STTALK 75 // StreetTalk Server
#define DHCP_TAG_STDA 76 // StreetTalk Directory Assistance Server
#define DHCP_TAG_CLASSLESS_ROUTE 121 // Classless Route
#define DHCP_OPTION_MAGIC 0x63538263 // Network byte order
#define DHCP_MAX_OPTIONS 256
//
// DHCP Extensions
//
#define DHCP_TAG_REQUEST_IP 50 // Requested IP Address
#define DHCP_TAG_LEASE 51 // IP Address Lease Time
#define DHCP_TAG_OVERLOAD 52 // Option Overload
#define DHCP_TAG_TFTP 66 // TFTP server name
#define DHCP_TAG_BOOTFILE 67 // Bootfile name
#define DHCP_TAG_TYPE 53 // DHCP Message Type
#define DHCP_TAG_SERVER_ID 54 // Server Identifier
#define DHCP_TAG_PARA_LIST 55 // Parameter Request List
#define DHCP_TAG_MESSAGE 56 // Message
#define DHCP_TAG_MAXMSG 57 // Maximum DHCP Message Size
#define DHCP_TAG_T1 58 // Renewal (T1) Time Value
#define DHCP_TAG_T2 59 // Rebinding (T2) Time Value
#define DHCP_TAG_VENDOR_CLASS 60 // Vendor class identifier
#define DHCP_TAG_CLIENT_ID 61 // Client-identifier
typedef enum {
//
// DHCP option types, this is used to validate the DHCP options.
//
DHCP_OPTION_SWITCH = 1,
DHCP_OPTION_INT8,
DHCP_OPTION_INT16,
DHCP_OPTION_INT32,
DHCP_OPTION_IP,
DHCP_OPTION_IPPAIR
} DHCP_OPTION_TYPE;
typedef enum {
//
// Value of DHCP overload option
//
DHCP_OVERLOAD_FILENAME = 1,
DHCP_OVERLOAD_SVRNAME = 2,
DHCP_OVERLOAD_BOTH = 3
} DHCP_OVERLOAD_TYPE;
#define DHCP_OPTION_MAGIC 0x63538263 // Network byte order
#define DHCP_MAX_OPTIONS 256
//
// DHCP option types, this is used to validate the DHCP options.
//
#define DHCP_OPTION_SWITCH 1
#define DHCP_OPTION_INT8 2
#define DHCP_OPTION_INT16 3
#define DHCP_OPTION_INT32 4
#define DHCP_OPTION_IP 5
#define DHCP_OPTION_IPPAIR 6
//
// Value of DHCP overload option
//
#define DHCP_OVERLOAD_FILENAME 1
#define DHCP_OVERLOAD_SVRNAME 2
#define DHCP_OVERLOAD_BOTH 3
///
/// The DHCP option structure. This structure extends the EFI_DHCP_OPTION