NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
DU-Link API

Detailed Description

NVIDIA DRIVE® Update DU-Link library interface.

Data Structures

struct  DULINK_ACL_ENTRY
 Access Control List Entry. More...
 
struct  DULINK_ATTR
 Attribute of an DU-Link node. More...
 

Macros

#define DULINK_SUID_LINK   (0U)
 Sub-unit ID for internal DU Link functionality. More...
 
#define DULINK_SUID_CB   (1U)
 Sub-unit ID for callback functionality. More...
 
#define DULINK_ECODE(err)   DU_ECODE(DU_UID_LINK, DULINK_SUID_LINK, (err))
 Used to tag DU Link internal error codes. More...
 
#define DULINK_CB_ECODE(err)   DU_ECODE(DU_UID_LINK, DULINK_SUID_CB, (err))
 Used to tag callback specific error codes. More...
 
#define DULINK_ERR_GENERIC   DULINK_ECODE(1U)
 DU Link generic error. More...
 
#define DULINK_ERR_INVALID_ARGUMENT   DULINK_ECODE(2U)
 DU Link invalid argument error. More...
 
#define DULINK_ERR_BUFFER_TOO_SMALL   DULINK_ECODE(3U)
 DU Link buffer too small error. More...
 
#define DULINK_ERR_NOT_FOUND   DULINK_ECODE(4U)
 DU Link element or node can not found error. More...
 
#define DULINK_ERR_NOT_SUPPORTED   DULINK_ECODE(5U)
 DU Link operation type or messag type not supportedd error. More...
 
#define DULINK_ERR_NO_PERMISSION   DULINK_ECODE(6U)
 DU Link no permission error. More...
 
#define DULINK_ERR_ALLOC_FAILED   DULINK_ECODE(7U)
 DU Link allocate error. More...
 
#define DULINK_ERR_BUSY   DULINK_ECODE(8U)
 DU Link resource busy error. More...
 
#define DULINK_ERR_UPLINK_NOT_READY   DULINK_ECODE(9U)
 DU Link uplink not ready error. More...
 
#define DULINK_ERR_ROUTING   DULINK_ECODE(10U)
 DU Link router can not routing error. More...
 
#define DULINK_ERR_TIMEOUT   DULINK_ECODE(11U)
 DU Link timeout error. More...
 
#define DULINK_ERR_TRANSPORT   DULINK_ECODE(12U)
 DU Link transport error. More...
 
#define DULINK_ERR_ILLEGALMSG   DULINK_ECODE(13U)
 DU Link illegal message error. More...
 
#define DULINK_ERR_ROUTING_RETMSG   DULINK_ECODE(14U)
 DU Link router routing ret message error. More...
 
#define DULINK_ERR_NO_DST   DULINK_ECODE(15U)
 DU Link no destination error. More...
 
#define DULINK_ERR_NO_MEMORY   DULINK_ECODE(16U)
 DU Link no enough memory error. More...
 
#define DULINK_ERR_NO_P2P   DULINK_ECODE(17U)
 DU Link no P2P connection error. More...
 
#define DULINK_ERR_NO_CONNECT   DULINK_ECODE(18U)
 DU Link no connection error. More...
 
#define DULINK_ERR_ILLEGAL_OP   DULINK_ECODE(19U)
 DU Link illegal operation error. More...
 
#define DULINK_ERR_INIT   DULINK_ECODE(20U)
 DU Link initialize error. More...
 
#define DULINK_ERR_CLOSE   DULINK_ECODE(21U)
 DU Link close error. More...
 
#define DULINK_ERR_NOT_INIT   DULINK_ECODE(22U)
 DU Link not initialized error. More...
 
#define DULINK_CB_RCODE   DU_RCODE
 
#define DULINK_CB_OK   DU_OK
 
#define DULINK_CB_ERR_IO   DULINK_CB_ECODE(1U)
 
#define DULINK_CB_ERR_INVALID_ARGUMENT   DULINK_CB_ECODE(2U)
 
#define DULINK_CB_ERR_SYNTAX   DULINK_CB_ECODE(3U)
 
#define DULINK_CB_ERR_UNKNOWN   DULINK_CB_ECODE(4U)
 
#define DULINK_CB_ERR_BUSY_RETRY   DULINK_CB_ECODE(5U)
 
#define DULINK_CB_ERR_NOT_SUPPORTED   DULINK_CB_ECODE(6U)
 
#define DULINK_CB_ERR_NO_NODE   DULINK_CB_ECODE(7U)
 
#define DULINK_IS_CB_ERR(rcode)   (DU_ECODE_GET_SUID(rcode) == DULINK_SUID_CB)
 Used to check if DU_RCODE return is from a DU Link callback. More...
 
#define DULINK_GET_CB_ERR(rcode)   (DU_ECODE_GET_ERR(rcode))
 Get DULINK_CB_RCODE value from a DU_RCODE return value. More...
 
#define DULINK_VERSION_STR   "2"
 DU Link version string. More...
 
#define DULINK_MAX_PATH   (256U)
 Maximum string length of a DU Link path. More...
 
#define DULINK_MAX_NODE_NAME   (DULINK_MAX_PATH)
 Maximum allowed DU-Link node name. More...
 
#define DULINK_MAX_CHILDNODE   (256U)
 Maximum allowed child nodes within each DU-Link node. More...
 
#define DULINK_MAX_NODES   (256U)
 Maximum number of nodes within DU-Link instance. More...
 
#define DULINK_MAX_ACL   (16U)
 Maximum number of ACLs of a single node. More...
 
#define DULINK_MAX_NOTIFY_NODES   (16U)
 Maximum allowed number of notify nodes. More...
 
#define DULINK_MAX_NODES_TO_NOTIFY   (8U)
 Maximum number of nodes a notify node can signal. More...
 
#define DULINK_MAX_NOTIFY_MSG_LEN   (1024U)
 Maximum data length to read or write by notify node. More...
 
#define DULINK_MAX_DATA_SIZE   (1024U * 1024U)
 Maximum data buffer size that one DU-Link transaction can handle. More...
 
#define DULINK_PERMISSION_NONE   (0x00U)
 
#define DULINK_PERMISSION_READ   (0x01U)
 Represents read and size permission. More...
 
#define DULINK_PERMISSION_WRITE   (0x02U)
 Represents write permission. More...
 
#define DULINK_PERMISSION_WRITE_MASK   (0xFDU)
 Represents write permission mask. More...
 
#define DULINK_CLOSE_ALL   (0xFFFFFFFFU)
 Close all connection. More...
 
#define DULINK_CB_READ   (0U)
 Represents READ operation to be run in callback function for dulinkRead() More...
 
#define DULINK_CB_WRITE   (1U)
 Represents WRITE operation to be run in callback function for dulinkWrite() More...
 
#define DULINK_CB_SIZE   (2U)
 Represents SIZE operation to be run in callback function for dulinkGetSize() More...
 
#define DULINK_CB_ATTR   (3U)
 Reserved for internal usage and would not be passed to callback function. More...
 

Typedefs

typedef enum DULINK_NODE_TYPE DULINK_NODE_TYPE
 Type of DU Link node. More...
 
typedef enum DULINK_CONNECTION_TYPE DULINK_CONNECTION_TYPE
 Type of DU Link connection. More...
 
typedef struct DULINK_ACL_ENTRY DULINK_ACL_ENTRY
 Access Control List Entry. More...
 
typedef struct DULINK_ACL_ENTRYPDULINK_ACL_ENTRY
 
typedef struct DULINK_ATTR DULINK_ATTR
 Attribute of an DU-Link node. More...
 
typedef struct DULINK_ATTRPDULINK_ATTR
 
typedef uint32_t DULINK_CB_OPERATION
 Type of Callback operation. More...
 
typedef DULINK_CB_RCODE(* DULINK_CB) (const char *pRequestPath, const char *pOriginPath, void *pCtx, uint64_t offset, uint64_t length, void *pBuf, DULINK_CB_OPERATION operation, uint64_t *pRetVal)
 Callback function registered to handle IO operations of file. More...
 

Enumerations

enum  DULINK_NODE_TYPE {
  DULINK_NODE_TYPE_ELEMENT = 0,
  DULINK_NODE_TYPE_DIRECTORY,
  DULINK_NODE_TYPE_FILE
}
 Type of DU Link node. More...
 
enum  DULINK_CONNECTION_TYPE {
  DULINK_CONNECT_UPLINK = 0,
  DULINK_CONNECT_DOWNLINK,
  DULINK_CONNECT_P2P
}
 Type of DU Link connection. More...
 

Functions

DU_RCODE dulinkInit (const char *pName, const char *pParentPath)
 Initialize the DU Link element. More...
 
DU_RCODE dulinkOpen (const char *pRemotePath, DUTR_TR_TYPE trType, DUTR_SEC_TYPE seType, const void *pTrParam, const void *pSeParam, DULINK_CONNECTION_TYPE connType, uint32_t *pConnRefId)
 Register a connection. More...
 
DU_RCODE dulinkClose (uint32_t connRefId)
 Close DU Link connection. More...
 
DU_RCODE dulinkRead (const char *pPath, uint64_t offset, uint64_t length, void *pBuf, uint64_t *pRetLen)
 Read content from a DU-Link node. More...
 
DU_RCODE dulinkWrite (const char *pPath, uint64_t offset, uint64_t length, void *pBuf, uint64_t *pRetLen)
 Write content to a DU-Link file. More...
 
DU_RCODE dulinkGetSize (const char *pPath, uint64_t *pSize)
 Get size needed for reading content from DU-Link node. More...
 
DU_RCODE dulinkGetAttribute (const char *pPath, PDULINK_ATTR pAttribute)
 Get attribute of a DU-Link node. More...
 
DU_RCODE dulinkExportDirectory (const char *pPath, const DULINK_ATTR *pAttribute)
 Register a directory to DU LINK. More...
 
DU_RCODE dulinkExportFile (const char *pPath, const DULINK_ATTR *pAttribute, DULINK_CB callback, void *pCtx)
 Register a file to DU LINK. More...
 
DU_RCODE dulinkUnlinkDirectory (const char *pPath)
 Unregister a directory from DU LINK. More...
 
DU_RCODE dulinkUnlinkFile (const char *pPath)
 Unregister a file from DU LINK. More...
 
DU_RCODE dulinkExportNotifyNode (const char *pNotifyPath)
 Create a node to notify other DU Link nodes when change has occurred. More...
 
DU_RCODE dulinkTriggerNotify (const char *pNotifyPath, void *pBuf, uint64_t bufSize)
 Trigger notification to all nodes listening to a notify node. More...
 

Macro Definition Documentation

◆ DULINK_CB_ATTR

#define DULINK_CB_ATTR   (3U)

Reserved for internal usage and would not be passed to callback function.

Definition at line 261 of file dulink.h.

◆ DULINK_CB_ECODE

#define DULINK_CB_ECODE (   err)    DU_ECODE(DU_UID_LINK, DULINK_SUID_CB, (err))

Used to tag callback specific error codes.

Definition at line 47 of file dulink.h.

◆ DULINK_CB_ERR_BUSY_RETRY

#define DULINK_CB_ERR_BUSY_RETRY   DULINK_CB_ECODE(5U)

Definition at line 103 of file dulink.h.

◆ DULINK_CB_ERR_INVALID_ARGUMENT

#define DULINK_CB_ERR_INVALID_ARGUMENT   DULINK_CB_ECODE(2U)

Definition at line 100 of file dulink.h.

◆ DULINK_CB_ERR_IO

#define DULINK_CB_ERR_IO   DULINK_CB_ECODE(1U)

Definition at line 99 of file dulink.h.

◆ DULINK_CB_ERR_NO_NODE

#define DULINK_CB_ERR_NO_NODE   DULINK_CB_ECODE(7U)

Definition at line 106 of file dulink.h.

◆ DULINK_CB_ERR_NOT_SUPPORTED

#define DULINK_CB_ERR_NOT_SUPPORTED   DULINK_CB_ECODE(6U)

Definition at line 105 of file dulink.h.

◆ DULINK_CB_ERR_SYNTAX

#define DULINK_CB_ERR_SYNTAX   DULINK_CB_ECODE(3U)

Definition at line 101 of file dulink.h.

◆ DULINK_CB_ERR_UNKNOWN

#define DULINK_CB_ERR_UNKNOWN   DULINK_CB_ECODE(4U)

Definition at line 102 of file dulink.h.

◆ DULINK_CB_OK

#define DULINK_CB_OK   DU_OK

Definition at line 98 of file dulink.h.

◆ DULINK_CB_RCODE

#define DULINK_CB_RCODE   DU_RCODE

Definition at line 97 of file dulink.h.

◆ DULINK_CB_READ

#define DULINK_CB_READ   (0U)

Represents READ operation to be run in callback function for dulinkRead()

Definition at line 253 of file dulink.h.

◆ DULINK_CB_SIZE

#define DULINK_CB_SIZE   (2U)

Represents SIZE operation to be run in callback function for dulinkGetSize()

Definition at line 259 of file dulink.h.

◆ DULINK_CB_WRITE

#define DULINK_CB_WRITE   (1U)

Represents WRITE operation to be run in callback function for dulinkWrite()

Definition at line 256 of file dulink.h.

◆ DULINK_CLOSE_ALL

#define DULINK_CLOSE_ALL   (0xFFFFFFFFU)

Close all connection.

Definition at line 153 of file dulink.h.

◆ DULINK_ECODE

#define DULINK_ECODE (   err)    DU_ECODE(DU_UID_LINK, DULINK_SUID_LINK, (err))

Used to tag DU Link internal error codes.

Definition at line 45 of file dulink.h.

◆ DULINK_ERR_ALLOC_FAILED

#define DULINK_ERR_ALLOC_FAILED   DULINK_ECODE(7U)

DU Link allocate error.

Definition at line 63 of file dulink.h.

◆ DULINK_ERR_BUFFER_TOO_SMALL

#define DULINK_ERR_BUFFER_TOO_SMALL   DULINK_ECODE(3U)

DU Link buffer too small error.

Definition at line 55 of file dulink.h.

◆ DULINK_ERR_BUSY

#define DULINK_ERR_BUSY   DULINK_ECODE(8U)

DU Link resource busy error.

Definition at line 65 of file dulink.h.

◆ DULINK_ERR_CLOSE

#define DULINK_ERR_CLOSE   DULINK_ECODE(21U)

DU Link close error.

Definition at line 92 of file dulink.h.

◆ DULINK_ERR_GENERIC

#define DULINK_ERR_GENERIC   DULINK_ECODE(1U)

DU Link generic error.

Definition at line 51 of file dulink.h.

◆ DULINK_ERR_ILLEGAL_OP

#define DULINK_ERR_ILLEGAL_OP   DULINK_ECODE(19U)

DU Link illegal operation error.

Definition at line 88 of file dulink.h.

◆ DULINK_ERR_ILLEGALMSG

#define DULINK_ERR_ILLEGALMSG   DULINK_ECODE(13U)

DU Link illegal message error.

Definition at line 76 of file dulink.h.

◆ DULINK_ERR_INIT

#define DULINK_ERR_INIT   DULINK_ECODE(20U)

DU Link initialize error.

Definition at line 90 of file dulink.h.

◆ DULINK_ERR_INVALID_ARGUMENT

#define DULINK_ERR_INVALID_ARGUMENT   DULINK_ECODE(2U)

DU Link invalid argument error.

Definition at line 53 of file dulink.h.

◆ DULINK_ERR_NO_CONNECT

#define DULINK_ERR_NO_CONNECT   DULINK_ECODE(18U)

DU Link no connection error.

Definition at line 86 of file dulink.h.

◆ DULINK_ERR_NO_DST

#define DULINK_ERR_NO_DST   DULINK_ECODE(15U)

DU Link no destination error.

Definition at line 80 of file dulink.h.

◆ DULINK_ERR_NO_MEMORY

#define DULINK_ERR_NO_MEMORY   DULINK_ECODE(16U)

DU Link no enough memory error.

Definition at line 82 of file dulink.h.

◆ DULINK_ERR_NO_P2P

#define DULINK_ERR_NO_P2P   DULINK_ECODE(17U)

DU Link no P2P connection error.

Definition at line 84 of file dulink.h.

◆ DULINK_ERR_NO_PERMISSION

#define DULINK_ERR_NO_PERMISSION   DULINK_ECODE(6U)

DU Link no permission error.

Definition at line 61 of file dulink.h.

◆ DULINK_ERR_NOT_FOUND

#define DULINK_ERR_NOT_FOUND   DULINK_ECODE(4U)

DU Link element or node can not found error.

Definition at line 57 of file dulink.h.

◆ DULINK_ERR_NOT_INIT

#define DULINK_ERR_NOT_INIT   DULINK_ECODE(22U)

DU Link not initialized error.

Definition at line 94 of file dulink.h.

◆ DULINK_ERR_NOT_SUPPORTED

#define DULINK_ERR_NOT_SUPPORTED   DULINK_ECODE(5U)

DU Link operation type or messag type not supportedd error.

Definition at line 59 of file dulink.h.

◆ DULINK_ERR_ROUTING

#define DULINK_ERR_ROUTING   DULINK_ECODE(10U)

DU Link router can not routing error.

Definition at line 69 of file dulink.h.

◆ DULINK_ERR_ROUTING_RETMSG

#define DULINK_ERR_ROUTING_RETMSG   DULINK_ECODE(14U)

DU Link router routing ret message error.

Definition at line 78 of file dulink.h.

◆ DULINK_ERR_TIMEOUT

#define DULINK_ERR_TIMEOUT   DULINK_ECODE(11U)

DU Link timeout error.

Definition at line 71 of file dulink.h.

◆ DULINK_ERR_TRANSPORT

#define DULINK_ERR_TRANSPORT   DULINK_ECODE(12U)

DU Link transport error.

Definition at line 73 of file dulink.h.

◆ DULINK_ERR_UPLINK_NOT_READY

#define DULINK_ERR_UPLINK_NOT_READY   DULINK_ECODE(9U)

DU Link uplink not ready error.

Definition at line 67 of file dulink.h.

◆ DULINK_GET_CB_ERR

#define DULINK_GET_CB_ERR (   rcode)    (DU_ECODE_GET_ERR(rcode))

Get DULINK_CB_RCODE value from a DU_RCODE return value.

Definition at line 117 of file dulink.h.

◆ DULINK_IS_CB_ERR

#define DULINK_IS_CB_ERR (   rcode)    (DU_ECODE_GET_SUID(rcode) == DULINK_SUID_CB)

Used to check if DU_RCODE return is from a DU Link callback.

Non-zero value indicates return value comes from callback, whereas zero indicates that a DU Link internal error has occurred.

Definition at line 112 of file dulink.h.

◆ DULINK_MAX_ACL

#define DULINK_MAX_ACL   (16U)

Maximum number of ACLs of a single node.

Definition at line 134 of file dulink.h.

◆ DULINK_MAX_CHILDNODE

#define DULINK_MAX_CHILDNODE   (256U)

Maximum allowed child nodes within each DU-Link node.

Definition at line 130 of file dulink.h.

◆ DULINK_MAX_DATA_SIZE

#define DULINK_MAX_DATA_SIZE   (1024U * 1024U)

Maximum data buffer size that one DU-Link transaction can handle.

Definition at line 142 of file dulink.h.

◆ DULINK_MAX_NODE_NAME

#define DULINK_MAX_NODE_NAME   (DULINK_MAX_PATH)

Maximum allowed DU-Link node name.

Definition at line 128 of file dulink.h.

◆ DULINK_MAX_NODES

#define DULINK_MAX_NODES   (256U)

Maximum number of nodes within DU-Link instance.

Definition at line 132 of file dulink.h.

◆ DULINK_MAX_NODES_TO_NOTIFY

#define DULINK_MAX_NODES_TO_NOTIFY   (8U)

Maximum number of nodes a notify node can signal.

Definition at line 138 of file dulink.h.

◆ DULINK_MAX_NOTIFY_MSG_LEN

#define DULINK_MAX_NOTIFY_MSG_LEN   (1024U)

Maximum data length to read or write by notify node.

Definition at line 140 of file dulink.h.

◆ DULINK_MAX_NOTIFY_NODES

#define DULINK_MAX_NOTIFY_NODES   (16U)

Maximum allowed number of notify nodes.

Definition at line 136 of file dulink.h.

◆ DULINK_MAX_PATH

#define DULINK_MAX_PATH   (256U)

Maximum string length of a DU Link path.

Any bytes except \0 and / are allowed in path.

Definition at line 126 of file dulink.h.

◆ DULINK_PERMISSION_NONE

#define DULINK_PERMISSION_NONE   (0x00U)

Definition at line 144 of file dulink.h.

◆ DULINK_PERMISSION_READ

#define DULINK_PERMISSION_READ   (0x01U)

Represents read and size permission.

Definition at line 146 of file dulink.h.

◆ DULINK_PERMISSION_WRITE

#define DULINK_PERMISSION_WRITE   (0x02U)

Represents write permission.

Definition at line 148 of file dulink.h.

◆ DULINK_PERMISSION_WRITE_MASK

#define DULINK_PERMISSION_WRITE_MASK   (0xFDU)

Represents write permission mask.

Definition at line 150 of file dulink.h.

◆ DULINK_SUID_CB

#define DULINK_SUID_CB   (1U)

Sub-unit ID for callback functionality.

Definition at line 42 of file dulink.h.

◆ DULINK_SUID_LINK

#define DULINK_SUID_LINK   (0U)

Sub-unit ID for internal DU Link functionality.

Definition at line 40 of file dulink.h.

◆ DULINK_VERSION_STR

#define DULINK_VERSION_STR   "2"

DU Link version string.

Definition at line 120 of file dulink.h.

Typedef Documentation

◆ DULINK_ACL_ENTRY

Access Control List Entry.

DULINK_ACL_ENTRY stores set of permissions controlling access to the node from a single source node.

◆ DULINK_ATTR

typedef struct DULINK_ATTR DULINK_ATTR

Attribute of an DU-Link node.

DULINK_ATTR stores information about a node, including its type and all of the access permissions allowed by other DU Link elements.

◆ DULINK_CB

typedef DULINK_CB_RCODE(* DULINK_CB) (const char *pRequestPath, const char *pOriginPath, void *pCtx, uint64_t offset, uint64_t length, void *pBuf, DULINK_CB_OPERATION operation, uint64_t *pRetVal)

Callback function registered to handle IO operations of file.

Parameters
[in]pRequestPath(const_char*)Full path of node being accessed.
[in]pOriginPath(const_char*)Full path of element originating the request.
[in]pCtx(void*)Pointer to user application context. This pointer will be set during export file operation and will be passed into the callback by DU Link each time the callback is executed.
[in]offset(uint64_t)Offset of IO operation. This parameter would not be valid for DULINK_CB_SIZE operation.
[in]length(uint64_t)Size wanted to read/write. This parameter would not be valid for DULINK_CB_SIZE operation.
[in,out]pBufPointer to buffer provided for read/write operation. This parameter would not be valid for DULINK_CB_SIZE operation.
[in]operation(DULINK_CB_OPERATION)IO operation, it would be one of:
  • DULINK_CB_READ
  • DULINK_CB_WRITE
  • DULINK_CB_SIZE
[out]pRetVal(uint64_t*)Return value from callback:
  • for operation DULINK_CB_READ Actual bytes read
  • for operation DULINK_CB_WRITE Actual bytes write
  • for operation DULINK_CB_SIZE size of the file
DU Link honors retVal to check how many bytes actually processed when doing read/write operations. Correct number must be returned or otherwise may lead to dead loop.
Returns
DULINK_CB_OK Upon success.
DULINK_CB_ERR_* Error has occurred. Possible errors must come from DULINK_CB_ERR.

Definition at line 311 of file dulink.h.

◆ DULINK_CB_OPERATION

typedef uint32_t DULINK_CB_OPERATION

Type of Callback operation.

Definition at line 250 of file dulink.h.

◆ DULINK_CONNECTION_TYPE

Type of DU Link connection.

◆ DULINK_NODE_TYPE

Type of DU Link node.

◆ PDULINK_ACL_ENTRY

◆ PDULINK_ATTR

typedef struct DULINK_ATTR * PDULINK_ATTR

Enumeration Type Documentation

◆ DULINK_CONNECTION_TYPE

Type of DU Link connection.

Enumerator
DULINK_CONNECT_UPLINK 
DULINK_CONNECT_DOWNLINK 
DULINK_CONNECT_P2P 

Definition at line 175 of file dulink.h.

◆ DULINK_NODE_TYPE

Type of DU Link node.

Enumerator
DULINK_NODE_TYPE_ELEMENT 

Element type node. There is one element node per instance of DU Link.

DULINK_NODE_TYPE_DIRECTORY 

Directory node which can store file nodes beneath it.

DULINK_NODE_TYPE_FILE 

File type node.

These are the most common type of node and are associated with a user defined callback function for READ, WRITE, SIZE operations.

Definition at line 160 of file dulink.h.

Function Documentation

◆ dulinkClose()

DU_RCODE dulinkClose ( uint32_t  connRefId)

Close DU Link connection.

Calling this function would disconnect a particular connection or all connection established.

language C

interface DU-Link Interface Spec

Parameters
[in]connRefId(uint32_t)Reference ID returned from dulinkOpen, or DULINK_CLOSE_ALL.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NO_PERMISSION Connection already closed/not yet initialized.
DULINK_ERR_TRANSPORT Error from DU_TR.
DULINK_ERR_GENERIC Other errors.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: No
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: Yes

◆ dulinkExportDirectory()

DU_RCODE dulinkExportDirectory ( const char *  pPath,
const DULINK_ATTR pAttribute 
)

Register a directory to DU LINK.

This function can be called to register a directory. Attribute needs to be provided to set correct access control.

This function would return error if Attribute is incorrect (ex. type is not directory or numACL is 0).

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to registered directory. Path would be relative to current element.
[in]pAttribute(const_PDULINK_ATTR)Pointer to attribute buffer. Caller can deallocate the buffer after calling this function.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid.
DULINK_ERR_NOT_FOUND Requested parent node is not found.
DULINK_ERR_NOT_SUPPORTED Trying to export a directory with same name as existing node.
DULINK_ERR_BUFFER_TOO_SMALL Node table is full, no more node can be added.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: Yes
    • De-Init: No

◆ dulinkExportFile()

DU_RCODE dulinkExportFile ( const char *  pPath,
const DULINK_ATTR pAttribute,
DULINK_CB  callback,
void pCtx 
)

Register a file to DU LINK.

This function can be called to register a file. Attribute needs to be provided to set correct access control.

This function would return error if Attribute is incorrect (ex. type is not file or numACL is 0).

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to registered file. Path would be relative to current element.
[in]pAttribute(const_PDULINK_ATTR)Pointer to attribute buffer. Caller can deallocate the buffer after calling this function.
[in]callback(DULINK_CB)Callback function used for IO operation.
[in]pCtx(void*)Pointer to user application context. This pointer will be passed into the callback each time it is executed.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid.
DULINK_ERR_NOT_FOUND Requested parent node is not found.
DULINK_ERR_NOT_SUPPORTED Trying to export a file with same name as existing node.
DULINK_ERR_BUFFER_TOO_SMALL Node table is full, no more node can be added.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: Yes
    • De-Init: No

◆ dulinkExportNotifyNode()

DU_RCODE dulinkExportNotifyNode ( const char *  pNotifyPath)

Create a node to notify other DU Link nodes when change has occurred.

This function will create a new DU Link node for notifying other nodes when a change has occurred within the node being monitored. The new DU Link node must be named with .notify extension, with name as <MonitorPath>.notify.

For example, if exporting a notify node to monitor path /myElement/state, the notify node should be named as /myElement/state.notify. Note that the node being monitored must already exist before calling dulinkExportNotifyNode. In this case, /myElement/state must exist before calling this function with /myElement/state.notify.

The new DU Link notify node will be readable and writable by the same set of nodes that have permission to read the monitor node.

A notify node can be written with dulinkWrite to add or remove nodes from the list of nodes to notify when triggerNotify is called. To add a node to the list, "+<NODE_PATH>" should be written to the .notify node. To remove a node from the notify list, "-<NODE_PATH>" should be written.

When a node is added to the notify list, it will immediately be notified of the current value of the node being monitored.

Notice that, the internal buffer used to read from node being monitored has size of DULINK_MAX_NOTIFY_MSG_LEN. Data longer than this may truncated when notifying.

Calling dulinkRead on the .notify node will return a NULL separated list of all nodes currently in the notify list. dulinkGetSize will return the length of this list.

language C

interface DU-Link Interface Spec

Parameters
[in]pNotifyPath(const_char*)Path of .notify node to export. pNotifyPath should be the path of an already existing local node with addition of ".notify" suffix. For example, if a node called state should get a notify node, pNotifyPath should be "/myElement/state.notify".
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid.
DULINK_ERR_NOT_FOUND Corresponding monitor node for notify node is not found.
DULINK_ERR_NOT_SUPPORTED Trying to export a node with same name as existing node.
DULINK_ERR_BUFFER_TOO_SMALL Node table is full, no more nodes can be added.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: Yes
    • De-Init: No

◆ dulinkGetAttribute()

DU_RCODE dulinkGetAttribute ( const char *  pPath,
PDULINK_ATTR  pAttribute 
)

Get attribute of a DU-Link node.

This function can be called to obtain attribute of a DU-Link node. The caller would obtain a copy of the attribute.

This call is a blocking call.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to node wanted to obtain attribute. This can be an absolute path start with "/" or relative path under this element.
[out]pAttribute(PDULINK_ATTR)Pointer to caller allocated output buffer.
Returns
DU_OK Upon success.
DULINK_ERR_ROUTING Could not find open connection to requested path.
DULINK_ERR_UPLINK_NOT_READY Connection to requested path is not ready.
DULINK_ERR_ALLOC_FAILED Not enough memory or memory allocation failed with DU_TR.
DULINK_ERR_TRANSPORT Transportation error happened in DU_TR.
DULINK_ERR_GENERIC Failed to fetch maximum buffer size in DU_TR.
DULINK_ERR_BUFFER_TOO_SMALL Request/Origin path is too long.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NOT_FOUND Requested node is not found.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkGetSize()

DU_RCODE dulinkGetSize ( const char *  pPath,
uint64_t *  pSize 
)

Get size needed for reading content from DU-Link node.

This function would return size of a DU-Link file, or buffer size needed for NULL separated list of sub nodes under particular element/directory.

This call is a blocking call.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to node wanted to get size. This can be an absolute path start with "/" or relative path under this element.
[out]pSize(uint64_t*)Size obtained.
Returns
DU_OK Upon success.
DULINK_ERR_ROUTING Could not find open connection to requested path.
DULINK_ERR_UPLINK_NOT_READY Connection to requested path is not ready.
DULINK_ERR_ALLOC_FAILED Not enough memory or memory allocation failed with DU_TR.
DULINK_ERR_TRANSPORT Transportation error happened in DU_TR.
DULINK_ERR_GENERIC Failed to fetch maximum buffer size in DU_TR.
DULINK_ERR_BUFFER_TOO_SMALL Request/Origin path is too long.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NOT_FOUND Requested node is not found.
DULINK_ERR_NO_PERMISSION Permission check failed.
Callback errors (DULINK_IS_CB_ERR would return true) Error from callback, use DULINK_GET_CB_ERR to extract them.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkInit()

DU_RCODE dulinkInit ( const char *  pName,
const char *  pParentPath 
)

Initialize the DU Link element.

This function should be called once and only once per element during program execution and would set element name and parent path of DU Link element.

Call any other API before calling this function would result in an error.

language C

interface DU-Link Interface Spec

Parameters
[in]pName(const_char*)Name of this element.
[in]pParentPath(const_char*)Parent path of this element.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_GENERIC Other errors.

pre None

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: No
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: Yes
    • De-Init: No

◆ dulinkOpen()

DU_RCODE dulinkOpen ( const char *  pRemotePath,
DUTR_TR_TYPE  trType,
DUTR_SEC_TYPE  seType,
const void pTrParam,
const void pSeParam,
DULINK_CONNECTION_TYPE  connType,
uint32_t *  pConnRefId 
)

Register a connection.

This function can be called to register a connection to DU Link element, it can be either UPLINK connection, DOWNLINK connection or P2P connection.

Only one UPLINK would be allowed per element. In MVP version only P2P connection is supported.

The connection parameter is same as dutrOpen, however no handle would be returned and the handle would be stored internally in DU-Link.

language C

interface DU-Link Interface Spec

Parameters
[in]pRemotePath(const_char*)Absolute path of node being connected. Once connection is established, this will be verified by reading the remote node's parent path and name to ensure the connection has been made to the expected node. Verifying remote path will be skipped for P2P connection type.
[in]trType(DUTR_TR_TYPE)Type of back-end transport protocol used.
[in]seType(DUTR_SEC_TYPE)Type of security protocol.
[in]pTrParam(const_void*)Pointer to the argument of selected transport protocol. For instance if trType is DUTR_TR_TYPE_IVC, then it shall point to the structure DUTR_IVC_PARAM.
[in]pSeParam(const_void*)Pointer to the argument of selected security protocol. For instance if seType is DUTR_SEC_TYPE_TLS, then it shall point to the structure DUTR_SEC_TLS_PARAM.
[in]connType(DULINK_CONNECTION_TYPE)Type of connection.
[out]pConnRefId(uint32_t*)Reference ID can be used to close connection.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NOT_SUPPORTED Connection not yet supported.
DULINK_ERR_BUFFER_TOO_SMALL Remote path is too long.
DULINK_ERR_TRANSPORT Error from DU_TR.
DULINK_ERR_GENERIC Other errors.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ dulinkRead()

DU_RCODE dulinkRead ( const char *  pPath,
uint64_t  offset,
uint64_t  length,
void pBuf,
uint64_t *  pRetLen 
)

Read content from a DU-Link node.

This function can be called to read content of a DU-Link file or obtain a NULL separated list of sub nodes under particular element/directory.

This call is a blocking call. DU Link would do framing and do multiple DU TR transmission if needed.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to node wanted to read. This can be an absolute path start with "/" or relative path under this element
[in]offset(uint64_t)Offset of read operation
[in]length(uint64_t)Size wanted to read.
[out]pBuf(void*)Pointer to caller allocated buffer provided for data fill in.
[out]pRetLen(uint64_t*)Size of data actually read.
Returns
DU_OK Upon success.
DULINK_ERR_ROUTING Could not find open connection to requested path.
DULINK_ERR_UPLINK_NOT_READY Connection to requested path is not ready.
DULINK_ERR_ALLOC_FAILED Not enough memory or memory allocation failed with DU_TR.
DULINK_ERR_TRANSPORT Transportation error happened in DU_TR.
DULINK_ERR_GENERIC Failed to fetch maximum buffer size in DU_TR.
DULINK_ERR_BUFFER_TOO_SMALL Request/Origin path is too long.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NOT_FOUND Requested node is not found.
DULINK_ERR_NO_PERMISSION Permission check failed.
Callback errors (DULINK_IS_CB_ERR would return true) Error from callback, use DULINK_GET_CB_ERR to extract them.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • User defined callback is thread-safe
    • Re-entrant: Yes, with the following conditions:
      • User defined callback is re-entrant
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkTriggerNotify()

DU_RCODE dulinkTriggerNotify ( const char *  pNotifyPath,
void pBuf,
uint64_t  bufSize 
)

Trigger notification to all nodes listening to a notify node.

This function will trigger an exported notify node to update all listening nodes of the latest state of the monitor node.

When this function is called, the value provided would be forwarded to listeners via dulinkWrite.

This function requires that the notify node passed into pNotifyPath is currently exported under the current local DU Link element.

This function is a blocking call, it would not return until the broadcast is done.

Notice that, the internal buffer used to read from node being monitored has size of DULINK_MAX_NOTIFY_MSG_LEN. Data longer than this may truncated when notifying.

language C

interface DU-Link Interface Spec

Parameters
[in]pNotifyPath(const_char*)Path of exported notify node to trigger.
[in]pBuf(void*)Content wants to be broadcasted.
[in]bufSize(uint64_t)Size of input buffer.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid.
DULINK_ERR_NOT_FOUND Corresponding monitor node is not found.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkUnlinkDirectory()

DU_RCODE dulinkUnlinkDirectory ( const char *  pPath)

Unregister a directory from DU LINK.

Directory must not have child nodes.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to directory wanted to unregister. Path would be relative to current element.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid.
DULINK_ERR_NOT_FOUND Requested directory is not found.
DULINK_ERR_NOT_SUPPORTED Trying to remove a non-empty directory.
DULINK_ERR_GENERIC Internal data corruption.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkUnlinkFile()

DU_RCODE dulinkUnlinkFile ( const char *  pPath)

Unregister a file from DU LINK.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(const_char*)Path to file wanted to unregister. Path would be relative to current element.
Returns
DU_OK Upon success.
DULINK_ERR_INVALID_ARGUMENT Input argument is invalid
DULINK_ERR_NOT_FOUND Requested file is not found.
DULINK_ERR_GENERIC Internal data corruption.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: Yes
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ dulinkWrite()

DU_RCODE dulinkWrite ( const char *  pPath,
uint64_t  offset,
uint64_t  length,
void pBuf,
uint64_t *  pRetLen 
)

Write content to a DU-Link file.

This function can be called to write content to a DU-Link file. Calling this function on an element or directory would result in an error.

This call is a blocking call. DU Link would do framing and do multiple DU TR transmission if needed.

language C

interface DU-Link Interface Spec

Parameters
[in]pPath(char*)Path to file wanted to write. This can be an absolute path start with "/" or relative path under this element.
[in]offset(uint64_t)Offset of write operation.
[in]length(uint64_t)Size wanted to write.
[in]pBuf(void*)Pointer to caller allocated buffer provided for data.
[out]pRetLen(uint64_t*)Size of data actually written.
Returns
DU_OK Upon success.
DULINK_ERR_ROUTING Could not find open connection to requested path.
DULINK_ERR_UPLINK_NOT_READY Connection to requested path is not ready.
DULINK_ERR_ALLOC_FAILED Not enough memory or memory allocation failed with DU_TR.
DULINK_ERR_TRANSPORT Transportation error happened in DU_TR.
DULINK_ERR_GENERIC Failed to fetch maximum buffer size in DU_TR.
DULINK_ERR_BUFFER_TOO_SMALL Request/Origin path is too long.
DULINK_ERR_INVALID_ARGUMENT Invalid input argument.
DULINK_ERR_NOT_FOUND Requested node is not found.
DULINK_ERR_NO_PERMISSION Permission check failed.
Callback errors (DULINK_IS_CB_ERR would return true) Error from callback, use DULINK_GET_CB_ERR to extract them.

pre dulinkInit should already be called

usage

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes, with the following conditions:
      • User defined callback is thread-safe
    • Re-entrant: Yes, with the following conditions:
      • User defined callback is re-entrant
    • Async/Sync: Sync
  • Required privileges: None
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No