.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "TSSSLCLIENTCONTEXT" "3ts" "Nov 02, 2023" "9.2" "Apache Traffic Server" .SH NAME TSSslClientContext \- TSSslClientContext API function .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C #include .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%TSReturnCode\fP TSSslClientContextsNamesGet(int n, const char **result, int *actual) .UNINDENT .INDENT 0.0 .TP .B \fI\%TSSslContext\fP TSSslClientContextFindByName(const char *ca_paths, const char *ck_paths) .UNINDENT .SH DESCRIPTION .sp These functions are used to explore the client contexts that Traffic Server uses to connect to upstreams. .sp \fI\%TSSslClientContextsNamesGet()\fP can be used to retrieve the entire client context mappings. Note that in Traffic Server, client contexts are stored in a 2\-level mapping with ca paths and cert/key paths as keys. Hence every 2 null\-terminated string in \fIresult\fP can be used to lookup one context. \fIresult\fP points to an user allocated array that will hold pointers to lookup key strings and \fIn\fP is the size for \fIresult\fP array. \fIactual\fP, if valid, will be filled with actual number of lookup keys (2 for each context). .sp \fI\%TSSslClientContextFindByName()\fP can be used to retrieve the client context pointed by the lookup key pairs. User should call \fI\%TSSslClientContextsNamesGet()\fP first to determine which lookup keys are present before querying for the context. \fIca_paths\fP should be the first key and \fIck_paths\fP should be the second. This function returns NULL if the client context mapping are changed and no valid context exists for the key pair. The caller is responsible for releasing the context returned by this function with \fI\%TSSslContextDestroy()\fP\&. .SH EXAMPLES .sp The example below is excerpted from \fIexample/plugins/c\-api/client_context_dump/client_context_dump.cc\fP in the Traffic Server source distribution. It demonstrates how to use \fI\%TSSslClientContextsNamesGet()\fP and \fI\%TSSslClientContextFindByName()\fP to retrieve all contexts. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C 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(malloc(sizeof(const char *) * count)); TSSslClientContextsNamesGet(count, results, nullptr); for (int i = 0; i < count; i += 2) { dump_context(results[i], results[i + 1]); } } } .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C void dump_context(const char *ca_path, const char *ck_path) { TSSslContext ctx = TSSslClientContextFindByName(ca_path, ck_path); if (ctx) { .ft P .fi .UNINDENT .UNINDENT .SH COPYRIGHT 2023, dev@trafficserver.apache.org .\" Generated by docutils manpage writer. .