Defines | Functions
dn_tcp.h File Reference

TCP API file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _DN_EXP_TCP

Functions

_DN_EXP_TCP HRESULT tcp_accept (int sock, int *client)
 TCP server accepts a TCP client.
_DN_EXP_TCP HRESULT tcp_clear (int sock, uint32_t timeout)
 Clears the received buffer.
_DN_EXP_TCP HRESULT tcp_close (int *sock)
 Closes the socket.
_DN_EXP_TCP HRESULT tcp_open_client (void *param, int *sock)
 Opens TCP client.
_DN_EXP_TCP HRESULT tcp_open_server (void *param, int *sock)
 Opens TCP server.
_DN_EXP_TCP HRESULT tcp_recv (int sock, char *buf, uint32_t len_buf, uint32_t *len_recved, uint32_t timeout, void *arg)
 Receives TCP packet.
_DN_EXP_TCP HRESULT tcp_send (int sock, const char *buf, uint32_t len_buf, void *arg)
 Sends TCP packet.
_DN_EXP_TCP HRESULT tcp_set_keepalive (int sock, int enable, uint32_t idle, uint32_t interval, uint32_t count)
 Sets keep alive option.
_DN_EXP_TCP HRESULT tcp_set_nodelay (int sock, int enable)
 Sets no delay option.
_DN_EXP_TCP HRESULT tcp_set_timeout (int sock, uint32_t timeout)
 Sets timeout value to the TCP socket.

Detailed Description

TCP API file.

Defines TCP APIs.

Version:
1.1
Date:
2014/11/06
2016/12/15 Adds connection timeout function for tcp_open_client.
Author:
DENSO WAVE

Software License Agreement (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file dn_tcp.h.


Define Documentation

#define _DN_EXP_TCP

Definition at line 38 of file dn_tcp.h.


Function Documentation

HRESULT tcp_accept ( int  sock,
int *  client 
)

TCP server accepts a TCP client.

Parameters:
[in]sockThe TCP server socket.
[out]clientThe socket of the accepted TCP client.
Note:
This function is not thread safe.
Must take mutex among socket_open, socket_close and tcp_accept.

Definition at line 448 of file dn_tcp.c.

HRESULT tcp_clear ( int  sock,
uint32_t  timeout 
)

Clears the received buffer.

Parameters:
[in]sockThe socket to be cleared.
[in]timeoutTimeout value.

Definition at line 417 of file dn_tcp.c.

HRESULT tcp_close ( int *  sock)

Closes the socket.

Parameters:
[in,out]sockThe socket to be closed.

Definition at line 305 of file dn_tcp.c.

HRESULT tcp_open_client ( void *  param,
int *  sock 
)

Opens TCP client.

Parameters:
[in]paramThe pointer of Ethernet connection parameters: CONN_PARAM_ETH.
[out]sockThe created socket.

Definition at line 107 of file dn_tcp.c.

HRESULT tcp_open_server ( void *  param,
int *  sock 
)

Opens TCP server.

Parameters:
[in]paramThe pointer of Ethernet connection parameters: CONN_PARAM_ETH.
[out]sockThe created socket.

Definition at line 254 of file dn_tcp.c.

HRESULT tcp_recv ( int  sock,
char *  buf,
uint32_t  len_buf,
uint32_t len_recved,
uint32_t  timeout,
void *  arg 
)

Receives TCP packet.

Parameters:
[in]sockThe socket to receive.
[out]bufThe buffer to be received.
[in]len_bufThe allocated size of received buffer.
[out]len_recvedThe size of received buffer.
[in]argSpecial parameter: int.

Definition at line 364 of file dn_tcp.c.

HRESULT tcp_send ( int  sock,
const char *  buf,
uint32_t  len_buf,
void *  arg 
)

Sends TCP packet.

Parameters:
[in]sockThe socket to send.
[in]bufThe buffer to be sent.
[in]len_bufThe size of sent buffer.
[in]argSpecial parameter: int.

Definition at line 319 of file dn_tcp.c.

HRESULT tcp_set_keepalive ( int  sock,
int  enable,
uint32_t  idle,
uint32_t  interval,
uint32_t  count 
)

Sets keep alive option.

Parameters:
[in]sockThe TCP socket.
[in]enableEnable option. 0: disable, 1: enable.
[in]idleIdle time until sending keep alive packet.
[in]intervalInterval time between keep alive packet.
[in]countThe number of sending keep alive packet.

Definition at line 485 of file dn_tcp.c.

HRESULT tcp_set_nodelay ( int  sock,
int  enable 
)

Sets no delay option.

Parameters:
[in]sockThe TCP socket.
[in]enableEnable option. 0: disable, 1: enable.

Definition at line 500 of file dn_tcp.c.

HRESULT tcp_set_timeout ( int  sock,
uint32_t  timeout 
)

Sets timeout value to the TCP socket.

Parameters:
[in]sockThe socket to be set.
[in]timeoutTimeout value.

Definition at line 405 of file dn_tcp.c.



bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Thu Jun 6 2019 21:00:03