DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

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-2020 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>
51 #include <dw/core/base/Exports.h>
52 #include <dw/core/base/Status.h>
53 #include <dw/core/base/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* const server, uint16_t const port, size_t const connectionPoolSize,
82  dwContextHandle_t const context);
83 
97 dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t* const connection, dwTime_t const timeoutUs,
98  dwSocketServerHandle_t const server);
99 
112 dwStatus dwSocketServer_broadcast(uint8_t const* const buffer, size_t const bufferSize, dwSocketServerHandle_t const server);
113 
123 dwStatus dwSocketServer_release(dwSocketServerHandle_t const server);
124 
136 dwStatus dwSocketClient_initialize(dwSocketClientHandle_t* const client, size_t const connectionPoolSize,
137  dwContextHandle_t const context);
138 
155 dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t* const connection, char8_t const* const host, uint16_t const port,
156  dwTime_t const timeoutUs, dwSocketClientHandle_t const client);
157 
170 dwStatus dwSocketClient_broadcast(uint8_t const* const buffer, size_t const bufferSize, dwSocketClientHandle_t const client);
171 
181 dwStatus dwSocketClient_release(dwSocketClientHandle_t const client);
182 
201 dwStatus dwSocketConnection_write(const void* const buffer, size_t* const bufferSize, dwTime_t const timeoutUs,
202  dwSocketConnectionHandle_t const connection);
203 
222 dwStatus dwSocketConnection_peek(uint8_t* const buffer, size_t* const bufferSize,
223  dwTime_t const timeoutUs,
224  dwSocketConnectionHandle_t const connection);
225 
242 dwStatus dwSocketConnection_read(void* const buffer, size_t* const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection);
243 
253 dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t const connection);
254 
255 #ifdef __cplusplus
256 }
257 #endif
258 
261 #endif // DW_IPC_SOCKETCLIENTSERVER_H_
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *const client, size_t const connectionPoolSize, dwContextHandle_t const context)
Creates and initializes a socket client.
DW_API_PUBLIC dwStatus dwSocketServer_broadcast(uint8_t const *const buffer, size_t const bufferSize, dwSocketServerHandle_t const server)
Broadcasts a message to all connected sockets of the pool.
DW_API_PUBLIC dwStatus dwSocketServer_initialize(dwSocketServerHandle_t *const server, uint16_t const port, size_t const connectionPoolSize, dwContextHandle_t const context)
Creates and initializes a socket server accepting incoming client connections.
struct dwSocketConnectionObject * dwSocketConnectionHandle_t
Handle representing the a bi-directional client-server network socket connection. ...
DW_API_PUBLIC dwStatus dwSocketClient_release(dwSocketClientHandle_t const client)
Terminate a socket client.
dwStatus
Status definition.
Definition: Status.h:180
DW_API_PUBLIC dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t *const connection, dwTime_t const timeoutUs, dwSocketServerHandle_t const server)
Accepts an incoming connection at a socket server.
struct dwSocketClientObject * dwSocketClientHandle_t
Handle representing the a network socket client.
DW_API_PUBLIC dwStatus dwSocketConnection_read(void *const buffer, size_t *const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection)
Receive a message of a given length from the network connection.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwSocketServer_release(dwSocketServerHandle_t const server)
Terminate a socket server.
DW_API_PUBLIC dwStatus dwSocketConnection_write(const void *const buffer, size_t *const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection)
Send a message of a given length through the socket connection with a timeout.
DW_API_PUBLIC dwStatus dwSocketConnection_peek(uint8_t *const buffer, size_t *const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection)
Peek at a message of a given length from the network connection (blocking within timeout period)...
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:79
NVIDIA DriveWorks API: Core Methods
char char8_t
Definition: Types.h:72
DW_API_PUBLIC dwStatus dwSocketClient_broadcast(uint8_t const *const buffer, size_t const bufferSize, dwSocketClientHandle_t const client)
Broadcasts a message to all connected sockets of the pool.
DW_API_PUBLIC dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t const connection)
Terminate a socket connection.
DW_API_PUBLIC dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t *const connection, char8_t const *const host, uint16_t const port, dwTime_t const timeoutUs, dwSocketClientHandle_t const client)
Connects a socket connection to a listening socket server.
struct dwSocketServerObject * dwSocketServerHandle_t
Handle representing the a network socket server.
#define DW_API_PUBLIC
Definition: Exports.h:54
NVIDIA DriveWorks API: Core Status Methods
NVIDIA DriveWorks API: Core Exports