xref: /trafficserver/include/ts/apidefs.h.in (revision e9da3e03)
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#ifndef _HTTP_PROXY_API_ENUMS_H_
602#define _HTTP_PROXY_API_ENUMS_H_
603/// Values for per server outbound connection tracking group definition.
604/// See proxy.config.http.per_server.match
605typedef enum {
606  TS_SERVER_OUTBOUND_MATCH_IP,
607  TS_SERVER_OUTBOUND_MATCH_PORT,
608  TS_SERVER_OUTBOUND_MATCH_HOST,
609  TS_SERVER_OUTBOUND_MATCH_BOTH
610} TSOutboundConnectionMatchType;
611#endif
612
613/* librecords types */
614
615/* The values of this enum must match enum RecT in I_RecDefs.h */
616typedef enum {
617  TS_RECORDTYPE_NULL    = 0x00,
618  TS_RECORDTYPE_CONFIG  = 0x01,
619  TS_RECORDTYPE_PROCESS = 0x02,
620  TS_RECORDTYPE_NODE    = 0x04,
621  TS_RECORDTYPE_LOCAL   = 0x10,
622  TS_RECORDTYPE_PLUGIN  = 0x20,
623  TS_RECORDTYPE_ALL     = 0x3F
624} TSRecordType;
625
626/* The values of this enum must match enum RecDataT in I_RecDefs.h */
627typedef enum {
628  TS_RECORDDATATYPE_NULL = 0,
629  TS_RECORDDATATYPE_INT,
630  TS_RECORDDATATYPE_FLOAT,
631  TS_RECORDDATATYPE_STRING,
632  TS_RECORDDATATYPE_COUNTER,
633  TS_RECORDDATATYPE_STAT_CONST,
634  TS_RECORDDATATYPE_STAT_FX,
635  TS_RECORDDATATYPE_MAX
636} TSRecordDataType;
637
638typedef union {
639  int64_t rec_int;
640  float rec_float;
641  char *rec_string;
642  int64_t rec_counter;
643} TSRecordData;
644
645/* The values of this enum must match enum RecPersistT in I_RecDefs.h */
646typedef enum {
647  TS_RECORDP_NULL,
648  TS_RECORDP_PERSISTENT,
649  TS_RECORDP_NON_PERSISTENT,
650} TSRecordPersistType;
651
652/* The values of this enum must match enum RecUpdateT in I_RecDefs.h */
653typedef enum {
654  TS_RECORDUPDATE_NULL,
655  TS_RECORDUPDATE_DYNAMIC,
656  TS_RECORDUPDATE_RESTART_TS,
657  TS_RECORDUPDATE_RESTART_TM,
658} TSRecordUpdateType;
659
660/* The values of this enum must match enum RecCheckT in I_RecDefs.h */
661typedef enum {
662  TS_RECORDCHECK_NULL,
663  TS_RECORDCHECK_STR,
664  TS_RECORDCHECK_INT,
665  TS_RECORDCHECK_IP,
666} TSRecordCheckType;
667
668/* The values of this enum must match enum RecModeT in I_RecDefs.h */
669typedef enum {
670  TS_RECORDMODE_NULL,
671  TS_RECORDMODE_CLIENT,
672  TS_RECORDMODE_SERVER,
673  TS_RECORDMODE_STAND_ALONE,
674} TSRecordModeType;
675
676/* The values of this enum must match enum RecAccessT in I_RecDefs.h */
677typedef enum {
678  TS_RECORDACCESS_NULL,
679  TS_RECORDACCESS_NO_ACCESS,
680  TS_RECORDACCESS_READ_ONLY,
681} TSRecordAccessType;
682
683typedef enum {
684  TS_CONFIG_NULL = -1,
685  TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR,
686  TS_CONFIG_HTTP_CHUNKING_ENABLED,
687  TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED,
688  TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME,
689  TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE,
690  TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN,
691  TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT,
692  TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT,
693  TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH,
694  TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT,
695  TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT,
696  TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT,
697  TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT,
698  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM,
699  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER,
700  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT,
701  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE,
702  TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP,
703  TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP,
704  TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED,
705  TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR,
706  TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS,
707  TS_CONFIG_HTTP_CACHE_HTTP,
708  TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE,
709  TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE,
710  TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE,
711  TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE,
712  TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES,
713  TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION,
714  TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC,
715  TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS,
716  TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR,
717  TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR,
718  TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME,
719  TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME,
720  TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME,
721  TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME,
722  TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE,
723  TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN,
724  TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT,
725  TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN,
726  TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT,
727  TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT,
728  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES,
729  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER,
730  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
731  TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
732  TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
733  TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
734  TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
735  TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
736  TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT,
737  TS_CONFIG_HTTP_RESPONSE_SERVER_STR,
738  TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR,
739  TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD,
740  TS_CONFIG_NET_SOCK_PACKET_MARK_OUT,
741  TS_CONFIG_NET_SOCK_PACKET_TOS_OUT,
742  TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE,
743  TS_CONFIG_HTTP_CHUNKING_SIZE,
744  TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED,
745  TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK,
746  TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK,
747  TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP,
748  TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE,
749  TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK,
750  TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE,
751  TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE,
752  TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED,
753  TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME,
754  TS_CONFIG_SSL_HSTS_MAX_AGE,
755  TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS,
756  TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME,
757  TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES,
758  TS_CONFIG_HTTP_CACHE_RANGE_WRITE,
759  TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED,
760  TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER,
761  TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE,
762  TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD,
763  TS_CONFIG_HTTP_CACHE_GENERATION,
764  TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE,
765  TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION,
766  TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS,
767  TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES,
768  TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY,
769  TS_CONFIG_HTTP_ATTACH_SERVER_SESSION_TO_CLIENT,
770  TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT,
771  TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT,
772  TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT,
773  TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS,
774  TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN,
775  TS_CONFIG_SRV_ENABLED,
776  TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD,
777  TS_CONFIG_SSL_CERT_FILENAME,
778  TS_CONFIG_SSL_CLIENT_CERT_FILENAME = TS_CONFIG_SSL_CERT_FILENAME,
779  TS_CONFIG_SSL_CERT_FILEPATH,
780  TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB,
781  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_MISMATCH,
782  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_LANGUAGE_MISMATCH,
783  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_ENCODING_MISMATCH,
784  TS_CONFIG_HTTP_CACHE_IGNORE_ACCEPT_CHARSET_MISMATCH,
785  TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD,
786  TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME,
787  TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS,
788  TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT,
789  TS_CONFIG_HTTP_NORMALIZE_AE,
790  TS_CONFIG_HTTP_INSERT_FORWARDED,
791  TS_CONFIG_HTTP_ALLOW_MULTI_RANGE,
792  TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED,
793  TS_CONFIG_HTTP_ALLOW_HALF_OPEN,
794  TS_CONFIG_HTTP_SERVER_MIN_KEEP_ALIVE_CONNS,
795  TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MAX,
796  TS_CONFIG_HTTP_PER_SERVER_CONNECTION_MATCH,
797  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER,
798  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_POLICY,
799  TS_CONFIG_SSL_CLIENT_VERIFY_SERVER_PROPERTIES,
800  TS_CONFIG_SSL_CLIENT_SNI_POLICY,
801  TS_CONFIG_SSL_CLIENT_PRIVATE_KEY_FILENAME,
802  TS_CONFIG_SSL_CLIENT_CA_CERT_FILENAME,
803  TS_CONFIG_HTTP_HOST_RESOLUTION_PREFERENCE,
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
876typedef struct tsapi_file *TSFile;
877
878typedef struct tsapi_mloc *TSMLoc;
879typedef struct tsapi_mbuffer *TSMBuffer;
880typedef struct tsapi_httpssn *TSHttpSsn;
881typedef struct tsapi_httptxn *TSHttpTxn;
882typedef struct tsapi_ssl_obj *TSSslConnection;
883typedef struct tsapi_ssl_session *TSSslSession;
884typedef struct tsapi_httpaltinfo *TSHttpAltInfo;
885typedef struct tsapi_mimeparser *TSMimeParser;
886typedef struct tsapi_httpparser *TSHttpParser;
887typedef struct tsapi_cachekey *TSCacheKey;
888typedef struct tsapi_cachehttpinfo *TSCacheHttpInfo;
889typedef struct tsapi_cachetxn *TSCacheTxn;
890typedef struct tsapi_x509_store_ctx *TSSslVerifyCTX;
891
892typedef struct tsapi_port *TSPortDescriptor;
893typedef struct tsapi_vio *TSVIO;
894typedef struct tsapi_thread *TSThread;
895typedef struct tsapi_event_thread *TSEventThread;
896typedef struct tsapi_x509 *TSSslX509;
897typedef struct tsapi_mutex *TSMutex;
898typedef struct tsapi_config *TSConfig;
899typedef struct tsapi_cont *TSCont;
900typedef struct tsapi_cont *TSVConn; /* a VConn is really a specialized TSCont */
901typedef struct tsapi_ssl_context *TSSslContext;
902typedef struct tsapi_action *TSAction;
903typedef struct tsapi_iobuffer *TSIOBuffer;
904typedef struct tsapi_iobufferdata *TSIOBufferData;
905typedef struct tsapi_bufferblock *TSIOBufferBlock;
906typedef struct tsapi_bufferreader *TSIOBufferReader;
907typedef struct tsapi_hostlookupresult *TSHostLookupResult;
908typedef struct tsapi_aiocallback *TSAIOCallback;
909typedef struct tsapi_net_accept *TSAcceptor;
910
911typedef struct tsapi_fetchsm *TSFetchSM;
912
913typedef void *(*TSThreadFunc)(void *data);
914typedef int (*TSEventFunc)(TSCont contp, TSEvent event, void *edata);
915typedef void (*TSConfigDestroyFunc)(void *data);
916
917typedef struct {
918  int success_event_id;
919  int failure_event_id;
920  int timeout_event_id;
921} TSFetchEvent;
922
923typedef struct TSFetchUrlParams {
924  const char *request;
925  int request_len;
926  struct sockaddr_storage ip;
927  int port;
928  TSCont contp;
929  TSFetchEvent events;
930  TSFetchWakeUpOptions options;
931  struct TSFetchUrlParams *next;
932} TSFetchUrlParams_t;
933
934// This is a duplicate of the SSL_MAX_SSL_SESSION_ID_LENGTH constant
935// Redefining here so we don't include the openssl/ssl.h file here
936#define TS_SSL_MAX_SSL_SESSION_ID_LENGTH 32
937
938// This mirrors the internal data structure SSLSessionID
939typedef struct TSSslSessionID_s {
940  size_t len;
941  char bytes[TS_SSL_MAX_SSL_SESSION_ID_LENGTH];
942} TSSslSessionID;
943
944/* --------------------------------------------------------------------------
945   Init */
946
947/**
948    This function must be defined by all plugins. Traffic Server
949    calls this initialization routine when it loads the plugin (at
950    startup), and sets argc and argv appropriately based on the values
951    in plugin.config.
952
953    @param argc the number of initial values specified in plugin.config,
954      plus one. If only the name of your plugin shared object is
955      specified in plugin.config, argc=1.
956    @param argv the vector of arguments. The length of argv is argc.
957      argv[0] is the name of the plugin shared library. Subsequent
958      values of argv are initialization values specified in
959      plugin.config.
960
961 */
962extern tsapi void TSPluginInit(int argc, const char *argv[]);
963
964/* --------------------------------------------------------------------------
965   URL schemes */
966extern tsapi const char *TS_URL_SCHEME_FILE;
967extern tsapi const char *TS_URL_SCHEME_FTP;
968extern tsapi const char *TS_URL_SCHEME_GOPHER;
969extern tsapi const char *TS_URL_SCHEME_HTTP;
970extern tsapi const char *TS_URL_SCHEME_HTTPS;
971extern tsapi const char *TS_URL_SCHEME_MAILTO;
972extern tsapi const char *TS_URL_SCHEME_NEWS;
973extern tsapi const char *TS_URL_SCHEME_NNTP;
974extern tsapi const char *TS_URL_SCHEME_PROSPERO;
975extern tsapi const char *TS_URL_SCHEME_TELNET;
976extern tsapi const char *TS_URL_SCHEME_TUNNEL;
977extern tsapi const char *TS_URL_SCHEME_WAIS;
978extern tsapi const char *TS_URL_SCHEME_PNM;
979extern tsapi const char *TS_URL_SCHEME_RTSP;
980extern tsapi const char *TS_URL_SCHEME_RTSPU;
981extern tsapi const char *TS_URL_SCHEME_MMS;
982extern tsapi const char *TS_URL_SCHEME_MMSU;
983extern tsapi const char *TS_URL_SCHEME_MMST;
984extern tsapi const char *TS_URL_SCHEME_WS;
985extern tsapi const char *TS_URL_SCHEME_WSS;
986
987/* --------------------------------------------------------------------------
988   URL scheme string lengths */
989extern tsapi int TS_URL_LEN_FILE;
990extern tsapi int TS_URL_LEN_FTP;
991extern tsapi int TS_URL_LEN_GOPHER;
992extern tsapi int TS_URL_LEN_HTTP;
993extern tsapi int TS_URL_LEN_HTTPS;
994extern tsapi int TS_URL_LEN_MAILTO;
995extern tsapi int TS_URL_LEN_NEWS;
996extern tsapi int TS_URL_LEN_NNTP;
997extern tsapi int TS_URL_LEN_PROSPERO;
998extern tsapi int TS_URL_LEN_TELNET;
999extern tsapi int TS_URL_LEN_WAIS;
1000extern tsapi int TS_URL_LEN_WS;
1001extern tsapi int TS_URL_LEN_WSS;
1002
1003/* --------------------------------------------------------------------------
1004   MIME fields */
1005extern tsapi const char *TS_MIME_FIELD_ACCEPT;
1006extern tsapi const char *TS_MIME_FIELD_ACCEPT_CHARSET;
1007extern tsapi const char *TS_MIME_FIELD_ACCEPT_ENCODING;
1008extern tsapi const char *TS_MIME_FIELD_ACCEPT_LANGUAGE;
1009extern tsapi const char *TS_MIME_FIELD_ACCEPT_RANGES;
1010extern tsapi const char *TS_MIME_FIELD_AGE;
1011extern tsapi const char *TS_MIME_FIELD_ALLOW;
1012extern tsapi const char *TS_MIME_FIELD_APPROVED;
1013extern tsapi const char *TS_MIME_FIELD_AUTHORIZATION;
1014extern tsapi const char *TS_MIME_FIELD_BYTES;
1015extern tsapi const char *TS_MIME_FIELD_CACHE_CONTROL;
1016extern tsapi const char *TS_MIME_FIELD_CLIENT_IP;
1017extern tsapi const char *TS_MIME_FIELD_CONNECTION;
1018extern tsapi const char *TS_MIME_FIELD_CONTENT_BASE;
1019extern tsapi const char *TS_MIME_FIELD_CONTENT_ENCODING;
1020extern tsapi const char *TS_MIME_FIELD_CONTENT_LANGUAGE;
1021extern tsapi const char *TS_MIME_FIELD_CONTENT_LENGTH;
1022extern tsapi const char *TS_MIME_FIELD_CONTENT_LOCATION;
1023extern tsapi const char *TS_MIME_FIELD_CONTENT_MD5;
1024extern tsapi const char *TS_MIME_FIELD_CONTENT_RANGE;
1025extern tsapi const char *TS_MIME_FIELD_CONTENT_TYPE;
1026extern tsapi const char *TS_MIME_FIELD_CONTROL;
1027extern tsapi const char *TS_MIME_FIELD_COOKIE;
1028extern tsapi const char *TS_MIME_FIELD_DATE;
1029extern tsapi const char *TS_MIME_FIELD_DISTRIBUTION;
1030extern tsapi const char *TS_MIME_FIELD_ETAG;
1031extern tsapi const char *TS_MIME_FIELD_EXPECT;
1032extern tsapi const char *TS_MIME_FIELD_EXPIRES;
1033extern tsapi const char *TS_MIME_FIELD_FOLLOWUP_TO;
1034extern tsapi const char *TS_MIME_FIELD_FROM;
1035extern tsapi const char *TS_MIME_FIELD_HOST;
1036extern tsapi const char *TS_MIME_FIELD_IF_MATCH;
1037extern tsapi const char *TS_MIME_FIELD_IF_MODIFIED_SINCE;
1038extern tsapi const char *TS_MIME_FIELD_IF_NONE_MATCH;
1039extern tsapi const char *TS_MIME_FIELD_IF_RANGE;
1040extern tsapi const char *TS_MIME_FIELD_IF_UNMODIFIED_SINCE;
1041extern tsapi const char *TS_MIME_FIELD_KEEP_ALIVE;
1042extern tsapi const char *TS_MIME_FIELD_KEYWORDS;
1043extern tsapi const char *TS_MIME_FIELD_LAST_MODIFIED;
1044extern tsapi const char *TS_MIME_FIELD_LINES;
1045extern tsapi const char *TS_MIME_FIELD_LOCATION;
1046extern tsapi const char *TS_MIME_FIELD_MAX_FORWARDS;
1047extern tsapi const char *TS_MIME_FIELD_MESSAGE_ID;
1048extern tsapi const char *TS_MIME_FIELD_NEWSGROUPS;
1049extern tsapi const char *TS_MIME_FIELD_ORGANIZATION;
1050extern tsapi const char *TS_MIME_FIELD_PATH;
1051extern tsapi const char *TS_MIME_FIELD_PRAGMA;
1052extern tsapi const char *TS_MIME_FIELD_PROXY_AUTHENTICATE;
1053extern tsapi const char *TS_MIME_FIELD_PROXY_AUTHORIZATION;
1054extern tsapi const char *TS_MIME_FIELD_PROXY_CONNECTION;
1055extern tsapi const char *TS_MIME_FIELD_PUBLIC;
1056extern tsapi const char *TS_MIME_FIELD_RANGE;
1057extern tsapi const char *TS_MIME_FIELD_REFERENCES;
1058extern tsapi const char *TS_MIME_FIELD_REFERER;
1059extern tsapi const char *TS_MIME_FIELD_REPLY_TO;
1060extern tsapi const char *TS_MIME_FIELD_RETRY_AFTER;
1061extern tsapi const char *TS_MIME_FIELD_SENDER;
1062extern tsapi const char *TS_MIME_FIELD_SERVER;
1063extern tsapi const char *TS_MIME_FIELD_SET_COOKIE;
1064extern tsapi const char *TS_MIME_FIELD_STRICT_TRANSPORT_SECURITY;
1065extern tsapi const char *TS_MIME_FIELD_SUBJECT;
1066extern tsapi const char *TS_MIME_FIELD_SUMMARY;
1067extern tsapi const char *TS_MIME_FIELD_TE;
1068extern tsapi const char *TS_MIME_FIELD_TRANSFER_ENCODING;
1069extern tsapi const char *TS_MIME_FIELD_UPGRADE;
1070extern tsapi const char *TS_MIME_FIELD_USER_AGENT;
1071extern tsapi const char *TS_MIME_FIELD_VARY;
1072extern tsapi const char *TS_MIME_FIELD_VIA;
1073extern tsapi const char *TS_MIME_FIELD_WARNING;
1074extern tsapi const char *TS_MIME_FIELD_WWW_AUTHENTICATE;
1075extern tsapi const char *TS_MIME_FIELD_XREF;
1076extern tsapi const char *TS_MIME_FIELD_X_FORWARDED_FOR;
1077extern tsapi const char *TS_MIME_FIELD_FORWARDED;
1078
1079/* --------------------------------------------------------------------------
1080   MIME fields string lengths */
1081extern tsapi int TS_MIME_LEN_ACCEPT;
1082extern tsapi int TS_MIME_LEN_ACCEPT_CHARSET;
1083extern tsapi int TS_MIME_LEN_ACCEPT_ENCODING;
1084extern tsapi int TS_MIME_LEN_ACCEPT_LANGUAGE;
1085extern tsapi int TS_MIME_LEN_ACCEPT_RANGES;
1086extern tsapi int TS_MIME_LEN_AGE;
1087extern tsapi int TS_MIME_LEN_ALLOW;
1088extern tsapi int TS_MIME_LEN_APPROVED;
1089extern tsapi int TS_MIME_LEN_AUTHORIZATION;
1090extern tsapi int TS_MIME_LEN_BYTES;
1091extern tsapi int TS_MIME_LEN_CACHE_CONTROL;
1092extern tsapi int TS_MIME_LEN_CLIENT_IP;
1093extern tsapi int TS_MIME_LEN_CONNECTION;
1094extern tsapi int TS_MIME_LEN_CONTENT_BASE;
1095extern tsapi int TS_MIME_LEN_CONTENT_ENCODING;
1096extern tsapi int TS_MIME_LEN_CONTENT_LANGUAGE;
1097extern tsapi int TS_MIME_LEN_CONTENT_LENGTH;
1098extern tsapi int TS_MIME_LEN_CONTENT_LOCATION;
1099extern tsapi int TS_MIME_LEN_CONTENT_MD5;
1100extern tsapi int TS_MIME_LEN_CONTENT_RANGE;
1101extern tsapi int TS_MIME_LEN_CONTENT_TYPE;
1102extern tsapi int TS_MIME_LEN_CONTROL;
1103extern tsapi int TS_MIME_LEN_COOKIE;
1104extern tsapi int TS_MIME_LEN_DATE;
1105extern tsapi int TS_MIME_LEN_DISTRIBUTION;
1106extern tsapi int TS_MIME_LEN_ETAG;
1107extern tsapi int TS_MIME_LEN_EXPECT;
1108extern tsapi int TS_MIME_LEN_EXPIRES;
1109extern tsapi int TS_MIME_LEN_FOLLOWUP_TO;
1110extern tsapi int TS_MIME_LEN_FROM;
1111extern tsapi int TS_MIME_LEN_HOST;
1112extern tsapi int TS_MIME_LEN_IF_MATCH;
1113extern tsapi int TS_MIME_LEN_IF_MODIFIED_SINCE;
1114extern tsapi int TS_MIME_LEN_IF_NONE_MATCH;
1115extern tsapi int TS_MIME_LEN_IF_RANGE;
1116extern tsapi int TS_MIME_LEN_IF_UNMODIFIED_SINCE;
1117extern tsapi int TS_MIME_LEN_KEEP_ALIVE;
1118extern tsapi int TS_MIME_LEN_KEYWORDS;
1119extern tsapi int TS_MIME_LEN_LAST_MODIFIED;
1120extern tsapi int TS_MIME_LEN_LINES;
1121extern tsapi int TS_MIME_LEN_LOCATION;
1122extern tsapi int TS_MIME_LEN_MAX_FORWARDS;
1123extern tsapi int TS_MIME_LEN_MESSAGE_ID;
1124extern tsapi int TS_MIME_LEN_NEWSGROUPS;
1125extern tsapi int TS_MIME_LEN_ORGANIZATION;
1126extern tsapi int TS_MIME_LEN_PATH;
1127extern tsapi int TS_MIME_LEN_PRAGMA;
1128extern tsapi int TS_MIME_LEN_PROXY_AUTHENTICATE;
1129extern tsapi int TS_MIME_LEN_PROXY_AUTHORIZATION;
1130extern tsapi int TS_MIME_LEN_PROXY_CONNECTION;
1131extern tsapi int TS_MIME_LEN_PUBLIC;
1132extern tsapi int TS_MIME_LEN_RANGE;
1133extern tsapi int TS_MIME_LEN_REFERENCES;
1134extern tsapi int TS_MIME_LEN_REFERER;
1135extern tsapi int TS_MIME_LEN_REPLY_TO;
1136extern tsapi int TS_MIME_LEN_RETRY_AFTER;
1137extern tsapi int TS_MIME_LEN_SENDER;
1138extern tsapi int TS_MIME_LEN_SERVER;
1139extern tsapi int TS_MIME_LEN_SET_COOKIE;
1140extern tsapi int TS_MIME_LEN_STRICT_TRANSPORT_SECURITY;
1141extern tsapi int TS_MIME_LEN_SUBJECT;
1142extern tsapi int TS_MIME_LEN_SUMMARY;
1143extern tsapi int TS_MIME_LEN_TE;
1144extern tsapi int TS_MIME_LEN_TRANSFER_ENCODING;
1145extern tsapi int TS_MIME_LEN_UPGRADE;
1146extern tsapi int TS_MIME_LEN_USER_AGENT;
1147extern tsapi int TS_MIME_LEN_VARY;
1148extern tsapi int TS_MIME_LEN_VIA;
1149extern tsapi int TS_MIME_LEN_WARNING;
1150extern tsapi int TS_MIME_LEN_WWW_AUTHENTICATE;
1151extern tsapi int TS_MIME_LEN_XREF;
1152extern tsapi int TS_MIME_LEN_X_FORWARDED_FOR;
1153extern tsapi int TS_MIME_LEN_FORWARDED;
1154
1155/* --------------------------------------------------------------------------
1156   HTTP values */
1157extern tsapi const char *TS_HTTP_VALUE_BYTES;
1158extern tsapi const char *TS_HTTP_VALUE_CHUNKED;
1159extern tsapi const char *TS_HTTP_VALUE_CLOSE;
1160extern tsapi const char *TS_HTTP_VALUE_COMPRESS;
1161extern tsapi const char *TS_HTTP_VALUE_DEFLATE;
1162extern tsapi const char *TS_HTTP_VALUE_GZIP;
1163extern tsapi const char *TS_HTTP_VALUE_IDENTITY;
1164extern tsapi const char *TS_HTTP_VALUE_KEEP_ALIVE;
1165extern tsapi const char *TS_HTTP_VALUE_MAX_AGE;
1166extern tsapi const char *TS_HTTP_VALUE_MAX_STALE;
1167extern tsapi const char *TS_HTTP_VALUE_MIN_FRESH;
1168extern tsapi const char *TS_HTTP_VALUE_MUST_REVALIDATE;
1169extern tsapi const char *TS_HTTP_VALUE_NONE;
1170extern tsapi const char *TS_HTTP_VALUE_NO_CACHE;
1171extern tsapi const char *TS_HTTP_VALUE_NO_STORE;
1172extern tsapi const char *TS_HTTP_VALUE_NO_TRANSFORM;
1173extern tsapi const char *TS_HTTP_VALUE_ONLY_IF_CACHED;
1174extern tsapi const char *TS_HTTP_VALUE_PRIVATE;
1175extern tsapi const char *TS_HTTP_VALUE_PROXY_REVALIDATE;
1176extern tsapi const char *TS_HTTP_VALUE_PUBLIC;
1177
1178/* --------------------------------------------------------------------------
1179   HTTP values string lengths */
1180extern tsapi int TS_HTTP_LEN_BYTES;
1181extern tsapi int TS_HTTP_LEN_CHUNKED;
1182extern tsapi int TS_HTTP_LEN_CLOSE;
1183extern tsapi int TS_HTTP_LEN_COMPRESS;
1184extern tsapi int TS_HTTP_LEN_DEFLATE;
1185extern tsapi int TS_HTTP_LEN_GZIP;
1186extern tsapi int TS_HTTP_LEN_IDENTITY;
1187extern tsapi int TS_HTTP_LEN_KEEP_ALIVE;
1188extern tsapi int TS_HTTP_LEN_MAX_AGE;
1189extern tsapi int TS_HTTP_LEN_MAX_STALE;
1190extern tsapi int TS_HTTP_LEN_MIN_FRESH;
1191extern tsapi int TS_HTTP_LEN_MUST_REVALIDATE;
1192extern tsapi int TS_HTTP_LEN_NONE;
1193extern tsapi int TS_HTTP_LEN_NO_CACHE;
1194extern tsapi int TS_HTTP_LEN_NO_STORE;
1195extern tsapi int TS_HTTP_LEN_NO_TRANSFORM;
1196extern tsapi int TS_HTTP_LEN_ONLY_IF_CACHED;
1197extern tsapi int TS_HTTP_LEN_PRIVATE;
1198extern tsapi int TS_HTTP_LEN_PROXY_REVALIDATE;
1199extern tsapi int TS_HTTP_LEN_PUBLIC;
1200
1201/* --------------------------------------------------------------------------
1202   HTTP methods */
1203extern tsapi const char *TS_HTTP_METHOD_CONNECT;
1204extern tsapi const char *TS_HTTP_METHOD_DELETE;
1205extern tsapi const char *TS_HTTP_METHOD_GET;
1206extern tsapi const char *TS_HTTP_METHOD_HEAD;
1207extern tsapi const char *TS_HTTP_METHOD_OPTIONS;
1208extern tsapi const char *TS_HTTP_METHOD_POST;
1209extern tsapi const char *TS_HTTP_METHOD_PURGE;
1210extern tsapi const char *TS_HTTP_METHOD_PUT;
1211extern tsapi const char *TS_HTTP_METHOD_TRACE;
1212extern tsapi const char *TS_HTTP_METHOD_PUSH;
1213
1214/* --------------------------------------------------------------------------
1215   HTTP methods string lengths */
1216extern tsapi int TS_HTTP_LEN_CONNECT;
1217extern tsapi int TS_HTTP_LEN_DELETE;
1218extern tsapi int TS_HTTP_LEN_GET;
1219extern tsapi int TS_HTTP_LEN_HEAD;
1220extern tsapi int TS_HTTP_LEN_OPTIONS;
1221extern tsapi int TS_HTTP_LEN_POST;
1222extern tsapi int TS_HTTP_LEN_PURGE;
1223extern tsapi int TS_HTTP_LEN_PUT;
1224extern tsapi int TS_HTTP_LEN_TRACE;
1225extern tsapi int TS_HTTP_LEN_PUSH;
1226
1227/* --------------------------------------------------------------------------
1228   TLS Next Protocol well-known protocol names. */
1229
1230extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_0_9;
1231extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_1_0;
1232extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_1_1;
1233extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_2_0;
1234extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_3;
1235extern tsapi const char *const TS_ALPN_PROTOCOL_HTTP_QUIC;
1236
1237extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_0_9;
1238extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_1_0;
1239extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_1_1;
1240extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_2_0;
1241extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_3;
1242extern tsapi int TS_ALPN_PROTOCOL_INDEX_HTTP_QUIC;
1243
1244extern tsapi const char *const TS_ALPN_PROTOCOL_GROUP_HTTP;
1245extern tsapi const char *const TS_ALPN_PROTOCOL_GROUP_HTTP2;
1246
1247extern tsapi const char *const TS_PROTO_TAG_HTTP_1_0;
1248extern tsapi const char *const TS_PROTO_TAG_HTTP_1_1;
1249extern tsapi const char *const TS_PROTO_TAG_HTTP_2_0;
1250extern tsapi const char *const TS_PROTO_TAG_HTTP_3;
1251extern tsapi const char *const TS_PROTO_TAG_HTTP_QUIC;
1252extern tsapi const char *const TS_PROTO_TAG_TLS_1_3;
1253extern tsapi const char *const TS_PROTO_TAG_TLS_1_2;
1254extern tsapi const char *const TS_PROTO_TAG_TLS_1_1;
1255extern tsapi const char *const TS_PROTO_TAG_TLS_1_0;
1256extern tsapi const char *const TS_PROTO_TAG_TCP;
1257extern tsapi const char *const TS_PROTO_TAG_UDP;
1258extern tsapi const char *const TS_PROTO_TAG_IPV4;
1259extern tsapi const char *const TS_PROTO_TAG_IPV6;
1260
1261/* --------------------------------------------------------------------------
1262   MLoc Constants */
1263/**
1264    Use TS_NULL_MLOC as the parent in calls that require a parent
1265    when an TSMLoc does not have a parent TSMLoc. For example if
1266    the TSMLoc is obtained by a call to TSHttpTxnClientReqGet(),
1267
1268 */
1269#define TS_NULL_MLOC ((TSMLoc)0)
1270
1271/* --------------------------------------------------------------------------
1272   Interface for the UUID APIs. https://www.ietf.org/rfc/rfc4122.txt. */
1273typedef enum {
1274  TS_UUID_UNDEFINED = 0,
1275  TS_UUID_V1        = 1,
1276  TS_UUID_V2,
1277  TS_UUID_V3,
1278  TS_UUID_V4, /* At this point, this is the only implemented version (or variant) */
1279  TS_UUID_V5,
1280} TSUuidVersion;
1281
1282#define TS_UUID_STRING_LEN 36
1283#define TS_CRUUID_STRING_LEN (TS_UUID_STRING_LEN + 19 + 1) /* UUID-len + len(uint64_t) + '-' */
1284typedef struct tsapi_uuid *TSUuid;
1285
1286#ifdef __cplusplus
1287namespace ts
1288{
1289  static const int NO_FD = -1; ///< No or invalid file descriptor.
1290}
1291#endif
1292
1293#ifdef __cplusplus
1294}
1295#endif /* __cplusplus */
1296