Distributed Publish & Subscribe for IoT
Registration

A registration service. More...

Data Structures

struct  _DPS_Registration
 Registration entry. More...
 
struct  _DPS_RegistrationList
 For returning a list of candidate remote nodes. More...
 

Macros

#define DPS_CANDIDATE_FAILED   0x02
 An attempt to link to a candidate was attempted but failed.
 
#define DPS_CANDIDATE_INVALID   0x10
 This is a invalid candidate address for linking.
 
#define DPS_CANDIDATE_LINKED   0x04
 Registration is currently linked.
 
#define DPS_CANDIDATE_TRYING   0x01
 An attempt is being made link to a candidate.
 
#define DPS_CANDIDATE_UNLINKED   0x08
 Registration was linked but is currently not linked.
 
#define DPS_REGISTRATION_GET_TIMEOUT   5000
 Default 5 second timeout for get requests.
 
#define DPS_REGISTRATION_PUT_TIMEOUT   2000
 Default 2 second timeout for put requests.
 

Typedefs

typedef void(* DPS_OnRegGetComplete) (DPS_RegistrationList *regs, DPS_Status status, void *data)
 Function prototype for callback called when DPS_Registration_Get() completes. More...
 
typedef void(* DPS_OnRegLinkToComplete) (DPS_Node *node, DPS_RegistrationList *regs, const DPS_NodeAddress *addr, DPS_Status status, void *data)
 Function prototype for callback called when DPS_Registration_LinkTo() completes. More...
 
typedef void(* DPS_OnRegPutComplete) (DPS_Status status, void *data)
 Function prototype for callback called when DPS_Registration_Put() completes. More...
 
typedef struct _DPS_Registration DPS_Registration
 Registration entry.
 
typedef struct _DPS_RegistrationList DPS_RegistrationList
 For returning a list of candidate remote nodes.
 

Functions

DPS_RegistrationListDPS_CreateRegistrationList (uint8_t size)
 Create an empty registration list of the specified size. More...
 
void DPS_DestroyRegistrationList (DPS_RegistrationList *regs)
 Destroy a registration list and free resources. More...
 
DPS_Status DPS_Registration_Get (DPS_Node *node, const char *addrText, const char *tenantString, DPS_RegistrationList *regs, uint16_t timeout, DPS_OnRegGetComplete cb, void *data)
 Lookup the addresses registered with a registration service. More...
 
DPS_Status DPS_Registration_GetSyn (DPS_Node *node, const char *addrText, const char *tenantString, DPS_RegistrationList *regs, uint16_t timeout)
 A synchronous version of DPS_RegistrationGet() this function blocks until the candidate list has been populated or the request times out. More...
 
DPS_Status DPS_Registration_LinkTo (DPS_Node *node, DPS_RegistrationList *regs, DPS_OnRegLinkToComplete cb, void *data)
 Randomly select a remote candidate to link to. More...
 
DPS_Status DPS_Registration_LinkToSyn (DPS_Node *node, DPS_RegistrationList *regs, DPS_NodeAddress *addr)
 Synchronous version of Registration_LinkTo. More...
 
DPS_Status DPS_Registration_Put (DPS_Node *node, const char *addrText, const char *tenantString, uint16_t timeout, DPS_OnRegPutComplete cb, void *data)
 Register a local node with a registration service. More...
 
DPS_Status DPS_Registration_PutSyn (DPS_Node *node, const char *addrText, const char *tenantString, uint16_t timeout)
 Synchronous version of DPS_RegistrationPut(). More...
 

Variables

const char * DPS_RegistryTopicString
 The registry topic string.
 

Detailed Description

A registration service.

Typedef Documentation

◆ DPS_OnRegGetComplete

typedef void(* DPS_OnRegGetComplete) (DPS_RegistrationList *regs, DPS_Status status, void *data)

Function prototype for callback called when DPS_Registration_Get() completes.

Parameters
regsStruct containing the list of candidate passed in to DPS_Registration_Get()
statusDPS_OK if the get completed successfully - the registration list might be empty,
dataCaller supplied data passed into the DPS_Registration_Get()

◆ DPS_OnRegLinkToComplete

typedef void(* DPS_OnRegLinkToComplete) (DPS_Node *node, DPS_RegistrationList *regs, const DPS_NodeAddress *addr, DPS_Status status, void *data)

Function prototype for callback called when DPS_Registration_LinkTo() completes.

Parameters
regsThe list of registrations addresses passed in to DPS_Registration_LinkTo().
addrThe address if the remote if status == DPS_OK
statusStatus code indicating success or failure
  • DPS_OK if a link was successfully established
  • DPS_ERR_NO_ROUTE if a link could not be established
  • Other error status codes
dataCaller supplied data passed into the DPS_Registration_LinkTo()

◆ DPS_OnRegPutComplete

typedef void(* DPS_OnRegPutComplete) (DPS_Status status, void *data)

Function prototype for callback called when DPS_Registration_Put() completes.

Parameters
statusStatus code indicating success or failure
  • DPS_OK if the registration was made
  • Other error status codes
dataCaller supplied data passed into the DPS_Registration_Put()

Function Documentation

◆ DPS_CreateRegistrationList()

DPS_RegistrationList* DPS_CreateRegistrationList ( uint8_t  size)

Create an empty registration list of the specified size.

Parameters
sizeThe desired size of the list
Returns
The newly created registration list or NULL if an error occurred

◆ DPS_DestroyRegistrationList()

void DPS_DestroyRegistrationList ( DPS_RegistrationList regs)

Destroy a registration list and free resources.

Parameters
regsA previously created registration list

◆ DPS_Registration_Get()

DPS_Status DPS_Registration_Get ( DPS_Node node,
const char *  addrText,
const char *  tenantString,
DPS_RegistrationList regs,
uint16_t  timeout,
DPS_OnRegGetComplete  cb,
void *  data 
)

Lookup the addresses registered with a registration service.

Parameters
nodeThe node
addrTextThe text string of the registration service address
tenantStringTopic string identifying the tenant
regsRegistration list for accumulating the results. The count field must be initialized with the maximum number of registrations to be returned. The candidate list pointer must remain valid until the callback is called.
timeoutTimeout in milliseconds
cbThe callback to call with the result
dataCaller supplied data to be passed to the callback
Returns
DPS_OK if the registration get request was successfully initiated, otherwise returns an error status and the callback function will not be called.

◆ DPS_Registration_GetSyn()

DPS_Status DPS_Registration_GetSyn ( DPS_Node node,
const char *  addrText,
const char *  tenantString,
DPS_RegistrationList regs,
uint16_t  timeout 
)

A synchronous version of DPS_RegistrationGet() this function blocks until the candidate list has been populated or the request times out.

Parameters
nodeThe node
addrTextThe text string of the registration service address
tenantStringTopic string identifying the tenant
regsRegistration list for accumulating the results.
timeoutTimeout in milliseconds
Returns
DPS_OK if the get request succeeded or and error status for the failure.

◆ DPS_Registration_LinkTo()

DPS_Status DPS_Registration_LinkTo ( DPS_Node node,
DPS_RegistrationList regs,
DPS_OnRegLinkToComplete  cb,
void *  data 
)

Randomly select a remote candidate to link to.

Parameters
nodeThe local node to link
regsThe list of candidate registrations to try to link to
cbThe callback to call with the result
dataCaller supplied data to be passed to the callback
Returns
Status code indicating success or failure
  • DPS_OK if a link is being tried, the success or failure will be reported in the callback
  • DPS_ERR_NO_ROUTE if no new links can be established
  • Other error status codes

◆ DPS_Registration_LinkToSyn()

DPS_Status DPS_Registration_LinkToSyn ( DPS_Node node,
DPS_RegistrationList regs,
DPS_NodeAddress addr 
)

Synchronous version of Registration_LinkTo.

Parameters
nodeThe local node to link
regsThe list of candidate registrations to try to link to
addrSet to the address of the linked candidate
Returns
Status code indicating success or failure
  • DPS_OK if a link was successfully established
  • DPS_ERR_NO_ROUTE if no new links can be established
  • Other error status codes

◆ DPS_Registration_Put()

DPS_Status DPS_Registration_Put ( DPS_Node node,
const char *  addrText,
const char *  tenantString,
uint16_t  timeout,
DPS_OnRegPutComplete  cb,
void *  data 
)

Register a local node with a registration service.

Parameters
nodeThe local node to register
addrTextThe text string of the registration service address
tenantStringTopic string identifying the tenant
timeoutTimeout in milliseconds
cbCallback called when the registration completes.
dataCaller provided data to be passed to the callback function
Returns
DPS_OK if the registration put request was successfully initiated, otherwise returns an error status and the callback function will not be called.

◆ DPS_Registration_PutSyn()

DPS_Status DPS_Registration_PutSyn ( DPS_Node node,
const char *  addrText,
const char *  tenantString,
uint16_t  timeout 
)

Synchronous version of DPS_RegistrationPut().

This function blocks until the operations is complete.

Parameters
nodeThe local node to register
addrTextThe text string of the registration service address
tenantStringTopic string identifying the tenant
timeoutTimeout in milliseconds
Returns
DPS_OK if the put request succeeded or and error status for the failure.