gnrc/tcp.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_H
23 #define GNRC_TCP_H
24 
25 #include <stdint.h>
26 #include "net/gnrc/pkt.h"
27 #include "net/gnrc/tcp/tcb.h"
28 
29 #ifdef MODULE_GNRC_IPV6
30 #include "net/gnrc/ipv6.h"
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
45 int gnrc_tcp_init(void);
46 
54 
83 int gnrc_tcp_open_active(gnrc_tcp_tcb_t *tcb, const uint8_t address_family,
84  const uint8_t *target_addr, const uint16_t target_port,
85  const uint16_t local_port);
86 
112 int gnrc_tcp_open_passive(gnrc_tcp_tcb_t *tcb, const uint8_t address_family,
113  const uint8_t *local_addr, const uint16_t local_port);
114 
138 ssize_t gnrc_tcp_send(gnrc_tcp_tcb_t *tcb, const void *data, const size_t len,
139  const uint32_t user_timeout_duration_us);
140 
167 ssize_t gnrc_tcp_recv(gnrc_tcp_tcb_t *tcb, void *data, const size_t max_len,
168  const uint32_t user_timeout_duration_us);
169 
181 
193 int gnrc_tcp_calc_csum(const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr);
194 
206 gnrc_pktsnip_t *gnrc_tcp_hdr_build(gnrc_pktsnip_t *payload, uint16_t src, uint16_t dst);
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* GNRC_TCP_H */
213 
GNRC TCP transmission control block.
General definitions for network packets and their helper functions.
gnrc_pktsnip_t * gnrc_tcp_hdr_build(gnrc_pktsnip_t *payload, uint16_t src, uint16_t dst)
Adds a tcp header to a given payload.
void gnrc_tcp_tcb_init(gnrc_tcp_tcb_t *tcb)
Initialize Transmission Control Block (tcb)
transmission control block of gnrc_tcp
Definition: tcb.h:50
ssize_t gnrc_tcp_recv(gnrc_tcp_tcb_t *tcb, void *data, const size_t max_len, const uint32_t user_timeout_duration_us)
Receive Data from the Peer.
Definitions for GNRC's IPv6 implementation.
int gnrc_tcp_open_passive(gnrc_tcp_tcb_t *tcb, const uint8_t address_family, const uint8_t *local_addr, const uint16_t local_port)
Opens a connection passively, by waiting for an incomming request.
int gnrc_tcp_init(void)
Initialize and start TCP.
ssize_t gnrc_tcp_send(gnrc_tcp_tcb_t *tcb, const void *data, const size_t len, const uint32_t user_timeout_duration_us)
Transmit Data to Peer.
Type to represent parts (either headers or payload) of a packet, called snips.
int gnrc_tcp_close(gnrc_tcp_tcb_t *tcb)
Close a tcp connection.
int gnrc_tcp_calc_csum(const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr)
Set checksum calculated from tcp and network-layer header in tcp-header.
int gnrc_tcp_open_active(gnrc_tcp_tcb_t *tcb, const uint8_t address_family, const uint8_t *target_addr, const uint16_t target_port, const uint16_t local_port)
Opens a connection actively.