|
xorp
|
An OLSR packet containing Messages. More...
#include <message.hh>
Public Member Functions | |
| Packet (MessageDecoder &md, OlsrTypes::FaceID faceid=0) | |
| size_t | length () const |
| size_t | mtu_bound () const |
| size_t | bounded_length () const |
| void | decode (uint8_t *ptr, size_t len) throw (InvalidPacket) |
| size_t | decode_packet_header (uint8_t *ptr, size_t len) throw (InvalidPacket) |
| Decode an OLSR packet header. | |
| bool | encode (vector< uint8_t > &pkt) |
| Encode a packet, including any nested messages. | |
| void | update_encoded_seqno (vector< uint8_t > &pkt) |
| uint16_t | seqno () const |
| void | set_seqno (uint16_t seqno) |
| OlsrTypes::FaceID | faceid () const |
| uint32_t | mtu () const |
| void | set_mtu (const uint32_t mtu) |
| void | set_faceid (OlsrTypes::FaceID faceid) |
| string | str () const |
| void | add_message (Message *m) |
| void | clear () |
| const vector< Message * > & | messages () |
| vector< Message * > & | get_messages () |
| Get a non-const reference to a packet's messages. | |
| bool | valid () const |
| vector< uint8_t > & | get () |
| void | store (uint8_t *ptr, size_t len) |
| Packet (OspfTypes::Version version) | |
| size_t | decode_standard_header (uint8_t *ptr, size_t &len) throw (InvalidPacket) |
| Decode standard header. | |
| virtual Packet * | decode (uint8_t *ptr, size_t len) const =0 throw (InvalidPacket) |
| Decode the packet. | |
| size_t | encode_standard_header (uint8_t *ptr, size_t len) |
| Encode standard header. | |
| virtual bool | encode (vector< uint8_t > &pkt)=0 |
| Encode the packet. | |
| void | store (uint8_t *ptr, size_t len) |
| Store the original packet, required for authentication. | |
| vector< uint8_t > & | get () |
| Get a reference to the original packet data, required for authentication. | |
| OspfTypes::Version | get_version () const |
| virtual OspfTypes::Type | get_type () const =0 |
| It is the responsibilty of the derived type to return this information. | |
| OspfTypes::RouterID | get_router_id () const |
| Get the Router ID. | |
| void | set_router_id (OspfTypes::RouterID id) |
| Set the Router ID. | |
| OspfTypes::AreaID | get_area_id () const |
| Get the Area ID. | |
| void | set_area_id (OspfTypes::AreaID id) |
| Set the Area ID. | |
| uint16_t | get_auth_type () const |
| Get the Auth Type. | |
| void | set_auth_type (uint16_t auth_type) |
| Set the Auth Type. | |
| uint8_t | get_instance_id () const |
| Get the Instance ID. | |
| void | set_instance_id (uint8_t instance_id) |
| Set the Instance ID. | |
| size_t | get_standard_header_length () |
| size_t | decode_point () const |
| Decode Point. | |
| string | standard () const |
| Generate a printable representation of the standard header. | |
| virtual string | str () const =0 |
| Generate a printable representation of the packet. | |
Static Public Member Functions | |
| static size_t | get_packet_header_length () |
Static Public Attributes | |
| static const size_t | STANDARD_HEADER_V2 = 24 |
| static const size_t | STANDARD_HEADER_V3 = 16 |
| static const size_t | VERSION_OFFSET = 0 |
| static const size_t | TYPE_OFFSET = 1 |
| static const size_t | LEN_OFFSET = 2 |
| static const size_t | ROUTER_ID_OFFSET = 4 |
| static const size_t | AREA_ID_OFFSET = 8 |
| static const size_t | CHECKSUM_OFFSET = 12 |
| static const size_t | AUTH_TYPE_OFFSET = 14 |
| static const size_t | AUTH_PAYLOAD_OFFSET = 16 |
| static const size_t | AUTH_PAYLOAD_SIZE = 8 |
| static const size_t | INSTANCE_ID_OFFSET = 14 |
Private Attributes | |
| MessageDecoder & | _message_decoder |
| bool | _is_valid |
| OlsrTypes::FaceID | _faceid |
| uint16_t | _seqno |
| uint32_t | _mtu |
| vector< Message * > | _messages |
| vector< uint8_t > | _pkt |
| const OspfTypes::Version | _version |
| bool | _valid |
| Set to true when the standard header fields are set. | |
| OspfTypes::RouterID | _router_id |
| Standard header. | |
| OspfTypes::AreaID | _area_id |
| OspfTypes::AuType | _auth_type |
| uint8_t | _auth [AUTH_PAYLOAD_SIZE] |
| uint8_t | _instance_id |
An OLSR packet containing Messages.
All packet decode routines must inherit from this interface.
Packets contain Messages. They are coalesced up up to the available MTU size, to save power on devices where transmission may have a high energy cost.
Also provides some utility routines to perform common packet processing.
| size_t Packet::bounded_length | ( | ) | const |
| virtual Packet* Packet::decode | ( | uint8_t * | ptr, |
| size_t | len | ||
| ) | const throw (InvalidPacket) [pure virtual] |
Decode the packet.
The returned packet must be free'd.
Implemented in HelloPacket, DataDescriptionPacket, LinkStateRequestPacket, LinkStateUpdatePacket, and LinkStateAcknowledgementPacket.
| size_t Packet::decode_packet_header | ( | uint8_t * | ptr, |
| size_t | len | ||
| ) | throw (InvalidPacket) |
Decode an OLSR packet header.
An OLSR packet is considered valid if its length is greater than the size of a standard packet header. The host IP stack takes care of UDP checksums, IP fragmentation and reassembly, and MTU size checks for us.
| size_t Packet::decode_point | ( | ) | const |
| size_t Packet::decode_standard_header | ( | uint8_t * | ptr, |
| size_t & | len | ||
| ) | throw (InvalidPacket) |
| virtual bool Packet::encode | ( | vector< uint8_t > & | pkt | ) | [pure virtual] |
Encode the packet.
| pkt | vector into which the packet should be placed. |
Implemented in HelloPacket, DataDescriptionPacket, LinkStateRequestPacket, LinkStateUpdatePacket, and LinkStateAcknowledgementPacket.
| size_t Packet::encode_standard_header | ( | uint8_t * | ptr, |
| size_t | len | ||
| ) |
| vector<Message*>& Packet::get_messages | ( | ) | [inline] |
| size_t Packet::get_standard_header_length | ( | ) | [inline] |
| virtual OspfTypes::Type Packet::get_type | ( | ) | const [pure virtual] |
It is the responsibilty of the derived type to return this information.
Implemented in HelloPacket, DataDescriptionPacket, LinkStateRequestPacket, LinkStateUpdatePacket, and LinkStateAcknowledgementPacket.
| OspfTypes::Version Packet::get_version | ( | ) | const [inline] |
| size_t Packet::mtu_bound | ( | ) | const |
| string Packet::standard | ( | ) | const |
| string Packet::str | ( | ) | const |
Reimplemented in HelloPacket, DataDescriptionPacket, LinkStateRequestPacket, LinkStateUpdatePacket, and LinkStateAcknowledgementPacket.
OspfTypes::RouterID Packet::_router_id [private] |
Standard header.
Version and Type information are constant so therefore not present.