Browse code

mi: cleanup - move type defs. to separate file

Moved MI types defs to mi/mi_types.h (from lib/kmi/mi.h).
This removes core dependency on lib/mi include files
(mi types are needed for kamailio module interface defs).

Andrei Pelinescu-Onciul authored on 18/08/2010 17:54:09
Showing 5 changed files
... ...
@@ -23,6 +23,7 @@
23 23
  * History:
24 24
  * ---------
25 25
  *  2006-09-08  first version (bogdan)
26
+ *  2010-08-18  use mi types from ../../mi/mi_types.h (andrei)
26 27
  */
27 28
 
28 29
 /*!
... ...
@@ -36,6 +37,7 @@
36 36
 #define _MI_MI_H_
37 37
 
38 38
 #include "../../str.h"
39
+#include "../../mi/mi_types.h"
39 40
 #include "tree.h"
40 41
 
41 42
 #define MI_ASYNC_RPL_FLAG   (1<<0)
... ...
@@ -43,11 +45,6 @@
43 43
 
44 44
 #define MI_ROOT_ASYNC_RPL   ((struct mi_root*)-1)
45 45
 
46
-struct mi_handler;
47
-
48
-typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
49
-typedef int (mi_child_init_f)(void);
50
-typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
51 46
 
52 47
 
53 48
 struct mi_handler {
... ...
@@ -66,15 +63,6 @@ struct mi_cmd {
66 66
 };
67 67
 
68 68
 
69
-typedef struct mi_export_ {
70
-	char *name;
71
-	mi_cmd_f *cmd;
72
-	unsigned int flags;
73
-	void *param;
74
-	mi_child_init_f *init_f;
75
-}mi_export_t;
76
-
77
-
78 69
 int register_mi_cmd( mi_cmd_f f, char *name, void *param,
79 70
 		mi_child_init_f in, unsigned int flags);
80 71
 
... ...
@@ -23,6 +23,7 @@
23 23
  * History:
24 24
  * ---------
25 25
  *  2006-09-08  first version (bogdan)
26
+ *  2010-08-18  use mi types from ../../mi/mi_types.h (andrei)
26 27
  */
27 28
 
28 29
 /*!
... ...
@@ -39,6 +40,7 @@
39 39
 
40 40
 #include <stdarg.h>
41 41
 #include "../../str.h"
42
+#include "../../mi/mi_types.h"
42 43
 
43 44
 struct mi_node;
44 45
 struct mi_handler;
... ...
@@ -63,21 +65,7 @@ struct mi_handler;
63 63
 #define MI_MISSING_PARM       MI_MISSING_PARM_S
64 64
 #define MI_BAD_PARM           MI_BAD_PARM_S
65 65
 
66
-struct mi_node {
67
-	str value;
68
-	str name;
69
-	struct mi_node *kids;
70
-	struct mi_node *next;
71
-	struct mi_node *last;
72
-	struct mi_attr *attributes;
73
-};
74
-
75
-struct mi_root {
76
-	unsigned int       code;
77
-	str                reason;
78
-	struct mi_handler  *async_hdl;
79
-	struct mi_node     node;
80
-};
66
+
81 67
 
82 68
 struct mi_root *init_mi_tree(unsigned int code, char *reason, int reason_len);
83 69
 
84 70
deleted file mode 100644
... ...
@@ -1,35 +0,0 @@
1
-/*
2
- * $Id$
3
- *
4
- * Copyright (C) 2008 iptelorg GmbH
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- */
18
-/*
19
- * mi compatibility wrapper for kamailio
20
- * for now it doesn't do anything, it just a compile helper
21
- * (obsolete, do not use anymore)
22
- *
23
- * History:
24
- * --------
25
- *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
26
- */
27
-
28
-#ifndef _mi_h_
29
-#define _mi_h_
30
-
31
-#include "../lib/kmi/mi.h"
32
-
33
-#endif /* _mi_h_ */
34
-
35
-
36 1
new file mode 100644
... ...
@@ -0,0 +1,80 @@
0
+/*
1
+ * $Id$
2
+ *
3
+ * Copyright (C) 2008 iptelorg GmbH
4
+ *
5
+ * Permission to use, copy, modify, and distribute this software for any
6
+ * purpose with or without fee is hereby granted, provided that the above
7
+ * copyright notice and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+ */
17
+/*
18
+ * mi compatibility wrapper for kamailio
19
+ * It contains only the type definition, needed for loading kamilio modules
20
+ * (used by sr_module.c).
21
+ * Note that MI usage in new modules is opsolete. They should implement RPCs
22
+ * instead. To use MI include lib/kmi/mi.h and link with lib kmi.
23
+ *
24
+ * History:
25
+ * --------
26
+ *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
27
+ *  2010-08-18  remove everything but the  data types definition (andrei)
28
+ */
29
+
30
+#ifndef _mi_h_
31
+#define _mi_h_
32
+
33
+#include "../str.h"
34
+
35
+struct mi_node {
36
+	str value;
37
+	str name;
38
+	struct mi_node *kids;
39
+	struct mi_node *next;
40
+	struct mi_node *last;
41
+	struct mi_attr *attributes;
42
+};
43
+
44
+
45
+struct mi_handler;
46
+
47
+struct mi_root {
48
+	unsigned int       code;
49
+	str                reason;
50
+	struct mi_handler  *async_hdl;
51
+	struct mi_node     node;
52
+};
53
+
54
+typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
55
+typedef int (mi_child_init_f)(void);
56
+typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
57
+
58
+/* FIXME
59
+struct mi_handler {
60
+	mi_handler_f *handler_f;
61
+	void * param;
62
+};
63
+*/
64
+
65
+
66
+struct mi_export_ {
67
+	char *name;
68
+	mi_cmd_f *cmd;
69
+	unsigned int flags;
70
+	void *param;
71
+	mi_child_init_f *init_f;
72
+};
73
+
74
+typedef struct mi_export_ mi_export_t;
75
+
76
+
77
+#endif /* _mi_h_ */
78
+
79
+
... ...
@@ -69,7 +69,7 @@
69 69
 
70 70
 /* kamailio compat */
71 71
 #include "statistics.h"
72
-#include "mi/mi.h"
72
+#include "mi/mi_types.h"
73 73
 #include "pvar.h"
74 74
 
75 75