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