MCPcopy Create free account
hub / github.com/apache/trafficserver / protocol_init

Function protocol_init

example/plugins/c-api/protocol/Protocol.cc:89–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static void
90protocol_init(int accept_port, int server_port ATS_UNUSED)
91{
92 TSCont contp;
93 int ret_val;
94
95 /* create customized log */
96 ret_val = TSTextLogObjectCreate(PLUGIN_NAME, TS_LOG_MODE_ADD_TIMESTAMP, &protocol_plugin_log);
97 if (ret_val != TS_SUCCESS) {
98 TSError("[%s] Failed to create log", PLUGIN_NAME);
99 }
100
101 /* format of the log entries, for caching_status, 1 for HIT and 0 for MISS */
102 ret_val = TSTextLogObjectWrite(protocol_plugin_log, "timestamp filename servername caching_status\n\n");
103 if (ret_val != TS_SUCCESS) {
104 TSError("[%s] Failed to write into log", PLUGIN_NAME);
105 }
106
107 contp = TSContCreate(accept_handler, TSMutexCreate());
108
109 /* Accept network traffic from the accept_port.
110 When there are requests coming in, contp's handler
111 should be called, in this case, contp's handler
112 is accept_event, see AcceptSM.c */
113 pending_action = TSNetAccept(contp, accept_port, -1, 1);
114}
115
116void
117TSPluginInit(int argc, const char *argv[])

Callers 1

TSPluginInitFunction · 0.85

Calls 6

TSTextLogObjectCreateFunction · 0.85
TSTextLogObjectWriteFunction · 0.85
TSContCreateFunction · 0.85
TSMutexCreateFunction · 0.85
TSNetAcceptFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected