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 37
 #define _MI_MI_H_
37 38
 
38 39
 #include "../../str.h"
40
+#include "../../mi/mi_types.h"
39 41
 #include "tree.h"
40 42
 
41 43
 #define MI_ASYNC_RPL_FLAG   (1<<0)
... ...
@@ -43,11 +45,6 @@
43 45
 
44 46
 #define MI_ROOT_ASYNC_RPL   ((struct mi_root*)-1)
45 47
 
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 48
 
52 49
 
53 50
 struct mi_handler {
... ...
@@ -66,15 +63,6 @@ struct mi_cmd {
66 63
 };
67 64
 
68 65
 
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 66
 int register_mi_cmd( mi_cmd_f f, char *name, void *param,
79 67
 		mi_child_init_f in, unsigned int flags);
80 68
 
... ...
@@ -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 40
 
40 41
 #include <stdarg.h>
41 42
 #include "../../str.h"
43
+#include "../../mi/mi_types.h"
42 44
 
43 45
 struct mi_node;
44 46
 struct mi_handler;
... ...
@@ -63,21 +65,7 @@ struct mi_handler;
63 65
 #define MI_MISSING_PARM       MI_MISSING_PARM_S
64 66
 #define MI_BAD_PARM           MI_BAD_PARM_S
65 67
 
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
-};
68
+
81 69
 
82 70
 struct mi_root *init_mi_tree(unsigned int code, char *reason, int reason_len);
83 71
 
84 72
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 0
new file mode 100644
... ...
@@ -0,0 +1,80 @@
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
+ * It contains only the type definition, needed for loading kamilio modules
21
+ * (used by sr_module.c).
22
+ * Note that MI usage in new modules is opsolete. They should implement RPCs
23
+ * instead. To use MI include lib/kmi/mi.h and link with lib kmi.
24
+ *
25
+ * History:
26
+ * --------
27
+ *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
28
+ *  2010-08-18  remove everything but the  data types definition (andrei)
29
+ */
30
+
31
+#ifndef _mi_h_
32
+#define _mi_h_
33
+
34
+#include "../str.h"
35
+
36
+struct mi_node {
37
+	str value;
38
+	str name;
39
+	struct mi_node *kids;
40
+	struct mi_node *next;
41
+	struct mi_node *last;
42
+	struct mi_attr *attributes;
43
+};
44
+
45
+
46
+struct mi_handler;
47
+
48
+struct mi_root {
49
+	unsigned int       code;
50
+	str                reason;
51
+	struct mi_handler  *async_hdl;
52
+	struct mi_node     node;
53
+};
54
+
55
+typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
56
+typedef int (mi_child_init_f)(void);
57
+typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
58
+
59
+/* FIXME
60
+struct mi_handler {
61
+	mi_handler_f *handler_f;
62
+	void * param;
63
+};
64
+*/
65
+
66
+
67
+struct mi_export_ {
68
+	char *name;
69
+	mi_cmd_f *cmd;
70
+	unsigned int flags;
71
+	void *param;
72
+	mi_child_init_f *init_f;
73
+};
74
+
75
+typedef struct mi_export_ mi_export_t;
76
+
77
+
78
+#endif /* _mi_h_ */
79
+
80
+
... ...
@@ -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