/src/trafficserver/build/include/ts/apidefs.h
Line | Count | Source |
1 | | /** @file |
2 | | |
3 | | This header file defines common types that can be shared |
4 | | between internal code and TS APIs. |
5 | | |
6 | | @section license License |
7 | | |
8 | | Licensed to the Apache Software Foundation (ASF) under one |
9 | | or more contributor license agreements. See the NOTICE file |
10 | | distributed with this work for additional information |
11 | | regarding copyright ownership. The ASF licenses this file |
12 | | to you under the Apache License, Version 2.0 (the |
13 | | "License"); you may not use this file except in compliance |
14 | | with the License. You may obtain a copy of the License at |
15 | | |
16 | | http://www.apache.org/licenses/LICENSE-2.0 |
17 | | |
18 | | Unless required by applicable law or agreed to in writing, software |
19 | | distributed under the License is distributed on an "AS IS" BASIS, |
20 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
21 | | See the License for the specific language governing permissions and |
22 | | limitations under the License. |
23 | | |
24 | | @section developers Developers |
25 | | |
26 | | Developers, when adding a new element to an enum, append it. DO NOT |
27 | | insert it. Otherwise, binary compatibility of plugins will be broken! |
28 | | |
29 | | */ |
30 | | |
31 | | #pragma once |
32 | | |
33 | | /* |
34 | | * ATS Plugin just needs to include <ts/ts.h>, |
35 | | * should not include this file directly! |
36 | | * |
37 | | */ |
38 | | |
39 | | /* GENERATED FILE WARNING! DO NOT EDIT apidefs.h |
40 | | * |
41 | | * You must modify apidefs.h.in instead. |
42 | | * |
43 | | */ |
44 | | |
45 | | #include <cstdint> |
46 | | #include <memory> |
47 | | #include <vector> |
48 | | #include <netinet/in.h> |
49 | | #include <sys/types.h> |
50 | | #include <sys/socket.h> |
51 | | #include <tuple> |
52 | | #include <type_traits> |
53 | | |
54 | | /** Apply printf format string compile-time argument checking to a function. |
55 | | * |
56 | | * |
57 | | * For example, given the following function from DiagsTypes.h: |
58 | | * |
59 | | * @code |
60 | | * class Diags { |
61 | | * |
62 | | * ... |
63 | | * |
64 | | * void |
65 | | * print( |
66 | | * const char *tag, |
67 | | * DiagsLevel level, |
68 | | * const SourceLocation *loc, |
69 | | * const char *fmt, |
70 | | * ...) const; |
71 | | * |
72 | | * ... |
73 | | * |
74 | | * }; |
75 | | * @endcode |
76 | | * |
77 | | * This macro can be used to apply compiler checking for ... against the fmt |
78 | | * argument like so: |
79 | | * |
80 | | * |
81 | | * @code |
82 | | * class Diags { |
83 | | * |
84 | | * ... |
85 | | * |
86 | | * void |
87 | | * print( |
88 | | * const char *tag, |
89 | | * DiagsLevel level, |
90 | | * const SourceLocation *loc, |
91 | | * const char *fmt, |
92 | | * ...) const TS_PRINTFLIKE(5, 6); |
93 | | * |
94 | | * ... |
95 | | * |
96 | | * }; |
97 | | * @endcode |
98 | | * |
99 | | * Note in this case, (5, 6) rather than (4, 5) is passed because `this` |
100 | | * counts as the implicit first parameter of this member function. |
101 | | * |
102 | | * @param[in] fmt_index The index of the format string argument, with argument |
103 | | * indexing starting at 1. |
104 | | * |
105 | | * @param[in] arg_index The index of the first format argument string, with |
106 | | * argument indexing starting at 1. |
107 | | */ |
108 | | #if !defined(TS_PRINTFLIKE) |
109 | | #if defined(__GNUC__) || defined(__clang__) |
110 | | #define TS_PRINTFLIKE(fmt_index, arg_index) __attribute__((format(printf, fmt_index, arg_index))) |
111 | | #else |
112 | | #define TS_PRINTFLIKE(fmt_index, arg_index) |
113 | | #endif |
114 | | #endif |
115 | | |
116 | | #if !defined(TS_NORETURN) |
117 | | #if defined(__GNUC__) || defined(__clang__) |
118 | | #define TS_NORETURN __attribute__((noreturn)) |
119 | | #else |
120 | | #define TS_NORETURN |
121 | | #endif |
122 | | #endif |
123 | | |
124 | | /* Version info |
125 | | * |
126 | | * Version numbers need to be preprocessor symbols for conditional compilation. |
127 | | */ |
128 | | /* clang-format off */ |
129 | | char const TS_VERSION_STRING[] = "11.0.0"; |
130 | | #define TS_VERSION_NUMBER 11000000 |
131 | | #define TS_VERSION_MAJOR 11 |
132 | | #define TS_VERSION_MINOR 0 |
133 | | #define TS_VERSION_MICRO 0 |
134 | | /* clang-format on */ |
135 | | |
136 | | constexpr long |
137 | | TS_HTTP_VERSION(int a, int b) |
138 | 0 | { |
139 | 0 | return ((long(a) & 0xFFFF) << 16) | (b & 0xFFFF); |
140 | 0 | } |
141 | | constexpr int |
142 | | TS_HTTP_MINOR(long v) |
143 | 0 | { |
144 | 0 | return int(v & 0xFFFF); |
145 | 0 | } |
146 | | constexpr int |
147 | | TS_HTTP_MAJOR(long v) |
148 | 0 | { |
149 | 0 | return int((v >> 16) & 0xFFFF); |
150 | 0 | } |
151 | | |
152 | | #ifndef TS_RES_MEM_PATH |
153 | | #define __TS_RES_PATH(x) #x |
154 | | #define _TS_RES_PATH(x) __TS_RES_PATH(x) |
155 | | #define TS_RES_PATH(x) x __FILE__ ":" _TS_RES_PATH(__LINE__) |
156 | | #define TS_RES_MEM_PATH TS_RES_PATH("memory/") |
157 | | #endif |
158 | | |
159 | | /** |
160 | | The following struct is used by TSPluginRegister(). It stores |
161 | | registration information about the plugin. |
162 | | |
163 | | */ |
164 | | struct TSPluginRegistrationInfo { |
165 | | const char *plugin_name; |
166 | | const char *vendor_name; |
167 | | const char *support_email; |
168 | | }; |
169 | | |
170 | | struct TSPluginMsg { |
171 | | const char *tag; ///< Message tag (null terminated). |
172 | | void const *data; ///< Message data (payload) |
173 | | size_t data_size; ///< Amount of message data. |
174 | | }; |
175 | | |
176 | | /** |
177 | | This set of enums are possible values returned by |
178 | | TSHttpHdrParseReq() and TSHttpHdrParseResp(). |
179 | | |
180 | | */ |
181 | | enum TSParseResult { |
182 | | TS_PARSE_ERROR = -1, |
183 | | TS_PARSE_DONE = 0, |
184 | | TS_PARSE_CONT = 1, |
185 | | }; |
186 | | |
187 | | /** |
188 | | This set of enums represents the possible HTTP types that |
189 | | can be assigned to an HTTP header. When a header is created |
190 | | with TSHttpHdrCreate(), it is automatically assigned a type of |
191 | | TS_HTTP_TYPE_UNKNOWN. You can modify the HTTP type ONCE after it |
192 | | the header is created, using TSHttpHdrTypeSet(). After setting the |
193 | | HTTP type once, you cannot set it again. Use TSHttpHdrTypeGet() |
194 | | to obtain the TSHttpType of an HTTP header. |
195 | | |
196 | | */ |
197 | | enum TSHttpType { |
198 | | TS_HTTP_TYPE_UNKNOWN, |
199 | | TS_HTTP_TYPE_REQUEST, |
200 | | TS_HTTP_TYPE_RESPONSE, |
201 | | }; |
202 | | |
203 | | /** |
204 | | This set of enums represents possible return values from |
205 | | TSHttpHdrStatusGet(), which retrieves the status code from an |
206 | | HTTP response header (TSHttpHdrStatusGet() retrieves status codes |
207 | | only from headers of type TS_HTTP_TYPE_RESPONSE). You can also set |
208 | | the TSHttpStatus of a response header using TSHttpHdrStatusSet(). |
209 | | |
210 | | */ |
211 | | enum TSHttpStatus { |
212 | | TS_HTTP_STATUS_NONE = 0, |
213 | | TS_HTTP_STATUS_CONTINUE = 100, |
214 | | TS_HTTP_STATUS_SWITCHING_PROTOCOL = 101, |
215 | | TS_HTTP_STATUS_EARLY_HINTS = 103, |
216 | | TS_HTTP_STATUS_OK = 200, |
217 | | TS_HTTP_STATUS_CREATED = 201, |
218 | | TS_HTTP_STATUS_ACCEPTED = 202, |
219 | | TS_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203, |
220 | | TS_HTTP_STATUS_NO_CONTENT = 204, |
221 | | TS_HTTP_STATUS_RESET_CONTENT = 205, |
222 | | TS_HTTP_STATUS_PARTIAL_CONTENT = 206, |
223 | | TS_HTTP_STATUS_MULTI_STATUS = 207, |
224 | | TS_HTTP_STATUS_ALREADY_REPORTED = 208, |
225 | | TS_HTTP_STATUS_IM_USED = 211, |
226 | | TS_HTTP_STATUS_MULTIPLE_CHOICES = 300, |
227 | | TS_HTTP_STATUS_MOVED_PERMANENTLY = 301, |
228 | | TS_HTTP_STATUS_MOVED_TEMPORARILY = 302, |
229 | | TS_HTTP_STATUS_SEE_OTHER = 303, |
230 | | TS_HTTP_STATUS_NOT_MODIFIED = 304, |
231 | | TS_HTTP_STATUS_USE_PROXY = 305, |
232 | | TS_HTTP_STATUS_TEMPORARY_REDIRECT = 307, |
233 | | TS_HTTP_STATUS_PERMANENT_REDIRECT = 308, |
234 | | TS_HTTP_STATUS_BAD_REQUEST = 400, |
235 | | TS_HTTP_STATUS_UNAUTHORIZED = 401, |
236 | | TS_HTTP_STATUS_PAYMENT_REQUIRED = 402, |
237 | | TS_HTTP_STATUS_FORBIDDEN = 403, |
238 | | TS_HTTP_STATUS_NOT_FOUND = 404, |
239 | | TS_HTTP_STATUS_METHOD_NOT_ALLOWED = 405, |
240 | | TS_HTTP_STATUS_NOT_ACCEPTABLE = 406, |
241 | | TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407, |
242 | | TS_HTTP_STATUS_REQUEST_TIMEOUT = 408, |
243 | | TS_HTTP_STATUS_CONFLICT = 409, |
244 | | TS_HTTP_STATUS_GONE = 410, |
245 | | TS_HTTP_STATUS_LENGTH_REQUIRED = 411, |
246 | | TS_HTTP_STATUS_PRECONDITION_FAILED = 412, |
247 | | TS_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413, |
248 | | TS_HTTP_STATUS_REQUEST_URI_TOO_LONG = 414, |
249 | | TS_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415, |
250 | | TS_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416, |
251 | | TS_HTTP_STATUS_EXPECTATION_FAILED = 417, |
252 | | TS_HTTP_STATUS_UNPROCESSABLE_ENTITY = 422, |
253 | | TS_HTTP_STATUS_LOCKED = 423, |
254 | | TS_HTTP_STATUS_FAILED_DEPENDENCY = 424, |
255 | | TS_HTTP_STATUS_UPGRADE_REQUIRED = 426, |
256 | | TS_HTTP_STATUS_PRECONDITION_REQUIRED = 428, |
257 | | TS_HTTP_STATUS_TOO_MANY_REQUESTS = 429, |
258 | | TS_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431, |
259 | | TS_HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451, |
260 | | TS_HTTP_STATUS_INTERNAL_SERVER_ERROR = 500, |
261 | | TS_HTTP_STATUS_NOT_IMPLEMENTED = 501, |
262 | | TS_HTTP_STATUS_BAD_GATEWAY = 502, |
263 | | TS_HTTP_STATUS_SERVICE_UNAVAILABLE = 503, |
264 | | TS_HTTP_STATUS_GATEWAY_TIMEOUT = 504, |
265 | | TS_HTTP_STATUS_HTTPVER_NOT_SUPPORTED = 505, |
266 | | TS_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506, |
267 | | TS_HTTP_STATUS_INSUFFICIENT_STORAGE = 507, |
268 | | TS_HTTP_STATUS_LOOP_DETECTED = 508, |
269 | | TS_HTTP_STATUS_NOT_EXTENDED = 510, |
270 | | TS_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511, |
271 | | }; |
272 | | |
273 | | /** |
274 | | TSEvents are sent to continuations when they are called back. |
275 | | The TSEvent provides the continuation's handler function with |
276 | | information about the callback. Based on the event it receives, |
277 | | the handler function can decide what to do. |
278 | | */ |
279 | | enum TSEvent { |
280 | | TS_EVENT_NONE = 0, |
281 | | TS_EVENT_IMMEDIATE = 1, |
282 | | TS_EVENT_TIMEOUT = 2, |
283 | | TS_EVENT_ERROR = 3, |
284 | | TS_EVENT_CONTINUE = 4, |
285 | | |
286 | | TS_EVENT_VCONN_READ_READY = 100, |
287 | | TS_EVENT_VCONN_WRITE_READY = 101, |
288 | | TS_EVENT_VCONN_READ_COMPLETE = 102, |
289 | | TS_EVENT_VCONN_WRITE_COMPLETE = 103, |
290 | | TS_EVENT_VCONN_EOS = 104, |
291 | | TS_EVENT_VCONN_INACTIVITY_TIMEOUT = 105, |
292 | | TS_EVENT_VCONN_ACTIVE_TIMEOUT = 106, |
293 | | TS_EVENT_VCONN_START = 107, |
294 | | TS_EVENT_VCONN_CLOSE = 108, |
295 | | TS_EVENT_VCONN_OUTBOUND_START = 109, |
296 | | TS_EVENT_VCONN_OUTBOUND_CLOSE = 110, |
297 | | TS_EVENT_VCONN_PRE_ACCEPT = TS_EVENT_VCONN_START, // Deprecated but still compatible |
298 | | |
299 | | TS_EVENT_NET_CONNECT = 200, |
300 | | TS_EVENT_NET_CONNECT_FAILED = 201, |
301 | | TS_EVENT_NET_ACCEPT = 202, |
302 | | TS_EVENT_NET_ACCEPT_FAILED = 204, |
303 | | |
304 | | TS_EVENT_HOST_LOOKUP = 500, |
305 | | |
306 | | TS_EVENT_CACHE_OPEN_READ = 1102, |
307 | | TS_EVENT_CACHE_OPEN_READ_FAILED = 1103, |
308 | | TS_EVENT_CACHE_OPEN_WRITE = 1108, |
309 | | TS_EVENT_CACHE_OPEN_WRITE_FAILED = 1109, |
310 | | TS_EVENT_CACHE_REMOVE = 1112, |
311 | | TS_EVENT_CACHE_REMOVE_FAILED = 1113, |
312 | | TS_EVENT_CACHE_SCAN = 1120, |
313 | | TS_EVENT_CACHE_SCAN_FAILED = 1121, |
314 | | TS_EVENT_CACHE_SCAN_OBJECT = 1122, |
315 | | TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED = 1123, |
316 | | TS_EVENT_CACHE_SCAN_OPERATION_FAILED = 1124, |
317 | | TS_EVENT_CACHE_SCAN_DONE = 1125, |
318 | | TS_EVENT_CACHE_LOOKUP = 1126, |
319 | | TS_EVENT_CACHE_READ = 1127, |
320 | | TS_EVENT_CACHE_DELETE = 1128, |
321 | | TS_EVENT_CACHE_WRITE = 1129, |
322 | | TS_EVENT_CACHE_WRITE_HEADER = 1130, |
323 | | TS_EVENT_CACHE_CLOSE = 1131, |
324 | | TS_EVENT_CACHE_LOOKUP_READY = 1132, |
325 | | TS_EVENT_CACHE_LOOKUP_COMPLETE = 1133, |
326 | | TS_EVENT_CACHE_READ_READY = 1134, |
327 | | TS_EVENT_CACHE_READ_COMPLETE = 1135, |
328 | | |
329 | | TS_EVENT_INTERNAL_1200 = 1200, |
330 | | |
331 | | TS_EVENT_SSL_SESSION_GET = 2000, |
332 | | TS_EVENT_SSL_SESSION_NEW = 2001, |
333 | | TS_EVENT_SSL_SESSION_REMOVE = 2002, |
334 | | |
335 | | TS_EVENT_AIO_DONE = 3900, |
336 | | |
337 | | TS_EVENT_HTTP_CONTINUE = 60000, |
338 | | TS_EVENT_HTTP_ERROR = 60001, |
339 | | TS_EVENT_HTTP_READ_REQUEST_HDR = 60002, |
340 | | TS_EVENT_HTTP_OS_DNS = 60003, |
341 | | TS_EVENT_HTTP_SEND_REQUEST_HDR = 60004, |
342 | | TS_EVENT_HTTP_READ_CACHE_HDR = 60005, |
343 | | TS_EVENT_HTTP_READ_RESPONSE_HDR = 60006, |
344 | | TS_EVENT_HTTP_SEND_RESPONSE_HDR = 60007, |
345 | | TS_EVENT_HTTP_REQUEST_TRANSFORM = 60008, |
346 | | TS_EVENT_HTTP_RESPONSE_TRANSFORM = 60009, |
347 | | TS_EVENT_HTTP_SELECT_ALT = 60010, |
348 | | TS_EVENT_HTTP_TXN_START = 60011, |
349 | | TS_EVENT_HTTP_TXN_CLOSE = 60012, |
350 | | TS_EVENT_HTTP_SSN_START = 60013, |
351 | | TS_EVENT_HTTP_SSN_CLOSE = 60014, |
352 | | TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE = 60015, |
353 | | TS_EVENT_HTTP_PRE_REMAP = 60016, |
354 | | TS_EVENT_HTTP_POST_REMAP = 60017, |
355 | | TS_EVENT_HTTP_REQUEST_BUFFER_READ_COMPLETE = 60018, |
356 | | TS_EVENT_HTTP_RESPONSE_CLIENT = 60019, |
357 | | TS_EVENT_HTTP_REQUEST_CLIENT = 60020, |
358 | | TS_EVENT_HTTP_TUNNEL_START = 60021, |
359 | | |
360 | | TS_EVENT_LIFECYCLE_PORTS_INITIALIZED = 60100, |
361 | | TS_EVENT_LIFECYCLE_PORTS_READY = 60101, |
362 | | TS_EVENT_LIFECYCLE_CACHE_READY = 60102, |
363 | | TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED = 60103, |
364 | | TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED = 60104, |
365 | | TS_EVENT_LIFECYCLE_MSG = 60105, |
366 | | TS_EVENT_LIFECYCLE_TASK_THREADS_READY = 60106, |
367 | | TS_EVENT_LIFECYCLE_SHUTDOWN = 60107, |
368 | | TS_EVENT_LIFECYCLE_LOG_INITIALIZED = 60108, |
369 | | |
370 | | TS_EVENT_INTERNAL_60200 = 60200, |
371 | | TS_EVENT_INTERNAL_60201 = 60201, |
372 | | TS_EVENT_INTERNAL_60202 = 60202, |
373 | | TS_EVENT_SSL_CERT = 60203, |
374 | | TS_EVENT_SSL_SERVERNAME = 60204, |
375 | | TS_EVENT_SSL_VERIFY_SERVER = 60205, |
376 | | TS_EVENT_SSL_VERIFY_CLIENT = 60206, |
377 | | TS_EVENT_SSL_CLIENT_HELLO = 60207, |
378 | | TS_EVENT_SSL_SECRET = 60208, |
379 | | |
380 | | TS_EVENT_MGMT_UPDATE = 60300, |
381 | | }; |
382 | | TSEvent const TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP = TS_EVENT_HTTP_PRE_REMAP; /* backwards compat */ |
383 | | |
384 | | /** |
385 | | This set of enums represents the possible hooks where you can |
386 | | set up continuation callbacks. The functions used to register a |
387 | | continuation for a particular hook are: |
388 | | |
389 | | TSHttpHookAdd: adds a global hook. You can globally add |
390 | | any hook except for |
391 | | - TS_HTTP_REQUEST_TRANSFORM_HOOK |
392 | | - TS_HTTP_RESPONSE_TRANSFORM_HOOK |
393 | | - TS_HTTP_RESPONSE_CLIENT_HOOK |
394 | | - TS_HTTP_REQUEST_CLIENT_HOOK |
395 | | |
396 | | The following hooks can ONLY be added globally: |
397 | | - TS_HTTP_SELECT_ALT_HOOK |
398 | | - TS_HTTP_SSN_START_HOOK |
399 | | |
400 | | TSHttpSsnHookAdd: adds a transaction hook to each transaction |
401 | | within a session. You can only use transaction hooks with this call: |
402 | | - TS_HTTP_READ_REQUEST_HDR_HOOK |
403 | | - TS_HTTP_OS_DNS_HOOK |
404 | | - TS_HTTP_SEND_REQUEST_HDR_HOOK |
405 | | - TS_HTTP_READ_CACHE_HDR_HOOK |
406 | | - TS_HTTP_READ_RESPONSE_HDR_HOOK |
407 | | - TS_HTTP_SEND_RESPONSE_HDR_HOOK |
408 | | - TS_HTTP_REQUEST_TRANSFORM_HOOK |
409 | | - TS_HTTP_RESPONSE_TRANSFORM_HOOK |
410 | | - TS_HTTP_RESPONSE_CLIENT_HOOK |
411 | | - TS_HTTP_REQUEST_CLIENT_HOOK |
412 | | - TS_HTTP_TXN_START_HOOK |
413 | | - TS_HTTP_TXN_CLOSE_HOOK |
414 | | - TS_HTTP_SSN_CLOSE_HOOK |
415 | | |
416 | | TSHttpTxnHookAdd: adds a callback at a specific point within |
417 | | an HTTP transaction. The following hooks can be used with this |
418 | | function: |
419 | | - TS_HTTP_READ_REQUEST_HDR_HOOK |
420 | | - TS_HTTP_OS_DNS_HOOK |
421 | | - TS_HTTP_SEND_REQUEST_HDR_HOOK |
422 | | - TS_HTTP_READ_CACHE_HDR_HOOK |
423 | | - TS_HTTP_READ_RESPONSE_HDR_HOOK |
424 | | - TS_HTTP_SEND_RESPONSE_HDR_HOOK |
425 | | - TS_HTTP_REQUEST_TRANSFORM_HOOK |
426 | | - TS_HTTP_RESPONSE_TRANSFORM_HOOK |
427 | | - TS_HTTP_TXN_CLOSE_HOOK |
428 | | |
429 | | The two transform hooks can ONLY be added as transaction hooks. |
430 | | |
431 | | TS_VCONN_START_HOOK - called just after the connection is created, |
432 | | before other activity such as I/O or TLS handshakes No handshake |
433 | | data has been read or sent (from the proxy) at this point |
434 | | |
435 | | TS_HTTP_LAST_HOOK _must_ be the last element. Only right place |
436 | | to insert a new element is just before TS_HTTP_LAST_HOOK. |
437 | | |
438 | | |
439 | | @note The TS_HTTP hooks below have to be in the same order as their |
440 | | corresponding TS_EVENT counterparts. We use this in calculating the |
441 | | corresponding event from a hook ID by summing |
442 | | TS_EVENT_HTTP_READ_REQUEST_HDR with the hook ID (see the invoke call in |
443 | | HttpSM::state_api_callout). For example, the following expression must be |
444 | | true: |
445 | | |
446 | | TS_EVENT_HTTP_TXN_CLOSE == TS_EVENT_HTTP_READ_REQUEST_HDR + TS_HTTP_TXN_CLOSE_HOOK |
447 | | |
448 | | */ |
449 | | enum TSHttpHookID { |
450 | | /* |
451 | | The following macro helps maintain the relationship between the TS_HTTP |
452 | | hooks and their TS_EVENT_HTTP counterparts as described in the above |
453 | | doxygen comment. |
454 | | */ |
455 | | #define DERIVE_HOOK_VALUE_FROM_EVENT(COMMON) TS_HTTP_##COMMON##_HOOK = TS_EVENT_HTTP_##COMMON - TS_EVENT_HTTP_READ_REQUEST_HDR |
456 | | DERIVE_HOOK_VALUE_FROM_EVENT(READ_REQUEST_HDR), // TS_HTTP_READ_REQUEST_HDR_HOOK |
457 | | DERIVE_HOOK_VALUE_FROM_EVENT(OS_DNS), // TS_HTTP_OS_DNS_HOOK |
458 | | DERIVE_HOOK_VALUE_FROM_EVENT(SEND_REQUEST_HDR), // TS_HTTP_SEND_REQUEST_HDR_HOOK |
459 | | DERIVE_HOOK_VALUE_FROM_EVENT(READ_CACHE_HDR), // TS_HTTP_READ_CACHE_HDR_HOOK |
460 | | DERIVE_HOOK_VALUE_FROM_EVENT(READ_RESPONSE_HDR), // TS_HTTP_READ_RESPONSE_HDR_HOOK |
461 | | DERIVE_HOOK_VALUE_FROM_EVENT(SEND_RESPONSE_HDR), // TS_HTTP_SEND_RESPONSE_HDR_HOOK |
462 | | DERIVE_HOOK_VALUE_FROM_EVENT(REQUEST_TRANSFORM), // TS_HTTP_REQUEST_TRANSFORM_HOOK |
463 | | DERIVE_HOOK_VALUE_FROM_EVENT(RESPONSE_TRANSFORM), // TS_HTTP_RESPONSE_TRANSFORM_HOOK |
464 | | DERIVE_HOOK_VALUE_FROM_EVENT(SELECT_ALT), // TS_HTTP_SELECT_ALT_HOOK |
465 | | DERIVE_HOOK_VALUE_FROM_EVENT(TXN_START), // TS_HTTP_TXN_START_HOOK |
466 | | DERIVE_HOOK_VALUE_FROM_EVENT(TXN_CLOSE), // TS_HTTP_TXN_CLOSE_HOOK |
467 | | DERIVE_HOOK_VALUE_FROM_EVENT(SSN_START), // TS_HTTP_SSN_START_HOOK |
468 | | DERIVE_HOOK_VALUE_FROM_EVENT(SSN_CLOSE), // TS_HTTP_SSN_CLOSE_HOOK |
469 | | DERIVE_HOOK_VALUE_FROM_EVENT(CACHE_LOOKUP_COMPLETE), // TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK |
470 | | DERIVE_HOOK_VALUE_FROM_EVENT(PRE_REMAP), // TS_HTTP_PRE_REMAP_HOOK |
471 | | DERIVE_HOOK_VALUE_FROM_EVENT(POST_REMAP), // TS_HTTP_POST_REMAP_HOOK |
472 | | DERIVE_HOOK_VALUE_FROM_EVENT(REQUEST_BUFFER_READ_COMPLETE), // TS_HTTP_REQUEST_BUFFER_READ_COMPLETE_HOOK |
473 | | DERIVE_HOOK_VALUE_FROM_EVENT(RESPONSE_CLIENT), // TS_HTTP_RESPONSE_CLIENT_HOOK |
474 | | DERIVE_HOOK_VALUE_FROM_EVENT(REQUEST_CLIENT), // TS_HTTP_REQUEST_CLIENT_HOOK |
475 | | DERIVE_HOOK_VALUE_FROM_EVENT(TUNNEL_START), // TS_HTTP_TUNNEL_START_HOOK |
476 | | |
477 | | // NOTE: |
478 | | // If adding any TS_HTTP hooks, be sure to understand the note above in the |
479 | | // doxygen comment about the ordering of these enum values with respect to |
480 | | // their corresponding TS_EVENT values. |
481 | | #undef DERIVE_HOOK_VALUE_FROM_EVENT |
482 | | |
483 | | // Putting the SSL hooks in the same enum space |
484 | | // So both sets of hooks can be set by the same Hook function |
485 | | TS_SSL_FIRST_HOOK, |
486 | | TS_VCONN_START_HOOK = TS_SSL_FIRST_HOOK, |
487 | | TS_VCONN_PRE_ACCEPT_HOOK = TS_VCONN_START_HOOK, // Deprecated but compatible for now. |
488 | | TS_VCONN_CLOSE_HOOK, |
489 | | TS_SSL_CLIENT_HELLO_HOOK, |
490 | | TS_SSL_SNI_HOOK, |
491 | | TS_SSL_CERT_HOOK = TS_SSL_SNI_HOOK, |
492 | | TS_SSL_SERVERNAME_HOOK, |
493 | | TS_SSL_SERVER_VERIFY_HOOK, |
494 | | TS_SSL_VERIFY_SERVER_HOOK = TS_SSL_SERVER_VERIFY_HOOK, |
495 | | TS_SSL_VERIFY_CLIENT_HOOK, |
496 | | TS_SSL_SESSION_HOOK, |
497 | | TS_VCONN_OUTBOUND_START_HOOK, |
498 | | TS_VCONN_OUTBOUND_CLOSE_HOOK, |
499 | | TS_SSL_LAST_HOOK = TS_VCONN_OUTBOUND_CLOSE_HOOK, |
500 | | TS_HTTP_LAST_HOOK, |
501 | | }; |
502 | | |
503 | | /** Plugin lifecycle hooks. |
504 | | |
505 | | These are called during lifecycle events of a plugin. They |
506 | | should be set in the plugin initialization function. The |
507 | | continuation is invoked with an event ID specified for each hook |
508 | | and @c nullptr for the event data. |
509 | | |
510 | | TS_LIFECYCLE_PORTS_INITIALIZED_HOOK |
511 | | |
512 | | called once, after the HTTP proxy port data structures have |
513 | | been initialized. In particular, SSL related calls that depend |
514 | | on accept endpoints may be invoked. After this hook is |
515 | | finished, the proxy port sockets are opened and connections |
516 | | are accepted. |
517 | | |
518 | | Event: TS_EVENT_LIFECYCLE_PORTS_INITIALIZED |
519 | | |
520 | | TS_LIFECYCLE_PORTS_READY_HOOK |
521 | | |
522 | | called once, after the sockets have been opened and the accept |
523 | | threads have been started. That is, the ports are ready to |
524 | | accept connections. This is *not* guaranteed to be called |
525 | | before the first connection is accepted. |
526 | | |
527 | | Event: TS_EVENT_LIFECYCLE_PORTS_READY |
528 | | |
529 | | TS_LIFECYCLE_CACHE_READY_HOOK |
530 | | |
531 | | called once, after the cache has finished its |
532 | | initialization. It is either online or has failed when this |
533 | | hook is called. |
534 | | |
535 | | Event: TS_EVENT_LIFECYCLE_CACHE_READY |
536 | | |
537 | | TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK |
538 | | |
539 | | called every time after a server SSL_CTX has finished the initialization. |
540 | | It exposes the initialized SSL_CTX pointer. |
541 | | |
542 | | Event: TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED |
543 | | |
544 | | TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK |
545 | | |
546 | | called once, after the client SSL_CTX has finished the initialization. |
547 | | It exposes the initialized SSL_CTX pointer. |
548 | | |
549 | | Event: TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED |
550 | | |
551 | | TS_LIFECYCLE_MSG_HOOK |
552 | | |
553 | | Called in response to an external agent. The data is a pointer to an instance of TSPluginMsg. |
554 | | |
555 | | Event: TS_EVENT_LIFECYCLE_MSG |
556 | | |
557 | | TS_LIFECYCLE_TASK_THREADS_READY_HOOK |
558 | | |
559 | | called once, after the task threads have been started. |
560 | | |
561 | | Event: TS_EVENT_LIFECYCLE_TASK_THREADS_READY |
562 | | |
563 | | TS_LIFECYCLE_SHUTDOWN_HOOK |
564 | | |
565 | | called once, after receiving a shutdown signal, such as SIGTERM. |
566 | | |
567 | | Event: TS_EVENT_LIFECYCLE_SHUTDOWN |
568 | | |
569 | | Ordering guarantees: |
570 | | |
571 | | - TS_LIFECYCLE_PORTS_INITIALIZED_HOOK before TS_LIFECYCLE_PORTS_READY_HOOK. |
572 | | |
573 | | NOTE! ONLY the orderings EXPLICITLY mentioned above are guaranteed. |
574 | | |
575 | | */ |
576 | | enum TSLifecycleHookID { |
577 | | TS_LIFECYCLE_PORTS_INITIALIZED_HOOK, |
578 | | TS_LIFECYCLE_PORTS_READY_HOOK, |
579 | | TS_LIFECYCLE_CACHE_READY_HOOK, |
580 | | TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK, |
581 | | TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK, |
582 | | TS_LIFECYCLE_MSG_HOOK, |
583 | | TS_LIFECYCLE_TASK_THREADS_READY_HOOK, |
584 | | TS_LIFECYCLE_SHUTDOWN_HOOK, |
585 | | TS_LIFECYCLE_SSL_SECRET_HOOK, |
586 | | TS_LIFECYCLE_LOG_INITIALIZED_HOOK, |
587 | | TS_LIFECYCLE_LAST_HOOK, |
588 | | }; |
589 | | |
590 | | enum TSServerState { |
591 | | TS_SRVSTATE_STATE_UNDEFINED = 0, |
592 | | TS_SRVSTATE_ACTIVE_TIMEOUT, |
593 | | TS_SRVSTATE_BAD_INCOMING_RESPONSE, |
594 | | TS_SRVSTATE_CONNECTION_ALIVE, |
595 | | TS_SRVSTATE_CONNECTION_CLOSED, |
596 | | TS_SRVSTATE_CONNECTION_ERROR, |
597 | | TS_SRVSTATE_INACTIVE_TIMEOUT, |
598 | | TS_SRVSTATE_OPEN_RAW_ERROR, |
599 | | TS_SRVSTATE_PARSE_ERROR, |
600 | | TS_SRVSTATE_TRANSACTION_COMPLETE, |
601 | | TS_SRVSTATE_PARENT_RETRY, |
602 | | TS_SRVSTATE_OUTBOUND_CONGESTION, |
603 | | }; |
604 | | |
605 | | enum TSLookingUpType { |
606 | | TS_LOOKUP_UNDEFINED_LOOKUP, |
607 | | TS_LOOKUP_PARENT_PROXY, |
608 | | TS_LOOKUP_ORIGIN_SERVER, |
609 | | TS_LOOKUP_INCOMING_ROUTER, |
610 | | TS_LOOKUP_HOST_NONE, |
611 | | }; |
612 | | |
613 | | enum TSCacheLookupResult { |
614 | | TS_CACHE_LOOKUP_MISS, |
615 | | TS_CACHE_LOOKUP_HIT_STALE, |
616 | | TS_CACHE_LOOKUP_HIT_FRESH, |
617 | | TS_CACHE_LOOKUP_SKIPPED, |
618 | | }; |
619 | | |
620 | | enum TSCacheDataType { |
621 | | TS_CACHE_DATA_TYPE_NONE, |
622 | | TS_CACHE_DATA_TYPE_HTTP, |
623 | | TS_CACHE_DATA_TYPE_OTHER, |
624 | | }; |
625 | | |
626 | | enum TSCacheError { |
627 | | TS_CACHE_ERROR_NO_DOC = -20400, |
628 | | TS_CACHE_ERROR_DOC_BUSY = -20401, |
629 | | TS_CACHE_ERROR_NOT_READY = -20407, |
630 | | }; |
631 | | |
632 | | enum TSCacheScanResult { |
633 | | TS_CACHE_SCAN_RESULT_DONE = 0, |
634 | | TS_CACHE_SCAN_RESULT_CONTINUE = 1, |
635 | | TS_CACHE_SCAN_RESULT_DELETE = 10, |
636 | | TS_CACHE_SCAN_RESULT_DELETE_ALL_ALTERNATES, |
637 | | TS_CACHE_SCAN_RESULT_UPDATE, |
638 | | TS_CACHE_SCAN_RESULT_RETRY, |
639 | | }; |
640 | | |
641 | | enum TSHttpTxnInfoKey { |
642 | | TS_TXN_INFO_NONE = -1, |
643 | | TS_TXN_INFO_CACHE_HIT_RAM, |
644 | | TS_TXN_INFO_CACHE_COMPRESSED_IN_RAM, |
645 | | TS_TXN_INFO_CACHE_HIT_RWW, // READ_WHILE_WRITE |
646 | | TS_TXN_INFO_CACHE_OPEN_READ_TRIES, |
647 | | TS_TXN_INFO_CACHE_OPEN_WRITE_TRIES, |
648 | | TS_TXN_INFO_CACHE_VOLUME, |
649 | | TS_TXN_INFO_LAST_ENTRY, |
650 | | }; |
651 | | |
652 | | enum TSHttpSsnInfoKey { |
653 | | TS_SSN_INFO_NONE = -1, |
654 | | TS_SSN_INFO_TRANSACTION_COUNT, |
655 | | TS_SSN_INFO_RECEIVED_FRAME_COUNT, |
656 | | }; |
657 | | |
658 | | enum TSVConnPPInfoKey { |
659 | | TS_PP_INFO_VERSION = 0x100, |
660 | | TS_PP_INFO_SRC_ADDR, |
661 | | TS_PP_INFO_SRC_PORT, |
662 | | TS_PP_INFO_DST_ADDR, |
663 | | TS_PP_INFO_DST_PORT, |
664 | | TS_PP_INFO_PROTOCOL, |
665 | | TS_PP_INFO_SOCK_TYPE, |
666 | | }; |
667 | | |
668 | | #define TS_SSN_INFO_RECEIVED_FRAME_COUNT_H2_UNKNOWN 999 |
669 | | #define TS_SSN_INFO_RECEIVED_FRAME_COUNT_H3_UNKNOWN 0x21 |
670 | | |
671 | | enum TSVConnCloseFlags { |
672 | | TS_VC_CLOSE_ABORT = -1, |
673 | | TS_VC_CLOSE_NORMAL = 1, |
674 | | }; |
675 | | |
676 | | enum TSIOBufferSizeIndex { |
677 | | TS_IOBUFFER_SIZE_INDEX_128 = 0, |
678 | | TS_IOBUFFER_SIZE_INDEX_256 = 1, |
679 | | TS_IOBUFFER_SIZE_INDEX_512 = 2, |
680 | | TS_IOBUFFER_SIZE_INDEX_1K = 3, |
681 | | TS_IOBUFFER_SIZE_INDEX_2K = 4, |
682 | | TS_IOBUFFER_SIZE_INDEX_4K = 5, |
683 | | TS_IOBUFFER_SIZE_INDEX_8K = 6, |
684 | | TS_IOBUFFER_SIZE_INDEX_16K = 7, |
685 | | TS_IOBUFFER_SIZE_INDEX_32K = 8, |
686 | | TS_IOBUFFER_SIZE_INDEX_64K = 9, |
687 | | TS_IOBUFFER_SIZE_INDEX_128K = 10, |
688 | | TS_IOBUFFER_SIZE_INDEX_256K = 11, |
689 | | TS_IOBUFFER_SIZE_INDEX_512K = 12, |
690 | | TS_IOBUFFER_SIZE_INDEX_1M = 13, |
691 | | TS_IOBUFFER_SIZE_INDEX_2M = 14, |
692 | | }; |
693 | | |
694 | | enum TSIOBufferWaterMark { |
695 | | TS_IOBUFFER_WATER_MARK_UNDEFINED = -1, |
696 | | TS_IOBUFFER_WATER_MARK_PLUGIN_VC_DEFAULT = 0, // mirror of DEFAULT_PLUGIN_VC_BUFFER_WATER_MARK |
697 | | TS_IOBUFFER_WATER_MARK_HTTP_DEFAULT = 32768, // mirror of default_buffer_water_mark |
698 | | }; |
699 | | |
700 | | enum TSReturnCode { |
701 | | TS_ERROR = -1, |
702 | | TS_SUCCESS = 0, |
703 | | }; |
704 | | |
705 | | enum TSFetchWakeUpOptions { |
706 | | NO_CALLBACK = 0, |
707 | | AFTER_HEADER, |
708 | | AFTER_BODY, |
709 | | }; |
710 | | |
711 | | /// Values for per server outbound connection tracking group definition. |
712 | | /// See proxy.config.http.per_server.match |
713 | | enum TSOutboundConnectionMatchType { |
714 | | TS_SERVER_OUTBOUND_MATCH_IP, |
715 | | TS_SERVER_OUTBOUND_MATCH_PORT, |
716 | | TS_SERVER_OUTBOUND_MATCH_HOST, |
717 | | TS_SERVER_OUTBOUND_MATCH_BOTH, |
718 | | }; |
719 | | |
720 | | /* librecords types */ |
721 | | |
722 | | /* The values of this enum must match enum RecT in I_RecDefs.h */ |
723 | | enum TSRecordType { |
724 | | TS_RECORDTYPE_NULL = 0x00, |
725 | | TS_RECORDTYPE_CONFIG = 0x01, |
726 | | TS_RECORDTYPE_PROCESS = 0x02, |
727 | | TS_RECORDTYPE_NODE = 0x04, |
728 | | TS_RECORDTYPE_PLUGIN = 0x20, |
729 | | TS_RECORDTYPE_ALL = 0x3F, |
730 | | }; |
731 | | |
732 | | /* The values of this enum must match enum RecDataT in I_RecDefs.h */ |
733 | | enum TSRecordDataType { |
734 | | TS_RECORDDATATYPE_NULL = 0, |
735 | | TS_RECORDDATATYPE_INT, |
736 | | TS_RECORDDATATYPE_FLOAT, |
737 | | TS_RECORDDATATYPE_STRING, |
738 | | TS_RECORDDATATYPE_COUNTER, |
739 | | TS_RECORDDATATYPE_STAT_CONST, |
740 | | TS_RECORDDATATYPE_STAT_FX, |
741 | | TS_RECORDDATATYPE_MAX, |
742 | | }; |
743 | | |
744 | | union TSRecordData { |
745 | | int64_t rec_int; |
746 | | float rec_float; |
747 | | char *rec_string; |
748 | | int64_t rec_counter; |
749 | | }; |
750 | | |
751 | | /* The values of this enum must match enum RecPersistT in I_RecDefs.h */ |
752 | | enum TSRecordPersistType { |
753 | | TS_RECORDP_NULL, |
754 | | TS_RECORDP_PERSISTENT, |
755 | | TS_RECORDP_NON_PERSISTENT, |
756 | | }; |
757 | | |
758 | | /* The values of this enum must match enum RecUpdateT in I_RecDefs.h */ |
759 | | enum TSRecordUpdateType { |
760 | | TS_RECORDUPDATE_NULL, |
761 | | TS_RECORDUPDATE_DYNAMIC, |
762 | | TS_RECORDUPDATE_RESTART_TS, |
763 | | }; |
764 | | |
765 | | /* The values of this enum must match enum RecCheckT in I_RecDefs.h */ |
766 | | enum TSRecordCheckType { |
767 | | TS_RECORDCHECK_NULL, |
768 | | TS_RECORDCHECK_STR, |
769 | | TS_RECORDCHECK_INT, |
770 | | TS_RECORDCHECK_IP, |
771 | | }; |
772 | | |
773 | | /* The values of this enum must match enum RecAccessT in I_RecDefs.h */ |
774 | | enum TSRecordAccessType { |
775 | | TS_RECORDACCESS_NULL, |
776 | | TS_RECORDACCESS_NO_ACCESS, |
777 | | TS_RECORDACCESS_READ_ONLY, |
778 | | }; |
779 | | |
780 | | enum TSOverridableConfigKey { |
781 | | TS_CONFIG_NULL = -1, |
782 | | TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR, |
783 | | TS_CONFIG_HTTP_CHUNKING_ENABLED, |
784 | | TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED, |
785 | | TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME, |
786 | | TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE, |
787 | | TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN, |
788 | | TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT, |
789 | | TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT, |
790 | | TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH, |
791 | | TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT, |
792 | | TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT, |
793 | | TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT, |
794 | | TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT, |
795 | | TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM, |
796 | | TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER, |
797 | | TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT, |
798 | | TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE, |
799 | | TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP, |
800 | | TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP, |
801 | | TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED, |
802 | | TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR, |
803 | | TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS, |
804 | | TS_CONFIG_HTTP_CACHE_HTTP, |
805 | | TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE, |
806 | | TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE, |
807 | | TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE, |
808 | | TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE, |
809 | | TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES, |
810 | | TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION, |
811 | | TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC, |
812 | | TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS, |
813 | | TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR, |
814 | | TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR, |
815 | | TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME, |
816 | | TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME, |
817 | | TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME, |
818 | | TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME, |
819 | | TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE, |
820 | | TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN, |
821 | | TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT, |
822 | | TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN, |
823 | | TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT, |
824 | | TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT, |
825 | | TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES, |
826 | | TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DOWN_SERVER, |
827 | | TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES, |
828 | | TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT, |
829 | | TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME, |
830 | | TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS, |
831 | | TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT, |
832 | | TS_CONFIG_HTTP_RESPONSE_SERVER_STR, |
833 | | TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR, |
834 | | TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD, |
835 | | TS_CONFIG_NET_SOCK_PACKET_MARK_OUT, |
836 | | TS_CONFIG_NET_SOCK_PACKET_TOS_OUT, |
837 | | TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE, |
838 | | TS_CONFIG_HTTP_CHUNKING_SIZE, |
839 | | TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED, |
840 | | TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK, |
841 | | TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK, |
842 | | TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP, |
843 | | TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE, |
844 | | TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK, |
845 | | TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE, |
846 | | TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE, |
847 | | TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED, |
848 | | TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME, |
849 | | TS_CONFIG_SSL_HSTS_MAX_AGE, |
850 | | TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS, |
851 | | TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME, |
852 | | TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES, |
853 | | TS_CONFIG_HTTP_CACHE_RANGE_WRITE, |
854 | | TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED, |
855 | | TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER, |
856 | | TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE, |
857 | | TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD, |
858 | | TS_CONFIG_HTTP_CACHE_GENERATION, |
859 | | TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE, |
860 | | TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION, |
861 | | TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS, |
862 | | TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES, |
863 | | TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRY_TIMEOUT, |
864 | | TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY, |
865 | | TS_CONFIG_HTTP_ATTACH_SERVER_SESSION_TO_CLIENT, |
866 | | TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT, |
867 | | TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT, |
868 | | TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT, |
869 | | TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS, |
870 | | TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN, |
871 | | TS_CONFIG_SRV_ENABLED, |
872 | | TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD, |
873 | | TS_CONFIG_SSL_CERT_FILENAME, |
874 | | TS_CONFIG_SSL_CLIENT_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME, |
875 | | TS_CONFIG_SSL_CERT_FILEPATH, |
876 | | TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB, |
877 | | TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH, |
878 | | TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH, |
879 | | TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH, |
880 | | TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH, |
881 | | TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD, |
882 | | TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME, |
883 | | TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS, |
884 | | TS_CONFIG_HTTP_NORMALIZE_AE, |
885 | | TS_CONFIG_HTTP_INSERT_FORWARDED, |
886 | | TS_CONFIG_HTTP_PROXY_PROTOCOL_OUT, |
887 | | TS_CONFIG_HTTP_ALLOW_MULTI_RANGE, |
888 | | TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED, |
889 | | TS_CONFIG_HTTP_ALLOW_HALF_OPEN, |
890 | | TS_CONFIG_HTTP_SERVER_MIN_KEEP_ALIVE_CONNS, |
891 | | TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MAX, |
892 | | TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MATCH, |
893 | | TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_POLICY, |
894 | | TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_PROPERTIES, |
895 | | TS_CONFIG_SSL_CLIENT_SNI_POLICY, |
896 | | TS_CONFIG_SSL_CLIENT_PRIVATE_KEY_FILENAME, |
897 | | TS_CONFIG_SSL_CLIENT_CA_CERT_FILENAME, |
898 | | TS_CONFIG_SSL_CLIENT_ALPN_PROTOCOLS, |
899 | | TS_CONFIG_HTTP_HOST_RESOLUTION_PREFERENCE, |
900 | | TS_CONFIG_HTTP_CONNECT_DOWN_POLICY, |
901 | | TS_CONFIG_HTTP_MAX_PROXY_CYCLES, |
902 | | TS_CONFIG_PLUGIN_VC_DEFAULT_BUFFER_INDEX, |
903 | | TS_CONFIG_PLUGIN_VC_DEFAULT_BUFFER_WATER_MARK, |
904 | | TS_CONFIG_NET_SOCK_NOTSENT_LOWAT, |
905 | | TS_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE, |
906 | | TS_CONFIG_HTTP_ENABLE_PARENT_TIMEOUT_MARKDOWNS, |
907 | | TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS, |
908 | | TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT, |
909 | | TS_CONFIG_HTTP_NO_DNS_JUST_FORWARD_TO_PARENT, |
910 | | TS_CONFIG_HTTP_CACHE_IGNORE_QUERY, |
911 | | TS_CONFIG_HTTP_DROP_CHUNKED_TRAILERS, |
912 | | TS_CONFIG_HTTP_STRICT_CHUNK_PARSING, |
913 | | TS_CONFIG_HTTP_NEGATIVE_CACHING_LIST, |
914 | | TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RETRY_BACKOFF_BASE, |
915 | | TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIST, |
916 | | TS_CONFIG_HTTP_CACHE_POST_METHOD, |
917 | | TS_CONFIG_HTTP_CACHE_TARGETED_CACHE_CONTROL_HEADERS, |
918 | | TS_CONFIG_LAST_ENTRY, |
919 | | }; |
920 | | |
921 | | /* The TASK pool of threads is the primary method of off-loading continuations from the |
922 | | net-threads. Configure this with proxy.config.task_threads in records.yaml. */ |
923 | | enum TSThreadPool { |
924 | | TS_THREAD_POOL_NET, |
925 | | TS_THREAD_POOL_TASK, |
926 | | /* unlikely you should use these */ |
927 | | TS_THREAD_POOL_DNS, |
928 | | TS_THREAD_POOL_UDP, |
929 | | }; |
930 | | |
931 | | /* TSHRTime stuff, this is a candidate for deprecation in v10.0.0 */ |
932 | | using TSHRTime = int64_t; |
933 | | |
934 | | TSHRTime const TS_HRTIME_NSECOND = 1; |
935 | | TSHRTime const TS_HRTIME_USECOND = 1000 * TS_HRTIME_NSECOND; |
936 | | TSHRTime const TS_HRTIME_MSECOND = 1000 * TS_HRTIME_USECOND; |
937 | | TSHRTime const TS_HRTIME_SECOND = 1000 * TS_HRTIME_MSECOND; |
938 | | |
939 | | constexpr TSHRTime |
940 | | TS_HRTIME_SECONDS(TSHRTime x) |
941 | 0 | { |
942 | 0 | return x * TS_HRTIME_SECOND; |
943 | 0 | } |
944 | | constexpr TSHRTime |
945 | | TS_HRTIME_MSECONDS(TSHRTime x) |
946 | 0 | { |
947 | 0 | return x * TS_HRTIME_MSECOND; |
948 | 0 | } |
949 | | constexpr TSHRTime |
950 | | TS_HRTIME_USECONDS(TSHRTime x) |
951 | 0 | { |
952 | 0 | return x * TS_HRTIME_USECOND; |
953 | 0 | } |
954 | | constexpr TSHRTime |
955 | | TS_HRTIME_NSECONDS(TSHRTime x) |
956 | 0 | { |
957 | 0 | return x * TS_HRTIME_NSECOND; |
958 | 0 | } |
959 | | |
960 | | /* The TSMilestonesType is an enum defining all the various milestones ("timers") that |
961 | | we track for a request. */ |
962 | | enum TSMilestonesType { |
963 | | TS_MILESTONE_NULL = -1, |
964 | | TS_MILESTONE_UA_BEGIN, |
965 | | TS_MILESTONE_UA_FIRST_READ, |
966 | | TS_MILESTONE_UA_READ_HEADER_DONE, |
967 | | TS_MILESTONE_UA_BEGIN_WRITE, |
968 | | TS_MILESTONE_UA_CLOSE, |
969 | | TS_MILESTONE_SERVER_FIRST_CONNECT, |
970 | | TS_MILESTONE_SERVER_CONNECT, |
971 | | TS_MILESTONE_SERVER_CONNECT_END, |
972 | | TS_MILESTONE_SERVER_BEGIN_WRITE, |
973 | | TS_MILESTONE_SERVER_FIRST_READ, |
974 | | TS_MILESTONE_SERVER_READ_HEADER_DONE, |
975 | | TS_MILESTONE_SERVER_CLOSE, |
976 | | TS_MILESTONE_CACHE_OPEN_READ_BEGIN, |
977 | | TS_MILESTONE_CACHE_OPEN_READ_END, |
978 | | TS_MILESTONE_CACHE_OPEN_WRITE_BEGIN, |
979 | | TS_MILESTONE_CACHE_OPEN_WRITE_END, |
980 | | TS_MILESTONE_DNS_LOOKUP_BEGIN, |
981 | | TS_MILESTONE_DNS_LOOKUP_END, |
982 | | TS_MILESTONE_SM_START, |
983 | | TS_MILESTONE_SM_FINISH, |
984 | | TS_MILESTONE_PLUGIN_ACTIVE, |
985 | | TS_MILESTONE_PLUGIN_TOTAL, |
986 | | TS_MILESTONE_TLS_HANDSHAKE_START, |
987 | | TS_MILESTONE_TLS_HANDSHAKE_END, |
988 | | TS_MILESTONE_SERVER_TLS_HANDSHAKE_START, |
989 | | TS_MILESTONE_SERVER_TLS_HANDSHAKE_END, |
990 | | TS_MILESTONE_LAST_ENTRY, |
991 | | }; |
992 | | |
993 | | /* These type aliases are used with the corresponding TSMgmt*Get functions |
994 | | for storing the values retrieved by those functions. For example, |
995 | | TSMgmtCounterGet() retrieves an TSMgmtCounter. */ |
996 | | using TSMgmtInt = int64_t; |
997 | | using TSMgmtCounter = int64_t; |
998 | | using TSMgmtFloat = float; |
999 | | using TSMgmtString = char *; |
1000 | | |
1001 | | /// The source of a management value. |
1002 | | enum TSMgmtSource { |
1003 | | TS_MGMT_SOURCE_NULL, ///< No source / value not found. |
1004 | | TS_MGMT_SOURCE_DEFAULT, ///< Built in core default. |
1005 | | TS_MGMT_SOURCE_PLUGIN, ///< Plugin supplied default. |
1006 | | TS_MGMT_SOURCE_EXPLICIT, ///< Set by administrator (config file, external API, etc.) |
1007 | | TS_MGMT_SOURCE_ENV, ///< Process environment variable. |
1008 | | }; |
1009 | | |
1010 | | /// The User Arg type, used for Txn/Ssn/VConn user argument slots |
1011 | | enum TSUserArgType { |
1012 | | TS_USER_ARGS_TXN, ///< Transaction based. |
1013 | | TS_USER_ARGS_SSN, ///< Session based |
1014 | | TS_USER_ARGS_VCONN, ///< VConnection based |
1015 | | TS_USER_ARGS_GLB, ///< Global based |
1016 | | TS_USER_ARGS_COUNT, ///< Fake enum, # of valid entries. |
1017 | | }; |
1018 | | |
1019 | | /** An enumeration of HTTP version types for the priority functions that behave |
1020 | | * differently across HTTP protocols. */ |
1021 | | enum TSHttpPriorityType { |
1022 | | HTTP_PRIORITY_TYPE_HTTP_UNSPECIFIED = 1, |
1023 | | HTTP_PRIORITY_TYPE_HTTP_2, |
1024 | | HTTP_PRIORITY_TYPE_HTTP_3, |
1025 | | }; |
1026 | | |
1027 | | /** The abstract type of the various HTTP priority implementations. */ |
1028 | | struct TSHttpPriority { |
1029 | | /** The reference to the concrete HTTP priority implementation. This will be |
1030 | | * a value from TSHttpPriorityType. */ |
1031 | | uint8_t priority_type; |
1032 | | /** The space allocated for the concrete priority implementation. |
1033 | | * |
1034 | | * Note that this has to take padding into account. There is a static_assert |
1035 | | * in InkAPI.cc to verify that TSHttpPriority is at least as large as |
1036 | | * TSHttp2Priority. As other structures are added that are represented by |
1037 | | * TSHttpPriority add more static_asserts to verify that TSHttpPriority is as |
1038 | | * large as it needs to be. |
1039 | | */ |
1040 | | uint8_t data[7]; |
1041 | | }; |
1042 | | |
1043 | | /** A structure for HTTP/2 priority. |
1044 | | * |
1045 | | * For an explanation of these terms with respect to HTTP/2, see RFC 7540, |
1046 | | * section 5.3. |
1047 | | */ |
1048 | | struct TSHttp2Priority { |
1049 | | uint8_t priority_type; /** HTTP_PROTOCOL_TYPE_HTTP_2 */ |
1050 | | uint8_t weight; |
1051 | | /** The stream dependency. Per spec, see RFC 7540 section 6.2, this is 31 |
1052 | | * bits. We use a signed 32 bit structure to store either a valid dependency |
1053 | | * or -1 if the stream has no dependency. */ |
1054 | | int32_t stream_dependency; |
1055 | | }; |
1056 | | |
1057 | | // Wrapper class that provides controlled access to client hello data |
1058 | | class TSClientHello |
1059 | | { |
1060 | | public: |
1061 | | class TSExtensionTypeList |
1062 | | { |
1063 | | public: |
1064 | 0 | TSExtensionTypeList(void *ch) : _ch(ch) {} |
1065 | | |
1066 | | class Iterator |
1067 | | { |
1068 | | public: |
1069 | | Iterator(const void *ite); |
1070 | | Iterator &operator++(); |
1071 | | bool operator==(const Iterator &b) const; |
1072 | | int operator*() const; |
1073 | | |
1074 | | private: |
1075 | | char _real_iterator[24]; |
1076 | | }; |
1077 | | |
1078 | | Iterator begin(); |
1079 | | Iterator end(); |
1080 | | |
1081 | | private: |
1082 | | void *_ch; |
1083 | | }; |
1084 | | |
1085 | 0 | TSClientHello(void *ch) : _client_hello(ch) {} |
1086 | | |
1087 | | ~TSClientHello() = default; |
1088 | | |
1089 | | explicit |
1090 | | operator bool() const |
1091 | 0 | { |
1092 | 0 | return _client_hello != nullptr; |
1093 | 0 | } |
1094 | | |
1095 | | bool is_available() const; |
1096 | | |
1097 | | uint16_t get_version() const; |
1098 | | |
1099 | | const uint8_t *get_cipher_suites() const; |
1100 | | |
1101 | | size_t get_cipher_suites_len() const; |
1102 | | |
1103 | | // Returns an iterable container of extension type IDs |
1104 | | // This abstracts the difference between BoringSSL (extensions buffer) and OpenSSL (extension_ids array) |
1105 | | TSExtensionTypeList |
1106 | | get_extension_types() const |
1107 | 0 | { |
1108 | 0 | return TSExtensionTypeList(_client_hello); |
1109 | 0 | } |
1110 | | |
1111 | | // Internal accessor for API implementation |
1112 | | void * |
1113 | | _get_internal() const |
1114 | 0 | { |
1115 | 0 | return _client_hello; |
1116 | 0 | } |
1117 | | |
1118 | | private: |
1119 | | void *_client_hello; |
1120 | | }; |
1121 | | static_assert(std::is_trivially_copyable_v<TSClientHello> == true); |
1122 | | |
1123 | | using TSFile = struct tsapi_file *; |
1124 | | |
1125 | | using TSMLoc = struct tsapi_mloc *; |
1126 | | using TSMBuffer = struct tsapi_mbuffer *; |
1127 | | using TSHttpSsn = struct tsapi_httpssn *; |
1128 | | using TSHttpTxn = struct tsapi_httptxn *; |
1129 | | using TSSslConnection = struct tsapi_ssl_obj *; |
1130 | | using TSSslSession = struct tsapi_ssl_session *; |
1131 | | using TSHttpAltInfo = struct tsapi_httpaltinfo *; |
1132 | | using TSMimeParser = struct tsapi_mimeparser *; |
1133 | | using TSHttpParser = struct tsapi_httpparser *; |
1134 | | using TSCacheKey = struct tsapi_cachekey *; |
1135 | | using TSCacheHttpInfo = struct tsapi_cachehttpinfo *; |
1136 | | using TSCacheTxn = struct tsapi_cachetxn *; |
1137 | | using TSSslVerifyCTX = struct tsapi_x509_store_ctx *; |
1138 | | |
1139 | | using TSPortDescriptor = struct tsapi_port *; |
1140 | | using TSVIO = struct tsapi_vio *; |
1141 | | using TSThread = struct tsapi_thread *; |
1142 | | using TSEventThread = struct tsapi_event_thread *; |
1143 | | using TSSslX509 = struct tsapi_x509 *; |
1144 | | using TSMutex = struct tsapi_mutex *; |
1145 | | using TSConfig = struct tsapi_config *; |
1146 | | using TSCont = struct tsapi_cont *; |
1147 | | using TSVConn = struct tsapi_cont *; /* a VConn is really a specialized TSCont */ |
1148 | | using TSSslContext = struct tsapi_ssl_context *; |
1149 | | using TSAction = struct tsapi_action *; |
1150 | | using TSIOBuffer = struct tsapi_iobuffer *; |
1151 | | using TSIOBufferData = struct tsapi_iobufferdata *; |
1152 | | using TSIOBufferBlock = struct tsapi_bufferblock *; |
1153 | | using TSIOBufferReader = struct tsapi_bufferreader *; |
1154 | | using TSHostLookupResult = struct tsapi_hostlookupresult *; |
1155 | | using TSAIOCallback = struct tsapi_aiocallback *; |
1156 | | using TSAcceptor = struct tsapi_net_accept *; |
1157 | | using TSRemapPluginInfo = struct tsapi_remap_plugin_info *; |
1158 | | |
1159 | | using TSFetchSM = struct tsapi_fetchsm *; |
1160 | | |
1161 | | using TSThreadFunc = void *(*)(void *data); |
1162 | | using TSEventFunc = int (*)(TSCont contp, TSEvent event, void *edata); |
1163 | | using TSConfigDestroyFunc = void (*)(void *data); |
1164 | | using TSLogMarshalCallback = int (*)(TSHttpTxn, char *); |
1165 | | using TSLogUnmarshalCallback = std::tuple<int, int> (*)(char **, char *, int); |
1166 | | |
1167 | | struct TSFetchEvent { |
1168 | | int success_event_id; |
1169 | | int failure_event_id; |
1170 | | int timeout_event_id; |
1171 | | }; |
1172 | | |
1173 | | struct TSFetchUrlParams { |
1174 | | const char *request; |
1175 | | int request_len; |
1176 | | int port; |
1177 | | struct sockaddr_storage ip; |
1178 | | TSCont contp; |
1179 | | TSFetchEvent events; |
1180 | | TSFetchWakeUpOptions options; |
1181 | | struct TSFetchUrlParams *next; |
1182 | | }; |
1183 | | using TSFetchUrlParams_t = TSFetchUrlParams; |
1184 | | |
1185 | | // Extended FetchSM APIs |
1186 | | enum TSFetchEventExt { |
1187 | | TS_FETCH_EVENT_EXT_HEAD_READY = -1, |
1188 | | TS_FETCH_EVENT_EXT_HEAD_DONE = -2, |
1189 | | TS_FETCH_EVENT_EXT_BODY_READY = -3, |
1190 | | TS_FETCH_EVENT_EXT_BODY_DONE = -4, |
1191 | | }; |
1192 | | |
1193 | | enum TSFetchFlags { |
1194 | | TS_FETCH_FLAGS_NONE = 0, // do nothing |
1195 | | TS_FETCH_FLAGS_STREAM = 1 << 1, // enable stream IO |
1196 | | TS_FETCH_FLAGS_DECHUNK = 1 << 2, // dechunk body content |
1197 | | TS_FETCH_FLAGS_NEWLOCK = 1 << 3, // allocate new lock for fetch sm |
1198 | | TS_FETCH_FLAGS_NOT_INTERNAL_REQUEST = 1 << 4, // Allow this fetch to be created as a non-internal request. |
1199 | | TS_FETCH_FLAGS_SKIP_REMAP = 1 << 5, // Skip remapping and allow requesting arbitary URL |
1200 | | }; |
1201 | | |
1202 | | // This is a duplicate of the SSL_MAX_SSL_SESSION_ID_LENGTH constant |
1203 | | // Redefining here so we don't include the openssl/ssl.h file here |
1204 | | const int TS_SSL_MAX_SSL_SESSION_ID_LENGTH = 32; |
1205 | | |
1206 | | // This mirrors the internal data structure SSLSessionID |
1207 | | struct TSSslSessionID { |
1208 | | size_t len; |
1209 | | char bytes[TS_SSL_MAX_SSL_SESSION_ID_LENGTH]; |
1210 | | }; |
1211 | | |
1212 | | struct TSSecretID { |
1213 | | const char *cert_name; |
1214 | | size_t cert_name_len; |
1215 | | const char *key_name; |
1216 | | size_t key_name_len; |
1217 | | }; |
1218 | | |
1219 | | enum TSConnectType { |
1220 | | TS_CONNECT_UNDEFINED, |
1221 | | TS_CONNECT_PLUGIN, |
1222 | | TS_CONNECT_LAST_ENTRY, |
1223 | | }; |
1224 | | |
1225 | | struct TSHttpConnectOptions { |
1226 | | TSConnectType connect_type; |
1227 | | struct sockaddr const *addr; |
1228 | | const char *tag; |
1229 | | int64_t id; |
1230 | | TSIOBufferSizeIndex buffer_index; |
1231 | | TSIOBufferWaterMark buffer_water_mark; |
1232 | | }; |
1233 | | |
1234 | | /* -------------------------------------------------------------------------- |
1235 | | URL schemes */ |
1236 | | extern const char *TS_URL_SCHEME_FILE; |
1237 | | extern const char *TS_URL_SCHEME_FTP; |
1238 | | extern const char *TS_URL_SCHEME_GOPHER; |
1239 | | extern const char *TS_URL_SCHEME_HTTP; |
1240 | | extern const char *TS_URL_SCHEME_HTTPS; |
1241 | | extern const char *TS_URL_SCHEME_MAILTO; |
1242 | | extern const char *TS_URL_SCHEME_NEWS; |
1243 | | extern const char *TS_URL_SCHEME_NNTP; |
1244 | | extern const char *TS_URL_SCHEME_PROSPERO; |
1245 | | extern const char *TS_URL_SCHEME_TELNET; |
1246 | | extern const char *TS_URL_SCHEME_TUNNEL; |
1247 | | extern const char *TS_URL_SCHEME_WAIS; |
1248 | | extern const char *TS_URL_SCHEME_PNM; |
1249 | | extern const char *TS_URL_SCHEME_RTSP; |
1250 | | extern const char *TS_URL_SCHEME_RTSPU; |
1251 | | extern const char *TS_URL_SCHEME_MMS; |
1252 | | extern const char *TS_URL_SCHEME_MMSU; |
1253 | | extern const char *TS_URL_SCHEME_MMST; |
1254 | | extern const char *TS_URL_SCHEME_WS; |
1255 | | extern const char *TS_URL_SCHEME_WSS; |
1256 | | |
1257 | | /* -------------------------------------------------------------------------- |
1258 | | URL scheme string lengths */ |
1259 | | extern int TS_URL_LEN_FILE; |
1260 | | extern int TS_URL_LEN_FTP; |
1261 | | extern int TS_URL_LEN_GOPHER; |
1262 | | extern int TS_URL_LEN_HTTP; |
1263 | | extern int TS_URL_LEN_HTTPS; |
1264 | | extern int TS_URL_LEN_MAILTO; |
1265 | | extern int TS_URL_LEN_NEWS; |
1266 | | extern int TS_URL_LEN_NNTP; |
1267 | | extern int TS_URL_LEN_PROSPERO; |
1268 | | extern int TS_URL_LEN_TELNET; |
1269 | | extern int TS_URL_LEN_WAIS; |
1270 | | extern int TS_URL_LEN_WS; |
1271 | | extern int TS_URL_LEN_WSS; |
1272 | | |
1273 | | /* -------------------------------------------------------------------------- |
1274 | | MIME fields */ |
1275 | | extern const char *TS_MIME_FIELD_ACCEPT; |
1276 | | extern const char *TS_MIME_FIELD_ACCEPT_CHARSET; |
1277 | | extern const char *TS_MIME_FIELD_ACCEPT_ENCODING; |
1278 | | extern const char *TS_MIME_FIELD_ACCEPT_LANGUAGE; |
1279 | | extern const char *TS_MIME_FIELD_ACCEPT_RANGES; |
1280 | | extern const char *TS_MIME_FIELD_AGE; |
1281 | | extern const char *TS_MIME_FIELD_ALLOW; |
1282 | | extern const char *TS_MIME_FIELD_APPROVED; |
1283 | | extern const char *TS_MIME_FIELD_AUTHORIZATION; |
1284 | | extern const char *TS_MIME_FIELD_BYTES; |
1285 | | extern const char *TS_MIME_FIELD_CACHE_CONTROL; |
1286 | | extern const char *TS_MIME_FIELD_CLIENT_IP; |
1287 | | extern const char *TS_MIME_FIELD_CONNECTION; |
1288 | | extern const char *TS_MIME_FIELD_CONTENT_BASE; |
1289 | | extern const char *TS_MIME_FIELD_CONTENT_ENCODING; |
1290 | | extern const char *TS_MIME_FIELD_CONTENT_LANGUAGE; |
1291 | | extern const char *TS_MIME_FIELD_CONTENT_LENGTH; |
1292 | | extern const char *TS_MIME_FIELD_CONTENT_LOCATION; |
1293 | | extern const char *TS_MIME_FIELD_CONTENT_MD5; |
1294 | | extern const char *TS_MIME_FIELD_CONTENT_RANGE; |
1295 | | extern const char *TS_MIME_FIELD_CONTENT_TYPE; |
1296 | | extern const char *TS_MIME_FIELD_CONTROL; |
1297 | | extern const char *TS_MIME_FIELD_COOKIE; |
1298 | | extern const char *TS_MIME_FIELD_DATE; |
1299 | | extern const char *TS_MIME_FIELD_DISTRIBUTION; |
1300 | | extern const char *TS_MIME_FIELD_ETAG; |
1301 | | extern const char *TS_MIME_FIELD_EXPECT; |
1302 | | extern const char *TS_MIME_FIELD_EXPIRES; |
1303 | | extern const char *TS_MIME_FIELD_FOLLOWUP_TO; |
1304 | | extern const char *TS_MIME_FIELD_FROM; |
1305 | | extern const char *TS_MIME_FIELD_HOST; |
1306 | | extern const char *TS_MIME_FIELD_IF_MATCH; |
1307 | | extern const char *TS_MIME_FIELD_IF_MODIFIED_SINCE; |
1308 | | extern const char *TS_MIME_FIELD_IF_NONE_MATCH; |
1309 | | extern const char *TS_MIME_FIELD_IF_RANGE; |
1310 | | extern const char *TS_MIME_FIELD_IF_UNMODIFIED_SINCE; |
1311 | | extern const char *TS_MIME_FIELD_KEEP_ALIVE; |
1312 | | extern const char *TS_MIME_FIELD_KEYWORDS; |
1313 | | extern const char *TS_MIME_FIELD_LAST_MODIFIED; |
1314 | | extern const char *TS_MIME_FIELD_LINES; |
1315 | | extern const char *TS_MIME_FIELD_LOCATION; |
1316 | | extern const char *TS_MIME_FIELD_MAX_FORWARDS; |
1317 | | extern const char *TS_MIME_FIELD_MESSAGE_ID; |
1318 | | extern const char *TS_MIME_FIELD_NEWSGROUPS; |
1319 | | extern const char *TS_MIME_FIELD_ORGANIZATION; |
1320 | | extern const char *TS_MIME_FIELD_PATH; |
1321 | | extern const char *TS_MIME_FIELD_PRAGMA; |
1322 | | extern const char *TS_MIME_FIELD_PROXY_AUTHENTICATE; |
1323 | | extern const char *TS_MIME_FIELD_PROXY_AUTHORIZATION; |
1324 | | extern const char *TS_MIME_FIELD_PROXY_CONNECTION; |
1325 | | extern const char *TS_MIME_FIELD_PUBLIC; |
1326 | | extern const char *TS_MIME_FIELD_RANGE; |
1327 | | extern const char *TS_MIME_FIELD_REFERENCES; |
1328 | | extern const char *TS_MIME_FIELD_REFERER; |
1329 | | extern const char *TS_MIME_FIELD_REPLY_TO; |
1330 | | extern const char *TS_MIME_FIELD_RETRY_AFTER; |
1331 | | extern const char *TS_MIME_FIELD_SENDER; |
1332 | | extern const char *TS_MIME_FIELD_SERVER; |
1333 | | extern const char *TS_MIME_FIELD_SET_COOKIE; |
1334 | | extern const char *TS_MIME_FIELD_STRICT_TRANSPORT_SECURITY; |
1335 | | extern const char *TS_MIME_FIELD_SUBJECT; |
1336 | | extern const char *TS_MIME_FIELD_SUMMARY; |
1337 | | extern const char *TS_MIME_FIELD_TE; |
1338 | | extern const char *TS_MIME_FIELD_TRANSFER_ENCODING; |
1339 | | extern const char *TS_MIME_FIELD_UPGRADE; |
1340 | | extern const char *TS_MIME_FIELD_USER_AGENT; |
1341 | | extern const char *TS_MIME_FIELD_VARY; |
1342 | | extern const char *TS_MIME_FIELD_VIA; |
1343 | | extern const char *TS_MIME_FIELD_WARNING; |
1344 | | extern const char *TS_MIME_FIELD_WWW_AUTHENTICATE; |
1345 | | extern const char *TS_MIME_FIELD_XREF; |
1346 | | extern const char *TS_MIME_FIELD_X_FORWARDED_FOR; |
1347 | | extern const char *TS_MIME_FIELD_FORWARDED; |
1348 | | |
1349 | | /* -------------------------------------------------------------------------- |
1350 | | MIME fields string lengths */ |
1351 | | extern int TS_MIME_LEN_ACCEPT; |
1352 | | extern int TS_MIME_LEN_ACCEPT_CHARSET; |
1353 | | extern int TS_MIME_LEN_ACCEPT_ENCODING; |
1354 | | extern int TS_MIME_LEN_ACCEPT_LANGUAGE; |
1355 | | extern int TS_MIME_LEN_ACCEPT_RANGES; |
1356 | | extern int TS_MIME_LEN_AGE; |
1357 | | extern int TS_MIME_LEN_ALLOW; |
1358 | | extern int TS_MIME_LEN_APPROVED; |
1359 | | extern int TS_MIME_LEN_AUTHORIZATION; |
1360 | | extern int TS_MIME_LEN_BYTES; |
1361 | | extern int TS_MIME_LEN_CACHE_CONTROL; |
1362 | | extern int TS_MIME_LEN_CLIENT_IP; |
1363 | | extern int TS_MIME_LEN_CONNECTION; |
1364 | | extern int TS_MIME_LEN_CONTENT_BASE; |
1365 | | extern int TS_MIME_LEN_CONTENT_ENCODING; |
1366 | | extern int TS_MIME_LEN_CONTENT_LANGUAGE; |
1367 | | extern int TS_MIME_LEN_CONTENT_LENGTH; |
1368 | | extern int TS_MIME_LEN_CONTENT_LOCATION; |
1369 | | extern int TS_MIME_LEN_CONTENT_MD5; |
1370 | | extern int TS_MIME_LEN_CONTENT_RANGE; |
1371 | | extern int TS_MIME_LEN_CONTENT_TYPE; |
1372 | | extern int TS_MIME_LEN_CONTROL; |
1373 | | extern int TS_MIME_LEN_COOKIE; |
1374 | | extern int TS_MIME_LEN_DATE; |
1375 | | extern int TS_MIME_LEN_DISTRIBUTION; |
1376 | | extern int TS_MIME_LEN_ETAG; |
1377 | | extern int TS_MIME_LEN_EXPECT; |
1378 | | extern int TS_MIME_LEN_EXPIRES; |
1379 | | extern int TS_MIME_LEN_FOLLOWUP_TO; |
1380 | | extern int TS_MIME_LEN_FROM; |
1381 | | extern int TS_MIME_LEN_HOST; |
1382 | | extern int TS_MIME_LEN_IF_MATCH; |
1383 | | extern int TS_MIME_LEN_IF_MODIFIED_SINCE; |
1384 | | extern int TS_MIME_LEN_IF_NONE_MATCH; |
1385 | | extern int TS_MIME_LEN_IF_RANGE; |
1386 | | extern int TS_MIME_LEN_IF_UNMODIFIED_SINCE; |
1387 | | extern int TS_MIME_LEN_KEEP_ALIVE; |
1388 | | extern int TS_MIME_LEN_KEYWORDS; |
1389 | | extern int TS_MIME_LEN_LAST_MODIFIED; |
1390 | | extern int TS_MIME_LEN_LINES; |
1391 | | extern int TS_MIME_LEN_LOCATION; |
1392 | | extern int TS_MIME_LEN_MAX_FORWARDS; |
1393 | | extern int TS_MIME_LEN_MESSAGE_ID; |
1394 | | extern int TS_MIME_LEN_NEWSGROUPS; |
1395 | | extern int TS_MIME_LEN_ORGANIZATION; |
1396 | | extern int TS_MIME_LEN_PATH; |
1397 | | extern int TS_MIME_LEN_PRAGMA; |
1398 | | extern int TS_MIME_LEN_PROXY_AUTHENTICATE; |
1399 | | extern int TS_MIME_LEN_PROXY_AUTHORIZATION; |
1400 | | extern int TS_MIME_LEN_PROXY_CONNECTION; |
1401 | | extern int TS_MIME_LEN_PUBLIC; |
1402 | | extern int TS_MIME_LEN_RANGE; |
1403 | | extern int TS_MIME_LEN_REFERENCES; |
1404 | | extern int TS_MIME_LEN_REFERER; |
1405 | | extern int TS_MIME_LEN_REPLY_TO; |
1406 | | extern int TS_MIME_LEN_RETRY_AFTER; |
1407 | | extern int TS_MIME_LEN_SENDER; |
1408 | | extern int TS_MIME_LEN_SERVER; |
1409 | | extern int TS_MIME_LEN_SET_COOKIE; |
1410 | | extern int TS_MIME_LEN_STRICT_TRANSPORT_SECURITY; |
1411 | | extern int TS_MIME_LEN_SUBJECT; |
1412 | | extern int TS_MIME_LEN_SUMMARY; |
1413 | | extern int TS_MIME_LEN_TE; |
1414 | | extern int TS_MIME_LEN_TRANSFER_ENCODING; |
1415 | | extern int TS_MIME_LEN_UPGRADE; |
1416 | | extern int TS_MIME_LEN_USER_AGENT; |
1417 | | extern int TS_MIME_LEN_VARY; |
1418 | | extern int TS_MIME_LEN_VIA; |
1419 | | extern int TS_MIME_LEN_WARNING; |
1420 | | extern int TS_MIME_LEN_WWW_AUTHENTICATE; |
1421 | | extern int TS_MIME_LEN_XREF; |
1422 | | extern int TS_MIME_LEN_X_FORWARDED_FOR; |
1423 | | extern int TS_MIME_LEN_FORWARDED; |
1424 | | |
1425 | | /* -------------------------------------------------------------------------- |
1426 | | HTTP values */ |
1427 | | extern const char *TS_HTTP_VALUE_BYTES; |
1428 | | extern const char *TS_HTTP_VALUE_CHUNKED; |
1429 | | extern const char *TS_HTTP_VALUE_CLOSE; |
1430 | | extern const char *TS_HTTP_VALUE_COMPRESS; |
1431 | | extern const char *TS_HTTP_VALUE_DEFLATE; |
1432 | | extern const char *TS_HTTP_VALUE_GZIP; |
1433 | | extern const char *TS_HTTP_VALUE_BROTLI; |
1434 | | extern const char *TS_HTTP_VALUE_ZSTD; |
1435 | | extern const char *TS_HTTP_VALUE_IDENTITY; |
1436 | | extern const char *TS_HTTP_VALUE_KEEP_ALIVE; |
1437 | | extern const char *TS_HTTP_VALUE_MAX_AGE; |
1438 | | extern const char *TS_HTTP_VALUE_MAX_STALE; |
1439 | | extern const char *TS_HTTP_VALUE_MIN_FRESH; |
1440 | | extern const char *TS_HTTP_VALUE_MUST_REVALIDATE; |
1441 | | extern const char *TS_HTTP_VALUE_NONE; |
1442 | | extern const char *TS_HTTP_VALUE_NO_CACHE; |
1443 | | extern const char *TS_HTTP_VALUE_NO_STORE; |
1444 | | extern const char *TS_HTTP_VALUE_NO_TRANSFORM; |
1445 | | extern const char *TS_HTTP_VALUE_ONLY_IF_CACHED; |
1446 | | extern const char *TS_HTTP_VALUE_PRIVATE; |
1447 | | extern const char *TS_HTTP_VALUE_PROXY_REVALIDATE; |
1448 | | extern const char *TS_HTTP_VALUE_PUBLIC; |
1449 | | |
1450 | | /* -------------------------------------------------------------------------- |
1451 | | HTTP values string lengths */ |
1452 | | extern int TS_HTTP_LEN_BYTES; |
1453 | | extern int TS_HTTP_LEN_CHUNKED; |
1454 | | extern int TS_HTTP_LEN_CLOSE; |
1455 | | extern int TS_HTTP_LEN_COMPRESS; |
1456 | | extern int TS_HTTP_LEN_DEFLATE; |
1457 | | extern int TS_HTTP_LEN_GZIP; |
1458 | | extern int TS_HTTP_LEN_BROTLI; |
1459 | | extern int TS_HTTP_LEN_ZSTD; |
1460 | | extern int TS_HTTP_LEN_IDENTITY; |
1461 | | extern int TS_HTTP_LEN_KEEP_ALIVE; |
1462 | | extern int TS_HTTP_LEN_MAX_AGE; |
1463 | | extern int TS_HTTP_LEN_MAX_STALE; |
1464 | | extern int TS_HTTP_LEN_MIN_FRESH; |
1465 | | extern int TS_HTTP_LEN_MUST_REVALIDATE; |
1466 | | extern int TS_HTTP_LEN_NONE; |
1467 | | extern int TS_HTTP_LEN_NO_CACHE; |
1468 | | extern int TS_HTTP_LEN_NO_STORE; |
1469 | | extern int TS_HTTP_LEN_NO_TRANSFORM; |
1470 | | extern int TS_HTTP_LEN_ONLY_IF_CACHED; |
1471 | | extern int TS_HTTP_LEN_PRIVATE; |
1472 | | extern int TS_HTTP_LEN_PROXY_REVALIDATE; |
1473 | | extern int TS_HTTP_LEN_PUBLIC; |
1474 | | |
1475 | | /* -------------------------------------------------------------------------- |
1476 | | HTTP methods */ |
1477 | | extern const char *TS_HTTP_METHOD_CONNECT; |
1478 | | extern const char *TS_HTTP_METHOD_DELETE; |
1479 | | extern const char *TS_HTTP_METHOD_GET; |
1480 | | extern const char *TS_HTTP_METHOD_HEAD; |
1481 | | extern const char *TS_HTTP_METHOD_OPTIONS; |
1482 | | extern const char *TS_HTTP_METHOD_POST; |
1483 | | extern const char *TS_HTTP_METHOD_PURGE; |
1484 | | extern const char *TS_HTTP_METHOD_PUT; |
1485 | | extern const char *TS_HTTP_METHOD_TRACE; |
1486 | | extern const char *TS_HTTP_METHOD_PUSH; |
1487 | | |
1488 | | /* -------------------------------------------------------------------------- |
1489 | | HTTP methods string lengths */ |
1490 | | extern int TS_HTTP_LEN_CONNECT; |
1491 | | extern int TS_HTTP_LEN_DELETE; |
1492 | | extern int TS_HTTP_LEN_GET; |
1493 | | extern int TS_HTTP_LEN_HEAD; |
1494 | | extern int TS_HTTP_LEN_OPTIONS; |
1495 | | extern int TS_HTTP_LEN_POST; |
1496 | | extern int TS_HTTP_LEN_PURGE; |
1497 | | extern int TS_HTTP_LEN_PUT; |
1498 | | extern int TS_HTTP_LEN_TRACE; |
1499 | | extern int TS_HTTP_LEN_PUSH; |
1500 | | |
1501 | | /* -------------------------------------------------------------------------- |
1502 | | TLS Next Protocol well-known protocol names. */ |
1503 | | |
1504 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_0_9; |
1505 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_1_0; |
1506 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_1_1; |
1507 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_2_0; |
1508 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_3; |
1509 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_3_D29; |
1510 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_QUIC; |
1511 | | extern const char *const TS_ALPN_PROTOCOL_HTTP_QUIC_D29; |
1512 | | |
1513 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_0_9; |
1514 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_1_0; |
1515 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_1_1; |
1516 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_2_0; |
1517 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_3; |
1518 | | extern int TS_ALPN_PROTOCOL_INDEX_HTTP_QUIC; |
1519 | | |
1520 | | extern const char *const TS_ALPN_PROTOCOL_GROUP_HTTP; |
1521 | | extern const char *const TS_ALPN_PROTOCOL_GROUP_HTTP2; |
1522 | | |
1523 | | extern const char *const TS_PROTO_TAG_HTTP_1_0; |
1524 | | extern const char *const TS_PROTO_TAG_HTTP_1_1; |
1525 | | extern const char *const TS_PROTO_TAG_HTTP_2_0; |
1526 | | extern const char *const TS_PROTO_TAG_HTTP_3; |
1527 | | extern const char *const TS_PROTO_TAG_HTTP_QUIC; |
1528 | | extern const char *const TS_PROTO_TAG_TLS_1_3; |
1529 | | extern const char *const TS_PROTO_TAG_TLS_1_2; |
1530 | | extern const char *const TS_PROTO_TAG_TLS_1_1; |
1531 | | extern const char *const TS_PROTO_TAG_TLS_1_0; |
1532 | | extern const char *const TS_PROTO_TAG_TCP; |
1533 | | extern const char *const TS_PROTO_TAG_UDP; |
1534 | | extern const char *const TS_PROTO_TAG_IPV4; |
1535 | | extern const char *const TS_PROTO_TAG_IPV6; |
1536 | | |
1537 | | /* -------------------------------------------------------------------------- |
1538 | | MLoc Constants */ |
1539 | | /** |
1540 | | Use TS_NULL_MLOC as the parent in calls that require a parent |
1541 | | when an TSMLoc does not have a parent TSMLoc. For example if |
1542 | | the TSMLoc is obtained by a call to TSHttpTxnClientReqGet(), |
1543 | | |
1544 | | */ |
1545 | | TSMLoc const TS_NULL_MLOC = nullptr; |
1546 | | |
1547 | | /* -------------------------------------------------------------------------- |
1548 | | HostStatus types */ |
1549 | | |
1550 | | enum TSHostStatus { |
1551 | | TS_HOST_STATUS_INIT, |
1552 | | TS_HOST_STATUS_DOWN, |
1553 | | TS_HOST_STATUS_UP, |
1554 | | }; |
1555 | | |
1556 | | /* MUST match proxy/HostStatus.h Reason. |
1557 | | * If a value is added here, it MUST be added there with the same value. |
1558 | | */ |
1559 | | enum TSHostStatusReason { |
1560 | | TS_HOST_STATUS_ACTIVE = 0x1, |
1561 | | TS_HOST_STATUS_LOCAL = 0x2, |
1562 | | TS_HOST_STATUS_MANUAL = 0x4, |
1563 | | TS_HOST_STATUS_SELF_DETECT = 0x8, |
1564 | | TS_HOST_STATUS_ALL = 0xf, |
1565 | | }; |
1566 | | |
1567 | | /* -------------------------------------------------------------------------- |
1568 | | Interface for the UUID APIs. https://www.ietf.org/rfc/rfc4122.txt. */ |
1569 | | enum TSUuidVersion { |
1570 | | TS_UUID_UNDEFINED = 0, |
1571 | | TS_UUID_V1 = 1, |
1572 | | TS_UUID_V2, |
1573 | | TS_UUID_V3, |
1574 | | TS_UUID_V4, /* At this point, this is the only implemented version (or variant) */ |
1575 | | TS_UUID_V5, |
1576 | | }; |
1577 | | |
1578 | | const int TS_UUID_STRING_LEN = 36; |
1579 | | const int TS_CRUUID_STRING_LEN = TS_UUID_STRING_LEN + 19 + 1; /* UUID-len + len(uint64_t) + '-' */ |
1580 | | using TSUuid = struct tsapi_uuid *; |
1581 | | |
1582 | | /* Various HTTP "control" modes */ |
1583 | | enum TSHttpCntlType { |
1584 | | TS_HTTP_CNTL_LOGGING_MODE, |
1585 | | TS_HTTP_CNTL_INTERCEPT_RETRY_MODE, |
1586 | | TS_HTTP_CNTL_RESPONSE_CACHEABLE, |
1587 | | TS_HTTP_CNTL_REQUEST_CACHEABLE, |
1588 | | TS_HTTP_CNTL_SERVER_NO_STORE, |
1589 | | TS_HTTP_CNTL_TXN_DEBUG, |
1590 | | TS_HTTP_CNTL_SKIP_REMAPPING, |
1591 | | }; |
1592 | | |
1593 | | // JSONRPC 2.0 related interface. |
1594 | | using TSRPCProviderHandle = struct tsapi_rpcproviderhandle *; |
1595 | | using TSYaml = struct tsapi_yaml *; |
1596 | | |
1597 | | /// |
1598 | | /// @brief JSON-RPC Handler options |
1599 | | /// |
1600 | | /// This class holds information about how a handler will be managed and delivered when called. The JSON-RPC manager would use |
1601 | | /// this object to perform certain validation. |
1602 | | /// |
1603 | | struct TSRPCHandlerOptions { |
1604 | | struct Auth { |
1605 | | int restricted; ///< Tells the RPC Manager if the call can be delivered or not based on the config rules. |
1606 | | } auth{1}; |
1607 | | }; |
1608 | | |
1609 | | /// Configuration field info related to a parsed YAML node. |
1610 | | /// |
1611 | | /// This contains information about the parsed record field. This will be passed back to the @a TSYAMLRecNodeHandler |
1612 | | /// when you call @a TSRecYAMLConfigParse. This class holds the record name as well as the YAML node in case the caller |
1613 | | /// wants to use this information to manipulate the record. |
1614 | | struct TSYAMLRecCfgFieldData { |
1615 | | const char *field_name; ///< YAML field name. null terminated |
1616 | | const char *record_name; ///< record name. null terminated |
1617 | | TSYaml value_node; ///< YAML::Node pointer. |
1618 | | }; |
1619 | | |
1620 | | typedef enum { |
1621 | | TS_TXN_TYPE_UNKNOWN, |
1622 | | TS_TXN_TYPE_HTTP, |
1623 | | TS_TXN_TYPE_EXPLICIT_TUNNEL, |
1624 | | TS_TXN_TYPE_TR_PASS_TUNNEL, |
1625 | | } TSTxnType; |
1626 | | |
1627 | | /// Exposed for custom parent selection behavior. |
1628 | | /// |
1629 | | /// This can used in association with TS_EVENT_HTTP_OS_DNS. |
1630 | | /// Plugins may set this to indicate how to retry. |
1631 | | /// If handled false: |
1632 | | /// then no plugin set it and Core will proceed to do its own thing. |
1633 | | /// If handled true: |
1634 | | /// core will not do any parent processing, markdown, or anything else, |
1635 | | /// but will use the values in this for whether to use the existing |
1636 | | /// response or make another request |
1637 | | struct TSResponseAction { |
1638 | | char const *hostname; ///< host for next request (must be null terminated?) |
1639 | | size_t hostname_len; ///< host len for next request (not including null) |
1640 | | in_port_t port; ///< port for next request |
1641 | | bool fail; |
1642 | | bool is_retry; |
1643 | | bool nextHopExists; |
1644 | | bool responseIsRetryable; |
1645 | | bool goDirect; |
1646 | | bool parentIsProxy; |
1647 | | bool no_cache; |
1648 | | }; |
1649 | | |
1650 | | enum TSLogType { |
1651 | | TS_LOG_TYPE_INT, |
1652 | | // DINT is omitted from the public API for now, until we decide whether we keep the type |
1653 | | TS_LOG_TYPE_STRING = 2, |
1654 | | TS_LOG_TYPE_ADDR = 3, |
1655 | | }; |
1656 | | |
1657 | | /* -------------------------------------------------------------------------- |
1658 | | Init */ |
1659 | | |
1660 | | /** |
1661 | | This function must be defined by all plugins. Traffic Server |
1662 | | calls this initialization routine when it loads the plugin (at |
1663 | | startup), and sets argc and argv appropriately based on the values |
1664 | | in plugin.config. (Functions linked dynamically, and called using |
1665 | | dlsym() must be undecorated / extern "C".) |
1666 | | |
1667 | | @param argc the number of initial values specified in plugin.config, |
1668 | | plus one. If only the name of your plugin shared object is |
1669 | | specified in plugin.config, argc=1. |
1670 | | @param argv the vector of arguments. The length of argv is argc. |
1671 | | argv[0] is the name of the plugin shared library. Subsequent |
1672 | | values of argv are initialization values specified in |
1673 | | plugin.config. |
1674 | | |
1675 | | */ |
1676 | | extern "C" void TSPluginInit(int argc, const char *argv[]); |
1677 | | |
1678 | | namespace ts |
1679 | | { |
1680 | | static const int NO_FD = -1; ///< No or invalid file descriptor. |
1681 | | } |
1682 | | |
1683 | | #ifndef ATS_BUILD |
1684 | | |
1685 | | #endif |