This class provides several methods that can be used by elements that inherits from it to manage TCP packets.
More...
|
|
WritablePacket * | forgeRst (Packet *packet) |
| |
| WritablePacket * | forgePacket (uint32_t saddr, uint32_t daddr, uint16_t sport, uint16_t dport, tcp_seq_t seq, tcp_seq_t ack, uint16_t winSize, uint8_t flags, uint32_t contentSize=0) const |
| | Create a TCP packet.
|
| |
| uint16_t | getDestinationPort (Packet *packet) const |
| | Return the destination port of a packet.
|
| |
| uint16_t | getSourcePort (Packet *packet) const |
| | Return the source port of a packet.
|
| |
| tcp_seq_t | getNextSequenceNumber (Packet *packet) const |
| | Return the sequence number of the packet that will be received after the given one.
|
| |
| uint16_t | getWindowSize (Packet *packet) const |
| | Return the window size set in the header of a packet.
|
| |
| void | setWindowSize (WritablePacket *packet, uint16_t winSize) const |
| | Set the window size in the TCP header of a packet.
|
| |
| unsigned char * | getPayload (WritablePacket *packet) const |
| | Return the payload of a TCP packet.
|
| |
| const unsigned char * | getPayloadConst (Packet *packet) const |
| | Return the payload of a TCP packet.
|
| |
| uint16_t | getPayloadOffset (Packet *packet) const |
| | Return the offset of the payload in a TCP packet.
|
| |
| void | setPayload (WritablePacket *packet, const unsigned char *payload, uint32_t length) const |
| | Set the payload of a TCP packet.
|
| |
| void | setSequenceNumber (WritablePacket *packet, tcp_seq_t seq) const |
| | Set the sequence number of a TCP packet.
|
| |
| void | setAckNumber (WritablePacket *packet, tcp_seq_t ack) const |
| | Set the ack number of a TCP packet.
|
| |
| uint8_t | getFlags (Packet *packet) const |
| | Return the flags of a TCP packet.
|
| |
| uint16_t | packetTotalLength (Packet *packet) const |
| | Return the length of the IP packet, obtained from the header.
|
| |
| uint16_t | getIPHeaderOffset (Packet *packet) const |
| | Return the offset in the packet at which the IP header starts.
|
| |
| void | setPacketTotalLength (WritablePacket *packet, unsigned length) const |
| | Set the length of the IP packet in the header.
|
| |
| uint32_t | getDestinationAddress (Packet *packet) const |
| | Return the IP destination address of the packet.
|
| |
| uint32_t | getSourceAddress (Packet *packet) const |
| | Return the IP source address of the packet.
|
| |
| void | computeIPChecksum (WritablePacket *packet) const |
| | Recompute the IP checksum of the packet and set it in the IP header.
|
| |
| void | rewrite_ipport (WritablePacket *p, IPAddress ip, uint16_t port, const int shift, bool is_tcp) |
| |
|
| static tcp_seq_t | getSequenceNumber (Packet *packet) |
| | Return the sequence number of a packet.
|
| |
| static tcp_seq_t | getAckNumber (Packet *packet) |
| | Return the ack number of a packet.
|
| |
| static bool | isTCP (Packet *packet) |
| | Indicate whether a packet is a TCP packet.
|
| |
| static bool | isSyn (Packet *packet) |
| | Indicate whether a packet is a SYN packet.
|
| |
| static bool | isFin (Packet *packet) |
| | Indicate whether a packet is a FIN packet.
|
| |
| static bool | isRst (Packet *packet) |
| | Indicate whether a packet is a RST packet.
|
| |
| static bool | isAck (Packet *packet) |
| | Indicate whether a packet is an ACK packet.
|
| |
| static bool | checkFlag (Packet *packet, uint8_t flag) |
| | Check if a given flag is set in a packet.
|
| |
| static unsigned | getPayloadLength (Packet *packet) |
| | Return the length of the TCP payload of a packet.
|
| |
| static bool | isJustAnAck (Packet *packet, const bool or_fin=false) |
| | Indicate whether the packet is just an ACK without any additional information.
|
| |
| static void | computeTCPChecksum (WritablePacket *packet) |
| | Compute the TCP checksum of a packet and set it in its header.
|
| |
| static void | resetTCPChecksum (WritablePacket *packet) |
| | Reset the TCP checksum of a packet and set it in its header.
|
| |
|
static int | iterateOptions (Packet *packet, std::function< bool(uint8_t, void *)> fnt) |
| |
|
static void | printPacket (Packet *p) |
| |
This class provides several methods that can be used by elements that inherits from it to manage TCP packets.