forked from OpenSIPS/opensips
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmi.h
More file actions
129 lines (94 loc) · 2.66 KB
/
Copy pathmi.h
File metadata and controls
129 lines (94 loc) · 2.66 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Copyright (C) 2006 Voice Sistem SRL
*
* 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.
*
*
* History:
* ---------
* 2006-09-08 first version (bogdan)
*/
/*!
* \file
* \brief MI :: Management
* \ingroup mi
*/
#ifndef _MI_MI_H_
#define _MI_MI_H_
#include "../str.h"
#include "tree.h"
#define MI_ASYNC_RPL_FLAG (1<<0)
#define MI_NO_INPUT_FLAG (1<<1)
#define MI_ROOT_ASYNC_RPL ((struct mi_root*)-1)
struct mi_handler;
typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
typedef int (mi_child_init_f)(void);
typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
typedef int (mi_flush_f)(void *, struct mi_root *);
struct mi_handler {
mi_handler_f *handler_f;
void * param;
};
struct mi_cmd {
int id;
str module;
str name;
str help;
mi_child_init_f *init_f;
mi_cmd_f *f;
unsigned int flags;
void *param;
volatile unsigned char* trace_mask;
};
typedef struct mi_export_ {
char *name;
char *help;
mi_cmd_f *cmd;
unsigned int flags;
void *param;
mi_child_init_f *init_f;
}mi_export_t;
int register_mi_cmd( mi_cmd_f f, char *name, char *help, void *param,
mi_child_init_f in, unsigned int flags, char* mod_name);
int register_mi_mod( char *mod_name, mi_export_t *mis);
int init_mi_child();
struct mi_cmd* lookup_mi_cmd( char *name, int len);
struct mi_root *mi_help(struct mi_root *cmd, void *param);
extern mi_flush_f *crt_flush_fnct;
extern void *crt_flush_param;
static inline struct mi_root* run_mi_cmd(struct mi_cmd *cmd, struct mi_root *t,
mi_flush_f *f, void *param)
{
struct mi_root *ret;
/* set the flush function */
crt_flush_fnct = f;
crt_flush_param = param;
ret = cmd->f( t, cmd->param);
/* reset the flush function */
crt_flush_fnct = 0;
crt_flush_param = 0;
return ret;
}
void get_mi_cmds( struct mi_cmd** cmds, int *size);
static inline int flush_mi_tree(struct mi_root *t)
{
if(crt_flush_fnct)
return crt_flush_fnct(crt_flush_param, t);
else
return 0;
}
#endif