net/gnrc/transport_layer/tcp/internal/pkt.h¶
TCP paket handling declarations.
-
int
_pkt_build_reset_from_pkt
(include/net/gnrc/pkt.h::gnrc_pktsnip_t
** out_pkt,include/net/gnrc/pkt.h::gnrc_pktsnip_t
* in_pkt)¶ Build a reset packet from an incomming packet.
Note
This function builds a reset from an incomming packet in cases where the connection has not been established.
Parameters
out_pkt: Outgoing reset packet in_pkt: Incomming packet Return values
- Zero on success -ENOMEM if pktbuf is full.
-
int
_pkt_build
(tcb.h::gnrc_tcp_tcb_t
* tcb,include/net/gnrc/pkt.h::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, constmsp430_types.h::size_t
payload_len)¶ Build and allocate a TCB paket, TCB stores pointer to new paket.
Parameters
tcb: TCB holding the connection information. out_pkt: Pointer to paket to build. seq_con: Sequence number consumption of built packet. ctl: Control bits to set in out_pkt
.seq_num: Sequence number of the new packet. ack_num: Acknowledgment number of the new packet. payload: Pointer to payload buffer. payload_len: Payload size. Return values
- Zero on success. -ENOMEM if pktbuf is full.
-
int
_pkt_send
(tcb.h::gnrc_tcp_tcb_t
* tcb,include/net/gnrc/pkt.h::gnrc_pktsnip_t
* out_pkt, const uint16_t seq_con, const bool retransmit)¶ Sends packet to peer.
Parameters
tcb: TCB holding the connection information. out_pkt: Pointer to paket to send. seq_con: Sequence number consumption of the packet to send. retransmit: Flag so mark that packet this is a retransmission. Return values
- Zero on success. -EINVAL if out_pkt was NULL.
-
int
_pkt_chk_seq_num
(consttcb.h::gnrc_tcp_tcb_t
* tcb, const uint32_t seq_num, const uint32_t seg_len)¶ Verify sequence number.
Parameters
tcb: TCB holding the connection information. seq_num: Sequence number from the segment. seg_len: Length of a segments payload. Return values
- Zero if the sequence number is acceptable. Negative value if the sequence number is not acceptable.
-
uint32_t
_pkt_get_seg_len
(include/net/gnrc/pkt.h::gnrc_pktsnip_t
* pkt)¶ Extracts the length of a segment.
Parameters
pkt: Packet to calculate the segments length. Return values
- Segments length in bytes (== sequence number consumption).
-
uint32_t
_pkt_get_pay_len
(include/net/gnrc/pkt.h::gnrc_pktsnip_t
* pkt)¶ Calculates a packets payload length.
Parameters
pkt: Packet to calculate payload length. Return values
- The packets payload length in bytes.
-
int
_pkt_setup_retransmit
(tcb.h::gnrc_tcp_tcb_t
* tcb,include/net/gnrc/pkt.h::gnrc_pktsnip_t
* pkt, const bool retransmit)¶ Adds a packet to the retransmission mechanism.
Parameters
tcb: TCB holding the connection information. pkt: Packet to add to the retransmission mechanism. retransmit: Flag used to indicate that pkt
is a retransmit.Return values
- Zero on success. -ENOMEM if the retransmission queue is full. -EINVAL if pkt is null.
-
int
_pkt_acknowledge
(tcb.h::gnrc_tcp_tcb_t
* tcb, const uint32_t ack)¶ Acknowledges and removes packet from the retransmission mechanism.
Parameters
tcb: TCB holding the connection information. ack: Acknowldegment number used to acknowledge packets. Return values
- Zero on success. -ENODATA if there is nothing to acknowledge.
-
uint16_t
_pkt_calc_csum
(constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t
* hdr, constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t
* pseudo_hdr, constinclude/net/gnrc/pkt.h::gnrc_pktsnip_t
* payload)¶ Calculates checksum over payload, TCP header and network layer header.
Parameters
hdr: Gnrc_pktsnip_t to TCP header. pseudo_hdr: Gnrc_pktsnip_t to network layer header. payload: Gnrc_pktsnip_t to payload. Return values
- Non-zero checksum if given network layer is supported. Zero if given network layer is not supported.