C# Class NetworkPackets.IPPacket

Inheritance: NetworkPacket
Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Méthodes publiques

Свойство Type Description
BroadcastAddress MemBlock
DestinationIP MemBlock
Protocol Protocols
SourceIP MemBlock
ZeroAddress MemBlock

Méthodes publiques

Méthode Description
GenerateChecksum ( MemBlock header ) : ushort

Generates an 16-bit IP (UDP, TCP) checksum based upon header and optional extra memory blocks placed into args.

IPPacket ( ) : Brunet
IPPacket ( MemBlock Packet ) : Brunet

Takes in a MemBlock and parses it into IP Header fields

IPPacket ( Protocols Protocol, MemBlock SourceIP, MemBlock DestinationIP, ICopyable Payload ) : Brunet

Takes in the IP Header fields and a payload to create an IP Packet. Unlisted fields are generated by this constructor automatically.

IPPacket ( Protocols Protocol, MemBlock SourceIP, MemBlock DestinationIP, MemBlock hdr, ICopyable Payload ) : Brunet

Takes in the IP Header fields and a payload to create an IP Packet. Unlisted fields are generated by this constructor automatically.

MakePseudoHeader ( MemBlock source_address, MemBlock destination_address, byte protocol, ushort length ) : MemBlock
Translate ( MemBlock Packet, MemBlock SourceIP, MemBlock DestinationIP ) : MemBlock

If we're not creating a packet from scratch, this will keep its integrity and transform UDP and TCP headers as well (due to their checksums being dependent on source and destination ip addresses.

Private Methods

Méthode Description
ChecksumTest ( ) : void

Method Details

GenerateChecksum() public static méthode

Generates an 16-bit IP (UDP, TCP) checksum based upon header and optional extra memory blocks placed into args.
public static GenerateChecksum ( MemBlock header ) : ushort
header MemBlock The Header to base the checksum on.
Résultat ushort

IPPacket() public méthode

public IPPacket ( ) : Brunet
Résultat Brunet

IPPacket() public méthode

Takes in a MemBlock and parses it into IP Header fields
public IPPacket ( MemBlock Packet ) : Brunet
Packet MemBlock The IP Packet to parse.
Résultat Brunet

IPPacket() public méthode

Takes in the IP Header fields and a payload to create an IP Packet. Unlisted fields are generated by this constructor automatically.
public IPPacket ( Protocols Protocol, MemBlock SourceIP, MemBlock DestinationIP, ICopyable Payload ) : Brunet
Protocol Protocols The type of payload
SourceIP MemBlock The packets originating ip address
DestinationIP MemBlock The destination for the packet
Payload ICopyable The data stored in the IP Packet
Résultat Brunet

IPPacket() public méthode

Takes in the IP Header fields and a payload to create an IP Packet. Unlisted fields are generated by this constructor automatically.
public IPPacket ( Protocols Protocol, MemBlock SourceIP, MemBlock DestinationIP, MemBlock hdr, ICopyable Payload ) : Brunet
Protocol Protocols The type of payload
SourceIP MemBlock The packets originating ip address
DestinationIP MemBlock The destination for the packet
hdr MemBlock The original header of the IPPacket
Payload ICopyable The data stored in the IP Packet
Résultat Brunet

MakePseudoHeader() public static méthode

public static MakePseudoHeader ( MemBlock source_address, MemBlock destination_address, byte protocol, ushort length ) : MemBlock
source_address MemBlock
destination_address MemBlock
protocol byte
length ushort
Résultat MemBlock

Translate() public static méthode

If we're not creating a packet from scratch, this will keep its integrity and transform UDP and TCP headers as well (due to their checksums being dependent on source and destination ip addresses.
public static Translate ( MemBlock Packet, MemBlock SourceIP, MemBlock DestinationIP ) : MemBlock
Packet MemBlock The packet to translate.
SourceIP MemBlock The new source ip.
DestinationIP MemBlock The new destination ip.
Résultat MemBlock

Property Details

BroadcastAddress public_oe static_oe property

The default broadcast (multicast) address
public static MemBlock BroadcastAddress
Résultat MemBlock

DestinationIP public_oe property

The IP Address where the packet is going
public MemBlock DestinationIP
Résultat MemBlock

Protocol public_oe property

The protocol for this packet.
public Protocols Protocol
Résultat Protocols

SourceIP public_oe property

The IP Address where the packet originated
public MemBlock SourceIP
Résultat MemBlock

ZeroAddress public_oe static_oe property

The zero address
public static MemBlock ZeroAddress
Résultat MemBlock