-
Notifications
You must be signed in to change notification settings - Fork 584
/
Copy pathstatus_report.h
113 lines (81 loc) · 3.21 KB
/
status_report.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* Copyright (C) 2022 OpenSIPS Solutions
*
* This file is part of opensips, a free SIP server.
*
* opensips is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* opensips is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
*/
#ifndef _STATUS_REPORT_H_
#define _STATUS_REPORT_H_
#include "mi/mi.h"
#define CHAR_INT MI_SSTR
#define CHAR_INT_NULL NULL,0
#define STR2CI(_str) _str.s, _str.len
/* some pre-defined statuses that may be used by modules too */
enum sr_status {
SR_STATUS_NOT_FOUND = INT_MIN, /* just for internal usage! */
SR_STATUS_NO_DATA =- 2,
SR_STATUS_LOADING_DATA = -1,
SR_STATUS_NOT_READY = -1,
SR_STATUS_RESERVED = 0,
SR_STATUS_READY = 1,
SR_STATUS_RELOADING_DATA= 2,
};
/* functions to be used by modules using the status/report framework */
void *sr_register_group( char *name_s, int name_len, int is_public);
void *sr_get_group_by_name( char *name_s, int name_len);
int sr_register_identifier( void *group,
char *identifier_s, int identifier_len,
int init_status, char *status_txt_s, int status_txt_len,
int max_reports);
void* sr_register_group_with_identifier( char *group_s, int group_len,
int grp_is_public,
char *identifier_s, int identifier_len,
int init_status, char *status_txt_s, int status_txt_len,
int max_reports);
int sr_unregister_identifier( void *group,
char *identifier_s, int identifier_len);
int sr_set_status(void *group,
char *identifier_s, int identifier_len,
int status, char *status_txt_s, int status_txt_len,
int is_public);
int sr_add_report(void *group,
char *identifier_s, int identifier_len,
char *report_s, int report_len,
int is_public);
int sr_add_report_fmt(void *group,
char *identifier_s, int identifier_len,
int is_public,
char *fmt_val, ...);
/* functions related to status of the OpenSIPS core */
enum sr_core_states { STATE_NONE=-100, STATE_TERMINATING=-2,
STATE_INITIALIZING=-1, STATE_RUNNING=1 };
int sr_set_core_status(int status, char *txt_s, int txt_len);
void sr_set_core_status_terminating( void );
int sr_get_core_status(void);
int sr_add_core_report(char *report_s, int report_len);
/* functions used by the OpenSIPS core */
int init_status_report(void);
int fixup_sr_group(void **param);
int w_sr_check_status(struct sip_msg *msg, void *group, str *identifier);
mi_response_t *mi_sr_get_status(const mi_params_t *params,
struct mi_handler *async_hdl);
mi_response_t *mi_sr_list_status(const mi_params_t *params,
struct mi_handler *async_hdl);
mi_response_t *mi_sr_list_reports(const mi_params_t *params,
struct mi_handler *async_hdl);
mi_response_t *mi_sr_list_identifiers(const mi_params_t *params,
struct mi_handler *async_hdl);
#endif