class Packet

All packet decode routines must inherit from this interface. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods

Public Members


Detailed Description

All packet decode routines must inherit from this interface. Also provides some utility routines to perform common packet processing.

static const size_t STANDARD_HEADER_V2

STANDARD_HEADER_V2

static const size_t STANDARD_HEADER_V3

STANDARD_HEADER_V3

static const size_t AUTH_TYPE_OFFSET

AUTH_TYPE_OFFSET

static const size_t AUTH_PAYLOAD_OFFSET

AUTH_PAYLOAD_OFFSET

static const size_t AUTH_PAYLOAD_SIZE

AUTH_PAYLOAD_SIZE

static const size_t CHECKSUM_OFFSET

CHECKSUM_OFFSET

 Packet (OspfTypes::Version version)

Packet

 ~Packet ()

~Packet

[virtual]

size_t  decode_standard_header (uint8_t *ptr, size_t& len)
throw(BadPacket)

decode_standard_header

Decode standard header.

Used by the derived classes to extract the standard header and options field.

Parameters:

lenif the frame is larger than what is specified by the header length field drop the length down to the header length.

Returns: the offset where the specific header starts.

Packetdecode (uint8_t *ptr, size_t len)
throw(BadPacket)

decode

[const pure virtual]

Decode the packet. The returned packet must be free'd.

size_t  encode_standard_header (uint8_t *ptr, size_t len)

encode_standard_header

Encode standard header.

Used by the derived classes to put the standard header in the packet. Which includes the checksum so all other fields should already be in the packet.

Parameters:

ptrlocation to start writing header.
lensize of the buffer.

Returns: The offset that the header has been written to. Returns 0 on failure, such as the buffer is too small.

bool  encode (vector<uint8_t>& pkt)

encode

[pure virtual]

Encode the packet.

Parameters:

pktvector into which the packet should be placed.

Returns: true if the encoding suceeded.

void  store (uint8_t *ptr, size_t len)

store

Store the original packet, required for authentication.

vector<uint8_t>&  get ()

get

Get a reference to the original packet data, required for authentication.

OspfTypes::Version  get_version ()

get_version

[const]

Returns: The version this packet represents.

OspfTypes::Type  get_type ()

get_type

[const pure virtual]

It is the responsibilty of the derived type to return this information.

Returns: The type this packet represents.

OspfTypes::RouterID  get_router_id ()

get_router_id

[const]

Get the Router ID.

void  set_router_id (OspfTypes::RouterID id)

set_router_id

Set the Router ID.

OspfTypes::AreaID  get_area_id ()

get_area_id

[const]

Get the Area ID.

void  set_area_id (OspfTypes::AreaID id)

set_area_id

Set the Area ID.

uint16_t  get_auth_type ()

get_auth_type

[const]

Get the Auth Type.

void  set_auth_type (uint16_t auth_type)

set_auth_type

Set the Auth Type.

uint8_t  get_instance_id ()

get_instance_id

[const]

Get the Instance ID.

void  set_instance_id (uint8_t instance_id)

set_instance_id

Set the Instance ID.

inline size_t  get_standard_header_length ()

get_standard_header_length

Returns: the standard header length for this version of OSPF.

size_t  decode_point ()

decode_point

[const]

Decode Point.

If a packet is being decoded the standard header has already been processed. This method returns the offset at which the specific data starts.

Returns: The offset at which a derived class should start decoding.

string  standard ()

standard

[const]

Generate a printable representation of the standard header. Used by the derived classes implementing str().

string  str ()

str

[const pure virtual]

Generate a printable representation of the packet.


Generated by: pavlin on possum.icir.org on Thu Mar 9 04:43:44 2006, using kdoc $.