NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 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 --------------------------- */
360 (
361  const char *pName,
362  const char *pParentPath
363 );
364 
444 (
445  const char *pRemotePath,
446  DUTR_TR_TYPE trType,
447  DUTR_SEC_TYPE seType,
448  const void *pTrParam,
449  const void *pSeParam,
450  DULINK_CONNECTION_TYPE connType,
451  uint32_t *pConnRefId
452 );
453 
499 (
500  uint32_t connRefId
501 );
502 
584 (
585  const char *pPath,
586  uint64_t offset,
587  uint64_t length,
588  void *pBuf,
589  uint64_t *pRetLen
590 );
591 
673 (
674  const char *pPath,
675  uint64_t offset,
676  uint64_t length,
677  void *pBuf,
678  uint64_t *pRetLen
679 );
680 
750 (
751  const char *pPath,
752  uint64_t *pSize
753 );
754 
818 (
819  const char *pPath,
820  PDULINK_ATTR pAttribute
821 );
822 
876 (
877  const char *pPath,
878  const DULINK_ATTR *pAttribute
879 );
880 
940 (
941  const char *pPath,
942  const DULINK_ATTR *pAttribute,
943  DULINK_CB callback,
944  void *pCtx
945 );
946 
992 (
993  const char *pPath
994 );
995 
1036 (
1037  const char *pPath
1038 );
1039 
1114 (
1115  const char *pNotifyPath
1116 );
1117 
1176 (
1177  const char *pNotifyPath,
1178  void *pBuf,
1179  uint64_t bufSize
1180 );
1181 
1182 #ifdef NON_SAFETY_BUILD
1183 
1215 DU_RCODE dulinkGetParamsSize
1216 (
1217  uint32_t *pDulinkConnectionSize,
1218  uint32_t *pDulinkWorkerSize,
1219  uint32_t *pDulinkWaitObjSize
1220 );
1221 
1260 DU_RCODE dulinkSetInitParams
1261 (
1262  uint32_t numConnection,
1263  void *pConnectionTable,
1264  uint32_t numWorker,
1265  void *pWorkerTable,
1266  void *pWaitingTable
1267 );
1268 #endif
1269 
1272 #ifdef __cplusplus
1273 }
1274 #endif
1275 
1276 #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