sock/tcp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Alexander Aring <aar@pengutronix.de>
3  * Freie Universit├Ąt Berlin
4  * HAW Hamburg
5  * Kaspar Schleiser <kaspar@schleiser.de>
6  *
7  * This file is subject to the terms and conditions of the GNU Lesser
8  * General Public License v2.1. See the file LICENSE in the top level
9  * directory for more details.
10  */
11 
299 #ifndef NET_SOCK_TCP_H
300 #define NET_SOCK_TCP_H
301 
302 #include <stdint.h>
303 #include <stdlib.h>
304 #include <sys/types.h>
305 
306 #include "net/sock.h"
307 
308 #ifdef __cplusplus
309 extern "C" {
310 #endif
311 
312 typedef struct _sock_tl_ep sock_tcp_ep_t;
320 typedef struct sock_tcp sock_tcp_t;
321 
328 typedef struct sock_tcp_queue sock_tcp_queue_t;
329 
360 int sock_tcp_connect(sock_tcp_t *sock, const sock_tcp_ep_t *remote,
361  uint16_t local_port, uint16_t flags);
362 
386 int sock_tcp_listen(sock_tcp_queue_t *queue, const sock_tcp_ep_t *local,
387  sock_tcp_t *queue_array, unsigned queue_len,
388  uint16_t flags);
389 
399 void sock_tcp_disconnect(sock_tcp_t *sock);
400 
409 
422 
435 
448 
474 int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock,
475  uint32_t timeout);
476 
506 ssize_t sock_tcp_read(sock_tcp_t *sock, void *data, size_t max_len,
507  uint32_t timeout);
508 
529 ssize_t sock_tcp_write(sock_tcp_t *sock, const void *data, size_t len);
530 
531 #include "sock_types.h"
532 
533 #ifdef __cplusplus
534 }
535 #endif
536 
537 #endif /* NET_SOCK_TCP_H */
538 
void sock_tcp_stop_listen(sock_tcp_queue_t *queue)
Stops listening on TCP listening queue.
ssize_t sock_tcp_read(sock_tcp_t *sock, void *data, size_t max_len, uint32_t timeout)
Reads data from an established TCP stream.
int sock_tcp_get_local(sock_tcp_t *sock, sock_tcp_ep_t *ep)
Gets the local end point of a TCP sock object.
void sock_tcp_disconnect(sock_tcp_t *sock)
Disconnects a TCP connection.
struct sock_tcp sock_tcp_t
Type for a TCP sock object.
Definition: sock/tcp.h:320
int sock_tcp_get_remote(sock_tcp_t *sock, sock_tcp_ep_t *ep)
Gets the remote end point of a TCP sock object.
GNRC-specific types and function definitions.
Common IP-based transport layer end point.
Definition: sock.h:195
Common sock API definitions.
int sock_tcp_listen(sock_tcp_queue_t *queue, const sock_tcp_ep_t *local, sock_tcp_t *queue_array, unsigned queue_len, uint16_t flags)
Listen for an incoming connection request on local end point.
ssize_t sock_tcp_write(sock_tcp_t *sock, const void *data, size_t len)
Writes data to an established TCP stream.
stdlib.h wrapper for MSP430
int sock_tcp_connect(sock_tcp_t *sock, const sock_tcp_ep_t *remote, uint16_t local_port, uint16_t flags)
Establishes a new TCP sock connection.
int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock, uint32_t timeout)
Receives and handles TCP connection requests from other peers.
struct sock_tcp_queue sock_tcp_queue_t
Type for a TCP listening queue.
Definition: sock/tcp.h:328
int sock_tcp_queue_get_local(sock_tcp_queue_t *queue, sock_tcp_ep_t *ep)
Gets the local end point of a TCP sock queue object.