Module: sip-router Branch: master Commit: 627a1969b49446360f227fe23c56b80683145e5f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=627a1969...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Wed Aug 18 19:54:09 2010 +0200
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).
---
lib/kmi/mi.h | 16 +---------- lib/kmi/tree.h | 18 ++---------- mi/mi.h | 35 ------------------------ mi/mi_types.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sr_module.h | 2 +- 5 files changed, 86 insertions(+), 65 deletions(-)
diff --git a/lib/kmi/mi.h b/lib/kmi/mi.h index 5c0ac19..988bcd1 100644 --- a/lib/kmi/mi.h +++ b/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);
diff --git a/lib/kmi/tree.h b/lib/kmi/tree.h index 4a42823..ef6e657 100644 --- a/lib/kmi/tree.h +++ b/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);
diff --git a/mi/mi.h b/mi/mi.h deleted file mode 100644 index b3c106f..0000000 --- a/mi/mi.h +++ /dev/null @@ -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_ */ - - diff --git a/mi/mi_types.h b/mi/mi_types.h new file mode 100644 index 0000000..4da303c --- /dev/null +++ b/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_ */ + + diff --git a/sr_module.h b/sr_module.h index 1940a96..baf1081 100644 --- a/sr_module.h +++ b/sr_module.h @@ -69,7 +69,7 @@
/* kamailio compat */ #include "statistics.h" -#include "mi/mi.h" +#include "mi/mi_types.h" #include "pvar.h"