|
|
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.
Packet (MessageDecoder& md, OlsrTypes::FaceID faceid = 0)
| Packet |
~Packet ()
| ~Packet |
size_t get_packet_header_length ()
| get_packet_header_length |
[static]
size_t length ()
| length |
[const]
Returns: the size of the packet payload.
size_t mtu_bound ()
| mtu_bound |
[const]
Returns: the amount of free space in this packet for an OLSR packet payload, after MTU is taken into account.
size_t bounded_length ()
| bounded_length |
[const]
Returns: the size of the packet payload which will fit inside the MTU without splitting any messages. If no MTU is set, returns length().
void decode (uint8_t* ptr, size_t len)
throw(InvalidPacket) | decode |
size_t decode_packet_header (uint8_t* ptr, size_t len)
throw(InvalidPacket) | decode_packet_header |
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.
bool encode (vector<uint8_t>& pkt)
| encode |
Encode a packet, including any nested messages.
void update_encoded_seqno (vector<uint8_t>& pkt)
| update_encoded_seqno |
inline uint16_t seqno ()
| seqno |
[const]
inline void set_seqno (uint16_t seqno)
| set_seqno |
inline OlsrTypes::FaceID faceid ()
| faceid |
[const]
inline uint32_t mtu ()
| mtu |
[const]
inline void set_mtu (const uint32_t mtu)
| set_mtu |
inline void set_faceid (OlsrTypes::FaceID faceid)
| set_faceid |
string str ()
| str |
[const]
Returns: a string representation of the entire packet.
inline void add_message (Message* m)
| add_message |
inline void clear ()
| clear |
inline const vector<Message*>& messages ()
| messages |
inline vector<Message*>& get_messages ()
| get_messages |
Get a non-const reference to a packet's messages. For debugging use only, ie in simulation of multiple hops.
Returns: reference to the messages contained within the packet.
bool valid ()
| valid |
[const]
vector<uint8_t>& get ()
| get |
void store (uint8_t* ptr, size_t len)
| store |