mi/mi.h

Go to the documentation of this file.
00001 /*
00002  * $Id: mi.h 5003 2008-09-26 11:01:51Z henningw $
00003  *
00004  * Copyright (C) 2006 Voice Sistem SRL
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021  *
00022  *
00023  * History:
00024  * ---------
00025  *  2006-09-08  first version (bogdan)
00026  */
00027 
00028 /*!
00029  * \file 
00030  * \brief MI :: Management
00031  * \ingroup mi
00032  */
00033 
00034 
00035 #ifndef _MI_MI_H_
00036 #define _MI_MI_H_
00037 
00038 #include "../str.h"
00039 #include "tree.h"
00040 
00041 #define MI_ASYNC_RPL_FLAG   (1<<0)
00042 #define MI_NO_INPUT_FLAG    (1<<1)
00043 
00044 #define MI_ROOT_ASYNC_RPL   ((struct mi_root*)-1)
00045 
00046 struct mi_handler;
00047 
00048 typedef struct mi_root* (mi_cmd_f)(struct mi_root*, void *param);
00049 typedef int (mi_child_init_f)(void);
00050 typedef void (mi_handler_f)(struct mi_root *, struct mi_handler *, int);
00051 
00052 
00053 struct mi_handler {
00054    mi_handler_f *handler_f;
00055    void * param;
00056 };
00057 
00058 
00059 struct mi_cmd {
00060    int id;
00061    str name;
00062    mi_child_init_f *init_f;
00063    mi_cmd_f *f;
00064    unsigned int flags;
00065    void *param;
00066 };
00067 
00068 
00069 typedef struct mi_export_ {
00070    char *name;
00071    mi_cmd_f *cmd;
00072    unsigned int flags;
00073    void *param;
00074    mi_child_init_f *init_f;
00075 }mi_export_t;
00076 
00077 
00078 int register_mi_cmd( mi_cmd_f f, char *name, void *param,
00079       mi_child_init_f in, unsigned int flags);
00080 
00081 int register_mi_mod( char *mod_name, mi_export_t *mis);
00082 
00083 int init_mi_child(void);
00084 
00085 struct mi_cmd* lookup_mi_cmd( char *name, int len);
00086 
00087 static inline struct mi_root* run_mi_cmd(struct mi_cmd *cmd, struct mi_root *t)
00088 {
00089    return cmd->f( t, cmd->param);
00090 }
00091 
00092 void get_mi_cmds( struct mi_cmd** cmds, int *size);
00093 
00094 #endif
00095 

Generated on Wed May 23 20:00:27 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6