1 /** @file
2 
3   Definitions for internal management API.
4 
5   Purpose: This file contains all API wrapper functions in one class. In
6   order to eliminate the interdependencies of other library calls, new
7   types and structs will be defined and used in the wrapper function calls.
8 
9   @section license License
10 
11   Licensed to the Apache Software Foundation (ASF) under one
12   or more contributor license agreements.  See the NOTICE file
13   distributed with this work for additional information
14   regarding copyright ownership.  The ASF licenses this file
15   to you under the Apache License, Version 2.0 (the
16   "License"); you may not use this file except in compliance
17   with the License.  You may obtain a copy of the License at
18 
19       http://www.apache.org/licenses/LICENSE-2.0
20 
21   Unless required by applicable law or agreed to in writing, software
22   distributed under the License is distributed on an "AS IS" BASIS,
23   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24   See the License for the specific language governing permissions and
25   limitations under the License.
26  */
27 
28 #pragma once
29 
30 #include <cstdint>
31 #include <cstddef>
32 
33 /***************************************************************************
34  * System Specific Items
35  ***************************************************************************/
36 
37 #define tsapi
38 #define inkexp
39 #define inkimp
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
44 
45 #ifndef TS_RES_MEM_PATH
46 #define __TS_RES_PATH(x) #x
47 #define _TS_RES_PATH(x) __TS_RES_PATH(x)
48 #define TS_RES_PATH(x) x __FILE__ ":" _TS_RES_PATH(__LINE__)
49 #define TS_RES_MEM_PATH TS_RES_PATH("memory/")
50 #endif
51 
52 #define TM_OPT_BIND_STDOUT "bind_stdout"
53 #define TM_OPT_BIND_STDERR "bind_stderr"
54 
55 /***************************************************************************
56  * Error and Return Values
57  ***************************************************************************/
58 
59 typedef enum {
60   TS_ERR_OKAY = 0,
61 
62   TS_ERR_READ_FILE,           /* Error occur in reading file */
63   TS_ERR_WRITE_FILE,          /* Error occur in writing file */
64   TS_ERR_PARSE_CONFIG_RULE,   /* Error in parsing configuration file */
65   TS_ERR_INVALID_CONFIG_RULE, /* Invalid Configuration Rule */
66 
67   TS_ERR_NET_ESTABLISH, /* Problem in establishing a TCP socket */
68   TS_ERR_NET_READ,      /* Problem reading from socket */
69   TS_ERR_NET_WRITE,     /* Problem writing to socket */
70   TS_ERR_NET_EOF,       /* Hit socket EOF */
71   TS_ERR_NET_TIMEOUT,   /* Timed out while waiting for socket read */
72 
73   TS_ERR_SYS_CALL, /* Error in basic system call, eg. malloc */
74   TS_ERR_PARAMS,   /* Invalid parameters for a fn */
75 
76   TS_ERR_NOT_SUPPORTED,     /* Operation not supported */
77   TS_ERR_PERMISSION_DENIED, /* Operation not permitted */
78 
79   TS_ERR_FAIL
80 } TSMgmtError;
81 
82 /***************************************************************************
83  * Types
84  ***************************************************************************/
85 
86 typedef int64_t TSInt;
87 typedef int64_t TSCounter;
88 typedef float TSFloat;
89 typedef bool TSBool;
90 typedef char *TSString;
91 typedef char *TSIpAddr;
92 
93 typedef void *TSHandle;
94 typedef TSHandle TSList;
95 typedef TSHandle TSStringList; /* contains char* 's         */
96 typedef TSHandle TSIntList;    /* contains int* 's          */
97 
98 /*--- basic control operations --------------------------------------------*/
99 
100 typedef enum {
101   TS_ACTION_SHUTDOWN,    /* change requires user to stop then start the Traffic Server and Manager */
102   TS_ACTION_RESTART,     /* change requires restart Traffic Server and Traffic Manager */
103   TS_ACTION_DYNAMIC,     /* change is already made in function call */
104   TS_ACTION_RECONFIGURE, /* change requires TS to reread configuration files */
105   TS_ACTION_UNDEFINED
106 } TSActionNeedT;
107 
108 typedef enum {
109   TS_PROXY_ON,
110   TS_PROXY_OFF,
111   TS_PROXY_UNDEFINED,
112 } TSProxyStateT;
113 
114 /* used when starting Traffic Server process */
115 typedef enum {
116   TS_CACHE_CLEAR_NONE   = 0,        /* starts TS in regular mode w/o any options */
117   TS_CACHE_CLEAR_CACHE  = (1 << 0), /* run TS in  "clear cache" mode */
118   TS_CACHE_CLEAR_HOSTDB = (1 << 1), /* run TS in "clear the host db cache" mode */
119 } TSCacheClearT;
120 
121 /*--- event operations ----------------------------------------------------*/
122 typedef enum {
123   TS_EVENT_PRIORITY_WARNING,
124   TS_EVENT_PRIORITY_ERROR,
125   TS_EVENT_PRIORITY_FATAL,
126   TS_EVENT_PRIORITY_UNDEFINED
127 } TSEventPriorityT;
128 
129 typedef enum {
130   TS_REC_INT,
131   TS_REC_COUNTER,
132   TS_REC_FLOAT,
133   TS_REC_STRING,
134   TS_REC_UNDEFINED,
135 } TSRecordT;
136 
137 /* These are initialization options for the Init() function. */
138 typedef enum {
139   TS_MGMT_OPT_DEFAULTS = 0,
140   TS_MGMT_OPT_NO_EVENTS,    /* No event callbacks and threads */
141   TS_MGMT_OPT_NO_SOCK_TESTS /* No socket test thread */
142 } TSInitOptionT;
143 
144 typedef enum {
145   TS_RESTART_OPT_NONE  = 0x0,
146   TS_RESTART_OPT_DRAIN = 0x02, /* Wait for traffic to drain before restarting. */
147 } TSRestartOptionT;
148 
149 typedef enum {
150   TS_STOP_OPT_NONE = 0x0,
151   TS_STOP_OPT_DRAIN, /* Wait for traffic to drain before stopping. */
152 } TSStopOptionT;
153 
154 typedef enum {
155   TS_DRAIN_OPT_NONE = 0x0,
156   TS_DRAIN_OPT_IDLE, /* Wait for idle from new connections before draining. */
157   TS_DRAIN_OPT_UNDO, /* Recover TS from drain mode */
158 } TSDrainOptionT;
159 
160 /***************************************************************************
161  * Structures
162  ***************************************************************************/
163 
164 /*--- records -------------------------------------------------------------*/
165 typedef union { /* record value */
166   TSInt int_val;
167   TSCounter counter_val;
168   TSFloat float_val;
169   TSString string_val;
170 } TSRecordValueT;
171 
172 typedef struct {
173   char *rec_name;        /* record name */
174   TSInt rec_class;       /* record class (RecT) */
175   TSRecordT rec_type;    /* record type {TS_REC_INT...} */
176   TSRecordValueT valueT; /* record value */
177 } TSRecordEle;
178 
179 typedef struct {
180   /* Common RecRecord fields ... */
181   char *rec_name;
182   TSRecordValueT rec_value;
183   TSRecordValueT rec_default;
184   TSRecordT rec_type; /* data type (RecDataT) */
185   TSInt rec_class;    /* data class (RecT) */
186   TSInt rec_version;
187   TSInt rec_rsb; /* Raw Stat Block ID */
188   TSInt rec_order;
189 
190   /* RecConfigMeta fields ... */
191   TSInt rec_access;     /* access rights (RecAccessT) */
192   TSInt rec_update;     /* update_required bitmask */
193   TSInt rec_updatetype; /* update type (RecUpdateT) */
194   TSInt rec_checktype;  /* syntax check type (RecCheckT) */
195   TSInt rec_source;     /* source of data */
196   char *rec_checkexpr;  /* syntax check expression */
197 } TSConfigRecordDescription;
198 
199 /* Free (the contents of) a TSConfigRecordDescription */
200 tsapi void TSConfigRecordDescriptionFree(TSConfigRecordDescription *val);
201 
202 /* Heap-allocate a TSConfigRecordDescription. */
203 tsapi TSConfigRecordDescription *TSConfigRecordDescriptionCreate(void);
204 /* Free and destroy a heap-allocated TSConfigRecordDescription. */
205 tsapi void TSConfigRecordDescriptionDestroy(TSConfigRecordDescription *);
206 
207 /*--- events --------------------------------------------------------------*/
208 
209 /* Note: Each event has a format String associated with it from which the
210  *       description is constructed when an event is signalled. This format
211  *       string though can be retrieved from the event-mapping table which
212  *       is stored both locally and remotely.
213  */
214 
215 typedef struct {
216   int id;
217   char *name;                /* pre-set, immutable for PREDEFINED events */
218   char *description;         /* predefined events have default */
219   TSEventPriorityT priority; /* WARNING, ERROR, FATAL */
220 } TSMgmtEvent;
221 
222 /***************************************************************************
223  * Function Types
224  ***************************************************************************/
225 typedef void (*TSEventSignalFunc)(char *name, char *msg, int pri, void *data);
226 typedef void (*TSDisconnectFunc)(void *data);
227 
228 /***************************************************************************
229  * API Memory Management
230  ***************************************************************************/
231 #define TSmalloc(s) _TSmalloc((s), TS_RES_MEM_PATH)
232 #define TSrealloc(p, s) _TSrealloc((p), (s), TS_RES_MEM_PATH)
233 #define TSstrdup(p) _TSstrdup((p), -1, TS_RES_MEM_PATH)
234 #define TSstrndup(p, n) _TSstrdup((p), (n), TS_RES_MEM_PATH)
235 #define TSfree(p) _TSfree(p)
236 
237 tsapi void *_TSmalloc(unsigned int size, const char *path);
238 tsapi void *_TSrealloc(void *ptr, unsigned int size, const char *path);
239 tsapi char *_TSstrdup(const char *str, int length, const char *path);
240 tsapi void _TSfree(void *ptr);
241 
242 /***************************************************************************
243  * API Helper Functions for Data Carrier Structures
244  ***************************************************************************/
245 
246 /*--- TSList operations --------------------------------------------------*/
247 tsapi TSList TSListCreate();
248 tsapi void TSListDestroy(TSList l); /* list must be empty */
249 tsapi TSMgmtError TSListEnqueue(TSList l, void *data);
250 tsapi void *TSListDequeue(TSList l);
251 tsapi bool TSListIsEmpty(TSList l);
252 tsapi int TSListLen(TSList l); /* returns -1 if list is invalid */
253 tsapi bool TSListIsValid(TSList l);
254 
255 /*--- TSStringList operations --------------------------------------------*/
256 tsapi TSStringList TSStringListCreate();
257 tsapi void TSStringListDestroy(TSStringList strl);
258 tsapi TSMgmtError TSStringListEnqueue(TSStringList strl, char *str);
259 tsapi char *TSStringListDequeue(TSStringList strl);
260 tsapi bool TSStringListIsEmpty(TSStringList strl);
261 tsapi int TSStringListLen(TSStringList strl);
262 tsapi bool TSStringListIsValid(TSStringList strl);
263 
264 /*--- TSIntList operations --------------------------------------------*/
265 tsapi TSIntList TSIntListCreate();
266 tsapi void TSIntListDestroy(TSIntList intl);
267 tsapi TSMgmtError TSIntListEnqueue(TSIntList intl, int *str);
268 tsapi int *TSIntListDequeue(TSIntList intl);
269 tsapi bool TSIntListIsEmpty(TSIntList intl);
270 tsapi int TSIntListLen(TSIntList intl);
271 tsapi bool TSIntListIsValid(TSIntList intl, int min, int max);
272 
273 tsapi TSMgmtEvent *TSEventCreate();
274 tsapi void TSEventDestroy(TSMgmtEvent *event);
275 tsapi TSRecordEle *TSRecordEleCreate();
276 tsapi void TSRecordEleDestroy(TSRecordEle *ele);
277 
278 /***************************************************************************
279  * API Core
280  ***************************************************************************/
281 
282 /*--- api initialization and shutdown -------------------------------------*/
283 /* TSInit: initializations required for API clients
284  * Input: socket_path - not applicable for local clients
285  *                      for remote users, the path to the config directory.
286  *                      If == NULL, we use the Layout engine by default.
287  *        options - Control some features of the APIs
288  * Output: TS_ERR_xx
289  * Note: If remote client successfully connects, returns TS_ERR_OKAY; but
290  *       even if not successful connection (eg. client program is started
291  *       before TM) then can still make API calls and will try connecting then
292  */
293 tsapi TSMgmtError TSInit(const char *socket_path, TSInitOptionT options);
294 
295 /* TSTerminate: does clean up for API clients
296  * Input: <none>
297  * Output: <none>
298  */
299 tsapi TSMgmtError TSTerminate();
300 
301 /*--- plugin initialization -----------------------------------------------*/
302 /* TSPluginInit: called by traffic_manager to initialize the plugin
303  * Input:  argc - argument count
304  *         argv - argument array
305  * Output: <none>
306  */
307 inkexp extern void TSPluginInit(int argc, const char *argv[]);
308 
309 /*--- network operations --------------------------------------------------*/
310 /* UNIMPLEMENTED: used for remote clients on a different machine */
311 tsapi TSMgmtError TSConnect(TSIpAddr ip_addr, int port);
312 tsapi TSMgmtError TSDisconnectCbRegister(TSDisconnectFunc *func, void *data);
313 tsapi TSMgmtError TSDisconnectRetrySet(int retries, int retry_sleep_msec);
314 tsapi TSMgmtError TSDisconnect();
315 
316 /*--- control operations --------------------------------------------------*/
317 /* TSProxyStateGet: get the proxy state (on/off)
318  * Input:  <none>
319  * Output: proxy state (on/off)
320  */
321 tsapi TSProxyStateT TSProxyStateGet();
322 
323 /* TSProxyStateSet: set the proxy state (on/off)
324  * Input:  proxy_state - set to on/off
325  *         clear - a TSCacheClearT bitmask,
326  *            specifies if want to start TS with clear_cache or
327  *            clear_cache_hostdb option, or just run TS with no options;
328  *            only applies when turning proxy on
329  * Output: TSMgmtError
330  */
331 tsapi TSMgmtError TSProxyStateSet(TSProxyStateT proxy_state, unsigned clear);
332 
333 /* TSProxyBacktraceGet: get a backtrace of the proxy
334  * Input:  unsigned options - stack trace options
335  * Output: formatted backtrace of the proxy
336  * 	the caller must free this with TSfree
337  */
338 tsapi TSMgmtError TSProxyBacktraceGet(unsigned, TSString *);
339 
340 /* TSReconfigure: tell traffic_server to re-read its configuration files
341  * Input:  <none>
342  * Output: TSMgmtError
343  */
344 tsapi TSMgmtError TSReconfigure();
345 
346 /* TSRestart: restarts Traffic Manager and Traffic Server
347  * Input: options - bitmask of TSRestartOptionT
348  * Output: TSMgmtError
349  */
350 tsapi TSMgmtError TSRestart(unsigned options);
351 
352 /* TSActionDo: based on TSActionNeedT, will take appropriate action
353  * Input: action - action that needs to be taken
354  * Output: TSMgmtError
355  */
356 tsapi TSMgmtError TSActionDo(TSActionNeedT action);
357 
358 /* TSBounce: restart the traffic_server process(es).
359  * Input: options - bitmask of TSRestartOptionT
360  * Output TSMgmtError
361  */
362 tsapi TSMgmtError TSBounce(unsigned options);
363 
364 /* TSStop: stop the traffic_server process(es).
365  * Input: options - bitmask of TSRestartOptionT
366  * Output TSMgmtError
367  */
368 tsapi TSMgmtError TSStop(unsigned options);
369 
370 /* TSDrain: drain requests of the traffic_server process.
371  * Input: options - TSDrainOptionT
372  * Output TSMgmtError
373  */
374 tsapi TSMgmtError TSDrain(unsigned options);
375 
376 /* TSStorageDeviceCmdOffline: Request to make a cache storage device offline.
377  * @arg dev Target device, specified by path to device.
378  * @return Success.
379  */
380 tsapi TSMgmtError TSStorageDeviceCmdOffline(const char *dev);
381 
382 /* TSLifecycleMessage: Send a lifecycle message to the plugins.
383  * @arg tag Alert tag string (null-terminated)
384  * @return Success
385  */
386 tsapi TSMgmtError TSLifecycleMessage(const char *tag, void const *data, size_t data_size);
387 
388 /* TSGetErrorMessage: convert error id to error message
389  * Input:  error id (defined in TSMgmtError)
390  * Output: corresponding error message (allocated memory)
391  */
392 char *TSGetErrorMessage(TSMgmtError error_id);
393 
394 /* TSReadFromUrl: reads a remotely located config file into a buffer
395  * Input:  url        - remote location of the file
396  *         header     - a buffer is allocated on the header char* pointer
397  *         headerSize - the size of the header buffer is returned
398  *         body       - a buffer is allocated on the body char* pointer
399  *         bodySize   - the size of the body buffer is returned
400  * Output: TSMgmtError   - TS_ERR_OKAY if succeed, TS_ERR_FAIL otherwise
401  * Obsolete:  tsapi TSMgmtError TSReadFromUrl (char *url, char **text, int *size);
402  * NOTE: The URL can be expressed in the following forms:
403  *       - http://www.example.com:80/products/network/index.html
404  *       - http://www.example.com/products/network/index.html
405  *       - http://www.example.com/products/network/
406  *       - http://www.example.com/
407  *       - http://www.example.com
408  *       - www.example.com
409  * NOTE: header and headerSize can be NULL
410  */
411 tsapi TSMgmtError TSReadFromUrl(char *url, char **header, int *headerSize, char **body, int *bodySize);
412 
413 /* TSReadFromUrl: reads a remotely located config file into a buffer
414  * Input:  url        - remote location of the file
415  *         header     - a buffer is allocated on the header char* pointer
416  *         headerSize - the size of the header buffer is returned
417  *         body       - a buffer is allocated on the body char* pointer
418  *         bodySize   - the size of the body buffer is returned
419  *         timeout    - the max. connection timeout value before aborting.
420  * Output: TSMgmtError   - TS_ERR_OKAY if succeed, TS_ERR_FAIL otherwise
421  * NOTE: The URL can be expressed in the following forms:
422  *       - http://www.example.com:80/products/network/index.html
423  *       - http://www.example.com/products/network/index.html
424  *       - http://www.example.com/products/network/
425  *       - http://www.example.com/
426  *       - http://www.example.com
427  *       - www.example.com
428  * NOTE: header and headerSize can be NULL
429  */
430 tsapi TSMgmtError TSReadFromUrlEx(const char *url, char **header, int *headerSize, char **body, int *bodySize, int timeout);
431 tsapi TSMgmtError TSHostStatusSetUp(const char *host_name, int down_time, const char *reason);
432 tsapi TSMgmtError TSHostStatusSetDown(const char *host_name, int down_time, const char *reason);
433 /*--- statistics operations -----------------------------------------------*/
434 /* TSStatsReset: sets all the statistics variables to their default values
435  * Output: TSMgmtError
436  */
437 tsapi TSMgmtError TSStatsReset(const char *name);
438 
439 /*--- variable operations -------------------------------------------------*/
440 /* TSRecordGet: gets a record
441  * Input:  rec_name - the name of the record (proxy.config.record_name)
442  *         rec_val  - allocated TSRecordEle structure, value stored inside
443  * Output: TSMgmtError (if the rec_name does not exist, returns TS_ERR_FAIL)
444  */
445 tsapi TSMgmtError TSRecordGet(const char *rec_name, TSRecordEle *rec_val);
446 
447 /* TSRecordGet*: gets a record w/ a known type
448  * Input:  rec_name - the name of the record (proxy.config.record_name)
449  *         *_val    - allocated TSRecordEle structure, value stored inside
450  * Output: TSMgmtError
451  * Note: For TSRecordGetString, the function will allocate memory for the
452  *       *string_val, so the caller must free (*string_val);
453  */
454 tsapi TSMgmtError TSRecordGetInt(const char *rec_name, TSInt *int_val);
455 tsapi TSMgmtError TSRecordGetCounter(const char *rec_name, TSCounter *counter_val);
456 tsapi TSMgmtError TSRecordGetFloat(const char *rec_name, TSFloat *float_val);
457 tsapi TSMgmtError TSRecordGetString(const char *rec_name, TSString *string_val);
458 
459 /* TSRecordGetMlt: gets a set of records
460  * Input:  rec_list - list of record names the user wants to retrieve;
461  *                    resulting gets will be stored in the same list;
462  *                    if one get fails, transaction will be aborted
463  * Output: TSMgmtError
464  */
465 tsapi TSMgmtError TSRecordGetMlt(TSStringList rec_names, TSList rec_vals);
466 
467 /* TSRecordGetMatchMlt: gets a set of records
468  * Input:  rec_regex - regular expression to match against record names
469  * Output: TSMgmtError, TSList of TSRecordEle
470  */
471 tsapi TSMgmtError TSRecordGetMatchMlt(const char *rec_regex, TSList list);
472 
473 /* TSRecordSet*: sets a record w/ a known type
474  * Input:  rec_name     - the name of the record (proxy.config.record_name)
475  *         *_val        - the value to set the record to
476  *         *action_need - indicates which operation required by user for changes to take effect
477  * Output: TSMgmtError
478  */
479 
480 tsapi TSMgmtError TSRecordSet(const char *rec_name, const char *val, TSActionNeedT *action_need);
481 tsapi TSMgmtError TSRecordSetInt(const char *rec_name, TSInt int_val, TSActionNeedT *action_need);
482 tsapi TSMgmtError TSRecordSetCounter(const char *rec_name, TSCounter counter_val, TSActionNeedT *action_need);
483 tsapi TSMgmtError TSRecordSetFloat(const char *rec_name, TSFloat float_val, TSActionNeedT *action_need);
484 tsapi TSMgmtError TSRecordSetString(const char *rec_name, const char *string_val, TSActionNeedT *action_need);
485 
486 /* TSConfigRecordDescribe: fetch a full description of a configuration record
487  * Input: rec_name  - name of the record
488  *        flags     - (unused) fetch flags bitmask
489  *        val       - output value;
490  * Output: TSMgmtError
491  */
492 tsapi TSMgmtError TSConfigRecordDescribe(const char *rec_name, unsigned flags, TSConfigRecordDescription *val);
493 tsapi TSMgmtError TSConfigRecordDescribeMatchMlt(const char *rec_regex, unsigned flags, TSList list);
494 
495 /* TSRecordSetMlt: sets a set of records
496  * Input:  rec_list     - list of record names the user wants to set;
497  *                        if one set fails, transaction will be aborted
498  *         *action_need - indicates which operation required by user for changes to take effect
499  * Output: TSMgmtError
500  */
501 tsapi TSMgmtError TSRecordSetMlt(TSList rec_list, TSActionNeedT *action_need);
502 
503 /*--- events --------------------------------------------------------------*/
504 /* Only a set of statically defined events exist. An event is either
505  * active or inactive. An event is active when it is triggered, and
506  * becomes inactive when resolved. Events are triggered and resolved
507  * by specifying the event's name (which is predefined and immutable).
508  */
509 
510 /* TSEventResolve: enables the user to resolve an event
511  * Input:  event_name - event to resolve
512  * Output: TSMgmtError
513  */
514 tsapi TSMgmtError TSEventResolve(const char *event_name);
515 
516 /* TSActiveEventGetMlt: query for a list of all the currently active events
517  * Input:  active_events - an empty TSList; if function call is successful,
518  *                         active_events will contain names of the currently
519  *                         active events
520  * Output: TSMgmtError
521  */
522 tsapi TSMgmtError TSActiveEventGetMlt(TSList active_events);
523 
524 /* TSEventIsActive: check if the specified event is active
525  * Input:  event_name - name of event to check if active; must be one of
526  *                      the predefined names
527  *         is_current - when function completes, if true, then the event is
528  *                      active
529  * Output: TSMgmtError
530  */
531 tsapi TSMgmtError TSEventIsActive(char *event_name, bool *is_current);
532 
533 /* TSEventSignalCbRegister: register a callback for a specific event or
534  *                           for any event
535  * Input:  event_name - the name of event to register callback for;
536  *                      if NULL, the callback is registered for all events
537  *         func       - callback function
538  *         data       - data to pass to callback
539  * Output: TSMgmtError
540  */
541 tsapi TSMgmtError TSEventSignalCbRegister(char *event_name, TSEventSignalFunc func, void *data);
542 
543 /* TSEventSignalCbUnregister: unregister a callback for a specific event
544  *                             or for any event
545  * Input: event_name - the name of event to unregister callback for;
546  *                     if NULL, the callback is unregistered for all events
547  *         func       - callback function
548  * Output: TSMgmtError
549  */
550 tsapi TSMgmtError TSEventSignalCbUnregister(char *event_name, TSEventSignalFunc func);
551 
552 /*--- TS Cache Inspector Operations --------------------------------------------*/
553 
554 /* TSLookupFromCacheUrl
555  *   Function takes an url and an 'info' buffer as input,
556  *   lookups cache information of the url and saves the
557  *   cache info to the info buffer
558  */
559 tsapi TSMgmtError TSLookupFromCacheUrl(TSString url, TSString *info);
560 
561 /* TSLookupFromCacheUrlRegex
562  *   Function takes a string in a regex form and returns
563  *   a list of urls that match the regex
564  ********************************************************/
565 
566 tsapi TSMgmtError TSLookupFromCacheUrlRegex(TSString url_regex, TSString *list);
567 
568 /* TSDeleteFromCacheUrl
569  *   Function takes an url and an 'info' buffer as input,
570  *   deletes the url from cache if it's in the cache and
571  *   returns the status of deletion
572  ********************************************************/
573 
574 tsapi TSMgmtError TSDeleteFromCacheUrl(TSString url, TSString *info);
575 
576 /* TSDeleteFromCacheUrlRegex
577  *   Function takes a string in a regex form and returns
578  *   a list of urls deleted from cache
579  ********************************************************/
580 
581 tsapi TSMgmtError TSDeleteFromCacheUrlRegex(TSString url_regex, TSString *list);
582 
583 /* TSInvalidateFromCacheUrlRegex
584  *   Function takes a string in a regex form and returns
585  *   a list of urls invalidated from cache
586  ********************************************************/
587 
588 tsapi TSMgmtError TSInvalidateFromCacheUrlRegex(TSString url_regex, TSString *list);
589 
590 #ifdef __cplusplus
591 }
592 #endif /* __cplusplus */
593