The friendly Operating System for the Internet of Things
net/gnrc/transport_layer/tcp/internal/pkt.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2017 Simon Brummer
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef GNRC_TCP_INTERNAL_PKT_H
23 #define GNRC_TCP_INTERNAL_PKT_H
24 
25 #include <stdint.h>
26 #include "net/gnrc/pkt.h"
27 #include "net/gnrc/tcp/tcb.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
46 
62 int _pkt_build(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t **out_pkt, uint16_t *seq_con,
63  const uint16_t ctl, const uint32_t seq_num, const uint32_t ack_num,
64  void *payload, const size_t payload_len);
65 
77 int _pkt_send(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *out_pkt, const uint16_t seq_con,
78  const bool retransmit);
79 
90 int _pkt_chk_seq_num(const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num, const uint32_t seg_len);
91 
99 uint32_t _pkt_get_seg_len(gnrc_pktsnip_t *pkt);
100 
108 uint32_t _pkt_get_pay_len(gnrc_pktsnip_t *pkt);
109 
121 int _pkt_setup_retransmit(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *pkt, const bool retransmit);
122 
132 int _pkt_acknowledge(gnrc_tcp_tcb_t *tcb, const uint32_t ack);
133 
144 uint16_t _pkt_calc_csum(const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr,
145  const gnrc_pktsnip_t *payload);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* GNRC_TCP_INTERNAL_PKT_H */
152 
int _pkt_setup_retransmit(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *pkt, const bool retransmit)
Adds a paket to the retransmission mechanism.
GNRC TCP transmission control block.
int _pkt_acknowledge(gnrc_tcp_tcb_t *tcb, const uint32_t ack)
Acknowledges and removes packet from the retransmission mechanism.
General definitions for network packets and their helper functions.
uint32_t _pkt_get_pay_len(gnrc_pktsnip_t *pkt)
Calculates a segments payload length.
int _pkt_chk_seq_num(const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num, const uint32_t seg_len)
Checks sequence number.
int _pkt_send(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *out_pkt, const uint16_t seq_con, const bool retransmit)
Sends a packet to the peer.
transmission control block of gnrc_tcp
Definition: tcb.h:50
uint16_t _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.
int _pkt_build_reset_from_pkt(gnrc_pktsnip_t **out_pkt, gnrc_pktsnip_t *in_pkt)
Build a reset packet from an incomming packet.
uint32_t _pkt_get_seg_len(gnrc_pktsnip_t *pkt)
Extracts the length of a segment.
Type to represent parts (either headers or payload) of a packet, called snips.
int _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 tcp paket, tcb stores pointer to new paket.