gnrc_tcp_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 
20 #ifndef GNRC_TCP_PKT_H
21 #define GNRC_TCP_PKT_H
22 
23 #include <stdint.h>
24 #include "net/gnrc.h"
25 #include "net/gnrc/tcp/tcb.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
44  gnrc_pktsnip_t *in_pkt);
45 
62  uint16_t *seq_con, const uint16_t ctl,
63  const uint32_t seq_num, const uint32_t ack_num,
64  void *payload, const size_t payload_len);
65 
78  const uint16_t seq_con, const bool retransmit);
79 
90 int _gnrc_tcp_pkt_chk_seq_num(const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num,
91  const uint32_t seg_len);
92 
101 
110 
123  const bool retransmit);
124 
134 int _gnrc_tcp_pkt_acknowledge(gnrc_tcp_tcb_t *tcb, const uint32_t ack);
135 
146 uint16_t _gnrc_tcp_pkt_calc_csum(const gnrc_pktsnip_t *hdr,
147  const gnrc_pktsnip_t *pseudo_hdr,
148  const gnrc_pktsnip_t *payload);
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* GNRC_TCP_PKT_H */
155 
gnrc.h
Includes all essential GNRC network stack base modules.
_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.
_gnrc_tcp_pkt_calc_csum
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.
_gnrc_tcp_pkt_get_seg_len
uint32_t _gnrc_tcp_pkt_get_seg_len(gnrc_pktsnip_t *pkt)
Extracts the length of a segment.
_transmission_control_block
Transmission control block of GNRC TCP.
Definition: tcb.h:45
_gnrc_tcp_pkt_get_pay_len
uint32_t _gnrc_tcp_pkt_get_pay_len(gnrc_pktsnip_t *pkt)
Calculates a packets payload length.
_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.
_gnrc_tcp_pkt_send
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.
_gnrc_tcp_pkt_setup_retransmit
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.
_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.
tcb.h
GNRC TCP transmission control block (TCB)
_gnrc_tcp_pkt_build_reset_from_pkt
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.
gnrc_pktsnip
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108