TSSSLCLIENTCONTEXT(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– TSSSLCLIENTCONTEXT πŸ’–

okay bestie, welcome to TSSSLCLIENTCONTEXT(3ts) from the Apache Traffic Server manual β€” yes she's a section-3 library page and yes she's serving looks ✨

🌸 NAME 🌸

TSSslClientContext β€” the TSSslClientContext API function, periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <ts/ts.h>

TSReturnCode TSSslClientContextsNamesGet(int n, const char **result, int *actual)

TSSslContext TSSslClientContextFindByName(const char *ca_paths, const char *ck_paths)

πŸ¦‹ DESCRIPTION πŸ¦‹

so these functions are literally your little backstage pass to peek at the client contexts that Traffic Server uses to connect to upstreams πŸ‘€

TSSslClientContextsNamesGet() is the one you call when you wanna grab the entire client context mapping. and here's the tea: in Traffic Server, client contexts are stored in a 2-level mapping, with ca paths and cert/key paths as the keys πŸ”‘πŸ”‘ so basically every 2 null-terminated strings inside result can be used to look up exactly one context.

result points to a user-allocated array that's gonna hold pointers to lookup key strings, and n is the size of that result array. and actual, if it's valid, gets filled with the actual number of lookup keys β€” that's 2 for each context babe, do the math ✨

TSSslClientContextFindByName() is the follow-up bestie. she retrieves the client context pointed to by the lookup key pairs. but listen β€” you should call TSSslClientContextsNamesGet() first to figure out which lookup keys are even present before you go querying for the context, iykyk. ca_paths should be the first key and ck_paths should be the second.

😭 heads up: this function returns NULL if the client context mapping got changed and no valid context exists for that key pair. rude but fair.

and also β€” the caller is responsible for releasing the context returned by this function, using TSSslContextDestroy(). don't be the friend who leaves the context hanging, it's giving leak πŸ’€


🌈 EXAMPLES 🌈

the example below is excerpted from example/plugins/c-api/client_context_dump/client_context_dump.cc in the Traffic Server source distribution πŸ“ she demonstrates how to use TSSslClientContextsNamesGet() and TSSslClientContextFindByName() to retrieve all contexts 🫢

if (tag.substr(0, PLUGIN_PREFIX.size()) == PLUGIN_PREFIX) {
  tag.remove_prefix(PLUGIN_PREFIX.size());
  // Grab all keys by API and dump to log file according to arg passed in
  int count = 0;
  TSSslClientContextsNamesGet(0, nullptr, &count);
  if (count > 0) {
    char const **results = static_cast<char const **>(malloc(sizeof(const char *) * count));
    TSSslClientContextsNamesGet(count, results, nullptr);
    for (int i = 0; i < count; i += 2) {
      dump_context(results[i], results[i + 1]);
    }
  }
}

void
dump_context(const char *ca_path, const char *ck_path)
{
  TSSslContext ctx = TSSslClientContextFindByName(ca_path, ck_path);
  if (ctx) {

2026, dev@trafficserver.apache.org


okay that's the whole page, no notes πŸ’– she's giving version 9.2, dated Feb 12, 2026, brought to you by the Apache Traffic Server girlies β€” slay, and remember to TSSslContextDestroy() your contexts before you log off, mwah πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from