DriveWorks SDK Reference

| 0.6.67 Release

SocketClientServer.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2016 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
46 #ifndef DW_IPC_SOCKETCLIENTSERVER_H__
47 #define DW_IPC_SOCKETCLIENTSERVER_H__
48 
49 #include <dw/core/Config.h>
50 #include <dw/core/Context.h>
51 #include <dw/core/Exports.h>
52 #include <dw/core/Status.h>
53 #include <dw/core/Types.h>
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
60 typedef struct dwSocketServerObject *dwSocketServerHandle_t;
61 
63 typedef struct dwSocketClientObject *dwSocketClientHandle_t;
64 
66 typedef struct dwSocketConnectionObject *dwSocketConnectionHandle_t;
67 
81 dwStatus dwSocketServer_initialize(dwSocketServerHandle_t *server, uint16_t port, size_t connection_pool_size,
82  dwContextHandle_t context);
83 
97 dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t *connection, dwTime_t timeout_us,
98  dwSocketServerHandle_t server);
99 
112 dwStatus dwSocketServer_broadcast(const uint8_t *buffer, size_t buffer_size, dwSocketServerHandle_t server);
113 
123 dwStatus dwSocketServer_release(dwSocketServerHandle_t *server);
124 
136 dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *client, size_t connection_pool_size,
137  dwContextHandle_t context);
138 
155 dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t *connection, const char *server_ip, uint16_t port,
156  dwTime_t timeout_us, dwSocketClientHandle_t client);
157 
170 dwStatus dwSocketClient_broadcast(const uint8_t *buffer, size_t buffer_size, dwSocketClientHandle_t client);
171 
181 dwStatus dwSocketClient_release(dwSocketClientHandle_t *client);
182 
197 dwStatus dwSocketConnection_send(const uint8_t *buffer, size_t *buffer_size,
198  dwSocketConnectionHandle_t connection);
199 
214 dwStatus dwSocketConnection_peek(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection);
215 
230 dwStatus dwSocketConnection_peekNonBlock(uint8_t *buffer, size_t *buffer_size,
231  dwSocketConnectionHandle_t connection);
232 
247 dwStatus dwSocketConnection_recv(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection);
248 
263 dwStatus dwSocketConnection_recvNonBlock(uint8_t *buffer, size_t *buffer_size,
264  dwSocketConnectionHandle_t connection);
265 
275 dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t *connection);
276 
277 #ifdef __cplusplus
278 }
279 #endif
280 
283 #endif // DW_IPC_SOCKETCLIENTSERVER_H__
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwSocketClient_release(dwSocketClientHandle_t *client)
Terminate a socket client.
DW_API_PUBLIC dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t *connection, dwTime_t timeout_us, dwSocketServerHandle_t server)
Accepts an incoming connection at a socket server.
DW_API_PUBLIC dwStatus dwSocketServer_broadcast(const uint8_t *buffer, size_t buffer_size, dwSocketServerHandle_t server)
Broadcasts a message to all connected sockets of the pool.
DW_API_PUBLIC dwStatus dwSocketConnection_send(const uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection)
Send a message of a given length through the socket connection.
uint64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:89
NVIDIA DriveWorks API: Core Methods
DW_API_PUBLIC dwStatus dwSocketConnection_recvNonBlock(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection)
Receive a message of a given length from the network connection if data is available (non-blocking)...
DW_API_PUBLIC dwStatus dwSocketConnection_recv(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection)
Receive a message of a given length from the network connection (blocking).
struct dwSocketConnectionObject * dwSocketConnectionHandle_t
Handle representing the a bi-directional client-server network socket connection. ...
NVIDIA DriveWorks API: Core Exports
DW_API_PUBLIC dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *client, size_t connection_pool_size, dwContextHandle_t context)
Creates and initializes a socket client.
DW_API_PUBLIC dwStatus dwSocketConnection_peek(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection)
Peek at a message of a given length from the network connection (blocking).
dwStatus
Status definition.
Definition: Status.h:167
struct dwSocketClientObject * dwSocketClientHandle_t
Handle representing the a network socket client.
DW_API_PUBLIC dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t *connection)
Terminate a socket connection.
DW_API_PUBLIC dwStatus dwSocketConnection_peekNonBlock(uint8_t *buffer, size_t *buffer_size, dwSocketConnectionHandle_t connection)
Peek at a message of a given length from the network connection (non-blocking).
DW_API_PUBLIC dwStatus dwSocketServer_initialize(dwSocketServerHandle_t *server, uint16_t port, size_t connection_pool_size, dwContextHandle_t context)
Creates and initializes a socket server accepting incoming client connections.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:78
DW_API_PUBLIC dwStatus dwSocketServer_release(dwSocketServerHandle_t *server)
Terminate a socket server.
DW_API_PUBLIC dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t *connection, const char *server_ip, uint16_t port, dwTime_t timeout_us, dwSocketClientHandle_t client)
Connects a socket connection to a listening socket server.
struct dwSocketServerObject * dwSocketServerHandle_t
Handle representing the a network socket server.
DW_API_PUBLIC dwStatus dwSocketClient_broadcast(const uint8_t *buffer, size_t buffer_size, dwSocketClientHandle_t client)
Broadcasts a message to all connected sockets of the pool.
#define DW_API_PUBLIC
Definition: Exports.h:76
NVIDIA DriveWorks API: Core Status Methods