Distributed Publish & Subscribe for IoT
|
Entities in the DPS network. More...
Macros | |
#define | DPS_LINK_LOSS_TIMEOUT 30000 |
This establishes the base rate at which keep-alive subscription messages are sent to remote nodes. More... | |
#define | DPS_MCAST_PUB_DISABLED 0 |
Disable multicast send and receive on the node. More... | |
#define | DPS_MCAST_PUB_ENABLE_RECV 2 |
Enable multicast receive on the node. More... | |
#define | DPS_MCAST_PUB_ENABLE_SEND 1 |
Enable multicast send on the node. More... | |
#define | DPS_SUBSCRIPTION_UPDATE_RATE 2000 |
The default maximum rate (in msecs) to compute and send out subscription updates. More... | |
Typedefs | |
typedef struct _DPS_Node | DPS_Node |
Opaque type for a node. | |
typedef void(* | DPS_OnLinkComplete) (DPS_Node *node, const DPS_NodeAddress *addr, DPS_Status status, void *data) |
Function prototype for function called when a DPS_Link() completes. More... | |
typedef void(* | DPS_OnLinkLoss) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a link is lossed. More... | |
typedef void(* | DPS_OnNodeDestroyed) (DPS_Node *node, void *data) |
Function prototype for callback function called when a node is destroyed. More... | |
typedef void(* | DPS_OnNodeShutdown) (DPS_Node *node, void *data) |
Function prototype for callback function called when a node is shutdown. More... | |
typedef void(* | DPS_OnResolveAddressComplete) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a DPS_ResolveAddress() completes. More... | |
typedef void(* | DPS_OnUnlinkComplete) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a DPS_Unlink() completes. More... | |
Functions | |
DPS_Node * | DPS_CreateNode (const char *separators, DPS_KeyStore *keyStore, const DPS_KeyId *keyId) |
Allocates space for a local DPS node. More... | |
DPS_Status | DPS_DestroyNode (DPS_Node *node, DPS_OnNodeDestroyed cb, void *data) |
Destroys a node and free any resources. More... | |
const DPS_NodeAddress * | DPS_GetListenAddress (DPS_Node *node) |
Get the address this node is listening for connections on. More... | |
const char * | DPS_GetListenAddressString (DPS_Node *node) |
Get text representation of the address this node is listening for connections on. More... | |
void * | DPS_GetNodeData (const DPS_Node *node) |
Get application data pointer previously set by DPS_SetNodeData() More... | |
DPS_Status | DPS_Link (DPS_Node *node, const char *addrText, DPS_OnLinkComplete cb, void *data) |
Link the local node to a remote node. More... | |
DPS_Status | DPS_LinkTo (DPS_Node *node, const char *addrText, DPS_NodeAddress *addr) |
Synchronous helper that wraps DPS_Link(). More... | |
DPS_Status | DPS_ResolveAddress (DPS_Node *node, const char *host, const char *service, DPS_OnResolveAddressComplete cb, void *data) |
Resolve a host name or IP address and service name or port number. More... | |
DPS_Status | DPS_SetLinkLossCallback (DPS_Node *node, DPS_OnLinkLoss cb, void *data) |
Set a callback function to called when a link explicily established by this node was lost. More... | |
DPS_Status | DPS_SetNodeData (DPS_Node *node, void *data) |
Store a pointer to application data in a node. More... | |
void | DPS_SetNodeLinkLossTimeout (DPS_Node *node, uint32_t linkLossMsecs) |
Override the default link-loss detection timeout (in msecs) More... | |
void | DPS_SetNodeSubscriptionUpdateDelay (DPS_Node *node, uint32_t subsRateMsecs) |
Override the default time delay (in msecs) between subscription updates. More... | |
DPS_Status | DPS_ShutdownNode (DPS_Node *node, DPS_OnNodeShutdown cb, void *data) |
Shutdowns a node. More... | |
DPS_Status | DPS_StartNode (DPS_Node *node, int mcastPub, DPS_NodeAddress *listenAddr) |
Initialized and starts running a local node. More... | |
DPS_Status | DPS_Unlink (DPS_Node *node, const DPS_NodeAddress *addr, DPS_OnUnlinkComplete cb, void *data) |
Unlink a local node from a remote node. More... | |
DPS_Status | DPS_UnlinkFrom (DPS_Node *node, const DPS_NodeAddress *addr) |
Synchronous helper that wraps DPS_Unlink(). More... | |
Entities in the DPS network.
#define DPS_LINK_LOSS_TIMEOUT 30000 |
This establishes the base rate at which keep-alive subscription messages are sent to remote nodes.
This timeout governs how long it takes to detect a mesh disconnect and start a recovery process. This timeout value should be much larger than DPS_SUBSCRIPTION_UPDATE_RATE.
#define DPS_MCAST_PUB_DISABLED 0 |
Disable multicast send and receive on the node.
See mcastPub
of DPS_StartNode().
#define DPS_MCAST_PUB_ENABLE_RECV 2 |
Enable multicast receive on the node.
See mcastPub
of DPS_StartNode().
#define DPS_MCAST_PUB_ENABLE_SEND 1 |
Enable multicast send on the node.
See mcastPub
of DPS_StartNode().
#define DPS_SUBSCRIPTION_UPDATE_RATE 2000 |
The default maximum rate (in msecs) to compute and send out subscription updates.
This causes subscription updates coming in from multiple remote nodes to be batched up for forwarding. This reduces network traffic when new nodes join the mesh, particularly at startup time, at the cost of increased latency for the propagation of subscriptions across the mesh. New subscriptions local to a node are not subject to this timeout value and are set immediately to adjacent nodes.
typedef void(* DPS_OnLinkComplete) (DPS_Node *node, const DPS_NodeAddress *addr, DPS_Status status, void *data) |
Function prototype for function called when a DPS_Link() completes.
node | The local node to use |
addr | The address of the remote node that was linked |
status | Indicates if the link completed or failed. A status of DPS_ERR_EXISTS indicates the remote node is already linked. |
data | Application data passed in the call to DPS_Link() |
typedef void(* DPS_OnLinkLoss) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a link is lossed.
node | The local node that lost a link |
addr | The address of the remote node that was unlinked |
data | Application data passed in the call to DPS_SetLinkLossCallback() |
typedef void(* DPS_OnNodeDestroyed) (DPS_Node *node, void *data) |
Function prototype for callback function called when a node is destroyed.
node | The node that was destroyed. This node is valid during the callback. |
data | Data passed to DPS_DestroyNode() |
typedef void(* DPS_OnNodeShutdown) (DPS_Node *node, void *data) |
Function prototype for callback function called when a node is shutdown.
Shutdown cleanly unlinks any nodes from this node. DPS_DestroyNode() does not.
node | The node that was shutdown. This node is valid during the callback. |
data | Data passed to DPS_ShutdownNode() |
typedef void(* DPS_OnResolveAddressComplete) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a DPS_ResolveAddress() completes.
node | The local node to use |
addr | The resolved address or NULL if the address could not be resolved |
data | Application data passed in the call to DPS_ResolveAddress() |
typedef void(* DPS_OnUnlinkComplete) (DPS_Node *node, const DPS_NodeAddress *addr, void *data) |
Function prototype for function called when a DPS_Unlink() completes.
node | The local node that was unlinked from a remote node |
addr | The address of the remote node that was unlinked |
data | Application data passed in the call to DPS_Unlink() |
DPS_Node* DPS_CreateNode | ( | const char * | separators, |
DPS_KeyStore * | keyStore, | ||
const DPS_KeyId * | keyId | ||
) |
Allocates space for a local DPS node.
separators | The separator characters to use for topic matching, if NULL defaults to "/" |
keyStore | The key store to use for this node |
keyId | The key identifier of this node |
DPS_Status DPS_DestroyNode | ( | DPS_Node * | node, |
DPS_OnNodeDestroyed | cb, | ||
void * | data | ||
) |
Destroys a node and free any resources.
node | The node to destroy |
cb | Callback function to be called when the node is destroyed |
data | Data to be passed to the callback function |
const DPS_NodeAddress* DPS_GetListenAddress | ( | DPS_Node * | node | ) |
Get the address this node is listening for connections on.
node | The node |
const char* DPS_GetListenAddressString | ( | DPS_Node * | node | ) |
Get text representation of the address this node is listening for connections on.
node | The node |
void* DPS_GetNodeData | ( | const DPS_Node * | node | ) |
Get application data pointer previously set by DPS_SetNodeData()
node | The node |
DPS_Status DPS_Link | ( | DPS_Node * | node, |
const char * | addrText, | ||
DPS_OnLinkComplete | cb, | ||
void * | data | ||
) |
Link the local node to a remote node.
node | The local node to use |
addrText | The text string of the address to link to |
cb | The callback function to call on completion |
data | Application data to be passed to the callback |
DPS_Status DPS_LinkTo | ( | DPS_Node * | node, |
const char * | addrText, | ||
DPS_NodeAddress * | addr | ||
) |
Synchronous helper that wraps DPS_Link().
node | The local node to link from |
addrText | The text string of the address to link to |
addr | Returns the resolved address for the remote node |
DPS_Status DPS_ResolveAddress | ( | DPS_Node * | node, |
const char * | host, | ||
const char * | service, | ||
DPS_OnResolveAddressComplete | cb, | ||
void * | data | ||
) |
Resolve a host name or IP address and service name or port number.
node | The local node to use |
host | The host name or IP address to resolve |
service | The port or service name to resolve |
cb | The callback function to call on completion |
data | Application data to be passed to the callback |
DPS_Status DPS_SetLinkLossCallback | ( | DPS_Node * | node, |
DPS_OnLinkLoss | cb, | ||
void * | data | ||
) |
Set a callback function to called when a link explicily established by this node was lost.
This function is only called in the case of a surprise link-loss, not when DPS_Unlink() was called.
node | The local node |
cb | The callback function to call on loss of a link |
data | Application data to be passed to the callback |
DPS_Status DPS_SetNodeData | ( | DPS_Node * | node, |
void * | data | ||
) |
Store a pointer to application data in a node.
node | The node |
data | The data pointer to store |
void DPS_SetNodeLinkLossTimeout | ( | DPS_Node * | node, |
uint32_t | linkLossMsecs | ||
) |
Override the default link-loss detection timeout (in msecs)
node | The node |
linkLossMsecs | The time for the link to an unresponsive remote node to be considered lost |
void DPS_SetNodeSubscriptionUpdateDelay | ( | DPS_Node * | node, |
uint32_t | subsRateMsecs | ||
) |
Override the default time delay (in msecs) between subscription updates.
node | The node |
subsRateMsecs | The time delay (in msecs) between updates |
DPS_Status DPS_ShutdownNode | ( | DPS_Node * | node, |
DPS_OnNodeShutdown | cb, | ||
void * | data | ||
) |
Shutdowns a node.
node | The node to shutdown |
cb | Callback function to be called when the node is shutdown |
data | Data to be passed to the callback function |
DPS_Status DPS_StartNode | ( | DPS_Node * | node, |
int | mcastPub, | ||
DPS_NodeAddress * | listenAddr | ||
) |
Initialized and starts running a local node.
Node can only be started once.
node | The node |
mcastPub | Indicates if this node sends or listens for multicast publications |
listenAddr | If non-NULL identifies specific address to listen on |
DPS_Status DPS_Unlink | ( | DPS_Node * | node, |
const DPS_NodeAddress * | addr, | ||
DPS_OnUnlinkComplete | cb, | ||
void * | data | ||
) |
Unlink a local node from a remote node.
node | The local node to use |
addr | The address of the remote node to unlink from |
cb | The callback function to call on completion, can be NULL which case the function is synchronous |
data | Application data to be passed to the callback |
DPS_Status DPS_UnlinkFrom | ( | DPS_Node * | node, |
const DPS_NodeAddress * | addr | ||
) |
Synchronous helper that wraps DPS_Unlink().
node | The local node to unlink from |
addr | The address of the remote node to unlink |