1 /*
2  * SNMPStats Module
3  * Copyright (C) 2006 SOMA Networks, INC.
4  * Written by: Jeffrey Magder (jmagder@somanetworks.com)
5  *
6  * This file is part of Kamailio, a free SIP server.
7  *
8  * Kamailio is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version
12  *
13  * Kamailio is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21  * USA
22  *
23  */
24 
25 /*!
26  * \file
27  * \brief SNMP statistic module, globals
28  * \ingroup snmpstats
29  * - Module: \ref snmpstats
30  */
31 
32 
33 #ifndef _SNMP_STATS_GLOBALS_
34 #define _SNMP_STATS_GLOBALS_
35 
36 #include "../../core/sr_module.h"
37 
38 #define KAMAILIO_OID 1, 3, 6, 1, 4, 1, 34352
39 
40 /***************************************************************
41  * Textual Conventions for BITS types - begins
42  *
43  * To set a bit  : |= with the define
44  * To clear a bit: &= ~(the_define)
45  *
46  * Example:
47  *
48  * 1) Setting a minor alarm status:
49  *
50  * 	currentAlarmStatus |=  TC_ALARM_STATUS_MINOR
51  *
52  * 2) Clearing a minor alarm status:
53  *
54  * 	currentAlarmStatus &= ~TC_ALARM_STATUS_MINOR
55  */
56 #define TC_SIP_TRANSPORT_PROTOCOL_OTHER (128 >> 0)
57 #define TC_SIP_TRANSPORT_PROTOCOL_UDP (128 >> 1)
58 #define TC_SIP_TRANSPORT_PROTOCOL_TCP (128 >> 2)
59 #define TC_SIP_TRANSPORT_PROTOCOL_SCTP (128 >> 3)
60 #define TC_SIP_TRANSPORT_PROTOCOL_TLS (128 >> 4)
61 #define TC_SIP_TRANSPORT_PROTOCOL_SCTP_TLS (128 >> 5)
62 #define TC_SIP_TRANSPORT_PROTOCOL_WS (128 >> 6)
63 #define TC_SIP_TRANSPORT_PROTOCOL_WSS (128 >> 7)
64 
65 #define TC_SIP_ENTITY_ROLE_OTHER (128 >> 0)
66 #define TC_SIP_ENTITY_ROLE_USER_AGENT (128 >> 1)
67 #define TC_SIP_ENTITY_ROLE_PROXY_SERVER (128 >> 2)
68 #define TC_SIP_ENTITY_ROLE_REDIRECT_SERVER (128 >> 3)
69 #define TC_SIP_ENTITY_ROLE_REGISTRAR_SERVER (128 >> 4)
70 #define TC_SIP_ENTITY_ROLE_EDGEPROXY_SERVER (128 >> 5)
71 #define TC_SIP_ENTITY_ROLE_SIPCAPTURE_SERVER (128 >> 6)
72 
73 #define TC_SIP_OPTION_TAG_REQUIRE (128 >> 0)
74 #define TC_SIP_OPTION_TAG_PROXY_REQUIRE (128 >> 1)
75 #define TC_SIP_OPTION_TAG_SUPPORTED (128 >> 2)
76 #define TC_SIP_OPTION_TAG_UNSUPPORTED (128 >> 3)
77 
78 #define TC_ALARM_STATUS_UNDER_REPAIR (128 >> 0)
79 #define TC_ALARM_STATUS_CRITICAL (128 >> 1)
80 #define TC_ALARM_STATUS_MAJOR (128 >> 2)
81 #define TC_ALARM_STATUS_MINOR (128 >> 3)
82 #define TC_ALARM_STATUS_ALARM_OUTSTANDING (128 >> 4)
83 #define TC_ALARM_STATUS_UNKNOWN (128 >> 5)
84 
85 #define TC_TRANSPORT_PROTOCOL_OTHER (128 >> 0)
86 #define TC_TRANSPORT_PROTOCOL_UDP (128 >> 1)
87 #define TC_TRANSPORT_PROTOCOL_TCP (128 >> 2)
88 #define TC_TRANSPORT_PROTOCOL_SCTP (128 >> 3)
89 #define TC_TRANSPORT_PROTOCOL_TLS (128 >> 4)
90 #define TC_TRANSPORT_PROTOCOL_SCRTP_TLS (128 >> 5)
91 #define TC_TRANSPORT_PROTOCOL_WS (128 >> 6)
92 #define TC_TRANSPORT_PROTOCOL_WSS (128 >> 7)
93 
94 /*
95  * Textual Conventions for BITS types - ends
96  *************************************************************/
97 
98 
99 /***************************************************************
100  * Textual Conventions for INTEGER types - begins
101  */
102 #define TC_ALARM_STATE_CLEAR 0
103 #define TC_ALARM_STATE_CRITICAL 1
104 #define TC_ALARM_STATE_MAJOR 2
105 #define TC_ALARM_STATE_MINOR 3
106 #define TC_ALARM_STATE_UNKNOWN 4
107 
108 #define TC_USAGE_STATE_IDLE 0
109 #define TC_USAGE_STATE_ACTIVE 1
110 #define TC_USAGE_STATE_BUSY 2
111 #define TC_USAGE_STATE_UNKNOWN 3
112 
113 #define TC_ROWSTATUS_ACTIVE 1
114 #define TC_ROWSTATUS_NOTINSERVICE 2
115 #define TC_ROWSTATUS_NOTREADY 3
116 #define TC_ROWSTATUS_CREATEANDGO 4
117 #define TC_ROWSTATUS_CREATEANDWAIT 5
118 #define TC_ROWSTATUS_DESTROY 6
119 /*
120  * Textual Conventions for INTEGER types - ends
121  *************************************************************/
122 
123 
124 #define TC_TRUE 1
125 #define TC_FALSE 2
126 
127 #define SNMPGET_TEMP_FILE "/tmp/kamailio_SNMPAgent.txt"
128 #define SNMPGET_MAX_BUFFER 80
129 #define MAX_PROC_BUFFER 256
130 
131 #define MAX_USER_LOOKUP_COUNTER 255
132 
133 #define HASH_SIZE 32
134 
135 extern unsigned int global_UserLookupCounter;
136 
137 /*******************************************************************************
138  * Configuration File Handler Prototypes
139  */
140 
141 /*! Handles setting of the sip entity type parameter. */
142 int handleSipEntityType(modparam_t type, void *val);
143 
144 /*! Handles setting of the Msg Queue Depth Minor Threshold */
145 int set_queue_minor_threshold(modparam_t type, void *val);
146 
147 /*! Handles setting of the Msg Queue Depth Major Threshold */
148 int set_queue_major_threshold(modparam_t type, void *val);
149 
150 /*! Handles setting of the dialog minor threshold */
151 int set_dlg_minor_threshold(modparam_t type, void *val);
152 
153 /*! Handles setting of the dialog major threshold */
154 int set_dlg_major_threshold(modparam_t type, void *val);
155 
156 /*! Handles setting of the path to the snmpget binary. */
157 int set_snmpget_path(modparam_t type, void *val);
158 
159 /*! Handles setting of the snmp community string. */
160 int set_snmp_community(modparam_t type, void *val);
161 
162 #endif