uuid.h

UUID conversion, handling and tracking

Universally Unique Identifiers (UUIDs) are used in ACN for several purposes including Component IDs (CIDs) and DDL module identifiers (DCIDs).

See RFC 4122 for definition

Summary
uuid.hUUID conversion, handling and tracking
UUID searchThere are several places where we need to store records indexed by UUID which need highly optimized lookup.
Macros
UUID iteration macrosThese macros iterate over all the UUIDs stored in a set in sorted order without recursion.
Functions
adduuidAdds uuid to the set (storing the pointer uuid).
finduuidFind the record in the set whose uuid matches the one passed.
unlinkuuidRemoves uuid from the set

UUID search

There are several places where we need to store records indexed by UUID which need highly optimized lookup.

UUID records are contained in a uuidset, with operations to find, add and remove UUIDs from a set.

These routines deal in pointers to the UUID itself and do not copy create or destroy these UUIDs which are typically embedded in larger structures which are being tracked.

hint: use <container_of()> to get from the UUID to the structure.

Summary
Macros
UUID iteration macrosThese macros iterate over all the UUIDs stored in a set in sorted order without recursion.
Functions
adduuidAdds uuid to the set (storing the pointer uuid).
finduuidFind the record in the set whose uuid matches the one passed.
unlinkuuidRemoves uuid from the set

Macros

UUID iteration macros

These macros iterate over all the UUIDs stored in a set in sorted order without recursion.  The code is ugly but that comes from the nature of the problem.

FOR_EACH_UUID(set, ptr, type, member)start iteration
NEXT_UUID()end of iteration loop

Functions

adduuid

extern int adduuid(struct uuidset_s *set,
const uint8_t *uuid)

Adds uuid to the set (storing the pointer uuid).

returns 0 if a new pointer was added, -1 if it was already there

finduuid

extern const uint8_t *finduuid(struct uuidset_s *set,
const uint8_t *uuid)

Find the record in the set whose uuid matches the one passed.

Returns the pointer to a matching uuid that was previously added to the set or NULL if not found.

unlinkuuid

extern int unlinkuuid(struct uuidset_s *set,
const uint8_t *uuid)

Removes uuid from the set

extern int adduuid(struct uuidset_s *set,
const uint8_t *uuid)
Adds uuid to the set (storing the pointer uuid).
extern const uint8_t *finduuid(struct uuidset_s *set,
const uint8_t *uuid)
Find the record in the set whose uuid matches the one passed.
extern int unlinkuuid(struct uuidset_s *set,
const uint8_t *uuid)
Removes uuid from the set
Close