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 
9 #pragma once
10 
22 #include <stdint.h>
23 #include "net/gnrc.h"
24 #include "net/gnrc/tcp/tcb.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
43  gnrc_pktsnip_t *in_pkt);
44 
61  uint16_t *seq_con, const uint16_t ctl,
62  const uint32_t seq_num, const uint32_t ack_num,
63  void *payload, const size_t payload_len);
64 
77  const uint16_t seq_con, const bool retransmit);
78 
89 int _gnrc_tcp_pkt_chk_seq_num(const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num,
90  const uint32_t seg_len);
91 
100 
109 
122  const bool retransmit);
123 
133 int _gnrc_tcp_pkt_acknowledge(gnrc_tcp_tcb_t *tcb, const uint32_t ack);
134 
146  const gnrc_pktsnip_t *pseudo_hdr,
147  const gnrc_pktsnip_t *payload);
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
Includes all essential GNRC network stack base modules.
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.
uint32_t _gnrc_tcp_pkt_get_pay_len(gnrc_pktsnip_t *pkt)
Calculates a packets payload length.
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.
int _gnrc_tcp_pkt_acknowledge(gnrc_tcp_tcb_t *tcb, const uint32_t ack)
Acknowledges and removes packet from the retransmission mechanism.
uint32_t _gnrc_tcp_pkt_get_seg_len(gnrc_pktsnip_t *pkt)
Extracts the length of a segment.
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.
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.
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.
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.
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
TCP sock type.
Definition: sock_types.h:101
GNRC TCP transmission control block (TCB)