TSUUIDCREATE(3ts)
β¨ TSUUIDCREATE(3ts) β¨
okay bestie, gather round, because we're about to talk about the Apache Traffic Server UUID construction APIs and honestly? it's giving main character energy. this is page TSUUIDCREATE(3ts) from the Traffic Server manual and it's all about making, managing, and using UUIDs in your plugin. π
πΈ NAME πΈ
TSUuidCreate β traffic Server UUID construction APIs
like... that's the whole vibe. UUIDs. constructing them. slay. π
π SYNOPSIS π
#include <ts/ts.h>
TSUuid TSUuidCreate(void)
TSReturnCode TSUuidInitialize(TSUuid uuid, TSUuidVersion v)
void TSUuidDestroy(TSUuid uuid)
TSReturnCode TSUuidCopy(TSUuid dest, const TSUuid src)
const char *TSUuidStringGet(const TSUuid uuid)
TSUuidVersion TSUuidVersionGet(const TSUuid uuid)
TSReturnCode TSUuidStringParse(TSUuid uuid, const char *uuid_str)
const TSUuid TSProcessUuidGet(void)
TSReturnCode TSClientRequestUuidGet(TSHttpTxn txnp, char *uuid_str)
π DESCRIPTION π
so these APIs are your girlies for creating, managing, and using UUIDs inside a plugin, and they implement part of RFC 4122. rn, only the V4 variant of the spec is implemented β that's it, that's the one. β¨ plus there's an internal, process-unique UUID available, which you can use to uniquely identify the running Traffic Server process. iconic.
TSUuidCreate() creates a brand new TSUuid object, hands it back to you, and you can use it with all the other APIs here. same energy with the read-only global process UUID you get from TSProcessUuidGet(). and listen β you must not attempt to modify any data as returned by either of these functions. not even a little. π
TSUuidInitialize() initializes a TSUuid object using the algorithm defined for the version you specify. heads up though: only the V4 variant is currently supported. you can call TSUuidInitialize() over and over, and each call generates a new UUID, but it will overwrite any existing UUID data in that object. which also means any strings you got from TSUuidStringGet() get modified right along with it. so like, be aware. π
TSUuidDestroy() destroys (releases) a TSUuid object and frees all the memory associated with it. yes, all of it β including any strings that came back from, say, TSUuidStringGet(). gone. bye. π¦
TSUuidCopy() copies one TSUuid into another, making an exact duplicate. note that both the source and the destination UUIDs have to be created properly, and neither should have been previously destroyed. no copying from beyond the grave, bestie. β°οΈ
TSUuidVersionGet() returns the version number for the TSUuid. this works properly for any RFC 4122 initialized UUID object β like, if you parse a string with TSUuidStringParse(), this will hand you back the correct variant ID. π―
TSUuidStringGet() returns a pointer to the internal string representation of the TSUuid object. here's the tea: there is no transfer of ownership of this string. if you need a copy, that's a you problem β you're responsible for making it yourself. and specifically: using a string returned by TSUuidStringGet() after you've 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 returned by this API. do not. I'm begging. π
TSUuidStringParse() converts an existing TSUuid string into a Traffic Server UUID object. it'll only succeed if the string is a proper RFC 4122 UUID β no impostors allowed. π« the TSUuid argument you pass in must be a properly TSUuidCreate()'d object, but it does not need to have been previously initialized. lowkey convenient.
finally, TSClientRequestUuidGet() extracts the client request uuid from a transaction. the output buffer must be long enough β minimum of TS_CRUUID_STRING_LEN + 1 bytes. this produces the same string that the log tag %<cruuid> generates, and it will be NULL terminated. periodt. π
π RETURN VALUES π
the TSUuid type is an opaque pointer to an internal representation of the UUID object. several of these functions return a normal Traffic Server return status code, TSReturnCode. you should verify the success of those APIs, of course. always check, bestie. β
TSUuidStringGet() will return NULL if the TSUuid object is not properly initialized. and likewise, TSUuidVersionGet() would then return TS_UUID_UNDEFINED. π
TSUuidDestroy() cannot fail and does not have a return value β but you are, of course, responsible for providing a valid TSUuid object. that part's on you. π
π EXAMPLES π
#include <ts/ts.h>
TSUuid machine, uuid;
machine = TSProcessUuidGet();
printf("Machine UUID is %s\n", TSUuidStringGet(machine);
if (uuid = TSUuidCreate()) {
if (TS_SUCCESS == TSUuidInitialize(uuid, TS_UUID_V4) {
printf("My UUID is %s\n", TSUuidStringGet(uuid));
}
TSUuidDestroy(uuid);
}
const char* str = "c71e2bab-90dc-4770-9535-c9304c3de38e";
if (TS_SUCCESS == TSUuidStringParse(uuid, str)) {
if (TS_UUID_V4 == TSUuidVersionGet(uuid)) {
// Yes!
}
}
look at that. art. β¨
π«Ά SEE ALSO π«Ά
TSAPI(3ts)TSUuid(3ts)TSReturnCode(3ts)
go read those too, iykyk. π
π COPYRIGHT π
2026, dev@trafficserver.apache.org
and that's the whole page, bestie!! π this was TSUUIDCREATE(3ts) from Apache Traffic Server, version 9.2, dated Feb 12, 2026. go make some UUIDs, you absolute icon. mwah. πβ¨π¦
π¦ where this page comes from
- ubuntu questing: trafficserver-dev 9.2.5+ds-1ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms