These APIs are used to create, manage, and use UUIDs in a plugin, implementing part of RFC4122.
Currently, only the V4 variant of the specifications is implemented. In addition, an internal, process
unique UUID is provided, which can be used to uniquely identifying the running Traffic Server process.
TSUuidCreate() creates a new TSUuid object, which is returned and can be used by the other APIs.
Similarly, a read-only global process UUID is returned from the function TSProcessUuidGet(). You must not
attempt to modify any data as returned by either of these functions.
TSUuidInitialize() initializes a TSUuid object, using the algorithm defined for the specified version.
Note that only the V4 variants is currently supported. You can call TSUuidInitialize() repeatedly, which
each generates a new UUID, but this will overwrite any existing UUID data in the object. This also
implies that any strings retrieved using TSUuidStringGet() are also modified accordingly.
TSUuidDestroy() destroys (releases) an TSUuid object, and frees all memory associated with this object.
This includes any strings as returned by e.g. TSUuidStringGet().
TSUuidCopy() copies one TSUuid to another, making an exact duplicate. Note that both the source and the
destination UUIDs must be created appropriately, and should not have been previously destroyed.
TSUuidVersionGet() returns the version number for the TSUuid. This will work properly for any RFC4122
initialized UUID object, e.g. if you parse a string with TSUuidStringParse() this will return the correct
variant ID.
TSUuidStringGet() returns a pointer to the internal string representation of the TSUuid object. It's
important to know that there is no transfer of ownership of this string. If you need a copy of it, you
are responsible of doing so yourself. In particular, using a string as returned by TSUuidStringGet()after you have called TSUuidDestroy() on the corresponding TSUuid object is a serious error. The UUID
object does not do any sort of reference counting on the string, and you must absolutely not free the
memory as returned by this API.
TSUuidStringParse() can be used to convert an existing TSUuid string to a Traffic Server UUID object.
This will only succeed if the TSUuid string is a proper RFC4122 UUID. The TSUuid argument passed to this
function must be a properly TSUuidCreate() object, but it does not need to be previously initialized.
Finally, TSClientRequestUuidGet() can be used to extract the client request uuid from a transaction. The
output buffer must be of sufficient length, minimum of TS_CRUUID_STRING_LEN + 1 bytes. This produces the
same string as the log tag %<cruuid> generates, and it will be NULL terminated.