NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
dulink.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
19 #ifndef DULINK_H_
20 #define DULINK_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* ------------------------ DRIVE Update Includes --------------------------- */
27 #include "ducommon.h"
28 #include "dutransport.h"
37 /* ------------------------ Defines------------------------------------------ */
38 
40 #define DULINK_SUID_LINK (0U)
41 #define DULINK_SUID_CB (1U)
43 
45 #define DULINK_ECODE(err) DU_ECODE(DU_UID_LINK, DULINK_SUID_LINK, (err))
46 #define DULINK_CB_ECODE(err) DU_ECODE(DU_UID_LINK, DULINK_SUID_CB, (err))
48 
49 // List type of DU Link Errors.
51 #define DULINK_ERR_GENERIC DULINK_ECODE(1U)
52 #define DULINK_ERR_INVALID_ARGUMENT DULINK_ECODE(2U)
54 #define DULINK_ERR_BUFFER_TOO_SMALL DULINK_ECODE(3U)
56 #define DULINK_ERR_NOT_FOUND DULINK_ECODE(4U)
58 #define DULINK_ERR_NOT_SUPPORTED DULINK_ECODE(5U)
60 #define DULINK_ERR_NO_PERMISSION DULINK_ECODE(6U)
62 #define DULINK_ERR_ALLOC_FAILED DULINK_ECODE(7U)
64 #define DULINK_ERR_BUSY DULINK_ECODE(8U)
66 #define DULINK_ERR_UPLINK_NOT_READY DULINK_ECODE(9U)
68 #define DULINK_ERR_ROUTING DULINK_ECODE(10U)
70 #define DULINK_ERR_TIMEOUT DULINK_ECODE(11U)
72 #define DULINK_ERR_TRANSPORT DULINK_ECODE(12U)
74 
76 #define DULINK_ERR_ILLEGALMSG DULINK_ECODE(13U)
77 #define DULINK_ERR_ROUTING_RETMSG DULINK_ECODE(14U)
79 #define DULINK_ERR_NO_DST DULINK_ECODE(15U)
81 #define DULINK_ERR_NO_MEMORY DULINK_ECODE(16U)
83 #define DULINK_ERR_NO_P2P DULINK_ECODE(17U)
85 #define DULINK_ERR_NO_CONNECT DULINK_ECODE(18U)
87 #define DULINK_ERR_ILLEGAL_OP DULINK_ECODE(19U)
89 #define DULINK_ERR_INIT DULINK_ECODE(20U)
91 #define DULINK_ERR_CLOSE DULINK_ECODE(21U)
93 #define DULINK_ERR_NOT_INIT DULINK_ECODE(22U)
95 
96 // Possible return values for DU Link callbacks.
97 #define DULINK_CB_RCODE DU_RCODE
98 #define DULINK_CB_OK DU_OK
99 #define DULINK_CB_ERR_IO DULINK_CB_ECODE(1U)
100 #define DULINK_CB_ERR_INVALID_ARGUMENT DULINK_CB_ECODE(2U)
101 #define DULINK_CB_ERR_SYNTAX DULINK_CB_ECODE(3U)
102 #define DULINK_CB_ERR_UNKNOWN DULINK_CB_ECODE(4U)
103 #define DULINK_CB_ERR_BUSY_RETRY DULINK_CB_ECODE(5U)
104 
105 #define DULINK_CB_ERR_NOT_SUPPORTED DULINK_CB_ECODE(6U)
106 #define DULINK_CB_ERR_NO_NODE DULINK_CB_ECODE(7U)
107 
112 #define DULINK_IS_CB_ERR(rcode) (DU_ECODE_GET_SUID(rcode) == DULINK_SUID_CB)
113 
117 #define DULINK_GET_CB_ERR(rcode) (DU_ECODE_GET_ERR(rcode))
118 
120 #define DULINK_VERSION_STR "2"
121 
126 #define DULINK_MAX_PATH (256U)
127 #define DULINK_MAX_NODE_NAME (DULINK_MAX_PATH)
129 #define DULINK_MAX_CHILDNODE (256U)
131 #define DULINK_MAX_NODES (256U)
133 #define DULINK_MAX_ACL (16U)
135 #define DULINK_MAX_NOTIFY_NODES (16U)
137 #define DULINK_MAX_NODES_TO_NOTIFY (8U)
139 #define DULINK_MAX_NOTIFY_MSG_LEN (1024U)
141 #define DULINK_MAX_DATA_SIZE (1024U * 1024U)
143 
144 #define DULINK_PERMISSION_NONE (0x00U)
145 #define DULINK_PERMISSION_READ (0x01U)
147 #define DULINK_PERMISSION_WRITE (0x02U)
149 #define DULINK_PERMISSION_WRITE_MASK (0xFDU)
151 // Remaining Bits are reserved and must be 0.
153 #define DULINK_CLOSE_ALL (0xFFFFFFFFU)
154 
155 /* ------------------------ Types ------------------------------------------- */
156 
160 typedef enum DULINK_NODE_TYPE
161 {
171 
176 {
181 
182 
189 typedef struct DULINK_ACL_ENTRY
190 {
211  uint8_t allowMask; // DULINK_PERMISSION_READ | DULINK_PERMISSION_WRITE
216  uint8_t denyMask;
218 
225 typedef struct DULINK_ATTR
226 {
231  uint32_t numACL;
246 
250 typedef uint32_t DULINK_CB_OPERATION;
253 #define DULINK_CB_READ (0U)
254 #define DULINK_CB_WRITE (1U)
257 #define DULINK_CB_SIZE (2U)
260 #define DULINK_CB_ATTR (3U)
262 
311 typedef DULINK_CB_RCODE (*DULINK_CB)(const char* pRequestPath,
312  const char* pOriginPath, void *pCtx, uint64_t offset,
313  uint64_t length, void* pBuf,
314  DULINK_CB_OPERATION operation, uint64_t *pRetVal);
315 
316 /* ------------------------ Function Declarations --------------------------- */
366 (
367  const char *pName,
368  const char *pParentPath
369 );
370 
456 (
457  const char *pRemotePath,
458  DUTR_TR_TYPE trType,
459  DUTR_SEC_TYPE seType,
460  const void *pTrParam,
461  const void *pSeParam,
462  DULINK_CONNECTION_TYPE connType,
463  uint32_t *pConnRefId
464 );
465 
517 (
518  uint32_t connRefId
519 );
520 
608 (
609  const char *pPath,
610  uint64_t offset,
611  uint64_t length,
612  void *pBuf,
613  uint64_t *pRetLen
614 );
615 
703 (
704  const char *pPath,
705  uint64_t offset,
706  uint64_t length,
707  void *pBuf,
708  uint64_t *pRetLen
709 );
710 
786 (
787  const char *pPath,
788  uint64_t *pSize
789 );
790 
860 (
861  const char *pPath,
862  PDULINK_ATTR pAttribute
863 );
864 
924 (
925  const char *pPath,
926  const DULINK_ATTR *pAttribute
927 );
928 
994 (
995  const char *pPath,
996  const DULINK_ATTR *pAttribute,
997  DULINK_CB callback,
998  void *pCtx
999 );
1000 
1052 (
1053  const char *pPath
1054 );
1055 
1102 (
1103  const char *pPath
1104 );
1105 
1186 (
1187  const char *pNotifyPath
1188 );
1189 
1254 (
1255  const char *pNotifyPath,
1256  void *pBuf,
1257  uint64_t bufSize
1258 );
1259 
1260 #ifdef NON_SAFETY_BUILD
1261 
1299 DU_RCODE dulinkGetParamsSize
1300 (
1301  uint32_t *pDulinkConnectionSize,
1302  uint32_t *pDulinkWorkerSize,
1303  uint32_t *pDulinkWaitObjSize
1304 );
1305 
1350 DU_RCODE dulinkSetInitParams
1351 (
1352  uint32_t numConnection,
1353  void *pConnectionTable,
1354  uint32_t numWorker,
1355  void *pWorkerTable,
1356  void *pWaitingTable
1357 );
1358 #endif
1359 
1362 #ifdef __cplusplus
1363 }
1364 #endif
1365 
1366 #endif
DULINK_ACL_ENTRY::allowMask
uint8_t allowMask
Bitmask of allowed operation, this has lower priority of denied operation.
Definition: dulink.h:211
dutransport.h
NVIDIA DRIVE® Update DU-Transport library interface.
DUTR_TR_TYPE
DUTR_TR_TYPE
Defines DU-Transport back-end transport protocols.
Definition: dutransport.h:48
DULINK_ACL_ENTRY::denyMask
uint8_t denyMask
Bitmask of denied operation, setting this would force disallow operation specified in srcElement.
Definition: dulink.h:216
DU_RCODE
uint32_t DU_RCODE
Drive Update error codes.
Definition: ducommon.h:74
DULINK_ACL_ENTRY
Access Control List Entry.
Definition: dulink.h:189
DUTR_SEC_TYPE
DUTR_SEC_TYPE
Defines DU-Transport security protocols.
Definition: dutransport.h:61
ducommon.h
Common definitions and declarations for NVIDIA DRIVE® Update.
DULINK_ACL_ENTRY::srcElement
char srcElement[DULINK_MAX_PATH]
Absolute path of element that this access control take effect.
Definition: dulink.h:205