Distributed Publish Subscribe for IoT
registration.h File Reference

Go to the source code of this file.

Data Structures

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

Macros

#define DPS_CANDIDATE_TRYING   0x01 /** An attempt is being made link to a candidate */
 
#define DPS_CANDIDATE_FAILED   0x02 /** An attempt to link to a candidate was attempted but failed */
 
#define DPS_CANDIDATE_LINKED   0x04 /** Registration is currently linked */
 
#define DPS_CANDIDATE_UNLINKED   0x08 /** Registration was linked but is currently not linked */
 
#define DPS_CANDIDATE_INVALID   0x10 /** This is a invalid candidate address for linking */
 

Typedefs

typedef struct _DPS_Registration DPS_Registration
 Registration entry. More...
 
typedef struct _DPS_RegistrationList DPS_RegistrationList
 For returning a list of candidate remote nodes. More...
 
typedef void(* DPS_OnRegPutComplete) (DPS_Status status, void *data)
 Function prototype for callback called when DPS_Registration_Put() completes. More...
 
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, DPS_NodeAddress *addr, DPS_Status status, void *data)
 Function prototype for callback called when DPS_Registration_LinkTo() completes. More...
 

Functions

DPS_RegistrationListDPS_CreateRegistrationList (uint8_t size)
 Create an empty regisration list of the specified size. More...
 
void DPS_DestroyRegistrationList (DPS_RegistrationList *regs)
 Destroy a regisration list and free resources. More...
 
DPS_Status DPS_Registration_Put (DPS_Node *node, const char *host, uint16_t port, const char *tenantString, DPS_OnRegPutComplete cb, void *data)
 Resolve the host and port of a registration service and register a local node with that service. More...
 
DPS_Status DPS_Registration_PutSyn (DPS_Node *node, const char *host, uint16_t port, const char *tenantString)
 Synchronous version of DPS_RegistrationPut(). More...
 
DPS_Status DPS_Registration_Get (DPS_Node *node, const char *host, uint16_t port, const char *tenantString, DPS_RegistrationList *regs, DPS_OnRegGetComplete cb, void *data)
 Resolve the host and port of a registration service and lookup the addresses registered with that service. More...
 
DPS_Status DPS_Registration_GetSyn (DPS_Node *node, const char *host, uint16_t port, const char *tenantString, DPS_RegistrationList *regs)
 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...
 

Variables

const char * DPS_RegistryTopicString
 APIs for interacting with a registration service. More...
 

Macro Definition Documentation

#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 */

Typedef Documentation

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 succesfully - the registration list might be empty,
dataCaller supplied data passed into the DPS_Registration_Get()
typedef void(* DPS_OnRegLinkToComplete) (DPS_Node *node, DPS_RegistrationList *regs, DPS_NodeAddress *addr, DPS_Status status, void *data)

Function prototype for callback called when DPS_Registration_LinkTo() completes.

Parameters
regsThe list of registrations addressess 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 sucessfully 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()
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()

Registration entry.

For returning a list of candidate remote nodes.

Function Documentation

DPS_RegistrationList* DPS_CreateRegistrationList ( uint8_t  size)

Create an empty regisration list of the specified size.

void DPS_DestroyRegistrationList ( DPS_RegistrationList regs)

Destroy a regisration list and free resources.

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

Resolve the host and port of a registration service and lookup the addresses registered with that service.

Parameters
nodeThe node
hostThe host name or IP address to register with
portThe port number
tenantStringTopic string indentifying 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 remanin valid until the callback is called.
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 succesfully initiated, otherwise returns an error status and the callback function will not be called.
DPS_Status DPS_Registration_GetSyn ( DPS_Node node,
const char *  host,
uint16_t  port,
const char *  tenantString,
DPS_RegistrationList regs 
)

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

Parameters
nodeThe node
hostThe host name or IP address to register with
portThe port number
tenantStringTopic string indentifying the tenant
regsRegistration list for accumulating the results.
Returns
DPS_OK if the get request succeeded or and error status for the failure.
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_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_Status DPS_Registration_Put ( DPS_Node node,
const char *  host,
uint16_t  port,
const char *  tenantString,
DPS_OnRegPutComplete  cb,
void *  data 
)

Resolve the host and port of a registration service and register a local node with that service.

Parameters
nodeThe local node to register
hostThe host name or IP address to register with
portThe port number
tenantStringTopic string indentifying the tenant
cbCallback called when the registration completes.
dataCaller provided data to be passed to the callback function
Returns
DPS_OK if the registration put reequest was succesfully initiated, otherwise returns an error status and the callback function will not be called.
DPS_Status DPS_Registration_PutSyn ( DPS_Node node,
const char *  host,
uint16_t  port,
const char *  tenantString 
)

Synchronous version of DPS_RegistrationPut().

This function blocks until the operations is complete.

Parameters
nodeThe local node to register
hostThe host name or IP address to register with
portThe port number
tenantStringTopic string indentifying the tenant
Returns
DPS_OK if the put request succeeded or and error status for the failure.

Variable Documentation

const char* DPS_RegistryTopicString

APIs for interacting with a registration service.