Commit 8c832eed authored by Brickner_cp's avatar Brickner_cp

464 warnings left.

parent 3cdc9cdb
...@@ -22,11 +22,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,11 +22,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public abstract class IpV6ExtensionHeaderMobility : IpV6ExtensionHeaderStandard public abstract class IpV6ExtensionHeaderMobility : IpV6ExtensionHeaderStandard
{ {
/// <summary>
/// Identifies the type of this extension header.
/// </summary>
public sealed override IpV4Protocol Protocol public sealed override IpV4Protocol Protocol
{ {
get { return IpV4Protocol.MobilityHeader; } get { return IpV4Protocol.MobilityHeader; }
} }
/// <summary>
/// True iff the extension header parsing didn't encounter an issue.
/// </summary>
public sealed override bool IsValid public sealed override bool IsValid
{ {
get { return MobilityOptions.IsValid; } get { return MobilityOptions.IsValid; }
...@@ -39,21 +45,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -39,21 +45,11 @@ namespace PcapDotNet.Packets.IpV6
public const int MessageData = Checksum + sizeof(ushort); public const int MessageData = Checksum + sizeof(ushort);
} }
/// <summary>
/// The minimum number of bytes this extension header takes.
/// </summary>
public const int MinimumDataLength = DataOffset.MessageData; public const int MinimumDataLength = DataOffset.MessageData;
public IpV6ExtensionHeaderMobility(IpV4Protocol nextHeader, ushort checksum, IpV6MobilityOptions mobilityOptions, int? messageDataMobilityOptionsOffset)
: base(nextHeader)
{
if (messageDataMobilityOptionsOffset.HasValue)
{
int mobilityOptionsExtraBytes = (8 - (messageDataMobilityOptionsOffset.Value + 6) % 8) % 8;
if (mobilityOptions.BytesLength % 8 != mobilityOptionsExtraBytes)
mobilityOptions = mobilityOptions.Pad((8 + mobilityOptionsExtraBytes - (mobilityOptions.BytesLength % 8)) % 8);
}
Checksum = checksum;
MobilityOptions = mobilityOptions;
}
/// <summary> /// <summary>
/// Identifies the particular mobility message in question. /// Identifies the particular mobility message in question.
/// An unrecognized MH Type field causes an error indication to be sent. /// An unrecognized MH Type field causes an error indication to be sent.
...@@ -92,6 +88,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -92,6 +88,19 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public IpV6MobilityOptions MobilityOptions { get; private set; } public IpV6MobilityOptions MobilityOptions { get; private set; }
internal IpV6ExtensionHeaderMobility(IpV4Protocol nextHeader, ushort checksum, IpV6MobilityOptions mobilityOptions, int? messageDataMobilityOptionsOffset)
: base(nextHeader)
{
if (messageDataMobilityOptionsOffset.HasValue)
{
int mobilityOptionsExtraBytes = (8 - (messageDataMobilityOptionsOffset.Value + 6) % 8) % 8;
if (mobilityOptions.BytesLength % 8 != mobilityOptionsExtraBytes)
mobilityOptions = mobilityOptions.Pad((8 + mobilityOptionsExtraBytes - (mobilityOptions.BytesLength % 8)) % 8);
}
Checksum = checksum;
MobilityOptions = mobilityOptions;
}
internal static IpV6ExtensionHeaderMobility ParseData(IpV4Protocol nextHeader, DataSegment data) internal static IpV6ExtensionHeaderMobility ParseData(IpV4Protocol nextHeader, DataSegment data)
{ {
if (data.Length < MinimumDataLength) if (data.Length < MinimumDataLength)
......
...@@ -44,17 +44,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -44,17 +44,6 @@ namespace PcapDotNet.Packets.IpV6
public const int MinimumMessageDataLength = MessageDataOffset.Options; public const int MinimumMessageDataLength = MessageDataOffset.Options;
public IpV6ExtensionHeaderMobilityBindingAcknowledgementBase(IpV4Protocol nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status,
bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime,
IpV6MobilityOptions options)
: base(nextHeader, checksum, options, MessageDataOffset.Options)
{
Status = status;
KeyManagementMobilityCapability = keyManagementMobilityCapability;
SequenceNumber = sequenceNumber;
Lifetime = lifetime;
}
/// <summary> /// <summary>
/// Indicating the disposition of the Binding Update. /// Indicating the disposition of the Binding Update.
/// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node. /// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node.
...@@ -92,6 +81,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -92,6 +81,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public ushort Lifetime { get; private set; } public ushort Lifetime { get; private set; }
internal IpV6ExtensionHeaderMobilityBindingAcknowledgementBase(IpV4Protocol nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status,
bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime,
IpV6MobilityOptions options)
: base(nextHeader, checksum, options, MessageDataOffset.Options)
{
Status = status;
KeyManagementMobilityCapability = keyManagementMobilityCapability;
SequenceNumber = sequenceNumber;
Lifetime = lifetime;
}
internal override int MessageDataLength internal override int MessageDataLength
{ {
get { return MinimumMessageDataLength + MobilityOptions.BytesLength; } get { return MinimumMessageDataLength + MobilityOptions.BytesLength; }
......
...@@ -27,6 +27,38 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -27,6 +27,38 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage : IpV6ExtensionHeaderMobilityBindingRevocationMessage public sealed class IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage : IpV6ExtensionHeaderMobilityBindingRevocationMessage
{ {
/// <summary>
/// Creates an instance from next header, checksum, status, sequence number, proxy binding, IPv4 home address binding only, global and options.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="checksum">
/// Contains the checksum of the Mobility Header.
/// The checksum is calculated from the octet string consisting of a "pseudo-header"
/// followed by the entire Mobility Header starting with the Payload Proto field.
/// The checksum is the 16-bit one's complement of the one's complement sum of this string.
/// </param>
/// <param name="status">
/// Indicating the result of processing the Binding Revocation Indication message by the responder.
/// </param>
/// <param name="sequenceNumber">
/// Copied from the Sequence Number field in the Binding Revocation Indication.
/// It is used by the initiator, e.g., HA, LMA, MAG, in matching this Binding Revocation Acknowledgement
/// with the outstanding Binding Revocation Indication.
/// </param>
/// <param name="proxyBinding">
/// Set if set in the corresponding Binding Revocation Indication message.
/// </param>
/// <param name="ipV4HomeAddressBindingOnly">
/// Set if the it is set in the corresponding Binding Revocation Indication message.
/// </param>
/// <param name="global">
/// Set if it is set in the corresponding Binding Revocation Indication message.
/// </param>
/// <param name="options">
/// Zero or more TLV-encoded mobility options.
/// </param>
public IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage(IpV4Protocol nextHeader, ushort checksum, public IpV6ExtensionHeaderMobilityBindingRevocationAcknowledgementMessage(IpV4Protocol nextHeader, ushort checksum,
Ipv6MobilityBindingRevocationStatus status, ushort sequenceNumber, Ipv6MobilityBindingRevocationStatus status, ushort sequenceNumber,
bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global,
...@@ -39,7 +71,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -39,7 +71,7 @@ namespace PcapDotNet.Packets.IpV6
/// <summary> /// <summary>
/// Defines the type of the Binding Revocation Message. /// Defines the type of the Binding Revocation Message.
/// </summary> /// </summary>
public sealed override IpV6MobilityBindingRevocationType BindingRevocationType public override IpV6MobilityBindingRevocationType BindingRevocationType
{ {
get { return IpV6MobilityBindingRevocationType.BindingRevocationAcknowledgement; } get { return IpV6MobilityBindingRevocationType.BindingRevocationAcknowledgement; }
} }
......
...@@ -27,6 +27,42 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -27,6 +27,42 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage : IpV6ExtensionHeaderMobilityBindingRevocationMessage public sealed class IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage : IpV6ExtensionHeaderMobilityBindingRevocationMessage
{ {
/// <summary>
/// Creates an instance from next header, checksum, revocation trigger, sequence number, proxy binding, IPv4 home address binding only, global
/// and options.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="checksum">
/// Contains the checksum of the Mobility Header.
/// The checksum is calculated from the octet string consisting of a "pseudo-header"
/// followed by the entire Mobility Header starting with the Payload Proto field.
/// The checksum is the 16-bit one's complement of the one's complement sum of this string.
/// </param>
/// <param name="revocationTrigger">
/// Indicating the event that triggered the initiator to send the BRI message.
/// </param>
/// <param name="sequenceNumber">
/// Used by the initiator to match a returned Binding Revocation Acknowledgement with this Binding Revocation Indication.
/// This sequence number could be a random number.
/// At any time, implementations must ensure there is no collision between the sequence numbers of all outstanding Binding Revocation Indication
/// Messages.
/// </param>
/// <param name="proxyBinding">
/// Set by the initiator to indicate that the revoked binding(s) is a PMIPv6 binding.
/// </param>
/// <param name="ipV4HomeAddressBindingOnly">
/// Set by the initiator, home agent, or local mobility anchor to indicate to the receiving mobility entity the termination
/// of the IPv4 Home Address binding only as in Home Agent Operation and Local Mobility Anchor Operation.
/// </param>
/// <param name="global">
/// Set by the initiator, LMA or MAG, to indicate the termination of all Per-Peer mobility Bindings or Multiple Bindings that share
/// a common identifier(s) and are served by the initiator and responder as in Local Mobility Anchor Operation and Mobile Access Gateway Operation.
/// </param>
/// <param name="options">
/// Zero or more TLV-encoded mobility options.
/// </param>
public IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage(IpV4Protocol nextHeader, ushort checksum, public IpV6ExtensionHeaderMobilityBindingRevocationIndicationMessage(IpV4Protocol nextHeader, ushort checksum,
Ipv6MobilityBindingRevocationTrigger revocationTrigger, ushort sequenceNumber, Ipv6MobilityBindingRevocationTrigger revocationTrigger, ushort sequenceNumber,
bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global, bool proxyBinding, bool ipV4HomeAddressBindingOnly, bool global,
......
...@@ -48,16 +48,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -48,16 +48,6 @@ namespace PcapDotNet.Packets.IpV6
public const byte Global = 0x20; public const byte Global = 0x20;
} }
public IpV6ExtensionHeaderMobilityBindingRevocationMessage(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber, bool proxyBinding,
bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options)
: base(nextHeader, checksum, options, MessageDataOffset.Options)
{
SequenceNumber = sequenceNumber;
ProxyBinding = proxyBinding;
IpV4HomeAddressBindingOnly = ipV4HomeAddressBindingOnly;
Global = global;
}
/// <summary> /// <summary>
/// Identifies the particular mobility message in question. /// Identifies the particular mobility message in question.
/// An unrecognized MH Type field causes an error indication to be sent. /// An unrecognized MH Type field causes an error indication to be sent.
...@@ -103,6 +93,16 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -103,6 +93,16 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public bool Global { get; private set; } public bool Global { get; private set; }
internal IpV6ExtensionHeaderMobilityBindingRevocationMessage(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber, bool proxyBinding,
bool ipV4HomeAddressBindingOnly, bool global, IpV6MobilityOptions options)
: base(nextHeader, checksum, options, MessageDataOffset.Options)
{
SequenceNumber = sequenceNumber;
ProxyBinding = proxyBinding;
IpV4HomeAddressBindingOnly = ipV4HomeAddressBindingOnly;
Global = global;
}
internal abstract byte RevocationTriggerOrStatus { get; } internal abstract byte RevocationTriggerOrStatus { get; }
internal override int MessageDataLength internal override int MessageDataLength
......
...@@ -27,6 +27,40 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -27,6 +27,40 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public class IpV6ExtensionHeaderMobilityFastBindingAcknowledgement : IpV6ExtensionHeaderMobilityBindingAcknowledgementBase public class IpV6ExtensionHeaderMobilityFastBindingAcknowledgement : IpV6ExtensionHeaderMobilityBindingAcknowledgementBase
{ {
/// <summary>
/// Creates an instance from next header, checksum, status, key management mobility capability, sequence number, lifetime and options.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="checksum">
/// Contains the checksum of the Mobility Header.
/// The checksum is calculated from the octet string consisting of a "pseudo-header"
/// followed by the entire Mobility Header starting with the Payload Proto field.
/// The checksum is the 16-bit one's complement of the one's complement sum of this string.
/// </param>
/// <param name="status">
/// Indicating the disposition of the Binding Update.
/// Values of the Status field less than 128 indicate that the Binding Update was accepted by the receiving node.
/// Values greater than or equal to 128 indicate that the Binding Update was rejected by the receiving node.
/// </param>
/// <param name="keyManagementMobilityCapability">
/// If this is cleared, the protocol used by the home agent for establishing the IPsec security associations between the mobile node and the home agent
/// does not survive movements.
/// It may then have to be rerun.
/// (Note that the IPsec security associations themselves are expected to survive movements.)
/// </param>
/// <param name="sequenceNumber">
/// Copied from the Sequence Number field in the Binding Update.
/// It is used by the mobile node in matching this Binding Acknowledgement with an outstanding Binding Update.
/// </param>
/// <param name="lifetime">
/// The granted lifetime, in time units of 4 seconds for Binding Acknowledgement and 1 second for Fast Binding Acknowledgement,
/// for which this node should retain the entry for this mobile node in its Binding Cache.
/// </param>
/// <param name="options">
/// Zero or more TLV-encoded mobility options.
/// </param>
public IpV6ExtensionHeaderMobilityFastBindingAcknowledgement(IpV4Protocol nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status, public IpV6ExtensionHeaderMobilityFastBindingAcknowledgement(IpV4Protocol nextHeader, ushort checksum, IpV6BindingAcknowledgementStatus status,
bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime, bool keyManagementMobilityCapability, ushort sequenceNumber, ushort lifetime,
IpV6MobilityOptions options) IpV6MobilityOptions options)
......
...@@ -25,8 +25,51 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,8 +25,51 @@ namespace PcapDotNet.Packets.IpV6
/// +-----+-----------------------------------------------+ /// +-----+-----------------------------------------------+
/// </pre> /// </pre>
/// </summary> /// </summary>
public class IpV6ExtensionHeaderMobilityFastBindingUpdate : IpV6ExtensionHeaderMobilityBindingUpdateBase public sealed class IpV6ExtensionHeaderMobilityFastBindingUpdate : IpV6ExtensionHeaderMobilityBindingUpdateBase
{ {
/// <summary>
/// Creates an instance from next header, checksum, sequence number, acknowledge, home registration, link local address compatilibity,
/// key management mobility capability, lifetime and options.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="checksum">
/// Contains the checksum of the Mobility Header.
/// The checksum is calculated from the octet string consisting of a "pseudo-header"
/// followed by the entire Mobility Header starting with the Payload Proto field.
/// The checksum is the 16-bit one's complement of the one's complement sum of this string.
/// </param>
/// <param name="sequenceNumber">
/// Used by the receiving node to sequence Binding Updates and by the sending node to match a returned Binding Acknowledgement with this Binding Update.
/// </param>
/// <param name="acknowledge">
/// Set by the sending mobile node to request a Binding Acknowledgement be returned upon receipt of the Binding Update.
/// For Fast Binding Update this must be set to one to request that PAR send a Fast Binding Acknowledgement message.
/// </param>
/// <param name="homeRegistration">
/// Set by the sending mobile node to request that the receiving node should act as this node's home agent.
/// The destination of the packet carrying this message must be that of a router sharing the same subnet prefix as the home address
/// of the mobile node in the binding.
/// For Fast Binding Update this must be set to one.
/// </param>
/// <param name="linkLocalAddressCompatibility">
/// Set when the home address reported by the mobile node has the same interface identifier as the mobile node's link-local address.
/// </param>
/// <param name="keyManagementMobilityCapability">
/// If this is cleared, the protocol used for establishing the IPsec security associations between the mobile node and the home agent
/// does not survive movements.
/// It may then have to be rerun. (Note that the IPsec security associations themselves are expected to survive movements.)
/// If manual IPsec configuration is used, the bit must be cleared.
/// </param>
/// <param name="lifetime">
/// The number of time units remaining before the binding must be considered expired.
/// A value of zero indicates that the Binding Cache entry for the mobile node must be deleted.
/// One time unit is 4 seconds for Binding Update and 1 second for Fast Binding Update.
/// </param>
/// <param name="options">
/// Zero or more TLV-encoded mobility options.
/// </param>
public IpV6ExtensionHeaderMobilityFastBindingUpdate(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge, public IpV6ExtensionHeaderMobilityFastBindingUpdate(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber, bool acknowledge,
bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability, bool homeRegistration, bool linkLocalAddressCompatibility, bool keyManagementMobilityCapability,
ushort lifetime, IpV6MobilityOptions options) ushort lifetime, IpV6MobilityOptions options)
......
...@@ -27,6 +27,32 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -27,6 +27,32 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation : IpV6ExtensionHeaderMobilityLocalizedRouting public sealed class IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation : IpV6ExtensionHeaderMobilityLocalizedRouting
{ {
/// <summary>
/// Creates an instance from next header, checksum, sequence number, lifetime and options.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="checksum">
/// Contains the checksum of the Mobility Header.
/// The checksum is calculated from the octet string consisting of a "pseudo-header"
/// followed by the entire Mobility Header starting with the Payload Proto field.
/// The checksum is the 16-bit one's complement of the one's complement sum of this string.
/// </param>
/// <param name="sequenceNumber">
/// In initiation, a monotonically increasing integer. Set by a sending node in a request message, and used to match a reply to the request.
/// In acknowledgement, copied from the sequence number field of the LRI message being responded to.
/// </param>
/// <param name="lifetime">
/// In initiation, the requested time in seconds for which the sender wishes to have local forwarding.
/// A value of 0xffff (all ones) indicates an infinite lifetime.
/// When set to 0, indicates a request to stop localized routing.
/// In acknowledgement, the time in seconds for which the local forwarding is supported.
/// Typically copied from the corresponding field in the LRI message.
/// </param>
/// <param name="options">
/// Zero or more TLV-encoded mobility options.
/// </param>
public IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber, public IpV6ExtensionHeaderMobilityLocalizedRoutingInitiation(IpV4Protocol nextHeader, ushort checksum, ushort sequenceNumber,
ushort lifetime, IpV6MobilityOptions options) ushort lifetime, IpV6MobilityOptions options)
: base(nextHeader, checksum, sequenceNumber, lifetime, options) : base(nextHeader, checksum, sequenceNumber, lifetime, options)
......
...@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public IpV6Options Options { get; private set; } public IpV6Options Options { get; private set; }
/// <summary>
/// True iff the extension header parsing didn't encounter an issue.
/// </summary>
public sealed override bool IsValid public sealed override bool IsValid
{ {
get { return Options.IsValid; } get { return Options.IsValid; }
......
...@@ -25,8 +25,14 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,8 +25,14 @@ namespace PcapDotNet.Packets.IpV6
public const int TypeSpecificData = SegmentsLeft + sizeof(byte); public const int TypeSpecificData = SegmentsLeft + sizeof(byte);
} }
/// <summary>
/// The minimum number of bytes the extension header data takes.
/// </summary>
public const int DataMinimumLength = DataOffset.TypeSpecificData; public const int DataMinimumLength = DataOffset.TypeSpecificData;
/// <summary>
/// True iff the extension header parsing didn't encounter an issue.
/// </summary>
public override bool IsValid public override bool IsValid
{ {
get { return true; } get { return true; }
...@@ -42,6 +48,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -42,6 +48,9 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public byte SegmentsLeft { get; private set; } public byte SegmentsLeft { get; private set; }
/// <summary>
/// Identifies the type of this extension header.
/// </summary>
public override IpV4Protocol Protocol public override IpV4Protocol Protocol
{ {
get { return IpV4Protocol.IpV6Route; } get { return IpV4Protocol.IpV6Route; }
......
...@@ -26,14 +26,32 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,14 +26,32 @@ namespace PcapDotNet.Packets.IpV6
public const int HomeAddress = sizeof(uint); public const int HomeAddress = sizeof(uint);
} }
/// <summary>
/// The number of bytes the routing data takes.
/// </summary>
public const int ConstRoutingDataLength = RoutingDataOffset.HomeAddress + IpV6Address.SizeOf; public const int ConstRoutingDataLength = RoutingDataOffset.HomeAddress + IpV6Address.SizeOf;
/// <summary>
/// Creates an instance from next header, segments left and home address.
/// </summary>
/// <param name="nextHeader">
/// Identifies the type of header immediately following this extension header.
/// </param>
/// <param name="segmentsLeft">
/// Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination.
/// </param>
/// <param name="homeAddress">
/// The home address of the destination mobile node.
/// </param>
public IpV6ExtensionHeaderRoutingHomeAddress(IpV4Protocol nextHeader, byte segmentsLeft, IpV6Address homeAddress) public IpV6ExtensionHeaderRoutingHomeAddress(IpV4Protocol nextHeader, byte segmentsLeft, IpV6Address homeAddress)
: base(nextHeader, segmentsLeft) : base(nextHeader, segmentsLeft)
{ {
HomeAddress = homeAddress; HomeAddress = homeAddress;
} }
/// <summary>
/// Identifier of a particular Routing header variant.
/// </summary>
public override IpV6RoutingType RoutingType public override IpV6RoutingType RoutingType
{ {
get { return IpV6RoutingType.Type2RoutingHeader; } get { return IpV6RoutingType.Type2RoutingHeader; }
......
...@@ -26,6 +26,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,6 +26,9 @@ namespace PcapDotNet.Packets.IpV6
public const int TrafficSelector = TrafficSelectorFormat + sizeof(byte) + sizeof(byte); public const int TrafficSelector = TrafficSelectorFormat + sizeof(byte) + sizeof(byte);
} }
/// <summary>
/// The minimum number of bytes this option data takes.
/// </summary>
public const int OptionDataMinimumLength = Offset.TrafficSelector; public const int OptionDataMinimumLength = Offset.TrafficSelector;
public IpV6FlowIdentificationSubOptionTrafficSelector(IpV6FlowIdentificationTrafficSelectorFormat trafficSelectorFormat, DataSegment trafficSelector) public IpV6FlowIdentificationSubOptionTrafficSelector(IpV6FlowIdentificationTrafficSelectorFormat trafficSelectorFormat, DataSegment trafficSelector)
......
...@@ -24,25 +24,37 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,25 +24,37 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public IpV6MobilityOptionType OptionType { get; private set; } public IpV6MobilityOptionType OptionType { get; private set; }
/// <summary>
/// Returns true iff the given option is an equivalent option.
/// </summary>
public sealed override bool Equals(Option option) public sealed override bool Equals(Option option)
{ {
return Equals(option as IpV6MobilityOption); return Equals(option as IpV6MobilityOption);
} }
/// <summary>
/// Returns true iff the given option is an equivalent option.
/// </summary>
public bool Equals(IpV6MobilityOption other) public bool Equals(IpV6MobilityOption other)
{ {
return other != null && return other != null &&
OptionType == other.OptionType && Length == other.Length && EqualsData(other); OptionType == other.OptionType && Length == other.Length && EqualsData(other);
} }
/// <summary>
/// Returns a hash code for the option.
/// </summary>
public sealed override int GetHashCode() public sealed override int GetHashCode()
{ {
return Sequence.GetHashCode(OptionType, GetDataHashCode()); return Sequence.GetHashCode(OptionType, GetDataHashCode());
} }
/// <summary>
/// True iff parsing of this option didn't encounter issues.
/// </summary>
public virtual bool IsValid { get { return true; } } public virtual bool IsValid { get { return true; } }
protected IpV6MobilityOption(IpV6MobilityOptionType type) internal IpV6MobilityOption(IpV6MobilityOptionType type)
{ {
OptionType = type; OptionType = type;
} }
......
...@@ -22,8 +22,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,8 +22,11 @@ namespace PcapDotNet.Packets.IpV6
/// </pre> /// </pre>
/// </summary> /// </summary>
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.BindingIdentifier)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.BindingIdentifier)]
public class IpV6MobilityOptionBindingIdentifier : IpV6MobilityOptionComplex public sealed class IpV6MobilityOptionBindingIdentifier : IpV6MobilityOptionComplex
{ {
/// <summary>
/// The maximum value for Priority.
/// </summary>
public const byte MaxPriority = 0x7F; public const byte MaxPriority = 0x7F;
private static class Offset private static class Offset
...@@ -35,6 +38,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -35,6 +38,9 @@ namespace PcapDotNet.Packets.IpV6
public const int CareOfAddress = Priority + sizeof(byte); public const int CareOfAddress = Priority + sizeof(byte);
} }
/// <summary>
/// The minimum number of bytes this option data takes.
/// </summary>
public const int OptionDataMinimumLength = Offset.CareOfAddress; public const int OptionDataMinimumLength = Offset.CareOfAddress;
private static class Mask private static class Mask
...@@ -43,18 +49,105 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -43,18 +49,105 @@ namespace PcapDotNet.Packets.IpV6
public const byte Priority = 0x7F; public const byte Priority = 0x7F;
} }
/// <summary>
/// Creates an instance from binding id, status, simulatneous home and foreign binding, priority and IPv4 care of address.
/// </summary>
/// <param name="bindingId">
/// The BID that is assigned to the binding indicated by the care-of address in the Binding Update or the Binding Identifier mobility option.
/// The value of zero is reserved and should not be used.
/// </param>
/// <param name="status">
/// When the Binding Identifier mobility option is included in a Binding Acknowledgement,
/// this field overwrites the Status field in the Binding Acknowledgement only for this BID.
/// If this field is set to zero, the receiver ignores this field and uses the registration status stored in the Binding Acknowledgement message.
/// The receiver must ignore this field if the Binding Identifier mobility option is not carried within either the Binding Acknowledgement
/// or the Care-of Test messages.
/// The possible status codes are the same as the status codes of the Binding Acknowledgement.
/// This Status field is also used to carry error information related to the care-of address test in the Care-of Test message.
/// </param>
/// <param name="simultaneousHomeAndForeignBinding">
/// Indicates that the mobile node registers multiple bindings to the home agent while it is attached to the home link.
/// This flag is valid only for a Binding Update sent to the home agent.
/// </param>
/// <param name="priority">
/// Places each BID to a relative priority (PRI) with other registered BIDs.
/// Value '0' is reserved and must not be used.
/// A lower number in this field indicates a higher priority, while BIDs with the same BID-PRI value have equal priority meaning that,
/// the BID used is an implementation issue.
/// This is consistent with current practice in packet classifiers.
/// </param>
/// <param name="careOfAddress">
/// The IPv4 care-of address for the corresponding BID.
/// </param>
public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding,
byte priority, IpV4Address careOfAddress) byte priority, IpV4Address careOfAddress)
: this(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress, null) : this(bindingId, status, simultaneousHomeAndForeignBinding, priority, careOfAddress, null)
{ {
} }
/// <summary>
/// Creates an instance from binding id, status, simulatneous home and foreign binding, priority and IPv6 care of address.
/// </summary>
/// <param name="bindingId">
/// The BID that is assigned to the binding indicated by the care-of address in the Binding Update or the Binding Identifier mobility option.
/// The value of zero is reserved and should not be used.
/// </param>
/// <param name="status">
/// When the Binding Identifier mobility option is included in a Binding Acknowledgement,
/// this field overwrites the Status field in the Binding Acknowledgement only for this BID.
/// If this field is set to zero, the receiver ignores this field and uses the registration status stored in the Binding Acknowledgement message.
/// The receiver must ignore this field if the Binding Identifier mobility option is not carried within either the Binding Acknowledgement
/// or the Care-of Test messages.
/// The possible status codes are the same as the status codes of the Binding Acknowledgement.
/// This Status field is also used to carry error information related to the care-of address test in the Care-of Test message.
/// </param>
/// <param name="simultaneousHomeAndForeignBinding">
/// Indicates that the mobile node registers multiple bindings to the home agent while it is attached to the home link.
/// This flag is valid only for a Binding Update sent to the home agent.
/// </param>
/// <param name="priority">
/// Places each BID to a relative priority (PRI) with other registered BIDs.
/// Value '0' is reserved and must not be used.
/// A lower number in this field indicates a higher priority, while BIDs with the same BID-PRI value have equal priority meaning that,
/// the BID used is an implementation issue.
/// This is consistent with current practice in packet classifiers.
/// </param>
/// <param name="careOfAddress">
/// The IPv6 care-of address for the corresponding BID.
/// </param>
public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding,
byte priority, IpV6Address careOfAddress) byte priority, IpV6Address careOfAddress)
: this(bindingId, status, simultaneousHomeAndForeignBinding, priority, null, careOfAddress) : this(bindingId, status, simultaneousHomeAndForeignBinding, priority, null, careOfAddress)
{ {
} }
/// <summary>
/// Creates an instance from binding id, status, simulatneous home and foreign binding and priority.
/// </summary>
/// <param name="bindingId">
/// The BID that is assigned to the binding indicated by the care-of address in the Binding Update or the Binding Identifier mobility option.
/// The value of zero is reserved and should not be used.
/// </param>
/// <param name="status">
/// When the Binding Identifier mobility option is included in a Binding Acknowledgement,
/// this field overwrites the Status field in the Binding Acknowledgement only for this BID.
/// If this field is set to zero, the receiver ignores this field and uses the registration status stored in the Binding Acknowledgement message.
/// The receiver must ignore this field if the Binding Identifier mobility option is not carried within either the Binding Acknowledgement
/// or the Care-of Test messages.
/// The possible status codes are the same as the status codes of the Binding Acknowledgement.
/// This Status field is also used to carry error information related to the care-of address test in the Care-of Test message.
/// </param>
/// <param name="simultaneousHomeAndForeignBinding">
/// Indicates that the mobile node registers multiple bindings to the home agent while it is attached to the home link.
/// This flag is valid only for a Binding Update sent to the home agent.
/// </param>
/// <param name="priority">
/// Places each BID to a relative priority (PRI) with other registered BIDs.
/// Value '0' is reserved and must not be used.
/// A lower number in this field indicates a higher priority, while BIDs with the same BID-PRI value have equal priority meaning that,
/// the BID used is an implementation issue.
/// This is consistent with current practice in packet classifiers.
/// </param>
public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding, public IpV6MobilityOptionBindingIdentifier(ushort bindingId, IpV6BindingAcknowledgementStatus status, bool simultaneousHomeAndForeignBinding,
byte priority) byte priority)
: this(bindingId, status, simultaneousHomeAndForeignBinding, priority, null, null) : this(bindingId, status, simultaneousHomeAndForeignBinding, priority, null, null)
......
...@@ -24,16 +24,28 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,16 +24,28 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.ContextRequest)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.ContextRequest)]
public sealed class IpV6MobilityOptionContextRequest : IpV6MobilityOptionComplex public sealed class IpV6MobilityOptionContextRequest : IpV6MobilityOptionComplex
{ {
/// <summary>
/// Creates an instance from an array of requests.
/// </summary>
/// <param name="requests">The requests types and options.</param>
public IpV6MobilityOptionContextRequest(params IpV6MobilityOptionContextRequestEntry[] requests) public IpV6MobilityOptionContextRequest(params IpV6MobilityOptionContextRequestEntry[] requests)
: this(requests.AsReadOnly()) : this(requests.AsReadOnly())
{ {
} }
/// <summary>
/// Creates an instance from a list of requests.
/// </summary>
/// <param name="requests">The requests types and options.</param>
public IpV6MobilityOptionContextRequest(IList<IpV6MobilityOptionContextRequestEntry> requests) public IpV6MobilityOptionContextRequest(IList<IpV6MobilityOptionContextRequestEntry> requests)
: this(requests.AsReadOnly()) : this(requests.AsReadOnly())
{ {
} }
/// <summary>
/// Creates an instance from a collection of requests.
/// </summary>
/// <param name="requests">The requests types and options.</param>
public IpV6MobilityOptionContextRequest(ReadOnlyCollection<IpV6MobilityOptionContextRequestEntry> requests) public IpV6MobilityOptionContextRequest(ReadOnlyCollection<IpV6MobilityOptionContextRequestEntry> requests)
: base(IpV6MobilityOptionType.ContextRequest) : base(IpV6MobilityOptionType.ContextRequest)
{ {
......
...@@ -23,8 +23,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -23,8 +23,19 @@ namespace PcapDotNet.Packets.IpV6
public const int GreKeyIdentifier = sizeof(ushort); public const int GreKeyIdentifier = sizeof(ushort);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.GreKeyIdentifier + sizeof(uint); public const int OptionDataLength = Offset.GreKeyIdentifier + sizeof(uint);
/// <summary>
/// Creates an instance from GRE key identifier.
/// </summary>
/// <param name="greKeyIdentifier">
/// Contains the downlink or the uplink GRE key.
/// This field is present in the GRE Key option only if the GRE keys are being exchanged using the Proxy Binding Update and Proxy Binding
/// Acknowledgement messages.
/// </param>
public IpV6MobilityOptionGreKey(uint greKeyIdentifier) public IpV6MobilityOptionGreKey(uint greKeyIdentifier)
: base(IpV6MobilityOptionType.GreKey) : base(IpV6MobilityOptionType.GreKey)
{ {
......
...@@ -24,6 +24,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,6 +24,11 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.HomeNetworkPrefix)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.HomeNetworkPrefix)]
public sealed class IpV6MobilityOptionHomeNetworkPrefix : IpV6MobilityOptionNetworkPrefix public sealed class IpV6MobilityOptionHomeNetworkPrefix : IpV6MobilityOptionNetworkPrefix
{ {
/// <summary>
/// Creates an instance from prefix length and home network prefix.
/// </summary>
/// <param name="prefixLength">Indicates the prefix length of the IPv6 prefix contained in the option.</param>
/// <param name="homeNetworkPrefix">Contains the Home Network Prefix.</param>
public IpV6MobilityOptionHomeNetworkPrefix(byte prefixLength, IpV6Address homeNetworkPrefix) public IpV6MobilityOptionHomeNetworkPrefix(byte prefixLength, IpV6Address homeNetworkPrefix)
: base(IpV6MobilityOptionType.HomeNetworkPrefix, prefixLength, homeNetworkPrefix) : base(IpV6MobilityOptionType.HomeNetworkPrefix, prefixLength, homeNetworkPrefix)
{ {
......
...@@ -24,6 +24,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,6 +24,9 @@ namespace PcapDotNet.Packets.IpV6
public const int Address = sizeof(ushort); public const int Address = sizeof(ushort);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.Address + IpV4Address.SizeOf; public const int OptionDataLength = Offset.Address + IpV4Address.SizeOf;
internal IpV6MobilityOptionIpV4Address(IpV6MobilityOptionType type, IpV4Address address) internal IpV6MobilityOptionIpV4Address(IpV6MobilityOptionType type, IpV4Address address)
......
...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4AddressAcknowledgement)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4AddressAcknowledgement)]
public sealed class IpV6MobilityOptionIpV4AddressAcknowledgement : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress public sealed class IpV6MobilityOptionIpV4AddressAcknowledgement : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress
{ {
/// <summary>
/// Maximum value for Prefix Length.
/// </summary>
public const byte MaxPrefixLength = 0x3F; public const byte MaxPrefixLength = 0x3F;
private static class Offset private static class Offset
...@@ -41,8 +44,31 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -41,8 +44,31 @@ namespace PcapDotNet.Packets.IpV6
public const int PrefixLength = 2; public const int PrefixLength = 2;
} }
/// <summary>
/// Number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf; public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf;
/// <summary>
/// Creates an instance from status, Prefix Length and Home Address.
/// </summary>
/// <param name="status">
/// Indicates success or failure for the IPv4 home address binding.
/// Values from 0 to 127 indicate success.
/// Higher values indicate failure.
/// </param>
/// <param name="prefixLength">
/// The prefix length of the address allocated.
/// This field is only valid in case of success and must be set to zero and ignored in case of failure.
/// This field overrides what the mobile node requested (if not equal to the requested length).
/// </param>
/// <param name="homeAddress">
/// The IPv4 home address that the home agent will use in the binding cache entry.
/// This could be a public or private address.
/// This field must contain the mobile node's IPv4 home address.
/// If the address were dynamically allocated, the home agent will add the address to inform the mobile node.
/// Otherwise, if the address is statically allocated to the mobile node, the home agent will copy it from the binding update message.
/// </param>
public IpV6MobilityOptionIpV4AddressAcknowledgement(IpV6AddressAcknowledgementStatus status, byte prefixLength, IpV4Address homeAddress) public IpV6MobilityOptionIpV4AddressAcknowledgement(IpV6AddressAcknowledgementStatus status, byte prefixLength, IpV4Address homeAddress)
: base(IpV6MobilityOptionType.IpV4AddressAcknowledgement) : base(IpV6MobilityOptionType.IpV4AddressAcknowledgement)
{ {
......
...@@ -25,8 +25,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,8 +25,19 @@ namespace PcapDotNet.Packets.IpV6
public const byte IsServer = 0x01; public const byte IsServer = 0x01;
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.IsServer + sizeof(byte); public const int OptionDataLength = Offset.IsServer + sizeof(byte);
/// <summary>
/// Creates an instance from IsServer.
/// </summary>
/// <param name="isServer">
/// Specifies the DHCP support mode.
/// This flag indicates whether the mobile access gateway should function as a DHCP Server or a DHCP Relay for the attached mobile node.
/// If false, the mobile access gateway should act as a DHCP Relay and if true, it should act as a DHCP Server.
/// </param>
public IpV6MobilityOptionIpV4DhcpSupportMode(bool isServer) public IpV6MobilityOptionIpV4DhcpSupportMode(bool isServer)
: base(IpV6MobilityOptionType.IpV4DhcpSupportMode) : base(IpV6MobilityOptionType.IpV4DhcpSupportMode)
{ {
......
...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddress)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddress)]
public sealed class IpV6MobilityOptionIpV4HomeAddress : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress public sealed class IpV6MobilityOptionIpV4HomeAddress : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress
{ {
/// <summary>
/// The maximum value for Prefix Length.
/// </summary>
public const byte MaxPrefixLength = 0x3F; public const byte MaxPrefixLength = 0x3F;
private static class Offset private static class Offset
...@@ -42,8 +45,33 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -42,8 +45,33 @@ namespace PcapDotNet.Packets.IpV6
public const int PrefixLength = 2; public const int PrefixLength = 2;
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf; public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf;
/// <summary>
/// Creates an instance from Prefix Length, Request Prefix and Home Address.
/// </summary>
/// <param name="prefixLength">
/// The length of the prefix allocated to the mobile node.
/// If only a single address is allocated, this field must be set to 32.
/// In the first binding update requesting a prefix, the field contains the prefix length requested.
/// However, in the following binding updates, this field must contain the length of the prefix allocated.
/// A value of zero is invalid and must be considered an error.
/// </param>
/// <param name="requestPrefix">
/// When true, indicates that the mobile node requests a mobile network prefix.
/// This flag is only relevant for new requests, and must be ignored for binding refreshes.
/// </param>
/// <param name="homeAddress">
/// The mobile node's IPv4 home address that should be defended by the home agent.
/// This field could contain any unicast IPv4 address (public or private) that was assigned to the mobile node.
/// The value 0.0.0.0 is used to request an IPv4 home address from the home agent.
/// A mobile node may choose to use this option to request a prefix by setting the address to All Zeroes and setting the RequestPrefix flag.
/// The mobile node could then form an IPv4 home address based on the allocated prefix.
/// Alternatively, the mobile node may use two different options, one for requesting an address (static or dynamic) and another for requesting a
/// </param>
public IpV6MobilityOptionIpV4HomeAddress(byte prefixLength, bool requestPrefix, IpV4Address homeAddress) public IpV6MobilityOptionIpV4HomeAddress(byte prefixLength, bool requestPrefix, IpV4Address homeAddress)
: base(IpV6MobilityOptionType.IpV4HomeAddress) : base(IpV6MobilityOptionType.IpV4HomeAddress)
{ {
......
...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddressReply)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddressReply)]
public sealed class IpV6MobilityOptionIpV4HomeAddressReply : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress public sealed class IpV6MobilityOptionIpV4HomeAddressReply : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress
{ {
/// <summary>
/// The maximum value for Prefix Length.
/// </summary>
public const byte MaxPrefixLength = 0x3F; public const byte MaxPrefixLength = 0x3F;
private static class Offset private static class Offset
...@@ -31,6 +34,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -31,6 +34,9 @@ namespace PcapDotNet.Packets.IpV6
public const int HomeAddress = PrefixLength + sizeof(byte); public const int HomeAddress = PrefixLength + sizeof(byte);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf; public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf;
private static class Mask private static class Mask
...@@ -43,6 +49,20 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -43,6 +49,20 @@ namespace PcapDotNet.Packets.IpV6
public const int PrefixLength = 2; public const int PrefixLength = 2;
} }
/// <summary>
/// Creates an instance from status, Prefix Length and Home Address.
/// </summary>
/// <param name="status">
/// Indicates success or failure for the IPv4 home address assignment.
/// Values from 0 to 127 indicate success.
/// Higher values (128 to 255) indicate failure.
/// </param>
/// <param name="prefixLength">
/// Used to carry the prefix length of the mobile node's IPv4 home network corresponding to the IPv4 home address contained in the option.
/// </param>
/// <param name="homeAddress">
/// Used to carry the IPv4 home address assigned to the mobile node.
/// </param>
public IpV6MobilityOptionIpV4HomeAddressReply(IpV6IpV4HomeAddressReplyStatus status, byte prefixLength, IpV4Address homeAddress) public IpV6MobilityOptionIpV4HomeAddressReply(IpV6IpV4HomeAddressReplyStatus status, byte prefixLength, IpV4Address homeAddress)
: base(IpV6MobilityOptionType.IpV4HomeAddressReply) : base(IpV6MobilityOptionType.IpV4HomeAddressReply)
{ {
......
...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -22,6 +22,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddressRequest)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.IpV4HomeAddressRequest)]
public sealed class IpV6MobilityOptionIpV4HomeAddressRequest : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress public sealed class IpV6MobilityOptionIpV4HomeAddressRequest : IpV6MobilityOptionComplex, IIpV6MobilityOptionIpV4HomeAddress
{ {
/// <summary>
/// The maximum value for Prefix Length.
/// </summary>
public const byte MaxPrefixLength = 0x3F; public const byte MaxPrefixLength = 0x3F;
private static class Offset private static class Offset
...@@ -30,6 +33,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -30,6 +33,9 @@ namespace PcapDotNet.Packets.IpV6
public const int HomeAddress = PrefixLength + sizeof(ushort); public const int HomeAddress = PrefixLength + sizeof(ushort);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf; public const int OptionDataLength = Offset.HomeAddress + IpV4Address.SizeOf;
private static class Mask private static class Mask
...@@ -42,6 +48,16 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -42,6 +48,16 @@ namespace PcapDotNet.Packets.IpV6
public const int PrefixLength = 2; public const int PrefixLength = 2;
} }
/// <summary>
/// Creates an instance from Prefix Length and Home Address.
/// </summary>
/// <param name="prefixLength">
/// Indicates the prefix length of the mobile node's IPv4 home network corresponding to the IPv4 home address contained in the option.
/// </param>
/// <param name="homeAddress">
/// Contains the IPv4 home address that is being requested.
/// The value of 0.0.0.0 is used to request that the local mobility anchor perform the address allocation.
/// </param>
public IpV6MobilityOptionIpV4HomeAddressRequest(byte prefixLength, IpV4Address homeAddress) public IpV6MobilityOptionIpV4HomeAddressRequest(byte prefixLength, IpV4Address homeAddress)
: base(IpV6MobilityOptionType.IpV4HomeAddressRequest) : base(IpV6MobilityOptionType.IpV4HomeAddressRequest)
{ {
......
...@@ -24,6 +24,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,6 +24,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileAccessGatewayIpV6Address)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileAccessGatewayIpV6Address)]
public sealed class IpV6MobilityOptionMobileAccessGatewayIpV6Address : IpV6MobilityOptionComplex public sealed class IpV6MobilityOptionMobileAccessGatewayIpV6Address : IpV6MobilityOptionComplex
{ {
/// <summary>
/// The number of bytes the address field takes.
/// </summary>
public const byte AddressLength = 128; public const byte AddressLength = 128;
private static class Offset private static class Offset
...@@ -32,8 +35,15 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -32,8 +35,15 @@ namespace PcapDotNet.Packets.IpV6
public const int Address = AddressLength + sizeof(byte); public const int Address = AddressLength + sizeof(byte);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.Address + IpV6Address.SizeOf; public const int OptionDataLength = Offset.Address + IpV6Address.SizeOf;
/// <summary>
/// Creates an instance from address.
/// </summary>
/// <param name="address">Contains the MAG's IPv6 address.</param>
public IpV6MobilityOptionMobileAccessGatewayIpV6Address(IpV6Address address) public IpV6MobilityOptionMobileAccessGatewayIpV6Address(IpV6Address address)
: base(IpV6MobilityOptionType.MobileAccessGatewayIpV6Address) : base(IpV6MobilityOptionType.MobileAccessGatewayIpV6Address)
{ {
......
...@@ -24,6 +24,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,6 +24,11 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileNetworkPrefix)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileNetworkPrefix)]
public sealed class IpV6MobilityOptionMobileNetworkPrefix : IpV6MobilityOptionNetworkPrefix public sealed class IpV6MobilityOptionMobileNetworkPrefix : IpV6MobilityOptionNetworkPrefix
{ {
/// <summary>
/// Create an instance from prefix length and mobile network prefix.
/// </summary>
/// <param name="prefixLength">Indicates the prefix length of the IPv6 prefix contained in the option.</param>
/// <param name="mobileNetworkPrefix">Contains the Mobile Network Prefix.</param>
public IpV6MobilityOptionMobileNetworkPrefix(byte prefixLength, IpV6Address mobileNetworkPrefix) public IpV6MobilityOptionMobileNetworkPrefix(byte prefixLength, IpV6Address mobileNetworkPrefix)
: base(IpV6MobilityOptionType.MobileNetworkPrefix, prefixLength, mobileNetworkPrefix) : base(IpV6MobilityOptionType.MobileNetworkPrefix, prefixLength, mobileNetworkPrefix)
{ {
......
...@@ -26,8 +26,23 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -26,8 +26,23 @@ namespace PcapDotNet.Packets.IpV6
public const int MobileNodeGroupIdentifier = SubType + sizeof(byte) + sizeof(byte); public const int MobileNodeGroupIdentifier = SubType + sizeof(byte) + sizeof(byte);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.MobileNodeGroupIdentifier + sizeof(uint); public const int OptionDataLength = Offset.MobileNodeGroupIdentifier + sizeof(uint);
/// <summary>
/// Creates an instance from sub type and mobile node group identifier.
/// </summary>
/// <param name="subType">
/// Identifies the specific mobile node's group type.
/// </param>
/// <param name="mobileNodeGroupIdentifier">
/// Contains the mobile node's group identifier.
/// The value of (0) is reserved and should not be used.
/// The value of (1) ALL-SESSIONS is the default group of all mobility sessions established between a given local mobility anchor and a mobile access
/// gateway.
/// </param>
public IpV6MobilityOptionMobileNodeGroupIdentifier(IpV6MobileNodeGroupIdentifierSubType subType, uint mobileNodeGroupIdentifier) public IpV6MobilityOptionMobileNodeGroupIdentifier(IpV6MobileNodeGroupIdentifierSubType subType, uint mobileNodeGroupIdentifier)
: base(IpV6MobilityOptionType.MobileNodeGroupIdentifier) : base(IpV6MobilityOptionType.MobileNodeGroupIdentifier)
{ {
......
...@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileNodeIdentifier)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.MobileNodeIdentifier)]
public sealed class IpV6MobilityOptionMobileNodeIdentifier : IpV6MobilityOptionComplex public sealed class IpV6MobilityOptionMobileNodeIdentifier : IpV6MobilityOptionComplex
{ {
/// <summary>
/// The minimum length for identifier.
/// </summary>
public const int MinNetworkAccessIdentifierLength = 1; public const int MinNetworkAccessIdentifierLength = 1;
private static class Offset private static class Offset
...@@ -31,8 +34,20 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -31,8 +34,20 @@ namespace PcapDotNet.Packets.IpV6
public const int Identifier = Subtype + sizeof(byte); public const int Identifier = Subtype + sizeof(byte);
} }
/// <summary>
/// The minimum number of bytes this option data takes.
/// </summary>
public const int OptionDataMinimumLength = Offset.Identifier; public const int OptionDataMinimumLength = Offset.Identifier;
/// <summary>
/// Creates an instance from subtype and identifier.
/// </summary>
/// <param name="subtype">
/// Defines the specific type of identifier included in the Identifier field.
/// </param>
/// <param name="identifier">
/// A variable length identifier of type, as specified by the Subtype field of this option.
/// </param>
public IpV6MobilityOptionMobileNodeIdentifier(IpV6MobileNodeIdentifierSubtype subtype, DataSegment identifier) public IpV6MobilityOptionMobileNodeIdentifier(IpV6MobileNodeIdentifierSubtype subtype, DataSegment identifier)
: base(IpV6MobilityOptionType.MobileNodeIdentifier) : base(IpV6MobilityOptionType.MobileNodeIdentifier)
{ {
......
...@@ -23,8 +23,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -23,8 +23,17 @@ namespace PcapDotNet.Packets.IpV6
public const int LinkLayerIdentifier = sizeof(ushort); public const int LinkLayerIdentifier = sizeof(ushort);
} }
/// <summary>
/// The minimum number of bytes this option data takes.
/// </summary>
public const int OptionDataMinimumLength = Offset.LinkLayerIdentifier; public const int OptionDataMinimumLength = Offset.LinkLayerIdentifier;
/// <summary>
/// Creates an instance from link layer identifier.
/// </summary>
/// <param name="linkLayerIdentifier">
/// Contains the mobile node's link-layer identifier.
/// </param>
public IpV6MobilityOptionMobileNodeLinkLayerIdentifier(DataSegment linkLayerIdentifier) public IpV6MobilityOptionMobileNodeLinkLayerIdentifier(DataSegment linkLayerIdentifier)
: base(IpV6MobilityOptionType.MobileNodeLinkLayerIdentifier) : base(IpV6MobilityOptionType.MobileNodeLinkLayerIdentifier)
{ {
......
...@@ -25,8 +25,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,8 +25,17 @@ namespace PcapDotNet.Packets.IpV6
public const int InterfaceIdentifier = sizeof(ushort); public const int InterfaceIdentifier = sizeof(ushort);
} }
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = Offset.InterfaceIdentifier + sizeof(ulong); public const int OptionDataLength = Offset.InterfaceIdentifier + sizeof(ulong);
/// <summary>
/// Creates an instance from interface identifier.
/// </summary>
/// <param name="interfaceIdentifier">
/// The Interface Identifier value used for the mobile node's IPv6 Link-local address in the P-AN.
/// </param>
public IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier(ulong interfaceIdentifier) public IpV6MobilityOptionMobileNodeLinkLocalAddressInterfaceIdentifier(ulong interfaceIdentifier)
: base(IpV6MobilityOptionType.MobileNodeLinkLocalAddressInterfaceIdentifier) : base(IpV6MobilityOptionType.MobileNodeLinkLocalAddressInterfaceIdentifier)
{ {
......
...@@ -25,8 +25,21 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,8 +25,21 @@ namespace PcapDotNet.Packets.IpV6
public const int CareOfNonceIndex = HomeNonceIndex + sizeof(ushort); public const int CareOfNonceIndex = HomeNonceIndex + sizeof(ushort);
} }
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = Offset.CareOfNonceIndex + sizeof(ushort); public const int OptionDataLength = Offset.CareOfNonceIndex + sizeof(ushort);
/// <summary>
/// Creates an instance from home nounce index and care of nonce index.
/// </summary>
/// <param name="homeNonceIndex">
/// Tells the correspondent node which nonce value to use when producing the home keygen token.
/// </param>
/// <param name="careOfNonceIndex">
/// Ignored in requests to delete a binding.
/// Otherwise, it tells the correspondent node which nonce value to use when producing the care-of keygen token.
/// </param>
public IpV6MobilityOptionNonceIndices(ushort homeNonceIndex, ushort careOfNonceIndex) public IpV6MobilityOptionNonceIndices(ushort homeNonceIndex, ushort careOfNonceIndex)
: base(IpV6MobilityOptionType.NonceIndices) : base(IpV6MobilityOptionType.NonceIndices)
{ {
......
...@@ -25,6 +25,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,6 +25,9 @@ namespace PcapDotNet.Packets.IpV6
{ {
} }
/// <summary>
/// The number of bytes this option will take.
/// </summary>
public override int Length public override int Length
{ {
get { return sizeof(byte); } get { return sizeof(byte); }
......
...@@ -24,27 +24,36 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,27 +24,36 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public IpV6OptionType OptionType { get; private set; } public IpV6OptionType OptionType { get; private set; }
protected IpV6Option(IpV6OptionType type) /// <summary>
{ /// True iff the option type and data are equal.
OptionType = type; /// </summary>
}
public sealed override bool Equals(Option other) public sealed override bool Equals(Option other)
{ {
return Equals(other as IpV6Option); return Equals(other as IpV6Option);
} }
/// <summary>
/// True iff the option type and data are equal.
/// </summary>
public bool Equals(IpV6Option other) public bool Equals(IpV6Option other)
{ {
return other != null && return other != null &&
OptionType == other.OptionType && Length == other.Length && EqualsData(other); OptionType == other.OptionType && Length == other.Length && EqualsData(other);
} }
/// <summary>
/// Returns a hash code for the option.
/// </summary>
public sealed override int GetHashCode() public sealed override int GetHashCode()
{ {
return Sequence.GetHashCode(OptionType, GetDataHashCode()); return Sequence.GetHashCode(OptionType, GetDataHashCode());
} }
internal IpV6Option(IpV6OptionType type)
{
OptionType = type;
}
internal abstract bool EqualsData(IpV6Option other); internal abstract bool EqualsData(IpV6Option other);
internal abstract int GetDataHashCode(); internal abstract int GetDataHashCode();
......
...@@ -23,8 +23,18 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -23,8 +23,18 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.HomeAddress)] [IpV6OptionTypeRegistration(IpV6OptionType.HomeAddress)]
public class IpV6OptionHomeAddress : IpV6OptionComplex, IIpV6OptionComplexFactory public class IpV6OptionHomeAddress : IpV6OptionComplex, IIpV6OptionComplexFactory
{ {
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = IpV6Address.SizeOf; public const int OptionDataLength = IpV6Address.SizeOf;
/// <summary>
/// Creates an instance from home address.
/// </summary>
/// <param name="homeAddress">
/// The home address of the mobile node sending the packet.
/// This address must be a unicast routable address.
/// </param>
public IpV6OptionHomeAddress(IpV6Address homeAddress) public IpV6OptionHomeAddress(IpV6Address homeAddress)
: base(IpV6OptionType.HomeAddress) : base(IpV6OptionType.HomeAddress)
{ {
......
...@@ -27,6 +27,20 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -27,6 +27,20 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6OptionSmfDpdDefault : IpV6OptionSmfDpdSequenceBased public sealed class IpV6OptionSmfDpdDefault : IpV6OptionSmfDpdSequenceBased
{ {
/// <summary>
/// Creates an instance from tagger id and identifier.
/// </summary>
/// <param name="taggerId">
/// Used to differentiate multiple ingressing border gateways that may commonly apply the SMF_DPD option header to packets from a particular source.
/// Non-specific context.
/// </param>
/// <param name="identifier">
/// DPD packet Identifier.
/// When the TaggerId field is present, the Identifier can be considered a unique packet identifier
/// in the context of the TaggerId:srcAddr:dstAddr tuple.
/// When the TaggerId field is not present, then it is assumed that the source applied the SMF_DPD option
/// and the Identifier can be considered unique in the context of the IPv6 packet header srcAddr:dstAddr tuple.
/// </param>
public IpV6OptionSmfDpdDefault(DataSegment taggerId, DataSegment identifier) public IpV6OptionSmfDpdDefault(DataSegment taggerId, DataSegment identifier)
: base(identifier) : base(identifier)
{ {
...@@ -44,6 +58,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -44,6 +58,10 @@ namespace PcapDotNet.Packets.IpV6
TaggerId = taggerId; TaggerId = taggerId;
} }
/// <summary>
/// Used to differentiate multiple ingressing border gateways that may commonly apply the SMF_DPD option header to packets from a particular source.
/// Non-specific context.
/// </summary>
public DataSegment TaggerId { get; private set; } public DataSegment TaggerId { get; private set; }
/// <summary> /// <summary>
......
...@@ -25,6 +25,12 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,6 +25,12 @@ namespace PcapDotNet.Packets.IpV6
public const int HashAssistValue = 0; public const int HashAssistValue = 0;
} }
/// <summary>
/// Creates an instance from data.
/// </summary>
/// <param name="data">
/// The first bit of the data is ignored, and the rest are considered to be the Hash assist value (HAV) used to facilitate H-DPD operation.
/// </param>
public IpV6OptionSmfDpdSequenceHashAssistValue(DataSegment data) public IpV6OptionSmfDpdSequenceHashAssistValue(DataSegment data)
{ {
byte[] hashAssistValueBuffer = new byte[data.Length - Offset.HashAssistValue]; byte[] hashAssistValueBuffer = new byte[data.Length - Offset.HashAssistValue];
...@@ -38,6 +44,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -38,6 +44,9 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public DataSegment HashAssistValue { get; private set; } public DataSegment HashAssistValue { get; private set; }
/// <summary>
/// True since the hash assist value (HAV) field follows to aid in avoiding hash-based DPD collisions.
/// </summary>
public override bool HashIndicator public override bool HashIndicator
{ {
get { return true; } get { return true; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment