|
Click
|
A network packet. More...
Data | |
| enum | { default_headroom = 28 , min_buffer_length = 64 } |
| typedef void(* | buffer_destructor_type) (unsigned char *buf, size_t sz, void *argument) |
| static WritablePacket * | make (uint32_t headroom, const void *data, uint32_t length, uint32_t tailroom, bool clear=true) |
| Create and return a new packet. | |
| static WritablePacket * | make (const void *data, uint32_t length) |
| Create and return a new packet. | |
| static WritablePacket * | make (uint32_t length) |
| Create and return a new packet. | |
| static WritablePacket * | make_similar (Packet *original, uint32_t length) |
| static Packet * | make (struct sk_buff *skb) |
| Change an sk_buff into a Packet (linuxmodule). | |
| static void | empty_destructor (unsigned char *, size_t, void *) |
| static WritablePacket * | make (unsigned char *data, uint32_t length, buffer_destructor_type buffer_destructor, void *argument=(void *) 0, int headroom=0, int tailroom=0, bool clear=true) |
| Create and return a new packet (userlevel). | |
| static int | max_data_pool_size () |
| static void | static_cleanup () |
| void | kill () |
| Delete this packet. | |
| void | kill_nonatomic () |
| Delete this packet in a thread-safe context. | |
| bool | shared () const |
| Test whether this packet's data is shared. | |
| bool | shared_nonatomic () const |
| Test whether this packet's data is shared. | |
| Packet * | clone (bool fast=false) |
| Create a clone of this packet. | |
| WritablePacket * | duplicate (int32_t extra_headroom=0, int32_t extra_tailroom=0, const bool data_only=true) |
| WritablePacket * | uniqueify () |
| Return an unshared packet containing this packet's data. | |
| void | get () |
| const unsigned char * | data () const |
| Return the packet's data pointer. | |
| const unsigned char * | end_data () const |
| Return the packet's end data pointer. | |
| uint32_t | length () const |
| Return the packet's length. | |
| uint32_t | headroom () const |
| Return the packet's headroom. | |
| uint32_t | tailroom () const |
| Return the packet's tailroom. | |
| const unsigned char * | buffer () const |
| Return a pointer to the packet's data buffer. | |
| const unsigned char * | end_buffer () const |
| Return the packet's end data buffer pointer. | |
| uint32_t | buffer_length () const |
| Return the packet's buffer length. | |
| struct sk_buff * | skb () |
| const struct sk_buff * | skb () const |
| WritablePacket * | push (uint32_t len) |
| Add space for a header before the packet. | |
| WritablePacket * | push_mac_header (uint32_t len) |
| Add space for a MAC header before the packet. | |
| Packet * | nonunique_push (uint32_t len) |
| Add space for a header before the packet. | |
| void | pull (uint32_t len) |
| Remove a header from the front of the packet. | |
| WritablePacket * | put (uint32_t len) |
| Add space for data after the packet. | |
| Packet * | nonunique_put (uint32_t len) |
| Add space for data after the packet. | |
| void | take (uint32_t len) |
| Remove space from the end of the packet. | |
| Packet * | shift_data (int offset, bool free_on_failure=true) |
| Shift packet data within the data buffer. | |
| void | shrink_data (const unsigned char *data, uint32_t length) |
| Shrink the packet's data. | |
| void | change_headroom_and_length (uint32_t headroom, uint32_t length) |
| Shift the packet's data view to a different part of its buffer. | |
| void | change_buffer_length (uint32_t length) |
| bool | copy (Packet *p, int headroom=0) |
| Copy the content and annotations of another packet (userlevel) into this packet. | |
Annotations | |
never | |
| enum | { anno_size = 48 } |
| enum | PacketType { HOST = 0 , BROADCAST = 1 , MULTICAST = 2 , OTHERHOST = 3 , OUTGOING = 4 , LOOPBACK = 5 , FASTROUTE = 6 } |
| Values for packet_type_anno(). Must agree with Linux's PACKET_ constants in <linux/if_packet.h>. More... | |
| enum | { dst_ip_anno_offset = 0 , dst_ip_anno_size = 4 , dst_ip6_anno_offset = 0 , dst_ip6_anno_size = 16 } |
| const Timestamp & | timestamp_anno () const |
| Return the timestamp annotation. | |
| Timestamp & | timestamp_anno () |
| void | set_timestamp_anno (const Timestamp &t) |
| Set the timestamp annotation. | |
| net_device * | device_anno () const |
| Return the device annotation. | |
| void | set_device_anno (net_device *dev) |
| Set the device annotation. | |
| PacketType | packet_type_anno () const |
| Return the packet type annotation. | |
| void | set_packet_type_anno (PacketType t) |
| Set the packet type annotation. | |
| Packet * | next () const |
| Return the next packet annotation. | |
| Packet *& | next () |
| void | set_next (Packet *p) |
| Set the next packet annotation. | |
| Packet * | prev () const |
| Return the previous packet annotation. | |
| Packet *& | prev () |
| void | set_prev (Packet *p) |
| Set the previous packet annotation. | |
| Packet * | find_tail () |
| unsigned int | find_count () |
| IPAddress | dst_ip_anno () const |
| Return the destination IPv4 address annotation. | |
| void | set_dst_ip_anno (IPAddress addr) |
| Set the destination IPv4 address annotation. | |
| void * | anno () |
| Return a pointer to the annotation area. | |
| const void * | anno () const |
| uint8_t * | anno_u8 () |
| Return a pointer to the annotation area as uint8_ts. | |
| const uint8_t * | anno_u8 () const |
| overload | |
| uint32_t * | anno_u32 () |
| Return a pointer to the annotation area as uint32_ts. | |
| const uint32_t * | anno_u32 () const |
| overload | |
| uint8_t | anno_u8 (int i) const |
| Return annotation byte at offset i. | |
| void | set_anno_u8 (int i, uint8_t x) |
| Set annotation byte at offset i. | |
| uint16_t | anno_u16 (int i) const |
| Return 16-bit annotation at offset i. | |
| void | set_anno_u16 (int i, uint16_t x) |
| Set 16-bit annotation at offset i. | |
| int16_t | anno_s16 (int i) const |
| Return 16-bit annotation at offset i. | |
| void | set_anno_s16 (int i, int16_t x) |
| Set 16-bit annotation at offset i. | |
| uint32_t | anno_u32 (int i) const |
| Return 32-bit annotation at offset i. | |
| void | set_anno_u32 (int i, uint32_t x) |
| Set 32-bit annotation at offset i. | |
| int32_t | anno_s32 (int i) const |
| Return 32-bit annotation at offset i. | |
| void | set_anno_s32 (int i, int32_t x) |
| Set 32-bit annotation at offset i. | |
| uint64_t | anno_u64 (int i) const |
| Return 64-bit annotation at offset i. | |
| void | set_anno_u64 (int i, uint64_t x) |
| Set 64-bit annotation at offset i. | |
| void * | anno_ptr (int i) const |
| Return void * sized annotation at offset i. | |
| void | set_anno_ptr (int i, const void *x) |
| Set void * sized annotation at offset i. | |
| Packet * | data_packet () |
| void | clear_annotations (bool all=true) |
| Clear all packet annotations. | |
| void | copy_annotations (const Packet *, bool all=true) |
| Copy most packet annotations from p. | |
| void | copy_headers (const Packet *) |
Header Pointers | |
| bool | has_mac_header () const |
| Return true iff the packet's MAC header pointer is set. | |
| const unsigned char * | mac_header () const |
| Return the packet's MAC header pointer. | |
| int | mac_header_offset () const |
| Return the offset from the packet data to the MAC header. | |
| uint32_t | mac_header_length () const |
| Return the MAC header length. | |
| int | mac_length () const |
| Return the packet's length starting from its MAC header pointer. | |
| void | set_mac_header (const unsigned char *p) |
| Set the MAC header pointer. | |
| void | set_mac_header (const unsigned char *p, uint32_t len) |
| Set the MAC and network header pointers. | |
| void | clear_mac_header () |
| Unset the MAC header pointer. | |
| bool | has_network_header () const |
| Return true iff the packet's network header pointer is set. | |
| const unsigned char * | network_header () const |
| Return the packet's network header pointer. | |
| int | network_header_offset () const |
| Return the offset from the packet data to the network header. | |
| uint32_t | network_header_length () const |
| Return the network header length. | |
| int | network_length () const |
| Return the packet's length starting from its network header pointer. | |
| void | set_network_header (const unsigned char *p) |
| Set the network header. | |
| void | set_network_header (const unsigned char *p, uint32_t len) |
| Set the network and transport header pointers. | |
| void | set_network_header_length (uint32_t len) |
| Set the network header length. | |
| void | clear_network_header () |
| Unset the network header pointer. | |
| void | set_transport_header (const unsigned char *p) |
| Set the transport header. | |
| bool | has_transport_header () const |
| Return true iff the packet's transport header pointer is set. | |
| const unsigned char * | transport_header () const |
| Return the packet's transport header pointer. | |
| int | transport_header_offset () const |
| Return the offset from the packet data to the transport header. | |
| int | transport_length () const |
| Return the packet's length starting from its transport header pointer. | |
| void | clear_transport_header () |
| Unset the transport header pointer. | |
| const click_ether * | ether_header () const |
| Return the packet's MAC header pointer as Ethernet. | |
| void | set_ether_header (const click_ether *ethh) |
| Set the MAC header pointer to an Ethernet header. | |
| const click_ip * | ip_header () const |
| Return the packet's network header pointer as IPv4. | |
| int | ip_header_offset () const |
| Return the offset from the packet data to the IP header. | |
| uint32_t | ip_header_length () const |
| Return the IP header length. | |
| void | set_ip_header (const click_ip *iph, uint32_t len) |
| Set the network header pointer to an IPv4 header. | |
| const click_ip6 * | ip6_header () const |
| Return the packet's network header pointer as IPv6. | |
| int | ip6_header_offset () const |
| Return the offset from the packet data to the IPv6 header. | |
| uint32_t | ip6_header_length () const |
| Return the IPv6 header length. | |
| void | set_ip6_header (const click_ip6 *ip6h) |
| Set the network header pointer to an IPv6 header. | |
| void | set_ip6_header (const click_ip6 *ip6h, uint32_t len) |
| Set the network header pointer to an IPv6 header. | |
| const click_icmp * | icmp_header () const |
| Return the packet's transport header pointer as ICMP. | |
| const click_tcp * | tcp_header () const |
| Return the packet's transport header pointer as TCP. | |
| const click_udp * | udp_header () const |
| Return the packet's transport header pointer as UDP. | |
| uint16_t | getContentOffset () const |
| void | setContentOffset (uint16_t offset) |
| const unsigned char * | getPacketContent () |
| bool | isPacketContentEmpty () const |
| uint16_t | getPacketContentSize () const |
| typedef | typeof (((struct sk_buff *) 0) ->mac_header) mac_header_type |
| typedef | typeof (((struct sk_buff *) 0) ->network_header) network_header_type |
| typedef | typeof (((struct sk_buff *) 0) ->transport_header) transport_header_type |
A network packet.
Click's Packet class represents network packets within a router. Packet objects are passed from Element to Element via the Element::push() and Element::pull() functions. The vast majority of elements handle packets.
A packet consists of a data buffer, which stores the actual packet wire data, and a set of annotations, which store extra information calculated about the packet, such as the destination address to be used for routing. Every Packet object has different annotations, but a data buffer may be shared among multiple Packet objects, saving memory and speeding up packet copies. (See Packet::clone.) As a result a Packet's data buffer is not writable. To write into a packet, turn it into a nonshared WritablePacket first, using uniqueify(), push(), or put().
A packet's data buffer is a single flat array of bytes. The buffer may be larger than the actual packet data, leaving unused spaces called headroom and tailroom before and after the data proper. Prepending headers or appending data to a packet can be quite efficient if there is enough headroom or tailroom.
The relationships among a Packet object's data buffer variables is shown here:
data() end_data()
| |
|<- headroom() ->|<----- length() ----->|<- tailroom() ->|
| v v |
+================+======================+================+
|XXXXXXXXXXXXXXXX| PACKET CONTENTS |XXXXXXXXXXXXXXXX|
+================+======================+================+
^ ^
|<------------------ buffer_length() ------------------->|
| |
buffer() end_buffer()
Most code that manipulates packets is interested only in data() and length().
To create a Packet, call one of the make() functions. To destroy a Packet, call kill(). To clone a Packet, which creates a new Packet object that shares this packet's data, call clone(). To uniqueify a Packet, which unshares the packet data if necessary, call uniqueify(). To allocate extra space for headers or trailers, call push() and put(). To remove headers or trailers, call pull() and take().
data() end_data()
| |
push() | pull() take() | put()
<======= | =======> <======= | =======>
v v
+===========+================================+===========+
|XXXXXXXXXXX| PACKET CONTENTS |XXXXXXXXXXX|
+===========+================================+===========+
Packet objects are implemented in different ways in different drivers. The userlevel driver has its own C++ implementation. In the linuxmodule driver, however, Packet is an overlay on Linux's native sk_buff object: the Packet methods access underlying sk_buff data directly, with no overhead. (For example, Packet::data() returns the sk_buff's data field.)
Annotations are extra information about a packet above and beyond the packet data. Packet supports several specific annotations, plus a user annotation area available for arbitrary use by elements.
New packets start wth all annotations set to zero or null. Cloning a packet copies its annotations.
| anonymous enum |
| Enumerator | |
|---|---|
| default_headroom | Default packet headroom() for Packet::make(). 4-byte aligned. |
| min_buffer_length | Minimum buffer_length() for Packet::make() |
| enum Packet::PacketType |
Values for packet_type_anno(). Must agree with Linux's PACKET_ constants in <linux/if_packet.h>.
| Enumerator | |
|---|---|
| HOST | Packet was sent to this host. |
| BROADCAST | Packet was sent to a link-level multicast address. |
| MULTICAST | Packet was sent to a link-level multicast address. |
| OTHERHOST | Packet was sent to a different host, but received anyway. The receiving device is probably in promiscuous mode. |
| OUTGOING | Packet was generated by this host and is being sent elsewhere. |
|
static |
Create and return a new packet.
| headroom | headroom in new packet |
| data | data to be copied into the new packet |
| length | length of packet |
| tailroom | tailroom in new packet (ignored when DPDK is used) |
The data is copied into the new packet. If data is null, the packet's data is left uninitialized. The resulting packet's buffer_length() will be at least min_buffer_length ; if headroom + length + tailroom would be less, then tailroom is increased to make the total min_buffer_length .
The new packet's annotations are cleared and its header pointers are null.
|
inlinestatic |
Create and return a new packet.
| data | data to be copied into the new packet |
| length | length of packet |
The data is copied into the new packet. If data is null, the packet's data is left uninitialized. The new packet's headroom equals default_headroom , its tailroom is 0.
The returned packet's annotations are cleared and its header pointers are null.
|
inlinestatic |
Create and return a new packet.
| length | length of packet |
The packet's data is left uninitialized. The new packet's headroom equals default_headroom , its tailroom is 0.
The returned packet's annotations are cleared and its header pointers are null.
|
inlinestatic |
Change an sk_buff into a Packet (linuxmodule).
| skb | input sk_buff |
In the Linux kernel module, Packet objects are sk_buff objects. This function simply changes an sk_buff into a Packet by claiming its skb argument. If skb->users is 1, then skb is orphaned by skb_orphan(skb) and returned. If it is larger than 1, then skb is cloned and the clone is returned. (sk_buffs used for Click Packet objects must have skb->users == 1.) Null might be returned if there's no memory for the clone.
The returned packet's annotations and header pointers are not cleared: they have the same values they did in the sk_buff. If the packet came from Linux, then the header pointers and shared annotations (timestamp, packet type, next/prev packet) might have valid values, but the Click annotations (address, user) likely do not. Use clear_annotations() to clear them.
|
static |
Empty destructor which does nothing. Use this whenever possible instead of your own empty destructor as this special case will be detected and it won't be called.
|
static |
Create and return a new packet (userlevel).
| data | data used in the new packet |
| length | length of packet |
| destructor | destructor function |
| argument | argument to destructor function |
| headroom | headroom available before the data pointer |
| tailroom | tailroom available after data + length |
The packet's data pointer becomes the data: the data is not copied into the new packet, rather the packet owns the data pointer. When the packet's data is eventually destroyed, either because the packet is deleted or because of something like a push() or full(), the destructor will be called as destructor(data, length, argument). (If destructor is null, the packet data will be freed by delete[] data.) The packet has zero headroom and tailroom.
The returned packet's annotations are cleared and its header pointers are null.
|
inline |
Delete this packet.
The packet header (including annotations) is destroyed and its memory returned to the system. The packet's data is also freed if this is the last clone.
|
inline |
Delete this packet in a thread-safe context.
The packet header (including annotations) is destroyed and its memory returned to the system. The packet's data is also freed if this is the last clone.
@precond Packet are only handled by this thread
|
inline |
Test whether this packet's data is shared.
Returns true iff the packet's data is shared. If shared() is false, then the result of uniqueify() will equal this.
|
inline |
Test whether this packet's data is shared.
Returns true iff the packet's data is shared. If shared() is false, then the result of uniqueify() will equal this.
| Packet * Packet::clone | ( | bool | fast = false | ) |
Create a clone of this packet.
The returned clone has independent annotations, initially copied from this packet, but shares this packet's data. shared() returns true for both the packet and its clone. Returns null if there's no memory for the clone.
|
inline |
Return an unshared packet containing this packet's data.
The returned packet's data is unshared with any other packet, so it's safe to write the data. If shared() is false, this operation simply returns the input packet. If shared() is true, uniqueify() makes a copy of the data. The input packet is freed if the copy fails.
The returned WritablePacket pointer may not equal the input Packet pointer, so do not use the input pointer after the uniqueify() call.
The input packet's headroom and tailroom areas are copied in addition to its true contents. The header annotations are shifted to point into the new packet data if necessary.
uniqueify() is usually used like this:
|
inline |
Return the packet's data pointer.
This is the pointer to the first byte of packet data.
|
inline |
Return the packet's end data pointer.
The result points at the byte following the packet data.
|
inline |
Return the packet's length.
|
inline |
Return the packet's headroom.
The headroom is the amount of space available in the current packet buffer before data(). A push() operation is cheap if the packet's unshared and the length pushed is less than headroom().
|
inline |
Return the packet's tailroom.
The tailroom is the amount of space available in the current packet buffer following end_data(). A put() operation is cheap if the packet's unshared and the length put is less than tailroom().
|
inline |
Return a pointer to the packet's data buffer.
The result points at the packet's headroom, not its data.
|
inline |
Return the packet's end data buffer pointer.
The result points past the packet's tailroom.
|
inline |
Return the packet's buffer length.
|
inline |
Add space for a header before the packet.
| len | amount of space to add |
Returns a packet with an additional len bytes of uninitialized space before the current packet's data(). A copy of the packet data is made if there isn't enough headroom() in the current packet, or if the current packet is shared(). If no copy is made, this operation is quite efficient.
If a data copy would be required, but the copy fails because of lack of memory, then the current packet is freed.
push() is usually used like this:
|
inline |
Add space for a MAC header before the packet.
| len | amount of space to add and length of MAC header |
Combines the action of push() and set_mac_header(). len bytes are pushed for a MAC header, and on success, the packet's returned MAC and network header pointers are set as by set_mac_header(data(), len).
|
inline |
Add space for a header before the packet.
| len | amount of space to add |
This is a variant of push(). Returns a packet with an additional len bytes of uninitialized space before the current packet's data(). A copy of the packet data is made if there isn't enough headroom() in the current packet. However, no copy is made if the current packet is shared; and if no copy is made, this operation is quite efficient.
If a data copy would be required, but the copy fails because of lack of memory, then the current packet is freed.
|
inline |
Remove a header from the front of the packet.
| len | amount of space to remove |
Removes len bytes from the initial part of the packet, usually corresponding to some network header (for example, pull(14) removes an Ethernet header). This operation is efficient: it just bumps a pointer.
It is an error to attempt to pull more than length() bytes.
|
inline |
Add space for data after the packet.
| len | amount of space to add |
Returns a packet with an additional len bytes of uninitialized space after the current packet's data (starting at end_data()). A copy of the packet data is made if there isn't enough tailroom() in the current packet, or if the current packet is shared(). If no copy is made, this operation is quite efficient.
If a data copy would be required, but the copy fails because of lack of memory, then the current packet is freed.
put() is usually used like this:
|
inline |
Add space for data after the packet.
| len | amount of space to add |
This is a variant of put(). Returns a packet with an additional len bytes of uninitialized space after the current packet's data (starting at end_data()). A copy of the packet data is made if there isn't enough tailroom() in the current packet. However, no copy is made if the current packet is shared; and if no copy is made, this operation is quite efficient.
If a data copy would be required, but the copy fails because of lack of memory, then the current packet is freed.
|
inline |
Remove space from the end of the packet.
| len | amount of space to remove |
Removes len bytes from the end of the packet. This operation is efficient: it just bumps a pointer.
It is an error to attempt to pull more than length() bytes.
| Packet * Packet::shift_data | ( | int | offset, |
| bool | free_on_failure = true |
||
| ) |
Shift packet data within the data buffer.
| offset | amount to shift packet data |
| free_on_failure | if true, then delete the input packet on failure |
Useful to align packet data. For example, if the packet's embedded IP header is located at pointer value 0x8CCA03, then shift_data(1) or shift_data(-3) will both align the header on a 4-byte boundary.
Due to the alignement, the data may be shifted by an error of 4 bytes. Eg calling shift(-5) might shift only for -3.
If the packet is shared() or there isn't enough headroom or tailroom for the operation, the packet is passed to uniqueify() first. This can fail if there isn't enough memory. If it fails, shift_data returns null, and if free_on_failure is true (the default), the input packet is freed.
The packet's mac_header, network_header, and transport_header areas are preserved, even if they lie within the headroom. Any headroom outside these regions may be overwritten, as may any tailroom.
|
inline |
Shrink the packet's data.
| data | new data pointer |
| length | new length |
User-level programs that read packet logs commonly read a large chunk of data (32 kB or more) into a base Packet object. The log reader then works over the data buffer and, for each packet contained therein, outputs a clone that shares memory with the base packet. This is space- and time-efficient, but the generated packets have gigantic headroom and tailroom. Uniqueifying a generated packet will wastefully copy this headroom and tailroom as well. The shrink_data function addresses this problem.
shrink_data() removes all of a packet's headroom and tailroom. The resulting packet has data() equal to data, length() equal to length, and headroom() and tailroom() equal to zero.
|
inline |
Shift the packet's data view to a different part of its buffer.
| headroom | new headroom |
| length | new length |
Shifts the packet's data() pointer to a different part of the packet's data buffer. The buffer pointer itself is not changed, and the packet's contents are not affected (except by the new view).
| bool Packet::copy | ( | Packet * | p, |
| int | headroom = 0 |
||
| ) |
Copy the content and annotations of another packet (userlevel) into this packet.
| source | packet |
| headroom | for the new packet |
|
inline |
Return true iff the packet's MAC header pointer is set.
|
inline |
Return the packet's MAC header pointer.
|
inline |
Return the offset from the packet data to the MAC header.
|
inline |
Return the MAC header length.
This equals the offset from the MAC header pointer to the network header pointer.
|
inline |
Return the packet's length starting from its MAC header pointer.
|
inline |
Set the MAC header pointer.
| p | new header pointer |
|
inline |
Set the MAC and network header pointers.
| p | new MAC header pointer |
| len | new MAC header length |
|
inline |
Unset the MAC header pointer.
|
inline |
Return true iff the packet's network header pointer is set.
|
inline |
Return the packet's network header pointer.
|
inline |
Return the offset from the packet data to the network header.
|
inline |
Return the network header length.
This equals the offset from the network header pointer to the transport header pointer.
|
inline |
Return the packet's length starting from its network header pointer.
|
inline |
Set the network header.
| p | new network header pointer |
|
inline |
Set the network and transport header pointers.
| p | new network header pointer |
| len | new network header length |
|
inline |
Set the network header length.
| len | new network header length |
Setting the network header length really just sets the transport header pointer.
|
inline |
Unset the network header pointer.
|
inline |
Set the transport header.
| p | new transport header pointer |
|
inline |
Return true iff the packet's transport header pointer is set.
|
inline |
Return the packet's transport header pointer.
|
inline |
Return the offset from the packet data to the transport header.
|
inline |
Return the packet's length starting from its transport header pointer.
|
inline |
Unset the transport header pointer.
|
inline |
Return the packet's MAC header pointer as Ethernet.
|
inline |
Set the MAC header pointer to an Ethernet header.
| ethh | new Ethernet header pointer |
|
inline |
Return the packet's network header pointer as IPv4.
|
inline |
Return the offset from the packet data to the IP header.
|
inline |
Return the IP header length.
This equals the offset from the network header pointer to the transport header pointer.
|
inline |
Set the network header pointer to an IPv4 header.
| iph | new IP header pointer |
| len | new IP header length in bytes |
|
inline |
Return the packet's network header pointer as IPv6.
|
inline |
Return the offset from the packet data to the IPv6 header.
|
inline |
Return the IPv6 header length.
This equals the offset from the network header pointer to the transport header pointer.
|
inline |
Set the network header pointer to an IPv6 header.
| ip6h | new IP header pointer |
|
inline |
Set the network header pointer to an IPv6 header.
| ip6h | new IP header pointer |
| len | new IP header length in bytes |
|
inline |
Return the packet's transport header pointer as ICMP.
|
inline |
Return the packet's transport header pointer as TCP.
|
inline |
Return the packet's transport header pointer as UDP.
|
inline |
Return the timestamp annotation.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Set the timestamp annotation.
| t | new timestamp |
|
inline |
Return the device annotation.
|
inline |
Set the device annotation.
|
inline |
Return the packet type annotation.
|
inline |
Set the packet type annotation.
|
inline |
Return the next packet annotation.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Set the next packet annotation.
|
inline |
Return the previous packet annotation.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Set the previous packet annotation.
|
inline |
Return the destination IPv4 address annotation.
The value is taken from the address annotation area.
|
inline |
Set the destination IPv4 address annotation.
The value is stored in the address annotation area.
|
inline |
Return a pointer to the annotation area.
The area is anno_size bytes long.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Return a pointer to the annotation area as uint8_ts.
|
inline |
overload
|
inline |
Return a pointer to the annotation area as uint32_ts.
|
inline |
overload
|
inline |
Return annotation byte at offset i.
|
inline |
Set annotation byte at offset i.
| i | annotation offset in bytes |
| x | value |
|
inline |
Return 16-bit annotation at offset i.
Affects annotation bytes [i, i+1].
|
inline |
Set 16-bit annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects annotation bytes [i, i+1].
|
inline |
Return 16-bit annotation at offset i.
Affects annotation bytes [i, i+1].
|
inline |
Set 16-bit annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects annotation bytes [i, i+1].
|
inline |
Return 32-bit annotation at offset i.
Affects user annotation bytes [i, i+3].
|
inline |
Set 32-bit annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects user annotation bytes [i, i+3].
|
inline |
Return 32-bit annotation at offset i.
Affects user annotation bytes [4*i, 4*i+3].
|
inline |
Set 32-bit annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects user annotation bytes [i, i+3].
|
inline |
Return 64-bit annotation at offset i.
Affects user annotation bytes [i, i+7].
|
inline |
Set 64-bit annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects user annotation bytes [i, i+7].
|
inline |
Return void * sized annotation at offset i.
Affects user annotation bytes [i, i+sizeof(void *)].
|
inline |
Set void * sized annotation at offset i.
| i | annotation offset in bytes |
| x | value |
Affects user annotation bytes [i, i+sizeof(void *)].
|
inline |
Clear all packet annotations.
| all | If true, clear all annotations. If false, clear only Click's internal annotations. |
All user annotations and the address annotation are set to zero, the packet type annotation is set to HOST, the device annotation and all header pointers are set to null, the timestamp annotation is cleared, and the next/prev-packet annotations are set to null.
If all is false, then the packet type, device, timestamp, header, and next/prev-packet annotations are left alone.
|
inline |
Copy most packet annotations from p.
| p | source of annotations |
This packet's user annotations, address annotation, packet type annotation, device annotation, and timestamp annotation are set to the corresponding annotations from p.