| 87 | } |
| 88 | |
| 89 | static void |
| 90 | protocol_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 | |
| 116 | void |
| 117 | TSPluginInit(int argc, const char *argv[]) |
no test coverage detected