DriveWorks SDK Reference
3.0.4260 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 
48 #ifndef DW_IPC_SOCKETCLIENTSERVER_H_
49 #define DW_IPC_SOCKETCLIENTSERVER_H_
50 
51 #include <dw/core/Config.h>
52 #include <dw/core/Context.h>
53 #include <dw/core/Exports.h>
54 #include <dw/core/Status.h>
55 #include <dw/core/Types.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
62 typedef struct dwSocketServerObject* dwSocketServerHandle_t;
63 
65 typedef struct dwSocketClientObject* dwSocketClientHandle_t;
66 
68 typedef struct dwSocketConnectionObject* dwSocketConnectionHandle_t;
69 
73 typedef struct
74 {
75  uint16_t port;
76  uint32_t ip;
78 
92 dwStatus dwSocketServer_initialize(dwSocketServerHandle_t* server, uint16_t port, size_t connection_pool_size,
93  dwContextHandle_t context);
94 
108 dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t* connection, dwTime_t timeout_us,
109  dwSocketServerHandle_t server);
110 
123 dwStatus dwSocketServer_broadcast(const uint8_t* buffer, size_t buffer_size, dwSocketServerHandle_t server);
124 
134 dwStatus dwSocketServer_release(dwSocketServerHandle_t server);
135 
147 dwStatus dwSocketClient_initialize(dwSocketClientHandle_t* client, size_t connection_pool_size,
148  dwContextHandle_t context);
149 
166 dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t* connection, const char8_t* host, uint16_t port,
167  dwTime_t timeout_us, dwSocketClientHandle_t client);
168 
181 dwStatus dwSocketClient_broadcast(const uint8_t* buffer, size_t buffer_size, dwSocketClientHandle_t client);
182 
192 dwStatus dwSocketClient_release(dwSocketClientHandle_t client);
193 
212 dwStatus dwSocketConnection_write(const void* buffer, size_t* buffer_size, dwTime_t timeout_us,
213  dwSocketConnectionHandle_t connection);
214 
233 dwStatus dwSocketConnection_peek(uint8_t* buffer, size_t* buffer_size,
234  dwTime_t timeout_us,
235  dwSocketConnectionHandle_t connection);
236 
253 dwStatus dwSocketConnection_read(void* buffer, size_t* buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection);
254 
264 dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t connection);
265 
266 #ifdef __cplusplus
267 }
268 #endif
269 
272 #endif // DW_IPC_SOCKETCLIENTSERVER_H_
DW_API_PUBLIC dwStatus dwSocketClient_release(dwSocketClientHandle_t client)
Terminate a socket client.
NVIDIA DriveWorks API: Core Types
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_release(dwSocketConnectionHandle_t connection)
Terminate a socket connection.
DW_API_PUBLIC dwStatus dwSocketConnection_peek(uint8_t *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection)
Peek at a message of a given length from the network connection (blocking within timeout period)...
NVIDIA DriveWorks API: Core Methods
DW_API_PUBLIC dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t *connection, const char8_t *host, uint16_t port, dwTime_t timeout_us, dwSocketClientHandle_t client)
Connects a socket connection to a listening socket server.
struct dwSocketConnectionObject * dwSocketConnectionHandle_t
Handle representing the a bi-directional client-server network socket connection. ...
DW_API_PUBLIC dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *client, size_t connection_pool_size, dwContextHandle_t context)
Creates and initializes a socket client.
dwStatus
Status definition.
Definition: Status.h:166
struct dwSocketClientObject * dwSocketClientHandle_t
Handle representing the a network socket client.
DW_API_PUBLIC dwStatus dwSocketConnection_write(const void *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection)
Send a message of a given length through the socket connection with a timeout.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
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.
A structure contains data for POSIX sockaddr_in.
DW_API_PUBLIC dwStatus dwSocketServer_release(dwSocketServerHandle_t server)
Terminate a socket server.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:80
char char8_t
Definition: Types.h:72
DW_API_PUBLIC dwStatus dwSocketConnection_read(void *buffer, size_t *buffer_size, dwTime_t timeout_us, dwSocketConnectionHandle_t connection)
Receive a message of a given length from the network connection.
NVIDIA DriveWorks API: Core Exports
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:56
NVIDIA DriveWorks API: Core Status Methods