TCP packet handling declarations.
More...
TCP packet handling declarations.
- Author
- Simon Brummer simon.nosp@m..bru.nosp@m.mmer@.nosp@m.post.nosp@m.eo.de
Definition in file gnrc_tcp_pkt.h.
#include <stdint.h>
#include "net/gnrc.h"
#include "net/gnrc/tcp/tcb.h"
Go to the source code of this file.
int | _gnrc_tcp_pkt_build_reset_from_pkt (gnrc_pktsnip_t **out_pkt, gnrc_pktsnip_t *in_pkt) |
| Build a reset packet from an incoming packet. More...
|
|
int | _gnrc_tcp_pkt_build (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t **out_pkt, uint16_t *seq_con, const uint16_t ctl, const uint32_t seq_num, const uint32_t ack_num, void *payload, const size_t payload_len) |
| Build and allocate a TCB packet, TCB stores pointer to new packet. More...
|
|
int | _gnrc_tcp_pkt_send (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *out_pkt, const uint16_t seq_con, const bool retransmit) |
| Sends packet to peer. More...
|
|
int | _gnrc_tcp_pkt_chk_seq_num (const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num, const uint32_t seg_len) |
| Verify sequence number. More...
|
|
uint32_t | _gnrc_tcp_pkt_get_seg_len (gnrc_pktsnip_t *pkt) |
| Extracts the length of a segment. More...
|
|
uint32_t | _gnrc_tcp_pkt_get_pay_len (gnrc_pktsnip_t *pkt) |
| Calculates a packets payload length. More...
|
|
int | _gnrc_tcp_pkt_setup_retransmit (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *pkt, const bool retransmit) |
| Adds a packet to the retransmission mechanism. More...
|
|
int | _gnrc_tcp_pkt_acknowledge (gnrc_tcp_tcb_t *tcb, const uint32_t ack) |
| Acknowledges and removes packet from the retransmission mechanism. More...
|
|
uint16_t | _gnrc_tcp_pkt_calc_csum (const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr, const gnrc_pktsnip_t *payload) |
| Calculates checksum over payload, TCP header and network layer header. More...
|
|
◆ _gnrc_tcp_pkt_acknowledge()
int _gnrc_tcp_pkt_acknowledge |
( |
gnrc_tcp_tcb_t * |
tcb, |
|
|
const uint32_t |
ack |
|
) |
| |
Acknowledges and removes packet from the retransmission mechanism.
- Parameters
-
[in,out] | tcb | TCB holding the connection information. |
[in] | ack | Acknowldegment number used to acknowledge packets. |
- Returns
- Zero on success. -ENODATA if there is nothing to acknowledge.
◆ _gnrc_tcp_pkt_build()
int _gnrc_tcp_pkt_build |
( |
gnrc_tcp_tcb_t * |
tcb, |
|
|
gnrc_pktsnip_t ** |
out_pkt, |
|
|
uint16_t * |
seq_con, |
|
|
const uint16_t |
ctl, |
|
|
const uint32_t |
seq_num, |
|
|
const uint32_t |
ack_num, |
|
|
void * |
payload, |
|
|
const size_t |
payload_len |
|
) |
| |
Build and allocate a TCB packet, TCB stores pointer to new packet.
- Parameters
-
[in,out] | tcb | TCB holding the connection information. |
[out] | out_pkt | Pointer to packet to build. |
[out] | seq_con | Sequence number consumption of built packet. |
[in] | ctl | Control bits to set in out_pkt . |
[in] | seq_num | Sequence number of the new packet. |
[in] | ack_num | Acknowledgment number of the new packet. |
[in] | payload | Pointer to payload buffer. |
[in] | payload_len | Payload size. |
- Returns
- Zero on success. -ENOMEM if pktbuf is full.
◆ _gnrc_tcp_pkt_build_reset_from_pkt()
Build a reset packet from an incoming packet.
- Note
- This function builds a reset from an incoming packet in cases where the connection has not been established.
- Parameters
-
[out] | out_pkt | Outgoing reset packet |
[in] | in_pkt | Incoming packet |
- Returns
- Zero on success -ENOMEM if pktbuf is full.
◆ _gnrc_tcp_pkt_calc_csum()
Calculates checksum over payload, TCP header and network layer header.
- Parameters
-
[in] | hdr | Gnrc_pktsnip_t to TCP header. |
[in] | pseudo_hdr | Gnrc_pktsnip_t to network layer header. |
[in] | payload | Gnrc_pktsnip_t to payload. |
- Returns
- Non-zero checksum if given network layer is supported. Zero if given network layer is not supported.
◆ _gnrc_tcp_pkt_chk_seq_num()
int _gnrc_tcp_pkt_chk_seq_num |
( |
const gnrc_tcp_tcb_t * |
tcb, |
|
|
const uint32_t |
seq_num, |
|
|
const uint32_t |
seg_len |
|
) |
| |
Verify sequence number.
- Parameters
-
[in,out] | tcb | TCB holding the connection information. |
[in] | seq_num | Sequence number from the segment. |
[in] | seg_len | Length of a segments payload. |
- Returns
- Zero if the sequence number is acceptable. Negative value if the sequence number is not acceptable.
◆ _gnrc_tcp_pkt_get_pay_len()
Calculates a packets payload length.
- Parameters
-
[in] | pkt | Packet to calculate payload length. |
- Returns
- The packets payload length in bytes.
◆ _gnrc_tcp_pkt_get_seg_len()
Extracts the length of a segment.
- Parameters
-
[in] | pkt | Packet to calculate the segments length. |
- Returns
- Segments length in bytes (== sequence number consumption).
◆ _gnrc_tcp_pkt_send()
Sends packet to peer.
- Parameters
-
[in,out] | tcb | TCB holding the connection information. |
[in] | out_pkt | Pointer to packet to send. |
[in] | seq_con | Sequence number consumption of the packet to send. |
[in] | retransmit | Flag so mark that packet this is a retransmission. |
- Returns
- Zero on success. -EINVAL if out_pkt was NULL.
◆ _gnrc_tcp_pkt_setup_retransmit()
Adds a packet to the retransmission mechanism.
- Parameters
-
[in,out] | tcb | TCB holding the connection information. |
[in] | pkt | Packet to add to the retransmission mechanism. |
[in] | retransmit | Flag used to indicate that pkt is a retransmit. |
- Returns
- Zero on success. -ENOMEM if the retransmission queue is full. -EINVAL if pkt is null.