mi_types.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2008 iptelorg GmbH
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 /*
00019  * mi compatibility wrapper for kamailio
00020  * It contains only the type definition, needed for loading kamilio modules
00021  * (used by sr_module.c).
00022  * Note that MI usage in new modules is opsolete. They should implement RPCs
00023  * instead. To use MI include lib/kmi/mi.h and link with lib kmi.
00024  *
00025  * History:
00026  * --------
00027  *  2008-11-17  initial version compatible with kamailio mi/mi.h (andrei)
00028  *  2010-08-18  remove everything but the  data types definition (andrei)
00029  */
00030 
00031 #ifndef _mi_h_
00032 #define _mi_h_
00033 
00034 #include "../str.h"
00035 
00036 struct mi_node {
00037         str value;
00038         str name;
00039         struct mi_node *kids;
00040         struct mi_node *next;
00041         struct mi_node *last;
00042         struct mi_attr *attributes;
00043 };
00044 
00045 
00046 struct mi_handler;
00047 
00048 struct mi_root {
00049         unsigned int       code;
00050         str                reason;
00051         struct mi_handler  *async_hdl;
00052         struct mi_node     node;
00053 };
00054 
00055 typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
00056 typedef int (mi_child_init_f)(void);
00057 typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
00058 
00059 /* FIXME
00060 struct mi_handler {
00061         mi_handler_f *handler_f;
00062         void * param;
00063 };
00064 */
00065 
00066 
00067 struct mi_export_ {
00068         char *name;
00069         mi_cmd_f *cmd;
00070         unsigned int flags;
00071         void *param;
00072         mi_child_init_f *init_f;
00073 };
00074 
00075 typedef struct mi_export_ mi_export_t;
00076 
00077 
00078 #endif /* _mi_h_ */
00079 
00080