Bladeren bron

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 15 jaren geleden
bovenliggende
commit
627a1969b4
5 gewijzigde bestanden met toevoegingen van 86 en 65 verwijderingen
  1. 2 14
      lib/kmi/mi.h
  2. 3 15
      lib/kmi/tree.h
  3. 0 35
      mi/mi.h
  4. 80 0
      mi/mi_types.h
  5. 1 1
      sr_module.h

+ 2 - 14
lib/kmi/mi.h

@@ -23,6 +23,7 @@
  * History:
  * ---------
  *  2006-09-08  first version (bogdan)
+ *  2010-08-18  use mi types from ../../mi/mi_types.h (andrei)
  */
 
 /*!
@@ -36,6 +37,7 @@
 #define _MI_MI_H_
 
 #include "../../str.h"
+#include "../../mi/mi_types.h"
 #include "tree.h"
 
 #define MI_ASYNC_RPL_FLAG   (1<<0)
@@ -43,11 +45,6 @@
 
 #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);
 
 
 struct mi_handler {
@@ -66,15 +63,6 @@ struct mi_cmd {
 };
 
 
-typedef struct mi_export_ {
-	char *name;
-	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, void *param,
 		mi_child_init_f in, unsigned int flags);
 

+ 3 - 15
lib/kmi/tree.h

@@ -23,6 +23,7 @@
  * History:
  * ---------
  *  2006-09-08  first version (bogdan)
+ *  2010-08-18  use mi types from ../../mi/mi_types.h (andrei)
  */
 
 /*!
@@ -39,6 +40,7 @@
 
 #include <stdarg.h>
 #include "../../str.h"
+#include "../../mi/mi_types.h"
 
 struct mi_node;
 struct mi_handler;
@@ -63,21 +65,7 @@ struct mi_handler;
 #define MI_MISSING_PARM       MI_MISSING_PARM_S
 #define MI_BAD_PARM           MI_BAD_PARM_S
 
-struct mi_node {
-	str value;
-	str name;
-	struct mi_node *kids;
-	struct mi_node *next;
-	struct mi_node *last;
-	struct mi_attr *attributes;
-};
-
-struct mi_root {
-	unsigned int       code;
-	str                reason;
-	struct mi_handler  *async_hdl;
-	struct mi_node     node;
-};
+
 
 struct mi_root *init_mi_tree(unsigned int code, char *reason, int reason_len);
 

+ 0 - 35
mi/mi.h

@@ -1,35 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2008 iptelorg GmbH
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * mi compatibility wrapper for kamailio
- * for now it doesn't do anything, it just a compile helper
- * (obsolete, do not use anymore)
- *
- * History:
- * --------
- *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
- */
-
-#ifndef _mi_h_
-#define _mi_h_
-
-#include "../lib/kmi/mi.h"
-
-#endif /* _mi_h_ */
-
-

+ 80 - 0
mi/mi_types.h

@@ -0,0 +1,80 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * mi compatibility wrapper for kamailio
+ * It contains only the type definition, needed for loading kamilio modules
+ * (used by sr_module.c).
+ * Note that MI usage in new modules is opsolete. They should implement RPCs
+ * instead. To use MI include lib/kmi/mi.h and link with lib kmi.
+ *
+ * History:
+ * --------
+ *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
+ *  2010-08-18  remove everything but the  data types definition (andrei)
+ */
+
+#ifndef _mi_h_
+#define _mi_h_
+
+#include "../str.h"
+
+struct mi_node {
+	str value;
+	str name;
+	struct mi_node *kids;
+	struct mi_node *next;
+	struct mi_node *last;
+	struct mi_attr *attributes;
+};
+
+
+struct mi_handler;
+
+struct mi_root {
+	unsigned int       code;
+	str                reason;
+	struct mi_handler  *async_hdl;
+	struct mi_node     node;
+};
+
+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);
+
+/* FIXME
+struct mi_handler {
+	mi_handler_f *handler_f;
+	void * param;
+};
+*/
+
+
+struct mi_export_ {
+	char *name;
+	mi_cmd_f *cmd;
+	unsigned int flags;
+	void *param;
+	mi_child_init_f *init_f;
+};
+
+typedef struct mi_export_ mi_export_t;
+
+
+#endif /* _mi_h_ */
+
+

+ 1 - 1
sr_module.h

@@ -69,7 +69,7 @@
 
 /* kamailio compat */
 #include "statistics.h"
-#include "mi/mi.h"
+#include "mi/mi_types.h"
 #include "pvar.h"