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 <stdbool.h>
46#include <stdint.h> // NOLINT(modernize-deprecated-headers)
47#include <sys/types.h>
48#include <sys/socket.h>
49
50#ifndef tsapi
51#define tsapi
52#endif
53
54#if !defined(TS_PRINTFLIKE)
55#if defined(__GNUC__) || defined(__clang__)
56#define TS_PRINTFLIKE(fmt, arg) __attribute__((format(printf, fmt, arg)))
57#else
58#define TS_PRINTFLIKE(fmt, arg)
59#endif
60#endif
61
62#if !defined(TS_NORETURN)
63#if defined(__GNUC__) || defined(__clang__)
64#define TS_NORETURN __attribute__((noreturn))
65#else
66#define TS_NORETURN
67#endif
68#endif
69
70#ifdef __cplusplus
71extern "C" {
72#endif /* __cplusplus */
73
74/* Version info
75 */
76/* clang-format off */
77#define TS_VERSION_STRING "@TS_VERSION_STRING@"
78#define TS_VERSION_NUMBER @TS_VERSION_NUMBER@
79#define TS_VERSION_MAJOR @TS_VERSION_MAJOR@
80#define TS_VERSION_MINOR @TS_VERSION_MINOR@
81#define TS_VERSION_MICRO @TS_VERSION_MICRO@
82/* clang-format on */
83
84#define TS_HTTP_VERSION(a, b) ((((a)&0xFFFF) << 16) | ((b)&0xFFFF))
85#define TS_HTTP_MINOR(v) ((v)&0xFFFF)
86#define TS_HTTP_MAJOR(v) (((v) >> 16) & 0xFFFF)
87
88#ifndef TS_RES_MEM_PATH
89#define __TS_RES_PATH(x) #x
90#define _TS_RES_PATH(x) __TS_RES_PATH(x)
91#define TS_RES_PATH(x) x __FILE__ ":" _TS_RES_PATH(__LINE__)
92#define TS_RES_MEM_PATH TS_RES_PATH("memory/")
93#endif
94
95#ifndef TS_DEPRECATED
96#define TS_DEPRECATED __attribute__((deprecated))
97#endif
98
99/**
100    The following struct is used by TSPluginRegister(). It stores
101    registration information about the plugin.
102
103 */
104typedef struct {
105  const char *plugin_name;
106  const char *vendor_name;
107  const char *support_email;
108} TSPluginRegistrationInfo;
109
110typedef struct {
111  const char *tag;  ///< Message tag (null terminated).
112  void const *data; ///< Message data (payload)
113  size_t data_size; ///< Amount of message data.
114} TSPluginMsg;
115
116/**
117    This set of enums are possible values returned by
118    TSHttpHdrParseReq() and TSHttpHdrParseResp().
119
120 */
121typedef enum {
122  TS_PARSE_ERROR = -1,
123  TS_PARSE_DONE  = 0,
124  TS_PARSE_CONT  = 1,
125} TSParseResult;
126
127/**
128    This set of enums represents the possible HTTP types that
129    can be assigned to an HTTP header. When a header is created
130    with TSHttpHdrCreate(), it is automatically assigned a type of
131    TS_HTTP_TYPE_UNKNOWN. You can modify the HTTP type ONCE after it
132    the header is created, using TSHttpHdrTypeSet(). After setting the
133    HTTP type once, you cannot set it again. Use TSHttpHdrTypeGet()
134    to obtain the TSHttpType of an HTTP header.
135
136 */
137typedef enum {
138  TS_HTTP_TYPE_UNKNOWN,
139  TS_HTTP_TYPE_REQUEST,
140  TS_HTTP_TYPE_RESPONSE,
141} TSHttpType;
142
143/**
144    This set of enums represents possible return values from
145    TSHttpHdrStatusGet(), which retrieves the status code from an
146    HTTP response header (TSHttpHdrStatusGet() retrieves status codes
147    only from headers of type TS_HTTP_TYPE_RESPONSE). You can also set
148    the TSHttpStatus of a response header using TSHttpHdrStatusSet().
149
150 */
151typedef enum {
152  TS_HTTP_STATUS_NONE                            = 0,
153  TS_HTTP_STATUS_CONTINUE                        = 100,
154  TS_HTTP_STATUS_SWITCHING_PROTOCOL              = 101,
155  TS_HTTP_STATUS_EARLY_HINTS                     = 103,
156  TS_HTTP_STATUS_OK                              = 200,
157  TS_HTTP_STATUS_CREATED                         = 201,
158  TS_HTTP_STATUS_ACCEPTED                        = 202,
159  TS_HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION   = 203,
160  TS_HTTP_STATUS_NO_CONTENT                      = 204,
161  TS_HTTP_STATUS_RESET_CONTENT                   = 205,
162  TS_HTTP_STATUS_PARTIAL_CONTENT                 = 206,
163  TS_HTTP_STATUS_MULTI_STATUS                    = 207,
164  TS_HTTP_STATUS_ALREADY_REPORTED                = 208,
165  TS_HTTP_STATUS_IM_USED                         = 211,
166  TS_HTTP_STATUS_MULTIPLE_CHOICES                = 300,
167  TS_HTTP_STATUS_MOVED_PERMANENTLY               = 301,
168  TS_HTTP_STATUS_MOVED_TEMPORARILY               = 302,
169  TS_HTTP_STATUS_SEE_OTHER                       = 303,
170  TS_HTTP_STATUS_NOT_MODIFIED                    = 304,
171  TS_HTTP_STATUS_USE_PROXY                       = 305,
172  TS_HTTP_STATUS_TEMPORARY_REDIRECT              = 307,
173  TS_HTTP_STATUS_PERMANENT_REDIRECT              = 308,
174  TS_HTTP_STATUS_BAD_REQUEST                     = 400,
175  TS_HTTP_STATUS_UNAUTHORIZED                    = 401,
176  TS_HTTP_STATUS_PAYMENT_REQUIRED                = 402,
177  TS_HTTP_STATUS_FORBIDDEN                       = 403,
178  TS_HTTP_STATUS_NOT_FOUND                       = 404,
179  TS_HTTP_STATUS_METHOD_NOT_ALLOWED              = 405,
180  TS_HTTP_STATUS_NOT_ACCEPTABLE                  = 406,
181  TS_HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED   = 407,
182  TS_HTTP_STATUS_REQUEST_TIMEOUT                 = 408,
183  TS_HTTP_STATUS_CONFLICT                        = 409,
184  TS_HTTP_STATUS_GONE                            = 410,
185  TS_HTTP_STATUS_LENGTH_REQUIRED                 = 411,
186  TS_HTTP_STATUS_PRECONDITION_FAILED             = 412,
187  TS_HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE        = 413,
188  TS_HTTP_STATUS_REQUEST_URI_TOO_LONG            = 414,
189  TS_HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE          = 415,
190  TS_HTTP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
191  TS_HTTP_STATUS_EXPECTATION_FAILED              = 417,
192  TS_HTTP_STATUS_UNPROCESSABLE_ENTITY            = 422,
193  TS_HTTP_STATUS_LOCKED                          = 423,
194  TS_HTTP_STATUS_FAILED_DEPENDENCY               = 424,
195  TS_HTTP_STATUS_UPGRADE_REQUIRED                = 426,
196  TS_HTTP_STATUS_PRECONDITION_REQUIRED           = 428,
197  TS_HTTP_STATUS_TOO_MANY_REQUESTS               = 429,
198  TS_HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
199  TS_HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS   = 451,
200  TS_HTTP_STATUS_INTERNAL_SERVER_ERROR           = 500,
201  TS_HTTP_STATUS_NOT_IMPLEMENTED                 = 501,
202  TS_HTTP_STATUS_BAD_GATEWAY                     = 502,
203  TS_HTTP_STATUS_SERVICE_UNAVAILABLE             = 503,
204  TS_HTTP_STATUS_GATEWAY_TIMEOUT                 = 504,
205  TS_HTTP_STATUS_HTTPVER_NOT_SUPPORTED           = 505,
206  TS_HTTP_STATUS_VARIANT_ALSO_NEGOTIATES         = 506,
207  TS_HTTP_STATUS_INSUFFICIENT_STORAGE            = 507,
208  TS_HTTP_STATUS_LOOP_DETECTED                   = 508,
209  TS_HTTP_STATUS_NOT_EXTENDED                    = 510,
210  TS_HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511
211} TSHttpStatus;
212
213/**
214    This set of enums represents the possible hooks where you can
215    set up continuation callbacks. The functions used to register a
216    continuation for a particular hook are:
217
218    TSHttpHookAdd: adds a global hook. You can globally add
219    any hook except for
220     - TS_HTTP_REQUEST_TRANSFORM_HOOK
221     - TS_HTTP_RESPONSE_TRANSFORM_HOOK
222     - TS_HTTP_RESPONSE_CLIENT_HOOK
223
224    The following hooks can ONLY be added globally:
225     - TS_HTTP_SELECT_ALT_HOOK
226     - TS_HTTP_SSN_START_HOOK
227
228    TSHttpSsnHookAdd: adds a transaction hook to each transaction
229    within a session. You can only use transaction hooks with this call:
230     - TS_HTTP_READ_REQUEST_HDR_HOOK
231     - TS_HTTP_OS_DNS_HOOK
232     - TS_HTTP_SEND_REQUEST_HDR_HOOK
233     - TS_HTTP_READ_CACHE_HDR_HOOK
234     - TS_HTTP_READ_RESPONSE_HDR_HOOK
235     - TS_HTTP_SEND_RESPONSE_HDR_HOOK
236     - TS_HTTP_REQUEST_TRANSFORM_HOOK
237     - TS_HTTP_RESPONSE_TRANSFORM_HOOK
238     - TS_HTTP_RESPONSE_CLIENT_HOOK
239     - TS_HTTP_TXN_START_HOOK
240     - TS_HTTP_TXN_CLOSE_HOOK
241     - TS_HTTP_SSN_CLOSE_HOOK
242
243    TSHttpTxnHookAdd: adds a callback at a specific point within
244    an HTTP transaction. The following hooks can be used with this
245    function:
246     - TS_HTTP_READ_REQUEST_HDR_HOOK
247     - TS_HTTP_OS_DNS_HOOK
248     - TS_HTTP_SEND_REQUEST_HDR_HOOK
249     - TS_HTTP_READ_CACHE_HDR_HOOK
250     - TS_HTTP_READ_RESPONSE_HDR_HOOK
251     - TS_HTTP_SEND_RESPONSE_HDR_HOOK
252     - TS_HTTP_REQUEST_TRANSFORM_HOOK
253     - TS_HTTP_RESPONSE_TRANSFORM_HOOK
254     - TS_HTTP_TXN_CLOSE_HOOK
255
256    The two transform hooks can ONLY be added as transaction hooks.
257
258    TS_VCONN_START_HOOK - called just after the connection is created,
259    before other activity such as I/O or TLS handshakes  No handshake
260    data has been read or sent (from the proxy) at this point
261
262    TS_HTTP_LAST_HOOK _must_ be the last element. Only right place
263    to insert a new element is just before TS_HTTP_LAST_HOOK.
264
265 */
266typedef enum {
267  TS_HTTP_READ_REQUEST_HDR_HOOK,
268  TS_HTTP_OS_DNS_HOOK,
269  TS_HTTP_SEND_REQUEST_HDR_HOOK,
270  TS_HTTP_READ_CACHE_HDR_HOOK,
271  TS_HTTP_READ_RESPONSE_HDR_HOOK,
272  TS_HTTP_SEND_RESPONSE_HDR_HOOK,
273  TS_HTTP_REQUEST_TRANSFORM_HOOK,
274  TS_HTTP_RESPONSE_TRANSFORM_HOOK,
275  TS_HTTP_SELECT_ALT_HOOK,
276  TS_HTTP_TXN_START_HOOK,
277  TS_HTTP_TXN_CLOSE_HOOK,
278  TS_HTTP_SSN_START_HOOK,
279  TS_HTTP_SSN_CLOSE_HOOK,
280  TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK,
281  TS_HTTP_PRE_REMAP_HOOK,
282  TS_HTTP_POST_REMAP_HOOK,
283  TS_HTTP_RESPONSE_CLIENT_HOOK,
284  // Putting the SSL hooks in the same enum space
285  // So both sets of hooks can be set by the same Hook function
286  TS_SSL_FIRST_HOOK,
287  TS_VCONN_START_HOOK      = TS_SSL_FIRST_HOOK,
288  TS_VCONN_PRE_ACCEPT_HOOK = TS_VCONN_START_HOOK, // Deprecated but compatible for now.
289  TS_VCONN_CLOSE_HOOK,
290  TS_SSL_CLIENT_HELLO_HOOK,
291  TS_SSL_SNI_HOOK,
292  TS_SSL_CERT_HOOK = TS_SSL_SNI_HOOK,
293  TS_SSL_SERVERNAME_HOOK,
294  TS_SSL_SERVER_VERIFY_HOOK,
295  TS_SSL_VERIFY_SERVER_HOOK = TS_SSL_SERVER_VERIFY_HOOK,
296  TS_SSL_VERIFY_CLIENT_HOOK,
297  TS_SSL_SESSION_HOOK,
298  TS_VCONN_OUTBOUND_START_HOOK,
299  TS_VCONN_OUTBOUND_CLOSE_HOOK,
300  TS_SSL_LAST_HOOK = TS_VCONN_OUTBOUND_CLOSE_HOOK,
301  TS_HTTP_REQUEST_BUFFER_READ_COMPLETE_HOOK,
302  TS_HTTP_LAST_HOOK
303} TSHttpHookID;
304
305/** Plugin lifecycle hooks.
306
307    These are called during lifecycle events of a plugin. They
308    should be set in the plugin initialization function. The
309    continuation is invoked with an event ID specified for each hook
310    and @c NULL for the event data.
311
312    TS_LIFECYCLE_PORTS_INITIALIZED_HOOK
313
314      called once, after the HTTP proxy port data structures have
315      been initialized. In particular, SSL related calls that depend
316      on accept endpoints may be invoked. After this hook is
317      finished, the proxy port sockets are opened and connections
318      are accepted.
319
320      Event: TS_EVENT_LIFECYCLE_PORTS_INITIALIZED
321
322    TS_LIFECYCLE_PORTS_READY_HOOK
323
324      called once, after the sockets have been opened and the accept
325      threads have been started. That is, the ports are ready to
326      accept connections. This is *not* guaranteed to be called
327      before the first connection is accepted.
328
329      Event: TS_EVENT_LIFECYCLE_PORTS_READY
330
331    TS_LIFECYCLE_CACHE_READY_HOOK
332
333      called once, after the cache has finished its
334      initialization. It is either online or has failed when this
335      hook is called.
336
337      Event: TS_EVENT_LIFECYCLE_CACHE_READY
338
339    TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK
340
341      called every time after a server SSL_CTX has finished the initialization.
342      It exposes the initialized SSL_CTX pointer.
343
344      Event: TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED
345
346    TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK
347
348      called once, after the client SSL_CTX has finished the initialization.
349      It exposes the initialized SSL_CTX pointer.
350
351      Event: TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED
352
353    TS_LIFECYCLE_MSG_HOOK
354
355      Called in response to an external agent. The data is a pointer to  an instance of TSPluginMsg.
356
357      Event: TS_EVENT_LIFECYCLE_MSG
358
359    TS_LIFECYCLE_TASK_THREADS_READY_HOOK
360
361      called once, after the task threads have been started.
362
363      Event: TS_EVENT_LIFECYCLE_TASK_THREADS_READY
364
365    TS_LIFECYCLE_SHUTDOWN_HOOK
366
367      called once, after receiving a shutdown signal, such as SIGTERM.
368
369      Event: TS_EVENT_LIFECYCLE_SHUTDOWN
370
371    Ordering guarantees:
372
373    - TS_LIFECYCLE_PORTS_INITIALIZED_HOOK before TS_LIFECYCLE_PORTS_READY_HOOK.
374
375    NOTE! ONLY the orderings EXPLICITLY mentioned above are guaranteed.
376
377 */
378typedef enum {
379  TS_LIFECYCLE_PORTS_INITIALIZED_HOOK,
380  TS_LIFECYCLE_PORTS_READY_HOOK,
381  TS_LIFECYCLE_CACHE_READY_HOOK,
382  TS_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED_HOOK,
383  TS_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED_HOOK,
384  TS_LIFECYCLE_MSG_HOOK,
385  TS_LIFECYCLE_TASK_THREADS_READY_HOOK,
386  TS_LIFECYCLE_SHUTDOWN_HOOK,
387  TS_LIFECYCLE_LAST_HOOK
388} TSLifecycleHookID;
389
390/**
391    TSEvents are sent to continuations when they are called back.
392    The TSEvent provides the continuation's handler function with
393    information about the callback. Based on the event it receives,
394    the handler function can decide what to do.
395
396 */
397typedef enum {
398  TS_EVENT_NONE      = 0,
399  TS_EVENT_IMMEDIATE = 1,
400  TS_EVENT_TIMEOUT   = 2,
401  TS_EVENT_ERROR     = 3,
402  TS_EVENT_CONTINUE  = 4,
403
404  TS_EVENT_VCONN_READ_READY         = 100,
405  TS_EVENT_VCONN_WRITE_READY        = 101,
406  TS_EVENT_VCONN_READ_COMPLETE      = 102,
407  TS_EVENT_VCONN_WRITE_COMPLETE     = 103,
408  TS_EVENT_VCONN_EOS                = 104,
409  TS_EVENT_VCONN_INACTIVITY_TIMEOUT = 105,
410  TS_EVENT_VCONN_ACTIVE_TIMEOUT     = 106,
411  TS_EVENT_VCONN_START              = 107,
412  TS_EVENT_VCONN_CLOSE              = 108,
413  TS_EVENT_VCONN_OUTBOUND_START     = 109,
414  TS_EVENT_VCONN_OUTBOUND_CLOSE     = 110,
415  TS_EVENT_VCONN_PRE_ACCEPT         = TS_EVENT_VCONN_START, // Deprecated but still compatible
416
417  TS_EVENT_NET_CONNECT        = 200,
418  TS_EVENT_NET_CONNECT_FAILED = 201,
419  TS_EVENT_NET_ACCEPT         = 202,
420  TS_EVENT_NET_ACCEPT_FAILED  = 204,
421
422  TS_EVENT_INTERNAL_206 = 206,
423  TS_EVENT_INTERNAL_207 = 207,
424  TS_EVENT_INTERNAL_208 = 208,
425  TS_EVENT_INTERNAL_209 = 209,
426  TS_EVENT_INTERNAL_210 = 210,
427  TS_EVENT_INTERNAL_211 = 211,
428  TS_EVENT_INTERNAL_212 = 212,
429
430  TS_EVENT_HOST_LOOKUP = 500,
431
432  TS_EVENT_CACHE_OPEN_READ              = 1102,
433  TS_EVENT_CACHE_OPEN_READ_FAILED       = 1103,
434  TS_EVENT_CACHE_OPEN_WRITE             = 1108,
435  TS_EVENT_CACHE_OPEN_WRITE_FAILED      = 1109,
436  TS_EVENT_CACHE_REMOVE                 = 1112,
437  TS_EVENT_CACHE_REMOVE_FAILED          = 1113,
438  TS_EVENT_CACHE_SCAN                   = 1120,
439  TS_EVENT_CACHE_SCAN_FAILED            = 1121,
440  TS_EVENT_CACHE_SCAN_OBJECT            = 1122,
441  TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED = 1123,
442  TS_EVENT_CACHE_SCAN_OPERATION_FAILED  = 1124,
443  TS_EVENT_CACHE_SCAN_DONE              = 1125,
444  TS_EVENT_CACHE_LOOKUP                 = 1126,
445  TS_EVENT_CACHE_READ                   = 1127,
446  TS_EVENT_CACHE_DELETE                 = 1128,
447  TS_EVENT_CACHE_WRITE                  = 1129,
448  TS_EVENT_CACHE_WRITE_HEADER           = 1130,
449  TS_EVENT_CACHE_CLOSE                  = 1131,
450  TS_EVENT_CACHE_LOOKUP_READY           = 1132,
451  TS_EVENT_CACHE_LOOKUP_COMPLETE        = 1133,
452  TS_EVENT_CACHE_READ_READY             = 1134,
453  TS_EVENT_CACHE_READ_COMPLETE          = 1135,
454
455  TS_EVENT_INTERNAL_1200 = 1200,
456
457  TS_EVENT_SSL_SESSION_GET    = 2000,
458  TS_EVENT_SSL_SESSION_NEW    = 2001,
459  TS_EVENT_SSL_SESSION_REMOVE = 2002,
460
461  TS_EVENT_AIO_DONE = 3900,
462
463  TS_EVENT_HTTP_CONTINUE                = 60000,
464  TS_EVENT_HTTP_ERROR                   = 60001,
465  TS_EVENT_HTTP_READ_REQUEST_HDR        = 60002,
466  TS_EVENT_HTTP_OS_DNS                  = 60003,
467  TS_EVENT_HTTP_SEND_REQUEST_HDR        = 60004,
468  TS_EVENT_HTTP_READ_CACHE_HDR          = 60005,
469  TS_EVENT_HTTP_READ_RESPONSE_HDR       = 60006,
470  TS_EVENT_HTTP_SEND_RESPONSE_HDR       = 60007,
471  TS_EVENT_HTTP_REQUEST_TRANSFORM       = 60008,
472  TS_EVENT_HTTP_RESPONSE_TRANSFORM      = 60009,
473  TS_EVENT_HTTP_SELECT_ALT              = 60010,
474  TS_EVENT_HTTP_TXN_START               = 60011,
475  TS_EVENT_HTTP_TXN_CLOSE               = 60012,
476  TS_EVENT_HTTP_SSN_START               = 60013,
477  TS_EVENT_HTTP_SSN_CLOSE               = 60014,
478  TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE   = 60015,
479  TS_EVENT_HTTP_PRE_REMAP               = 60016,
480  TS_EVENT_HTTP_POST_REMAP              = 60017,
481  TS_EVENT_HTTP_REQUEST_BUFFER_COMPLETE = 60018,
482
483  TS_EVENT_LIFECYCLE_PORTS_INITIALIZED          = 60100,
484  TS_EVENT_LIFECYCLE_PORTS_READY                = 60101,
485  TS_EVENT_LIFECYCLE_CACHE_READY                = 60102,
486  TS_EVENT_LIFECYCLE_SERVER_SSL_CTX_INITIALIZED = 60103,
487  TS_EVENT_LIFECYCLE_CLIENT_SSL_CTX_INITIALIZED = 60104,
488  TS_EVENT_LIFECYCLE_MSG                        = 60105,
489  TS_EVENT_LIFECYCLE_TASK_THREADS_READY         = 60106,
490  TS_EVENT_LIFECYCLE_SHUTDOWN                   = 60107,
491
492  TS_EVENT_INTERNAL_60200    = 60200,
493  TS_EVENT_INTERNAL_60201    = 60201,
494  TS_EVENT_INTERNAL_60202    = 60202,
495  TS_EVENT_SSL_CERT          = 60203,
496  TS_EVENT_SSL_SERVERNAME    = 60204,
497  TS_EVENT_SSL_VERIFY_SERVER = 60205,
498  TS_EVENT_SSL_VERIFY_CLIENT = 60206,
499  TS_EVENT_SSL_CLIENT_HELLO  = 60207,
500
501  TS_EVENT_MGMT_UPDATE = 60300
502} TSEvent;
503#define TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP TS_EVENT_HTTP_PRE_REMAP /* backwards compat */
504
505typedef enum {
506  TS_SRVSTATE_STATE_UNDEFINED = 0,
507  TS_SRVSTATE_ACTIVE_TIMEOUT,
508  TS_SRVSTATE_BAD_INCOMING_RESPONSE,
509  TS_SRVSTATE_CONNECTION_ALIVE,
510  TS_SRVSTATE_CONNECTION_CLOSED,
511  TS_SRVSTATE_CONNECTION_ERROR,
512  TS_SRVSTATE_INACTIVE_TIMEOUT,
513  TS_SRVSTATE_OPEN_RAW_ERROR,
514  TS_SRVSTATE_PARSE_ERROR,
515  TS_SRVSTATE_TRANSACTION_COMPLETE,
516  TS_SRVSTATE_PARENT_RETRY,
517  TS_SRVSTATE_OUTBOUND_CONGESTION
518} TSServerState;
519
520typedef enum {
521  TS_LOOKUP_UNDEFINED_LOOKUP,
522  TS_LOOKUP_PARENT_PROXY,
523  TS_LOOKUP_ORIGIN_SERVER,
524  TS_LOOKUP_INCOMING_ROUTER,
525  TS_LOOKUP_HOST_NONE
526} TSLookingUpType;
527
528typedef enum {
529  TS_CACHE_LOOKUP_MISS,
530  TS_CACHE_LOOKUP_HIT_STALE,
531  TS_CACHE_LOOKUP_HIT_FRESH,
532  TS_CACHE_LOOKUP_SKIPPED
533} TSCacheLookupResult;
534
535typedef enum {
536  TS_CACHE_DATA_TYPE_NONE,
537  TS_CACHE_DATA_TYPE_HTTP,
538  TS_CACHE_DATA_TYPE_OTHER,
539} TSCacheDataType;
540
541typedef enum {
542  TS_CACHE_ERROR_NO_DOC    = -20400,
543  TS_CACHE_ERROR_DOC_BUSY  = -20401,
544  TS_CACHE_ERROR_NOT_READY = -20407,
545} TSCacheError;
546
547typedef enum {
548  TS_CACHE_SCAN_RESULT_DONE     = 0,
549  TS_CACHE_SCAN_RESULT_CONTINUE = 1,
550  TS_CACHE_SCAN_RESULT_DELETE   = 10,
551  TS_CACHE_SCAN_RESULT_DELETE_ALL_ALTERNATES,
552  TS_CACHE_SCAN_RESULT_UPDATE,
553  TS_CACHE_SCAN_RESULT_RETRY
554} TSCacheScanResult;
555
556typedef enum {
557  TS_TXN_INFO_NONE = -1,
558  TS_TXN_INFO_CACHE_HIT_RAM,
559  TS_TXN_INFO_CACHE_COMPRESSED_IN_RAM,
560  TS_TXN_INFO_CACHE_HIT_RWW, // READ_WHILE_WRITE
561  TS_TXN_INFO_CACHE_OPEN_READ_TRIES,
562  TS_TXN_INFO_CACHE_OPEN_WRITE_TRIES,
563  TS_TXN_INFO_CACHE_VOLUME,
564  TS_TXN_INFO_LAST_ENTRY
565} TSHttpTxnInfoKey;
566
567typedef enum {
568  TS_VC_CLOSE_ABORT  = -1,
569  TS_VC_CLOSE_NORMAL = 1,
570} TSVConnCloseFlags;
571
572typedef enum {
573  TS_IOBUFFER_SIZE_INDEX_128  = 0,
574  TS_IOBUFFER_SIZE_INDEX_256  = 1,
575  TS_IOBUFFER_SIZE_INDEX_512  = 2,
576  TS_IOBUFFER_SIZE_INDEX_1K   = 3,
577  TS_IOBUFFER_SIZE_INDEX_2K   = 4,
578  TS_IOBUFFER_SIZE_INDEX_4K   = 5,
579  TS_IOBUFFER_SIZE_INDEX_8K   = 6,
580  TS_IOBUFFER_SIZE_INDEX_16K  = 7,
581  TS_IOBUFFER_SIZE_INDEX_32K  = 8,
582  TS_IOBUFFER_SIZE_INDEX_64K  = 9,
583  TS_IOBUFFER_SIZE_INDEX_128K = 10,
584  TS_IOBUFFER_SIZE_INDEX_256K = 11,
585  TS_IOBUFFER_SIZE_INDEX_512K = 12,
586  TS_IOBUFFER_SIZE_INDEX_1M   = 13,
587  TS_IOBUFFER_SIZE_INDEX_2M   = 14
588} TSIOBufferSizeIndex;
589
590typedef enum {
591  TS_ERROR   = -1,
592  TS_SUCCESS = 0,
593} TSReturnCode;
594
595typedef enum {
596  NO_CALLBACK = 0,
597  AFTER_HEADER,
598  AFTER_BODY,
599} TSFetchWakeUpOptions;
600
601/// Values for per server outbound connection tracking group definition.
602/// See proxy.config.http.per_server.match
603typedef enum {
604  TS_SERVER_OUTBOUND_MATCH_IP,
605  TS_SERVER_OUTBOUND_MATCH_PORT,
606  TS_SERVER_OUTBOUND_MATCH_HOST,
607  TS_SERVER_OUTBOUND_MATCH_BOTH
608} TSOutboundConnectionMatchType;
609
610/* librecords types */
611
612/* The values of this enum must match enum RecT in I_RecDefs.h */
613typedef enum {
614  TS_RECORDTYPE_NULL    = 0x00,
615  TS_RECORDTYPE_CONFIG  = 0x01,
616  TS_RECORDTYPE_PROCESS = 0x02,
617  TS_RECORDTYPE_NODE    = 0x04,
618  TS_RECORDTYPE_LOCAL   = 0x10,
619  TS_RECORDTYPE_PLUGIN  = 0x20,
620  TS_RECORDTYPE_ALL     = 0x3F
621} TSRecordType;
622
623/* The values of this enum must match enum RecDataT in I_RecDefs.h */
624typedef enum {
625  TS_RECORDDATATYPE_NULL = 0,
626  TS_RECORDDATATYPE_INT,
627  TS_RECORDDATATYPE_FLOAT,
628  TS_RECORDDATATYPE_STRING,
629  TS_RECORDDATATYPE_COUNTER,
630  TS_RECORDDATATYPE_STAT_CONST,
631  TS_RECORDDATATYPE_STAT_FX,
632  TS_RECORDDATATYPE_MAX
633} TSRecordDataType;
634
635typedef union {
636  int64_t rec_int;
637  float rec_float;
638  char *rec_string;
639  int64_t rec_counter;
640} TSRecordData;
641
642/* The values of this enum must match enum RecPersistT in I_RecDefs.h */
643typedef enum {
644  TS_RECORDP_NULL,
645  TS_RECORDP_PERSISTENT,
646  TS_RECORDP_NON_PERSISTENT,
647} TSRecordPersistType;
648
649/* The values of this enum must match enum RecUpdateT in I_RecDefs.h */
650typedef enum {
651  TS_RECORDUPDATE_NULL,
652  TS_RECORDUPDATE_DYNAMIC,
653  TS_RECORDUPDATE_RESTART_TS,
654  TS_RECORDUPDATE_RESTART_TM,
655} TSRecordUpdateType;
656
657/* The values of this enum must match enum RecCheckT in I_RecDefs.h */
658typedef enum {
659  TS_RECORDCHECK_NULL,
660  TS_RECORDCHECK_STR,
661  TS_RECORDCHECK_INT,
662  TS_RECORDCHECK_IP,
663} TSRecordCheckType;
664
665/* The values of this enum must match enum RecModeT in I_RecDefs.h */
666typedef enum {
667  TS_RECORDMODE_NULL,
668  TS_RECORDMODE_CLIENT,
669  TS_RECORDMODE_SERVER,
670  TS_RECORDMODE_STAND_ALONE,
671} TSRecordModeType;
672
673/* The values of this enum must match enum RecAccessT in I_RecDefs.h */
674typedef enum {
675  TS_RECORDACCESS_NULL,
676  TS_RECORDACCESS_NO_ACCESS,
677  TS_RECORDACCESS_READ_ONLY,
678} TSRecordAccessType;
679
680typedef enum {
681  TS_CONFIG_NULL = -1,
682  TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR,
683  TS_CONFIG_HTTP_CHUNKING_ENABLED,
684  TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED,
685  TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME,
686  TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE,
687  TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN,
688  TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT,
689  TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT,
690  TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH,
691  TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT,
692  TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT,
693  TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT,
694  TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT,
695  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM,
696  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER,
697  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT,
698  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE,
699  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP,
700  TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP,
701  TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
702  TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
703  TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
704  TS_CONFIG_HTTP_CACHE_HTTP,
705  TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,
706  TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE,
707  TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE,
708  TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE,
709  TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES,
710  TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION,
711  TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC,
712  TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS,
713  TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR,
714  TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR,
715  TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,
716  TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME,
717  TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME,
718  TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME,
719  TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE,
720  TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN,
721  TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT,
722  TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN,
723  TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT,
724  TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT,
725  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES,
726  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER,
727  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
728  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
729  TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
730  TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
731  // Should be removed for 10.0
732  TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
733  TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
734  TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT,
735  TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
736  TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR,
737  TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD,
738  TS_CONFIG_NET_SOCK_PACKET_MARK_OUT,
739  TS_CONFIG_NET_SOCK_PACKET_TOS_OUT,
740  TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE,
741  TS_CONFIG_HTTP_CHUNKING_SIZE,
742  TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
743  TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
744  TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
745  TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
746  TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
747  TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
748  TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
749  TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
750  TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
751  TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
752  TS_CONFIG_SSL_HSTS_MAX_AGE,
753  TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS,
754  TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME,
755  TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES,
756  TS_CONFIG_HTTP_CACHE_RANGE_WRITE,
757  TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED,
758  TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER,
759  TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE,
760  TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD,
761  TS_CONFIG_HTTP_CACHE_GENERATION,
762  TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE,
763  TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION,
764  TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS,
765  TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES,
766  TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY,
767  TS_CONFIG_HTTP_ATTACH_SERVER_SESSION_TO_CLIENT,
768  TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
769  TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
770  TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
771  TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
772  TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
773  TS_CONFIG_SRV_ENABLED,
774  TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
775  TS_CONFIG_SSL_CERT_FILENAME,
776  TS_CONFIG_SSL_CLIENT_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME,
777  TS_CONFIG_SSL_CERT_FILEPATH,
778  TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
779  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
780  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
781  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
782  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
783  TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD,
784  TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME,
785  TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS,
786  TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT,
787  TS_CONFIG_HTTP_NORMALIZE_AE,
788  TS_CONFIG_HTTP_INSERT_FORWARDED,
789  TS_CONFIG_HTTP_PROXY_PROTOCOL_OUT,
790  TS_CONFIG_HTTP_ALLOW_MULTI_RANGE,
791  TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED,
792  TS_CONFIG_HTTP_ALLOW_HALF_OPEN,
793  TS_CONFIG_HTTP_SERVER_MIN_KEEP_ALIVE_CONNS,
794  TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MAX,
795  TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MATCH,
796  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER,
797  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_POLICY,
798  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_PROPERTIES,
799  TS_CONFIG_SSL_CLIENT_SNI_POLICY,
800  TS_CONFIG_SSL_CLIENT_PRIVATE_KEY_FILENAME,
801  TS_CONFIG_SSL_CLIENT_CA_CERT_FILENAME,
802  TS_CONFIG_HTTP_HOST_RESOLUTION_PREFERENCE,
803  TS_CONFIG_HTTP_CONNECT_DEAD_POLICY,
804  TS_CONFIG_LAST_ENTRY
805} TSOverridableConfigKey;
806
807/* The TASK pool of threads is the primary method of off-loading continuations from the
808   net-threads. Configure this with proxy.config.task_threads in records.config. */
809typedef enum {
810  TS_THREAD_POOL_NET,
811  TS_THREAD_POOL_TASK,
812  /* unlikely you should use these */
813  TS_THREAD_POOL_DNS,
814  TS_THREAD_POOL_UDP
815} TSThreadPool;
816
817typedef int64_t TSHRTime;
818
819/* The TSMilestonesType is an enum defining all the various milestones ("timers") that
820   we track for a request. */
821typedef enum {
822  TS_MILESTONE_NULL = -1,
823  TS_MILESTONE_UA_BEGIN,
824  TS_MILESTONE_UA_FIRST_READ,
825  TS_MILESTONE_UA_READ_HEADER_DONE,
826  TS_MILESTONE_UA_BEGIN_WRITE,
827  TS_MILESTONE_UA_CLOSE,
828  TS_MILESTONE_SERVER_FIRST_CONNECT,
829  TS_MILESTONE_SERVER_CONNECT,
830  TS_MILESTONE_SERVER_CONNECT_END,
831  TS_MILESTONE_SERVER_BEGIN_WRITE,
832  TS_MILESTONE_SERVER_FIRST_READ,
833  TS_MILESTONE_SERVER_READ_HEADER_DONE,
834  TS_MILESTONE_SERVER_CLOSE,
835  TS_MILESTONE_CACHE_OPEN_READ_BEGIN,
836  TS_MILESTONE_CACHE_OPEN_READ_END,
837  TS_MILESTONE_CACHE_OPEN_WRITE_BEGIN,
838  TS_MILESTONE_CACHE_OPEN_WRITE_END,
839  TS_MILESTONE_DNS_LOOKUP_BEGIN,
840  TS_MILESTONE_DNS_LOOKUP_END,
841  TS_MILESTONE_SM_START,
842  TS_MILESTONE_SM_FINISH,
843  TS_MILESTONE_PLUGIN_ACTIVE,
844  TS_MILESTONE_PLUGIN_TOTAL,
845  TS_MILESTONE_TLS_HANDSHAKE_START,
846  TS_MILESTONE_TLS_HANDSHAKE_END,
847  TS_MILESTONE_LAST_ENTRY
848} TSMilestonesType;
849
850/* These typedefs are used with the corresponding TSMgmt*Get functions
851   for storing the values retrieved by those functions. For example,
852   TSMgmtCounterGet() retrieves an TSMgmtCounter. */
853typedef int64_t TSMgmtInt;
854typedef int64_t TSMgmtCounter;
855typedef float TSMgmtFloat;
856typedef char *TSMgmtString;
857
858/// The source of a management value.
859typedef enum {
860  TS_MGMT_SOURCE_NULL,     ///< No source / value not found.
861  TS_MGMT_SOURCE_DEFAULT,  ///< Built in core default.
862  TS_MGMT_SOURCE_PLUGIN,   ///< Plugin supplied default.
863  TS_MGMT_SOURCE_EXPLICIT, ///< Set by administrator (config file, external API, etc.)
864  TS_MGMT_SOURCE_ENV       ///< Process environment variable.
865} TSMgmtSource;
866
867/// The User Arg type, used for Txn/Ssn/VConn user argument slots
868typedef enum {
869  TS_USER_ARGS_TXN,   ///< Transaction based.
870  TS_USER_ARGS_SSN,   ///< Session based
871  TS_USER_ARGS_VCONN, ///< VConnection based
872  TS_USER_ARGS_GLB,   ///< Global based
873  TS_USER_ARGS_COUNT  ///< Fake enum, # of valid entries.
874} TSUserArgType;
875
876/** An enumeration of HTTP version types for the priority functions that behave
877 * differently across HTTP protocols. */
878typedef enum {
879  HTTP_PRIORITY_TYPE_HTTP_UNSPECIFIED = 1,
880  HTTP_PRIORITY_TYPE_HTTP_2,
881  HTTP_PRIORITY_TYPE_HTTP_3,
882} TSHttpPriorityType;
883
884/** The abstract type of the various HTTP priority implementations. */
885typedef struct {
886  /** The reference to the concrete HTTP priority implementation. This will be
887   * a value from TSHttpPriorityType. */
888  uint8_t priority_type;
889  /** The space allocated for the concrete priority implementation.
890   *
891   * Note that this has to take padding into account. There is a static_assert
892   * in InkAPI.cc to verify that TSHttpPriority is at least as large as
893   * TSHttp2Priority. As other structures are added that are represented by
894   * TSHttpPriority add more static_asserts to verify that TSHttpPriority is as
895   * large as it needs to be.
896   */
897  uint8_t data[7];
898} TSHttpPriority;
899
900/** A structure for HTTP/2 priority.
901 *
902 * For an explanation of these terms with respect to HTTP/2, see RFC 7540,
903 * section 5.3.
904 */
905typedef struct {
906  uint8_t priority_type; /** HTTP_PROTOCOL_TYPE_HTTP_2 */
907  uint8_t weight;
908  /** The stream dependency. Per spec, see RFC 7540 section 6.2, this is 31
909   * bits. We use a signed 32 bit structure to store either a valid dependency
910   * or -1 if the stream has no dependency. */
911  int32_t stream_dependency;
912} TSHttp2Priority;
913
914typedef struct tsapi_file *TSFile;
915
916typedef struct tsapi_mloc *TSMLoc;
917typedef struct tsapi_mbuffer *TSMBuffer;
918typedef struct tsapi_httpssn *TSHttpSsn;
919typedef struct tsapi_httptxn *TSHttpTxn;
920typedef struct tsapi_ssl_obj *TSSslConnection;
921typedef struct tsapi_ssl_session *TSSslSession;
922typedef struct tsapi_httpaltinfo *TSHttpAltInfo;
923typedef struct tsapi_mimeparser *TSMimeParser;
924typedef struct tsapi_httpparser *TSHttpParser;
925typedef struct tsapi_cachekey *TSCacheKey;
926typedef struct tsapi_cachehttpinfo *TSCacheHttpInfo;
927typedef struct tsapi_cachetxn *TSCacheTxn;
928typedef struct tsapi_x509_store_ctx *TSSslVerifyCTX;
929
930typedef struct tsapi_port *TSPortDescriptor;
931typedef struct tsapi_vio *TSVIO;
932typedef struct tsapi_thread *TSThread;
933typedef struct tsapi_event_thread *TSEventThread;
934typedef struct tsapi_x509 *TSSslX509;
935typedef struct tsapi_mutex *TSMutex;
936typedef struct tsapi_config *TSConfig;
937typedef struct tsapi_cont *TSCont;
938typedef struct tsapi_cont *TSVConn; /* a VConn is really a specialized TSCont */
939typedef struct tsapi_ssl_context *TSSslContext;
940typedef struct tsapi_action *TSAction;
941typedef struct tsapi_iobuffer *TSIOBuffer;
942typedef struct tsapi_iobufferdata *TSIOBufferData;
943typedef struct tsapi_bufferblock *TSIOBufferBlock;
944typedef struct tsapi_bufferreader *TSIOBufferReader;
945typedef struct tsapi_hostlookupresult *TSHostLookupResult;
946typedef struct tsapi_aiocallback *TSAIOCallback;
947typedef struct tsapi_net_accept *TSAcceptor;
948
949typedef struct tsapi_fetchsm *TSFetchSM;
950
951typedef void *(*TSThreadFunc)(void *data);
952typedef int (*TSEventFunc)(TSCont contp, TSEvent event, void *edata);
953typedef void (*TSConfigDestroyFunc)(void *data);
954
955typedef struct {
956  int success_event_id;
957  int failure_event_id;
958  int timeout_event_id;
959} TSFetchEvent;
960
961typedef struct TSFetchUrlParams {
962  const char *request;
963  int request_len;
964  struct sockaddr_storage ip;
965  int port;
966  TSCont contp;
967  TSFetchEvent events;
968  TSFetchWakeUpOptions options;
969  struct TSFetchUrlParams *next;
970} TSFetchUrlParams_t;
971
972// This is a duplicate of the SSL_MAX_SSL_SESSION_ID_LENGTH constant
973// Redefining here so we don't include the openssl/ssl.h file here
974#define TS_SSL_MAX_SSL_SESSION_ID_LENGTH 32
975
976// This mirrors the internal data structure SSLSessionID
977typedef struct TSSslSessionID_s {
978  size_t len;
979  char bytes[TS_SSL_MAX_SSL_SESSION_ID_LENGTH];
980} TSSslSessionID;
981
982/* --------------------------------------------------------------------------
983   Init */
984
985/**
986    This function must be defined by all plugins. Traffic Server
987    calls this initialization routine when it loads the plugin (at
988    startup), and sets argc and argv appropriately based on the values
989    in plugin.config.
990
991    @param argc the number of initial values specified in plugin.config,
992      plus one. If only the name of your plugin shared object is
993      specified in plugin.config, argc=1.
994    @param argv the vector of arguments. The length of argv is argc.
995      argv[0] is the name of the plugin shared library. Subsequent
996      values of argv are initialization values specified in
997      plugin.config.
998
999 */
1000extern tsapi void TSPluginInit(int argc, const char *argv[]);
1001
1002/* --------------------------------------------------------------------------
1003   URL schemes */
1004extern tsapi const char *TS_URL_SCHEME_FILE;
1005extern tsapi const char *TS_URL_SCHEME_FTP;
1006extern tsapi const char *TS_URL_SCHEME_GOPHER;
1007extern tsapi const char *TS_URL_SCHEME_HTTP;
1008extern tsapi const char *TS_URL_SCHEME_HTTPS;
1009extern tsapi const char *TS_URL_SCHEME_MAILTO;
1010extern tsapi const char *TS_URL_SCHEME_NEWS;
1011extern tsapi const char *TS_URL_SCHEME_NNTP;
1012extern tsapi const char *TS_URL_SCHEME_PROSPERO;
1013extern tsapi const char *TS_URL_SCHEME_TELNET;
1014extern tsapi const char *TS_URL_SCHEME_TUNNEL;
1015extern tsapi const char *TS_URL_SCHEME_WAIS;
1016extern tsapi const char *TS_URL_SCHEME_PNM;
1017extern tsapi const char *TS_URL_SCHEME_RTSP;
1018extern tsapi const char *TS_URL_SCHEME_RTSPU;
1019extern tsapi const char *TS_URL_SCHEME_MMS;
1020extern tsapi const char *TS_URL_SCHEME_MMSU;
1021extern tsapi const char *TS_URL_SCHEME_MMST;
1022extern tsapi const char *TS_URL_SCHEME_WS;
1023extern tsapi const char *TS_URL_SCHEME_WSS;
1024
1025/* --------------------------------------------------------------------------
1026   URL scheme string lengths */
1027extern tsapi int TS_URL_LEN_FILE;
1028extern tsapi int TS_URL_LEN_FTP;
1029extern tsapi int TS_URL_LEN_GOPHER;
1030extern tsapi int TS_URL_LEN_HTTP;
1031extern tsapi int TS_URL_LEN_HTTPS;
1032extern tsapi int TS_URL_LEN_MAILTO;
1033extern tsapi int TS_URL_LEN_NEWS;
1034extern tsapi int TS_URL_LEN_NNTP;
1035extern tsapi int TS_URL_LEN_PROSPERO;
1036extern tsapi int TS_URL_LEN_TELNET;
1037extern tsapi int TS_URL_LEN_WAIS;
1038extern tsapi int TS_URL_LEN_WS;
1039extern tsapi int TS_URL_LEN_WSS;
1040
1041/* --------------------------------------------------------------------------
1042   MIME fields */
1043extern tsapi const char *TS_MIME_FIELD_ACCEPT;
1044extern tsapi const char *TS_MIME_FIELD_ACCEPT_CHARSET;
1045extern tsapi const char *TS_MIME_FIELD_ACCEPT_ENCODING;
1046extern tsapi const char *TS_MIME_FIELD_ACCEPT_LANGUAGE;
1047extern tsapi const char *TS_MIME_FIELD_ACCEPT_RANGES;
1048extern tsapi const char *TS_MIME_FIELD_AGE;
1049extern tsapi const char *TS_MIME_FIELD_ALLOW;
1050extern tsapi const char *TS_MIME_FIELD_APPROVED;
1051extern tsapi const char *TS_MIME_FIELD_AUTHORIZATION;
1052extern tsapi const char *TS_MIME_FIELD_BYTES;
1053extern tsapi const char *TS_MIME_FIELD_CACHE_CONTROL;
1054extern tsapi const char *TS_MIME_FIELD_CLIENT_IP;
1055extern tsapi const char *TS_MIME_FIELD_CONNECTION;
1056extern tsapi const char *TS_MIME_FIELD_CONTENT_BASE;
1057extern tsapi const char *TS_MIME_FIELD_CONTENT_ENCODING;
1058extern tsapi const char *TS_MIME_FIELD_CONTENT_LANGUAGE;
1059extern tsapi const char *TS_MIME_FIELD_CONTENT_LENGTH;
1060extern tsapi const char *TS_MIME_FIELD_CONTENT_LOCATION;
1061extern tsapi const char *TS_MIME_FIELD_CONTENT_MD5;
1062extern tsapi const char *TS_MIME_FIELD_CONTENT_RANGE;
1063extern tsapi const char *TS_MIME_FIELD_CONTENT_TYPE;
1064extern tsapi const char *TS_MIME_FIELD_CONTROL;
1065extern tsapi const char *TS_MIME_FIELD_COOKIE;
1066extern tsapi const char *TS_MIME_FIELD_DATE;
1067extern tsapi const char *TS_MIME_FIELD_DISTRIBUTION;
1068extern tsapi const char *TS_MIME_FIELD_ETAG;
1069extern tsapi const char *TS_MIME_FIELD_EXPECT;
1070extern tsapi const char *TS_MIME_FIELD_EXPIRES;
1071extern tsapi const char *TS_MIME_FIELD_FOLLOWUP_TO;
1072extern tsapi const char *TS_MIME_FIELD_FROM;
1073extern tsapi const char *TS_MIME_FIELD_HOST;
1074extern tsapi const char *TS_MIME_FIELD_IF_MATCH;
1075extern tsapi const char *TS_MIME_FIELD_IF_MODIFIED_SINCE;
1076extern tsapi const char *TS_MIME_FIELD_IF_NONE_MATCH;
1077extern tsapi const char *TS_MIME_FIELD_IF_RANGE;
1078extern tsapi const char *TS_MIME_FIELD_IF_UNMODIFIED_SINCE;
1079extern tsapi const char *TS_MIME_FIELD_KEEP_ALIVE;
1080extern tsapi const char *TS_MIME_FIELD_KEYWORDS;
1081extern tsapi const char *TS_MIME_FIELD_LAST_MODIFIED;
1082extern tsapi const char *TS_MIME_FIELD_LINES;
1083extern tsapi const char *TS_MIME_FIELD_LOCATION;
1084extern tsapi const char *TS_MIME_FIELD_MAX_FORWARDS;
1085extern tsapi const char *TS_MIME_FIELD_MESSAGE_ID;
1086extern tsapi const char *TS_MIME_FIELD_NEWSGROUPS;
1087extern tsapi const char *TS_MIME_FIELD_ORGANIZATION;
1088extern tsapi const char *TS_MIME_FIELD_PATH;
1089extern tsapi const char *TS_MIME_FIELD_PRAGMA;
1090extern tsapi const char *TS_MIME_FIELD_PROXY_AUTHENTICATE;
1091extern tsapi const char *TS_MIME_FIELD_PROXY_AUTHORIZATION;
1092extern tsapi const char *TS_MIME_FIELD_PROXY_CONNECTION;
1093extern tsapi const char *TS_MIME_FIELD_PUBLIC;
1094extern tsapi const char *TS_MIME_FIELD_RANGE;
1095extern tsapi const char *TS_MIME_FIELD_REFERENCES;
1096extern tsapi const char *TS_MIME_FIELD_REFERER;
1097extern tsapi const char *TS_MIME_FIELD_REPLY_TO;
1098extern tsapi const char *TS_MIME_FIELD_RETRY_AFTER;
1099extern tsapi const char *TS_MIME_FIELD_SENDER;
1100extern tsapi const char *TS_MIME_FIELD_SERVER;
1101extern tsapi const char *TS_MIME_FIELD_SET_COOKIE;
1102extern tsapi const char *TS_MIME_FIELD_STRICT_TRANSPORT_SECURITY;
1103extern tsapi const char *TS_MIME_FIELD_SUBJECT;
1104extern tsapi const char *TS_MIME_FIELD_SUMMARY;
1105extern tsapi const char *TS_MIME_FIELD_TE;
1106extern tsapi const char *TS_MIME_FIELD_TRANSFER_ENCODING;
1107extern tsapi const char *TS_MIME_FIELD_UPGRADE;
1108extern tsapi const char *TS_MIME_FIELD_USER_AGENT;
1109extern tsapi const char *TS_MIME_FIELD_VARY;
1110extern tsapi const char *TS_MIME_FIELD_VIA;
1111extern tsapi const char *TS_MIME_FIELD_WARNING;
1112extern tsapi const char *TS_MIME_FIELD_WWW_AUTHENTICATE;
1113extern tsapi const char *TS_MIME_FIELD_XREF;
1114extern tsapi const char *TS_MIME_FIELD_X_FORWARDED_FOR;
1115extern tsapi const char *TS_MIME_FIELD_FORWARDED;
1116
1117/* --------------------------------------------------------------------------
1118   MIME fields string lengths */
1119extern tsapi int TS_MIME_LEN_ACCEPT;
1120extern tsapi int TS_MIME_LEN_ACCEPT_CHARSET;
1121extern tsapi int TS_MIME_LEN_ACCEPT_ENCODING;
1122extern tsapi int TS_MIME_LEN_ACCEPT_LANGUAGE;
1123extern tsapi int TS_MIME_LEN_ACCEPT_RANGES;
1124extern tsapi int TS_MIME_LEN_AGE;
1125extern tsapi int TS_MIME_LEN_ALLOW;
1126extern tsapi int TS_MIME_LEN_APPROVED;
1127extern tsapi int TS_MIME_LEN_AUTHORIZATION;
1128extern tsapi int TS_MIME_LEN_BYTES;
1129extern tsapi int TS_MIME_LEN_CACHE_CONTROL;
1130extern tsapi int TS_MIME_LEN_CLIENT_IP;
1131extern tsapi int TS_MIME_LEN_CONNECTION;
1132extern tsapi int TS_MIME_LEN_CONTENT_BASE;
1133extern tsapi int TS_MIME_LEN_CONTENT_ENCODING;
1134extern tsapi int TS_MIME_LEN_CONTENT_LANGUAGE;
1135extern tsapi int TS_MIME_LEN_CONTENT_LENGTH;
1136extern tsapi int TS_MIME_LEN_CONTENT_LOCATION;
1137extern tsapi int TS_MIME_LEN_CONTENT_MD5;
1138extern tsapi int TS_MIME_LEN_CONTENT_RANGE;
1139extern tsapi int TS_MIME_LEN_CONTENT_TYPE;
1140extern tsapi int TS_MIME_LEN_CONTROL;
1141extern tsapi int TS_MIME_LEN_COOKIE;
1142extern tsapi int TS_MIME_LEN_DATE;
1143extern tsapi int TS_MIME_LEN_DISTRIBUTION;
1144extern tsapi int TS_MIME_LEN_ETAG;
1145extern tsapi int TS_MIME_LEN_EXPECT;
1146extern tsapi int TS_MIME_LEN_EXPIRES;
1147extern tsapi int TS_MIME_LEN_FOLLOWUP_TO;
1148extern tsapi int TS_MIME_LEN_FROM;
1149extern tsapi int TS_MIME_LEN_HOST;
1150extern tsapi int TS_MIME_LEN_IF_MATCH;
1151extern tsapi int TS_MIME_LEN_IF_MODIFIED_SINCE;
1152extern tsapi int TS_MIME_LEN_IF_NONE_MATCH;
1153extern tsapi int TS_MIME_LEN_IF_RANGE;
1154extern tsapi int TS_MIME_LEN_IF_UNMODIFIED_SINCE;
1155extern tsapi int TS_MIME_LEN_KEEP_ALIVE;
1156extern tsapi int TS_MIME_LEN_KEYWORDS;
1157extern tsapi int TS_MIME_LEN_LAST_MODIFIED;
1158extern tsapi int TS_MIME_LEN_LINES;
1159extern tsapi int TS_MIME_LEN_LOCATION;
1160extern tsapi int TS_MIME_LEN_MAX_FORWARDS;
1161extern tsapi int TS_MIME_LEN_MESSAGE_ID;
1162extern tsapi int TS_MIME_LEN_NEWSGROUPS;
1163extern tsapi int TS_MIME_LEN_ORGANIZATION;
1164extern tsapi int TS_MIME_LEN_PATH;
1165extern tsapi int TS_MIME_LEN_PRAGMA;
1166extern tsapi int TS_MIME_LEN_PROXY_AUTHENTICATE;
1167extern tsapi int TS_MIME_LEN_PROXY_AUTHORIZATION;
1168extern tsapi int TS_MIME_LEN_PROXY_CONNECTION;
1169extern tsapi int TS_MIME_LEN_PUBLIC;
1170extern tsapi int TS_MIME_LEN_RANGE;
1171extern tsapi int TS_MIME_LEN_REFERENCES;
1172extern tsapi int TS_MIME_LEN_REFERER;
1173extern tsapi int TS_MIME_LEN_REPLY_TO;
1174extern tsapi int TS_MIME_LEN_RETRY_AFTER;
1175extern tsapi int TS_MIME_LEN_SENDER;
1176extern tsapi int TS_MIME_LEN_SERVER;
1177extern tsapi int TS_MIME_LEN_SET_COOKIE;
1178extern tsapi int TS_MIME_LEN_STRICT_TRANSPORT_SECURITY;
1179extern tsapi int TS_MIME_LEN_SUBJECT;
1180extern tsapi int TS_MIME_LEN_SUMMARY;
1181extern tsapi int TS_MIME_LEN_TE;
1182extern tsapi int TS_MIME_LEN_TRANSFER_ENCODING;
1183extern tsapi int TS_MIME_LEN_UPGRADE;
1184extern tsapi int TS_MIME_LEN_USER_AGENT;
1185extern tsapi int TS_MIME_LEN_VARY;
1186extern tsapi int TS_MIME_LEN_VIA;
1187extern tsapi int TS_MIME_LEN_WARNING;
1188extern tsapi int TS_MIME_LEN_WWW_AUTHENTICATE;
1189extern tsapi int TS_MIME_LEN_XREF;
1190extern tsapi int TS_MIME_LEN_X_FORWARDED_FOR;
1191extern tsapi int TS_MIME_LEN_FORWARDED;
1192
1193/* --------------------------------------------------------------------------
1194   HTTP values */
1195extern tsapi const char *TS_HTTP_VALUE_BYTES;
1196extern tsapi const char *TS_HTTP_VALUE_CHUNKED;
1197extern tsapi const char *TS_HTTP_VALUE_CLOSE;
1198extern tsapi const char *TS_HTTP_VALUE_COMPRESS;
1199extern tsapi const char *TS_HTTP_VALUE_DEFLATE;
1200extern tsapi const char *TS_HTTP_VALUE_GZIP;
1201extern tsapi const char *TS_HTTP_VALUE_IDENTITY;
1202extern tsapi const char *TS_HTTP_VALUE_KEEP_ALIVE;
1203extern tsapi const char *TS_HTTP_VALUE_MAX_AGE;
1204extern tsapi const char *TS_HTTP_VALUE_MAX_STALE;
1205extern tsapi const char *TS_HTTP_VALUE_MIN_FRESH;
1206extern tsapi const char *TS_HTTP_VALUE_MUST_REVALIDATE;
1207extern tsapi const char *TS_HTTP_VALUE_NONE;
1208extern tsapi const char *TS_HTTP_VALUE_NO_CACHE;
1209extern tsapi const char *TS_HTTP_VALUE_NO_STORE;
1210extern tsapi const char *TS_HTTP_VALUE_NO_TRANSFORM;
1211extern tsapi const char *TS_HTTP_VALUE_ONLY_IF_CACHED;
1212extern tsapi const char *TS_HTTP_VALUE_PRIVATE;
1213extern tsapi const char *TS_HTTP_VALUE_PROXY_REVALIDATE;
1214extern tsapi const char *TS_HTTP_VALUE_PUBLIC;
1215
1216/* --------------------------------------------------------------------------
1217   HTTP values string lengths */
1218extern tsapi int TS_HTTP_LEN_BYTES;
1219extern tsapi int TS_HTTP_LEN_CHUNKED;
1220extern tsapi int TS_HTTP_LEN_CLOSE;
1221extern tsapi int TS_HTTP_LEN_COMPRESS;
1222extern tsapi int TS_HTTP_LEN_DEFLATE;
1223extern tsapi int TS_HTTP_LEN_GZIP;
1224extern tsapi int TS_HTTP_LEN_IDENTITY;
1225extern tsapi int TS_HTTP_LEN_KEEP_ALIVE;
1226extern tsapi int TS_HTTP_LEN_MAX_AGE;
1227extern tsapi int TS_HTTP_LEN_MAX_STALE;
1228extern tsapi int TS_HTTP_LEN_MIN_FRESH;
1229extern tsapi int TS_HTTP_LEN_MUST_REVALIDATE;
1230extern tsapi int TS_HTTP_LEN_NONE;
1231extern tsapi int TS_HTTP_LEN_NO_CACHE;
1232extern tsapi int TS_HTTP_LEN_NO_STORE;
1233extern tsapi int TS_HTTP_LEN_NO_TRANSFORM;
1234extern tsapi int TS_HTTP_LEN_ONLY_IF_CACHED;
1235extern tsapi int TS_HTTP_LEN_PRIVATE;
1236extern tsapi int TS_HTTP_LEN_PROXY_REVALIDATE;
1237extern tsapi int TS_HTTP_LEN_PUBLIC;
1238
1239/* --------------------------------------------------------------------------
1240   HTTP methods */
1241extern tsapi const char *TS_HTTP_METHOD_CONNECT;
1242extern tsapi const char *TS_HTTP_METHOD_DELETE;
1243extern tsapi const char *TS_HTTP_METHOD_GET;
1244extern tsapi const char *TS_HTTP_METHOD_HEAD;
1245extern tsapi const char *TS_HTTP_METHOD_OPTIONS;
1246extern tsapi const char *TS_HTTP_METHOD_POST;
1247extern tsapi const char *TS_HTTP_METHOD_PURGE;
1248extern tsapi const char *TS_HTTP_METHOD_PUT;
1249extern tsapi const char *TS_HTTP_METHOD_TRACE;
1250extern tsapi const char *TS_HTTP_METHOD_PUSH;
1251
1252/* --------------------------------------------------------------------------
1253   HTTP methods string lengths */
1254extern tsapi int TS_HTTP_LEN_CONNECT;
1255extern tsapi int TS_HTTP_LEN_DELETE;
1256extern tsapi int TS_HTTP_LEN_GET;
1257extern tsapi int TS_HTTP_LEN_HEAD;
1258extern tsapi int TS_HTTP_LEN_OPTIONS;
1259extern tsapi int TS_HTTP_LEN_POST;
1260extern tsapi int TS_HTTP_LEN_PURGE;
1261extern tsapi int TS_HTTP_LEN_PUT;
1262extern tsapi int TS_HTTP_LEN_TRACE;
1263extern tsapi int TS_HTTP_LEN_PUSH;
1264
1265/* --------------------------------------------------------------------------
1266   TLS Next Protocol well-known protocol names. */
1267
1268extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_0_9;
1269extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_1_0;
1270extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_1_1;
1271extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_2_0;
1272extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_3;
1273extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_3_D27;
1274extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_QUIC;
1275extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_QUIC_D27;
1276
1277extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_0_9;
1278extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_1_0;
1279extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_1_1;
1280extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_2_0;
1281extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_3;
1282extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_QUIC;
1283
1284extern tsapi const char *const TS_ALPN_PROTOCOL_GROUP_HTTP;
1285extern tsapi const char *const TS_ALPN_PROTOCOL_GROUP_HTTP2;
1286
1287extern tsapi const char *const TS_PROTO_TAG_HTTP_1_0;
1288extern tsapi const char *const TS_PROTO_TAG_HTTP_1_1;
1289extern tsapi const char *const TS_PROTO_TAG_HTTP_2_0;
1290extern tsapi const char *const TS_PROTO_TAG_HTTP_3;
1291extern tsapi const char *const TS_PROTO_TAG_HTTP_QUIC;
1292extern tsapi const char *const TS_PROTO_TAG_TLS_1_3;
1293extern tsapi const char *const TS_PROTO_TAG_TLS_1_2;
1294extern tsapi const char *const TS_PROTO_TAG_TLS_1_1;
1295extern tsapi const char *const TS_PROTO_TAG_TLS_1_0;
1296extern tsapi const char *const TS_PROTO_TAG_TCP;
1297extern tsapi const char *const TS_PROTO_TAG_UDP;
1298extern tsapi const char *const TS_PROTO_TAG_IPV4;
1299extern tsapi const char *const TS_PROTO_TAG_IPV6;
1300
1301/* --------------------------------------------------------------------------
1302   MLoc Constants */
1303/**
1304    Use TS_NULL_MLOC as the parent in calls that require a parent
1305    when an TSMLoc does not have a parent TSMLoc. For example if
1306    the TSMLoc is obtained by a call to TSHttpTxnClientReqGet(),
1307
1308 */
1309#define TS_NULL_MLOC ((TSMLoc)0)
1310
1311/* --------------------------------------------------------------------------
1312   Interface for the UUID APIs. https://www.ietf.org/rfc/rfc4122.txt. */
1313typedef enum {
1314  TS_UUID_UNDEFINED = 0,
1315  TS_UUID_V1        = 1,
1316  TS_UUID_V2,
1317  TS_UUID_V3,
1318  TS_UUID_V4, /* At this point, this is the only implemented version (or variant) */
1319  TS_UUID_V5,
1320} TSUuidVersion;
1321
1322#define TS_UUID_STRING_LEN 36
1323#define TS_CRUUID_STRING_LEN (TS_UUID_STRING_LEN + 19 + 1) /* UUID-len + len(uint64_t) + '-' */
1324typedef struct tsapi_uuid *TSUuid;
1325
1326#ifdef __cplusplus
1327namespace ts
1328{
1329  static const int NO_FD = -1; ///< No or invalid file descriptor.
1330}
1331#endif
1332
1333#ifdef __cplusplus
1334}
1335#endif /* __cplusplus */
1336