~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to proxy/mgmt2/BaseManager.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
 *
 
26
 * BaseManager.h
 
27
 *   Base Manager Class, base class for all managers.
 
28
 *
 
29
 * $Date: 2004-02-03 22:12:02 $
 
30
 *
 
31
 *
 
32
 */
 
33
 
 
34
#ifndef _BASE_MANAGER_H
 
35
#define _BASE_MANAGER_H
 
36
 
 
37
#include "ink_thread.h"
 
38
#include "ink_mutex.h"
 
39
#include "ink_llqueue.h"
 
40
 
 
41
#include "MgmtDefs.h"
 
42
 
 
43
 
 
44
/*******************************************
 
45
 * used by LocalManager and in Proxy Main. *
 
46
 */
 
47
#define MAX_OPTION_SIZE        2048
 
48
#define MAX_PROXY_SERVER_PORTS 48
 
49
#define MAX_ATTR_LEN           5
 
50
/*******************************************/
 
51
 
 
52
/*
 
53
 * MgmtEvent defines.
 
54
 */
 
55
// Event flows: traffic manager -> traffic server
 
56
#define MGMT_EVENT_SYNC_KEY              10000
 
57
#define MGMT_EVENT_SHUTDOWN              10001
 
58
#define MGMT_EVENT_RESTART               10002
 
59
#define MGMT_EVENT_BOUNCE                10003
 
60
#define MGMT_EVENT_CLEAR_STATS           10004
 
61
#define MGMT_EVENT_CONFIG_FILE_UPDATE    10005
 
62
#define MGMT_EVENT_PLUGIN_CONFIG_UPDATE  10006
 
63
#define MGMT_EVENT_HTTP_CLUSTER_DELTA    10007
 
64
#define MGMT_EVENT_ROLL_LOG_FILES        10008
 
65
#define MGMT_EVENT_LIBRECORDS            10009
 
66
 
 
67
/***********************************************************************
 
68
 *
 
69
 * MODULAIZATTION: if you are adding new signals, please ensure to add
 
70
 *                 the corresponding signals in librecords/I_RecSignals.h
 
71
 *
 
72
 *
 
73
 ***********************************************************************/
 
74
 
 
75
// Signal flows: traffic server -> traffic manager
 
76
#define MGMT_SIGNAL_PID                   0
 
77
#define MGMT_SIGNAL_MACHINE_UP            1     /* Data is ip addr */
 
78
#define MGMT_SIGNAL_MACHINE_DOWN          2
 
79
#define MGMT_SIGNAL_CONFIG_ERROR          3     /* Data is descriptive string */
 
80
#define MGMT_SIGNAL_SYSTEM_ERROR          4
 
81
#define MGMT_SIGNAL_LOG_SPACE_CRISIS      5
 
82
#define MGMT_SIGNAL_CONFIG_FILE_READ      6
 
83
#define MGMT_SIGNAL_CACHE_ERROR           7
 
84
#define MGMT_SIGNAL_CACHE_WARNING         8
 
85
#define MGMT_SIGNAL_LOGGING_ERROR         9
 
86
#define MGMT_SIGNAL_LOGGING_WARNING       10
 
87
// Currently unused: 11
 
88
#define MGMT_SIGNAL_PLUGIN_CONFIG_REG     12
 
89
#define MGMT_SIGNAL_PLUGIN_ADD_REC        13
 
90
#define MGMT_SIGNAL_PLUGIN_SET_CONFIG     14
 
91
#define MGMT_SIGNAL_LOG_FILES_ROLLED      15
 
92
#define MGMT_SIGNAL_LIBRECORDS            16
 
93
#define MGMT_SIGNAL_HTTP_CONGESTED_SERVER   20  /* Congestion control -- congested server */
 
94
#define MGMT_SIGNAL_HTTP_ALLEVIATED_SERVER  21  /* Congestion control -- alleviated server */
 
95
 
 
96
// Wireless (WDA) plugin signal
 
97
// Warning: 1. Don't change the # mapping 'cuase 3rd party software depends on them.
 
98
//          2. Ensure 1:1 maps with alarms in Alarm.h
 
99
#define INK_MGMT_SIGNAL_WDA_BILLING_CONNECTION_DIED  100
 
100
#define INK_MGMT_SIGNAL_WDA_BILLING_CORRUPTED_DATA   101
 
101
#define INK_MGMT_SIGNAL_WDA_XF_ENGINE_DOWN           102
 
102
#define INK_MGMT_SIGNAL_WDA_RADIUS_CORRUPTED_PACKETS 103
 
103
 
 
104
#define INK_MGMT_SIGNAL_ACC_ALARMS_START  200
 
105
#define INK_MGMT_SIGNAL_ACC_ALARMS_END    299
 
106
 
 
107
#define INK_MGMT_SIGNAL_SAC_SERVER_DOWN                 400
 
108
 
 
109
typedef struct _mgmt_message_hdr_type
 
110
{
 
111
  int msg_id;
 
112
  int data_len;
 
113
} MgmtMessageHdr;
 
114
 
 
115
 
 
116
typedef struct _mgmt_event_callback_list
 
117
{
 
118
  MgmtCallback func;
 
119
  void *opaque_data;
 
120
  struct _mgmt_event_callback_list *next;
 
121
} MgmtCallbackList;
 
122
 
 
123
 
 
124
class BaseManager
 
125
{
 
126
 
 
127
public:
 
128
 
 
129
  BaseManager();
 
130
  ~BaseManager();
 
131
 
 
132
  int registerMgmtCallback(int msg_id, MgmtCallback func, void *opaque_callback_data = NULL);
 
133
 
 
134
  int signalMgmtEntity(int msg_id, char *data_str = NULL);
 
135
  int signalMgmtEntity(int msg_id, char *data_raw, int data_len);
 
136
 
 
137
  LLQ *mgmt_event_queue;
 
138
  InkHashTable *mgmt_callback_table;
 
139
 
 
140
protected:
 
141
 
 
142
  void executeMgmtCallback(int msg_id, char *data_raw, int data_len);
 
143
 
 
144
private:
 
145
 
 
146
};                              /* End class BaseManager */
 
147
 
 
148
 
 
149
#endif /* _BASE_MANAGER_H */