NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
SocketClientServer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2016-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
29 #ifndef DW_IPC_SOCKETCLIENTSERVER_H_
30 #define DW_IPC_SOCKETCLIENTSERVER_H_
31 
32 #include <dw/core/base/Config.h>
33 #include <dw/core/context/Context.h>
34 #include <dw/core/base/Exports.h>
35 #include <dw/core/base/Status.h>
36 #include <dw/core/base/Types.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
43 typedef struct dwSocketServerObject* dwSocketServerHandle_t;
44 
46 typedef struct dwSocketClientObject* dwSocketClientHandle_t;
47 
49 typedef struct dwSocketConnectionObject* dwSocketConnectionHandle_t;
50 
69 dwStatus dwSocketServer_initialize(dwSocketServerHandle_t* const server, uint16_t const port, size_t const connectionPoolSize,
70  dwConstContextHandle_t const context);
71 
90 dwStatus dwSocketServer_accept(dwSocketConnectionHandle_t* const connection, dwTime_t const timeoutUs,
91  dwSocketServerHandle_t const server);
92 
110 dwStatus dwSocketServer_broadcast(uint8_t const* const buffer, size_t const bufferSize, dwSocketServerHandle_t const server);
111 
126 
143 dwStatus dwSocketClient_initialize(dwSocketClientHandle_t* const client, size_t const connectionPoolSize,
144  dwConstContextHandle_t const context);
145 
167 dwStatus dwSocketClient_connect(dwSocketConnectionHandle_t* const connection, char8_t const* const host, uint16_t const port,
168  dwTime_t const timeoutUs, dwSocketClientHandle_t const client);
169 
187 dwStatus dwSocketClient_broadcast(uint8_t const* const buffer, size_t const bufferSize, dwSocketClientHandle_t const client);
188 
203 
226 dwStatus dwSocketConnection_write(const void* const buffer, size_t* const bufferSize, dwTime_t const timeoutUs,
227  dwSocketConnectionHandle_t const connection);
228 
252 dwStatus dwSocketConnection_peek(uint8_t* const buffer, size_t* const bufferSize,
253  dwTime_t const timeoutUs,
254  dwSocketConnectionHandle_t const connection);
255 
276 dwStatus dwSocketConnection_read(void* const buffer, size_t* const bufferSize, dwTime_t const timeoutUs, dwSocketConnectionHandle_t const connection);
277 
292 
293 #ifdef __cplusplus
294 }
295 #endif
296 
299 #endif // DW_IPC_SOCKETCLIENTSERVER_H_
dwSocketConnectionHandle_t
struct dwSocketConnectionObject * dwSocketConnectionHandle_t
Handle representing the a bi-directional client-server network socket connection.
Definition: SocketClientServer.h:49
dwSocketConnection_write
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.
dwSocketServer_broadcast
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.
dwSocketServerHandle_t
struct dwSocketServerObject * dwSocketServerHandle_t
Handle representing the a network socket server.
Definition: SocketClientServer.h:43
dwSocketConnection_read
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.
dwSocketClient_connect
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.
dwSocketConnection_peek
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).
dwSocketClientHandle_t
struct dwSocketClientObject * dwSocketClientHandle_t
Handle representing the a network socket client.
Definition: SocketClientServer.h:46
dwTime_t
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: BasicTypes.h:54
dwSocketClient_broadcast
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.The pool is created in the initialization o...
dwSocketServer_initialize
DW_API_PUBLIC dwStatus dwSocketServer_initialize(dwSocketServerHandle_t *const server, uint16_t const port, size_t const connectionPoolSize, dwConstContextHandle_t const context)
Creates and initializes a socket server accepting incoming client connections.
dwSocketClient_release
DW_API_PUBLIC dwStatus dwSocketClient_release(dwSocketClientHandle_t const client)
Terminate a socket client.
char8_t
char char8_t
Definition: BasicTypes.h:47
dwSocketClient_initialize
DW_API_PUBLIC dwStatus dwSocketClient_initialize(dwSocketClientHandle_t *const client, size_t const connectionPoolSize, dwConstContextHandle_t const context)
Creates and initializes a socket client.
dwSocketServer_accept
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.
dwConstContextHandle_t
struct dwContextObject const * dwConstContextHandle_t
The Driveworks context handle.
Definition: Context.h:76
dwStatus
dwStatus
Status definition.
Definition: ErrorDefs.h:27
dwSocketServer_release
DW_API_PUBLIC dwStatus dwSocketServer_release(dwSocketServerHandle_t const server)
Terminate a socket server.
DW_API_PUBLIC
#define DW_API_PUBLIC
Definition: Exports.h:38
dwSocketConnection_release
DW_API_PUBLIC dwStatus dwSocketConnection_release(dwSocketConnectionHandle_t const connection)
Terminate a socket connection.