TSPLUGININIT(3ts)
π TSPLUGININIT π
okay bestie, pull up a chair because this is the main character of every Apache Traffic Server plugin page β it's TSPluginInit(3ts), straight out of the Apache Traffic Server manual, and honestly? she's iconic. πΈ
β¨ NAME β¨
TSPluginInit β Traffic Server plugin loading and registration π (yes, that's the whole vibe: loading and registering, the two-step of plugin existence)
β¨ SYNOPSIS β¨
#include <ts/ts.h>
void TSPluginInit(int argc, const char *argv[])
TSReturnCode TSPluginRegister(TSPluginRegistrationInfo *plugin_info)
β¨ DESCRIPTION β¨
so here's the tea, bestie π β TSPluginInit() must be defined by all plugins. like, every single one. no exceptions, no cap. Traffic Server calls this initialization routine when it loads the plugin, and it sets argc and argv appropriately based on the values in plugin.config.
argc is a count of the number of arguments in the argument vector, argv. and listen β that count is at least one, because the first argument in the argument vector is the plugin's name, which must exist in order for the plugin to be loaded. literally the plugin has to have a name to get in the door, iykyk π
TSPluginRegister() registers the appropriate SDK version specified in sdk_version for your plugin. use this function to make sure that the version of Traffic Server your plugin is running on actually supports the plugin. it's giving vibe check for compatibility π¦
β¨ RETURN VALUES β¨
TSPluginRegister() returns TS_ERROR if the plugin registration failed. π that's the bad ending, we don't want it.
β¨ EXAMPLES β¨
here's a whole little hello-world situation, go off π
#include <ts/ts.h>
#define PLUGIN_NAME "hello_world"
void
TSPluginInit (int argc, const char * argv[])
{
TSPluginRegistrationInfo info;
info.plugin_name = PLUGIN_NAME;
info.vendor_name = "MyCompany";
info.support_email = "ts-api-support@MyCompany.com";
if (TSPluginRegister(&info) != TS_SUCCESS) {
TSError("[%s] Plugin registration failed", PLUGIN_NAME);
}
}
β¨ SEE ALSO β¨
β¨ COPYRIGHT β¨
2026, dev@trafficserver.apache.org π
lowkey important reminder:TSPluginInit()is not optional. noTSPluginInit(), no plugin. periodt. π₯
and that's the whole page bestie!! π«Ά this was TSPLUGININIT(3ts) from Apache Traffic Server β version 9.2, dated Feb 12, 2026 β mwah, go register some plugins, you're gonna slay πβ¨π
π¦ where this page comes from
- ubuntu noble: trafficserver-dev 9.2.3+ds-1+deb12u1ubuntu0.1 Β· Apache-2.0
- 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