Commit 392a59d8 authored by Pekka Pessi's avatar Pekka Pessi

Removed ancient win32/ntv6 directory

darcs-hash:20051101103643-65a35-6ce45eb9175ab7a764c96fdfa3dbbc03625fd85b.gz
parent d5a61d71
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// Copyright (c) 1985-2000 Microsoft Corporation
//
// This file is part of the Microsoft Research IPv6 Network Protocol Stack.
// You should have received a copy of the Microsoft End-User License Agreement
// for this software along with this release; see the file "license.txt".
// If not, please see http://www.research.microsoft.com/msripv6/license.htm,
// or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
//
// Abstract:
//
// Definitions derived from the IPv6 specifications.
//
#ifndef ICMP6_INCLUDED
#define ICMP6_INCLUDED 1
//
// ICMPv6 Header.
// The actual message body follows this header and is type-specific.
//
typedef struct ICMPv6Header {
uchar Type; // Type of message (high bit zero for error messages).
uchar Code; // Type-specific differentiater.
ushort Checksum; // Calculated over ICMPv6 message and IPv6 psuedo-header.
} ICMPv6Header;
//
// ICMPv6 Type field definitions.
//
#define ICMPv6_DESTINATION_UNREACHABLE 1
#define ICMPv6_PACKET_TOO_BIG 2
#define ICMPv6_TIME_EXCEEDED 3
#define ICMPv6_PARAMETER_PROBLEM 4
#define ICMPv6_ECHO_REQUEST 128
#define ICMPv6_ECHO_REPLY 129
#define ICMPv6_MULTICAST_LISTENER_QUERY 130
#define ICMPv6_MULTICAST_LISTENER_REPORT 131
#define ICMPv6_MULTICAST_LISTENER_DONE 132
#define ICMPv6_ROUTER_SOLICIT 133
#define ICMPv6_ROUTER_ADVERT 134
#define ICMPv6_NEIGHBOR_SOLICIT 135
#define ICMPv6_NEIGHBOR_ADVERT 136
#define ICMPv6_REDIRECT 137
#define ICMPv6_ROUTER_RENUMBERING 138
#define ICMPv6_INFORMATION_TYPE(type) ((type) & 0x80)
#define ICMPv6_ERROR_TYPE(type) (((type) & 0x80) == 0)
// Max amount of packet data in an ICMP error message.
#define ICMPv6_ERROR_MAX_DATA_LEN \
(IPv6_MINIMUM_MTU - sizeof(IPv6Header) - \
sizeof(ICMPv6Header) - sizeof(uint))
//
// ICMPv6 Code field definitions.
//
// For Destination Unreachable errors:
#define ICMPv6_NO_ROUTE_TO_DESTINATION 0
#define ICMPv6_COMMUNICATION_PROHIBITED 1
// was ICMPv6_NOT_NEIGHBOR 2
#define ICMPv6_SCOPE_MISMATCH 2
#define ICMPv6_ADDRESS_UNREACHABLE 3
#define ICMPv6_PORT_UNREACHABLE 4
// For Time Exceeded errors:
#define ICMPv6_HOP_LIMIT_EXCEEDED 0
#define ICMPv6_REASSEMBLY_TIME_EXCEEDED 1
// For Parameter Problem errors:
#define ICMPv6_ERRONEOUS_HEADER_FIELD 0
#define ICMPv6_UNRECOGNIZED_NEXT_HEADER 1
#define ICMPv6_UNRECOGNIZED_OPTION 2
//
// Neighbor Discovery message option definitions.
//
#define ND_OPTION_SOURCE_LINK_LAYER_ADDRESS 1
#define ND_OPTION_TARGET_LINK_LAYER_ADDRESS 2
#define ND_OPTION_PREFIX_INFORMATION 3
#define ND_OPTION_REDIRECTED_HEADER 4
#define ND_OPTION_MTU 5
#define ND_NBMA_SHORTCUT_LIMIT 6 // Related to IPv6-NBMA.
#define ND_ADVERTISEMENT_INTERVAL 7 // For IPv6 Mobility.
#define ND_HOME_AGENT_INFO 8 // For IPv6 Mobility.
//
// Neighbor Advertisement message flags.
//
#define ND_NA_FLAG_ROUTER 0x80000000
#define ND_NA_FLAG_SOLICITED 0x40000000
#define ND_NA_FLAG_OVERRIDE 0x20000000
typedef struct NDRouterAdvertisement {
uchar CurHopLimit;
uchar M_O_Reserved; // Managed:1|Other:1|Reserved:6
ushort RouterLifetime;
uint ReachableTime;
uint RetransTimer;
} NDRouterAdvertisement;
//
// Router Advertisement message flags.
//
#define ND_RA_FLAG_MANAGED 0x80
#define ND_RA_FLAG_OTHER 0x40
typedef struct NDOptionMTU {
uchar Type;
uchar Length;
ushort Reserved;
uint MTU;
} NDOptionMTU;
typedef struct NDOptionPrefixInformation {
uchar Type;
uchar Length;
uchar PrefixLength;
uchar Flags;
uint ValidLifetime;
uint PreferredLifetime;
union { // Preserve compatibility with the pre-SitePrefixLength version.
uint Reserved2;
struct {
uchar Reserved3[3];
uchar SitePrefixLength;
};
};
IPv6Addr Prefix;
} NDOptionPrefixInformation;
//
// Prefix Information option flags.
//
#define ND_PREFIX_FLAG_ON_LINK 0x80
#define ND_PREFIX_FLAG_AUTONOMOUS 0x40
#define ND_PREFIX_FLAG_ROUTER_ADDRESS 0x20
#define ND_PREFIX_FLAG_SITE_PREFIX 0x10
#define ND_PREFIX_FLAG_ROUTE 0x01
//
// MLD message struct - this immediately follows the ICMPv6 header.
//
#include <packon.h>
typedef struct MLDMessage {
ushort MaxResponseDelay;
ushort Unused;
IPv6Addr GroupAddr;
} MLDMessage;
#include <packoff.h>
//
// Router Renumbering code values.
//
#define RR_COMMAND 0
#define RR_RESULT 1
#define RR_SEQUENCE_NO_RESET 255
#endif // ICMP6_INCLUDED
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// Copyright (c) 1985-2000 Microsoft Corporation
//
// This file is part of the Microsoft Research IPv6 Network Protocol Stack.
// You should have received a copy of the Microsoft End-User License Agreement
// for this software along with this release; see the file "license.txt".
// If not, please see http://www.research.microsoft.com/msripv6/license.htm,
// or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
//
// Abstract:
//
// Definitions derived from the IPv6 protocol specifications.
//
#ifndef IP6_INCLUDED
#define IP6_INCLUDED 1
#include <ip6addr.h>
//
// IPv6 Header Format.
// See RFC 1883, page 5 (and subsequent draft updates to same).
//
typedef struct IPv6Header {
ulong VersClassFlow; // 4 bits Version, 8 Traffic Class, 20 Flow Label.
ushort PayloadLength; // Zero indicates Jumbo Payload hop-by-hop option.
uchar NextHeader; // Values are superset of IPv4's Protocol field.
uchar HopLimit;
struct in6_addr Source;
struct in6_addr Dest;
} IPv6Header;
//
// Maximum value for the PayloadLength field.
// Note that the 40-byte IPv6 header is NOT included.
//
#define MAX_IPv6_PAYLOAD 65535
//
// Minimum size of an IPv6 link's MTU.
// Note that the 40-byte IPv6 header IS included,
// but any link-layer header is not.
//
#define IPv6_MINIMUM_MTU 1280
//
// Useful constants for working with various fields in the IPv6 header.
//
// NOTE: We keep the Version, Traffic Class and Flow Label fields as a single
// NOTE: 32 bit value (VersClassFlow) in network byte order (big-endian).
// NOTE: Since NT is little-endian, this means all loads/stores to/from this
// NOTE: field need to be byte swapped.
//
#define IP_VER_MASK 0x000000F0 // Version is high 4 bits of VersClassFlow.
#define IP_VERSION 0x00000060 // This is 6 << 28 (after byte swap).
#define IP_TRAFFIC_CLASS_MASK 0x0000F00F // 0x0FF00000 (after byte swap).
#define MAX_IP_PROTOCOL 255
//
// Protocol (i.e. "Next Header" field) values for included protocols.
//
#define IP_PROTOCOL_HOP_BY_HOP 0 // IPv6 Hop-by-Hop Options Header.
#define IP_PROTOCOL_V6 41 // IPv6 Header.
#define IP_PROTOCOL_ROUTING 43 // IPv6 Routing Header.
#define IP_PROTOCOL_FRAGMENT 44 // IPv6 Fragment Header.
#define IP_PROTOCOL_ESP 50 // IPSec Encapsulating Security Payload Hdr.
#define IP_PROTOCOL_AH 51 // IPSec Authentication Hdr.
#define IP_PROTOCOL_ICMPv6 58 // IPv6 Internet Control Message Protocol.
#define IP_PROTOCOL_NONE 59 // No next header - ignore packet remainder.
#define IP_PROTOCOL_DEST_OPTS 60 // IPv6 Destination Options Header.
__inline int
IsExtensionHeader(uchar Prot)
{
if ((Prot == IP_PROTOCOL_HOP_BY_HOP) || (Prot == IP_PROTOCOL_ROUTING) ||
(Prot == IP_PROTOCOL_FRAGMENT) || (Prot == IP_PROTOCOL_DEST_OPTS) ||
(Prot == IP_PROTOCOL_ESP) || (Prot == IP_PROTOCOL_AH))
return TRUE;
return FALSE;
}
//
// IPv6 type-length-value (TLV) encoded option types found in some
// extension headers. The upper two bits of each type are encoded
// so as to specify what action the node should take if it doesn't
// grok the option type. The third-highest-order bit specifies if
// the option data can change en-route to the final destination.
// See RFC 1883, section 4.2 (pages 9-10) for more information.
//
#define IPv6_OPT_ACTION_MASK 0xc0 // High two bits.
#define IPv6_OPT_DYNDATA_MASK 0x20 // Third-highest bit.
//
// Hop-by-Hop and Destination Options Headers.
// We use a single structure for both.
//
typedef struct IPv6OptionsHeader {
uchar NextHeader;
uchar HeaderExtLength; // In 8-byte units, not counting first 8.
} IPv6OptionsHeader;
//
// Routing Header.
//
typedef struct IPv6RoutingHeader {
uchar NextHeader;
uchar HeaderExtLength; // In 8-byte units, not counting first 8.
uchar RoutingType;
uchar SegmentsLeft; // Number of nodes still left to be visited.
uint Reserved;
} IPv6RoutingHeader;
//
// Fragment Header.
//
typedef struct FragmentHeader {
uchar NextHeader;
uchar Reserved;
ushort OffsetFlag; // Offset is upper 13 bits, flag is lowest bit.
ulong Id;
} FragmentHeader;
#define FRAGMENT_OFFSET_MASK 0xfff8
#define FRAGMENT_FLAG_MASK 0x0001
//
// Generic Extension Header.
//
typedef struct ExtensionHeader {
uchar NextHeader;
uchar HeaderExtLength; // In 8-byte units, not counting first 8.
} ExtensionHeader;
#define EXT_LEN_UNIT 8 // 8-byte units used for extension hdr length.
//
// Generic Options Header.
//
typedef struct OptionHeader {
uchar Type;
uchar DataLength; // In bytes, not counting two for the header.
} OptionHeader;
//
// Format of the router alert within the Hop-by-Hop Option header.
//
typedef struct IPv6RouterAlertOption {
uchar Type;
uchar Length;
ushort Value;
} IPv6RouterAlertOption;
//
// Mobile IPv6 destination option formats.
//
#pragma pack(1)
typedef struct IPv6BindingUpdateOption {
uchar Type;
uchar Length;
uchar Flags; // See mask values below.
uchar PrefixLength; // Only used for "home registration" updates.
ushort SeqNumber;
uint Lifetime; // Number of seconds before binding expires.
struct in6_addr CareOfAddr; // Only present when Flag is set.
} IPv6BindingUpdateOption;
#pragma pack()
// Masks for the Flags field.
#define IPV6_BINDING_ACK 0x80 // Request a binding acknowledgement.
#define IPV6_BINDING_HOME_REG 0x40 // Request host to act as home agent.
#define IPV6_BINDING_CARE_OF_ADDR 0x20 // Includes a care-of address.
#pragma pack(1)
typedef struct IPv6BindingAcknowledgementOption {
uchar Type;
uchar Length;
uchar Status; // Disposition of the mobile node's binding update.
ushort SeqNumber;
uint Lifetime; // Granted lifetime if binding accepted.
uint Refresh; // Interval recommended to send new binging update.
} IPv6BindingAcknowledgementOption;
#pragma pack()
// Disposition status values.
#define IPV6_BINDING_ACCEPTED 0
#define IPV6_BINDING_REJECTED 128 // Rejected for unspecified reason.
#define IPV6_BINDING_POORLY_FORMED 129 // Poorly formed binding update.
#define IPV6_BINDING_PROHIBITED 130 // Administratively prohibited.
#define IPV6_BINDING_NO_RESOURCES 131
#define IPV6_BINDING_HOME_REG_NOT_SUPPORTED 132 // Registration not supported.
#define IPV6_BINDING_NOT_HOME_SUBNET 133
#define IPV6_BINDING_SEQ_NO_TOO_SMALL 134
#define IPV6_BINDING_DYNAMIC_RESPONSE 135 // Dynamic HA discovery response.
#define IPV6_BINDING_BAD_IF_LENGTH 136 // Incorrect interface id length.
#define IPV6_BINDING_NOT_HOME_AGENT 137 // Not the HA for this mobile node.
typedef struct IPv6BindingRequestOption {
uchar Type;
uchar Length;
} IPv6BindingRequstOption;
#pragma pack(1)
typedef struct IPv6HomeAddressOption {
uchar Type;
uchar Length;
struct in6_addr HomeAddress;
} IPv6HomeAddressOption;
#pragma pack()
typedef struct SubOptionHeader {
uchar Type;
uchar DataLength; // In bytes, not counting two for the header.
} SubOptionHeader;
#define SUBOPT6_UNIQUE_ID 1
#define SUBOPT6_HOME_AGENTS_LIST 2
#pragma pack(1)
typedef struct IPv6UniqueIdSubOption {
uchar Type;
uchar Length;
ushort UniqueId;
} IPv6UniqueIdSubOption;
#pragma pack()
#pragma pack(1)
typedef struct IPv6HomeAgentsListSubOption {
uchar Type;
uchar Length;
// The list of home agents follows at this point.
} IPv6HomeAgentsListSubOption;
#pragma pack()
// Option Header Values.
#define OPT6_PAD_1 0 // Single byte pad.
#define OPT6_PAD_N 1 // Multiple byte pad.
#define OPT6_JUMBO_PAYLOAD 194 // Jumbo payload (greater than 64KB).
#define OPT6_TUNNEL_ENCAP_LIMIT 4 // REVIEW: Tentative, waiting for IANA.
#define OPT6_ROUTER_ALERT 5 // REVIEW: Tentative, waiting for IANA.
// Options related to IPv6 Mobility.
// REVIEW: These are all tentative, waiting for IANA approval.
#define OPT6_BINDING_UPDATE 198
#define OPT6_BINDING_ACK 7
#define OPT6_BINDING_REQUEST 8
#define OPT6_HOME_ADDRESS 201
// Options we don't yet care about.
#define OPT6_ENDPOINT_ID 168 // Charles Lynn?
#define OPT6_NSAP_ADDR 195 // RFC 1888.
// REVIEW: The below duplicates the IPv6_OPT_* stuff above.
// REVIEW: The above is nicely commented, but the below is what we use.
// Type of actions to be taken with unrecognized header options.
#define OPT6_ACTION(a) ((a) & 0xc0) // Get action bits.
#define OPT6_A_SKIP 0x00 // Skip and continue.
#define OPT6_A_DISCARD 0x40 // Discard packet.
#define OPT6_A_SEND_ICMP_ALL 0x80 // Send ICMP regardless of source addr.
#define OPT6_A_SEND_ICMP_NON_MULTI 0xc0 // Send ICMP if non-multicast src addr.
// Determining whether and option is mutiple or not.
#define OPT6_MUTABLE 0x20
#define OPT6_ISMUTABLE(t) ((t) & OPT6_MUTABLE)
//
// Authentication Header.
//
// The header conceptually includes a variable amount of Authentication Data
// which follows these fixed-size fields.
//
// Calling this "AHHeader" is redundant, but then again so is "TCP Protocol".
//
typedef struct AHHeader {
uchar NextHeader;
uchar PayloadLen; // In 4-byte units, not counting first 8 bytes.
ushort Reserved; // Padding. Must be zero on transmit.
ulong SPI; // Security Parameters Index.
ulong Seq; // Sequence number for anti-replay algorithms.
} AHHeader;
//
// Encapsulating Security Payload header and trailer.
//
// The header is followed by a variable amount of payload data, followed by
// a variable amount of padding (255 bytes maximum), followed by a byte for
// the Pad Length and a byte for the Next Header field, followed by a
// variable amount of Authentication Data.
//
// The amount of padding should be picked such that the Pad Length and
// Next Header field end up aligned on a 32 bit boundary.
//
typedef struct ESPHeader{
ulong SPI; // Security Parameters Index.
ulong Seq; // Sequence number for anti-replay algorithms.
} ESPHeader;
typedef struct ESPTrailer{
uchar PadLength; // Number of bytes in pad.
uchar NextHeader;
} ESPTrailer;
#endif // IP6_INCLUDED
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// Copyright (c) 1985-2000 Microsoft Corporation
//
// This file is part of the Microsoft Research IPv6 Network Protocol Stack.
// You should have received a copy of the Microsoft End-User License Agreement
// for this software along with this release; see the file "license.txt".
// If not, please see http://www.research.microsoft.com/msripv6/license.htm,
// or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
//
// Abstract:
//
// Defines the IPv6 address structure.
//
#ifndef IP6ADDR_INCLUDED
#define IP6ADDR_INCLUDED 1
//
// Basic types.
// REVIEW: These really belong somewhere else.
//
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned __int64 uint64;
typedef __int64 int64;
//
// An IPv6 address is 128 bits long.
//
struct in6_addr {
union {
uchar Byte[16];
ushort Word[8];
ulong DWord[4];
uint64 QWord[2];
} u;
};
//
// Defines to match RFC 2553.
//
#define _S6_un u
#define _S6_u8 Byte
#define _S6_u32 DWord
#define _S6_u64 QWord
#define s6_addr _S6_un._S6_u8
//
// Defines for our implementation.
//
#define s6_bytes u.Byte
#define s6_words u.Word
#define s6_dwords u.DWord
#define s6_qwords u.QWord
#endif // IP6ADDR_INCLUDED
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil -*- (for GNU Emacs)
//
// Copyright (c) 1985-2000 Microsoft Corporation
//
// This file is part of the Microsoft Research IPv6 Network Protocol Stack.
// You should have received a copy of the Microsoft End-User License Agreement
// for this software along with this release; see the file "license.txt".
// If not, please see http://www.research.microsoft.com/msripv6/license.htm,
// or write to Microsoft Research, One Microsoft Way, Redmond, WA 98052-6399.
//
// Abstract:
//
// Public definitions exported to transport layer and application
// software for Internet Protocol Version 6.
//
// Things we want visible to both user and kernel, yet aren't part of the
// official specifications (i.e. are implementation specific) go here.
//
#ifndef IP6EXP_INCLUDED
#define IP6EXP_INCLUDED 1
#include <ip6addr.h>
//
// Kernel code mostly uses the IPv6Addr typedef
// because it better fits NT naming conventions.
//
typedef struct in6_addr IPv6Addr;
//
// The IP APIs return status codes of this type.
//
typedef unsigned long IP_STATUS;
//
// IP_STATUS codes returned from IP APIs.
//
#define IP_STATUS_BASE 11000
#define IP_SUCCESS 0
#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
#define IP_DEST_NO_ROUTE (IP_STATUS_BASE + 2)
#define IP_DEST_ADDR_UNREACHABLE (IP_STATUS_BASE + 3)
#define IP_DEST_PROHIBITED (IP_STATUS_BASE + 4)
#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
#define IP_HW_ERROR (IP_STATUS_BASE + 8)
#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
#define IP_BAD_REQ (IP_STATUS_BASE + 11)
#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
#define IP_HOP_LIMIT_EXCEEDED (IP_STATUS_BASE + 13)
#define IP_REASSEMBLY_TIME_EXCEEDED (IP_STATUS_BASE + 14)
#define IP_PARAMETER_PROBLEM (IP_STATUS_BASE + 15)
#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
// was IP_DEST_NOT_NEIGHBOR (IP_STATUS_BASE + 19)
#define IP_DEST_UNREACHABLE (IP_STATUS_BASE + 20)
#define IP_TIME_EXCEEDED (IP_STATUS_BASE + 21)
#define IP_BAD_HEADER (IP_STATUS_BASE + 22)
#define IP_UNRECOGNIZED_NEXT_HEADER (IP_STATUS_BASE + 23)
#define IP_ICMP_ERROR (IP_STATUS_BASE + 24)
//
// The next group are status codes passed up on status indications to
// transport layer protocols.
//
#define IP_ADDR_DELETED (IP_STATUS_BASE + 40)
#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 41)
#define IP_MTU_CHANGE (IP_STATUS_BASE + 42)
#define IP_UNLOAD (IP_STATUS_BASE + 43)
#define IP_ADDR_ADDED (IP_STATUS_BASE + 44)
#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
#define MAX_IP_STATUS IP_GENERAL_FAILURE
#define IP_PENDING (IP_STATUS_BASE + 255)
//
// Parameter for AO_OPTION_ADD_MCAST and AO_OPTION_DEL_MCAST
// TDI set-information call and for the IPV6_JOIN/LEAVE_GROUP
// socket options.
//
typedef struct ipv6_mreq {
IPv6Addr ipv6mr_multiaddr; // IPv6 multicast address.
unsigned int ipv6mr_interface; // Interface index.
} IPV6_MREQ;