The friendly Operating System for the Internet of Things
conn/tcp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
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 
21 #ifndef NET_CONN_TCP_H
22 #define NET_CONN_TCP_H
23 
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #ifdef MODULE_GNRC_CONN_TCP
28 #include "net/gnrc/conn.h"
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
38 struct conn_tcp;
39 
43 typedef struct conn_tcp conn_tcp_t;
44 
59 int conn_tcp_create(conn_tcp_t *conn, const void *addr, size_t addr_len, int family,
60  uint16_t port);
61 
67 void conn_tcp_close(conn_tcp_t *conn);
68 
82 int conn_tcp_getlocaladdr(conn_tcp_t *conn, void *addr, uint16_t *port);
83 
97 int conn_tcp_getpeeraddr(conn_tcp_t *conn, void *addr, uint16_t *port);
98 
111 int conn_tcp_connect(conn_tcp_t *conn, const void *addr, size_t addr_len, uint16_t port);
112 
126 int conn_tcp_listen(conn_tcp_t *conn, int queue_len);
127 
138 int conn_tcp_accept(conn_tcp_t *conn, conn_tcp_t *out_conn);
139 
155 int conn_tcp_recv(conn_tcp_t *conn, void *data, size_t max_len);
156 
171 int conn_tcp_send(conn_tcp_t *conn, const void *data, size_t len);
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif /* NET_CONN_TCP_H */
178 
void conn_tcp_close(conn_tcp_t *conn)
Closes a TCP connection.
int conn_tcp_getpeeraddr(conn_tcp_t *conn, void *addr, uint16_t *port)
Gets the address of the connected peer of a TCP connection.
int conn_tcp_connect(conn_tcp_t *conn, const void *addr, size_t addr_len, uint16_t port)
Connects to a remote TCP peer.
struct conn_tcp conn_tcp_t
Implementation-specific type of a TCP connection object.
Definition: conn/tcp.h:43
int conn_tcp_accept(conn_tcp_t *conn, conn_tcp_t *out_conn)
Receives and handles TCP connection requests from other peers.
int conn_tcp_send(conn_tcp_t *conn, const void *data, size_t len)
Sends a TCP message.
int conn_tcp_listen(conn_tcp_t *conn, int queue_len)
Marks connection to listen for a connection request by a remote TCP peer.
GNRC-specific types and function definitions.
int conn_tcp_create(conn_tcp_t *conn, const void *addr, size_t addr_len, int family, uint16_t port)
Creates a new TCP connection object.
stdlib.h wrapper for MSP430
int conn_tcp_getlocaladdr(conn_tcp_t *conn, void *addr, uint16_t *port)
Gets the local address of a TCP connection.
int conn_tcp_recv(conn_tcp_t *conn, void *data, size_t max_len)
Receives a TCP message.