~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to proxy/mgmt2/api2/EventCallback.h

  • Committer: Bazaar Package Importer
  • Author(s): Arno Toell
  • Date: 2011-01-13 11:49:18 UTC
  • Revision ID: james.westby@ubuntu.com-20110113114918-vu422h8dknrgkj15
Tags: upstream-2.1.5-unstable
ImportĀ upstreamĀ versionĀ 2.1.5-unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 
 
3
  A brief file description
 
4
 
 
5
  @section license License
 
6
 
 
7
  Licensed to the Apache Software Foundation (ASF) under one
 
8
  or more contributor license agreements.  See the NOTICE file
 
9
  distributed with this work for additional information
 
10
  regarding copyright ownership.  The ASF licenses this file
 
11
  to you under the Apache License, Version 2.0 (the
 
12
  "License"); you may not use this file except in compliance
 
13
  with the License.  You may obtain a copy of the License at
 
14
 
 
15
      http://www.apache.org/licenses/LICENSE-2.0
 
16
 
 
17
  Unless required by applicable law or agreed to in writing, software
 
18
  distributed under the License is distributed on an "AS IS" BASIS,
 
19
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
20
  See the License for the specific language governing permissions and
 
21
  limitations under the License.
 
22
 */
 
23
 
 
24
/***************************************************************************
 
25
 * EventCallback.h
 
26
 * Purpose:  defines the CallbackTable which stores callback functions for
 
27
 *           specific events
 
28
 *
 
29
 *
 
30
 ***************************************************************************/
 
31
/*
 
32
 * EventCallback.h
 
33
 *
 
34
 * defines the CallbackTable which stores callback functions for
 
35
 * specific events. Used by both local api and remote api.
 
36
 */
 
37
 
 
38
#ifndef _EVENT_CALLBACK_H_
 
39
#define _EVENT_CALLBACK_H_
 
40
 
 
41
#include "ink_llqueue.h"
 
42
 
 
43
#include "INKMgmtAPI.h"
 
44
#include "CoreAPIShared.h"
 
45
 
 
46
// when registering the callback function, can pass in void* data which
 
47
// will then be passed to the callback function; need to store this data with
 
48
// the callback in a struct
 
49
typedef struct
 
50
{
 
51
  INKEventSignalFunc func;
 
52
  void *data;
 
53
} EventCallbackT;
 
54
 
 
55
// event_call_back_l is a queue of EventCallbackT
 
56
typedef struct
 
57
{
 
58
  LLQ *event_callback_l[NUM_EVENTS];
 
59
  ink_mutex event_callback_lock;
 
60
} CallbackTable;
 
61
 
 
62
#ifdef __cplusplus
 
63
extern "C"
 
64
{
 
65
#endif /* __cplusplus */
 
66
 
 
67
EventCallbackT *create_event_callback(INKEventSignalFunc func, void *data);
 
68
void delete_event_callback(EventCallbackT * event_cb);
 
69
 
 
70
CallbackTable *create_callback_table(const char *lock_name);
 
71
 
 
72
void delete_callback_table(CallbackTable * cb_table);
 
73
 
 
74
// returns list of event_id that have at least one callback registered for it
 
75
LLQ *get_events_with_callbacks(CallbackTable * cb_table);
 
76
 
 
77
INKError cb_table_register(CallbackTable * cb_table, char *event_name, INKEventSignalFunc func, void *data,
 
78
                           bool * first_cb);
 
79
INKError cb_table_unregister(CallbackTable * cb_table, char *event_name, INKEventSignalFunc func);
 
80
 
 
81
#ifdef __cplusplus
 
82
}
 
83
#endif /* __cplusplus */
 
84
 
 
85
#endif