component.h

Utilities for management of local and remote components

Summary
component.hUtilities for management of local and remote components
Local and remote componentsStructures for components
Types
struct Lcomponent_s
struct Rcomponent_s
Variables
Local component(s)Local component or component set depending on CF_MULTI_COMPONENT.
LcomponentsA <struct uuidset_s> with all registered local components (if CF_MULTI_COMPONENT is true).
localComponentA single global struct Lcomponent_s (if CF_MULTI_COMPONENT is false).
RcomponentsRemote component set
Functions
findLcompFind a local component by its CID.
releaseLcomponentUnlink a local component from Lcomponents and if it is unused free it.
addLcomponentAdd a local component to Lcomponents.
findRcompFind a remote component by its CID.
releaseRcomponentUnlink a remote component from Rcomponents and if it is unused free it.
addRcomponentAdd a remote component to Rcomponents.

Local and remote components

Structures for components

Because component structures get passed up and down the layers a lot, rather than elaborate cross linking between structures for DMP, SDT RLP etc, we keep them all in sub-structures within a single struct.

This is of course open to abuse — don’t.

Summary
Types
struct Lcomponent_s
struct Rcomponent_s
Variables
Local component(s)Local component or component set depending on CF_MULTI_COMPONENT.
LcomponentsA <struct uuidset_s> with all registered local components (if CF_MULTI_COMPONENT is true).
localComponentA single global struct Lcomponent_s (if CF_MULTI_COMPONENT is false).
RcomponentsRemote component set
Functions
findLcompFind a local component by its CID.
releaseLcomponentUnlink a local component from Lcomponents and if it is unused free it.
addLcomponentAdd a local component to Lcomponents.
findRcompFind a remote component by its CID.
releaseRcomponentUnlink a remote component from Rcomponents and if it is unused free it.
addRcomponentAdd a remote component to Rcomponents.

Types

struct Lcomponent_s

Local component.  Members include

uint8_t uuid[UUID_SIZE]CID must be first member for UUID object tracking.  See uuid.h
char uuidstr[UUID_STR_SIZE]keep a string copy too
const char *fctnThe Fixed Component Type Name as advertised in discovery
struct epi10_Lcomp_s epi10see <struct epi10_Lcomp_s>.  only if CF_EPI10.
struct sdt_Lcomp_s sdtSDT substructure.  only if CF_SDT.
struct dmp_Lcomp_s dmpDMP substructure.  only if CF_DMP.
uint16_t lifetimeDiscovery lifetime.  only if CF_EPI19.

Note on application details

  • If only one local component (CF_MULTI_COMPONENT is false) we keep the details in a special local component structure with only one global instance so we never need to search for it.
  • With multiple local components we have to deal with communication between them and any local one may also be a remote one.  However, we keep two separate structures for local and remote reference.

struct Rcomponent_s

Remote component.  Members include

uint8_t uuid[UUID_SIZE]CID must be first member for UUID object tracking.  See uuid.h
struct slp_Rcomp_s slpDiscovery related data.
struct sdt_Rcomp_s sdtSDT related data.
struct dmp_Rcomp_s dmpDMP related data

note

When there are multiple components using the same ACN instance, if one connects to another via ACN then both will create Rcomponent_s as well as their Lcomponent_s.

Variables

Local component(s)

Local component or component set depending on CF_MULTI_COMPONENT.

Lcomponents

extern struct uuidset_s Lcomponents

A <struct uuidset_s> with all registered local components (if CF_MULTI_COMPONENT is true).

localComponent

extern struct Lcomponent_s localComponent

A single global struct Lcomponent_s (if CF_MULTI_COMPONENT is false).

Rcomponents

extern struct uuidset_s Rcomponents

Remote component set

The set of remote components which we are communicating with.  These are managed by the generic UUID tracking code of uuid.h.

Functions

findLcomp

static inline struct Lcomponent_s * findLcomp(const uint8_t *uuid)

Find a local component by its CID.  If CF_MULTI_COMPONENT is false then the UUID match is still checked before returning localComponent.

releaseLcomponent

static inline void releaseLcomponent(struct Lcomponent_s *Lcomp)

Unlink a local component from Lcomponents and if it is unused free it.  If not CF_MULTI_COMPONENT a macro equivalent is defined.

addLcomponent

static inline int addLcomponent(struct Lcomponent_s *Lcomp)

Add a local component to Lcomponents.

if CF_MULTI_COMPONENT is true.

findRcomp

static inline struct Rcomponent_s * findRcomp(const uint8_t *uuid)

Find a remote component by its CID.

releaseRcomponent

static inline void releaseRcomponent(struct Rcomponent_s *Rcomp)

Unlink a remote component from Rcomponents and if it is unused free it.

addRcomponent

static inline int addRcomponent(struct Rcomponent_s *Rcomp)

Add a remote component to Rcomponents.

One or many components?
extern struct uuidset_s Lcomponents
A struct uuidset_s with all registered local components (if CF_MULTI_COMPONENT is true).
extern struct Lcomponent_s localComponent
A single global struct Lcomponent_s (if CF_MULTI_COMPONENT is false).
extern struct uuidset_s Rcomponents
Remote component set
static inline struct Lcomponent_s * findLcomp(const uint8_t *uuid)
Find a local component by its CID.
static inline void releaseLcomponent(struct Lcomponent_s *Lcomp)
Unlink a local component from Lcomponents and if it is unused free it.
static inline int addLcomponent(struct Lcomponent_s *Lcomp)
Add a local component to Lcomponents.
static inline struct Rcomponent_s * findRcomp(const uint8_t *uuid)
Find a remote component by its CID.
static inline void releaseRcomponent(struct Rcomponent_s *Rcomp)
Unlink a remote component from Rcomponents and if it is unused free it.
static inline int addRcomponent(struct Rcomponent_s *Rcomp)
Add a remote component to Rcomponents.
UUID conversion, handling and tracking
Multicast address allocation
enable the SDT layer
enable the DMP layer
Discovery using RLP
Close