lib/kmi/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  *  2010-08-18  use mi types from ../../mi/mi_types.h (andrei)
00027  */
00028 
00036 #ifndef _MI_MI_H_
00037 #define _MI_MI_H_
00038 
00039 #include "../../str.h"
00040 #include "../../mi/mi_types.h"
00041 #include "tree.h"
00042 
00043 #define MI_ASYNC_RPL_FLAG   (1<<0)
00044 #define MI_NO_INPUT_FLAG    (1<<1)
00045 
00046 #define MI_ROOT_ASYNC_RPL   ((struct mi_root*)-1)
00047 
00048 
00049 
00050 struct mi_handler {
00051         mi_handler_f *handler_f;
00052         void * param;
00053 };
00054 
00055 
00056 struct mi_cmd {
00057         int id;
00058         str name;
00059         mi_child_init_f *init_f;
00060         mi_cmd_f *f;
00061         unsigned int flags;
00062         void *param;
00063 };
00064 
00065 
00066 int register_mi_cmd( mi_cmd_f f, char *name, void *param,
00067                 mi_child_init_f in, unsigned int flags);
00068 
00069 int register_mi_mod( char *mod_name, mi_export_t *mis);
00070 
00071 int init_mi_child(int rank, int mode);
00072 
00073 struct mi_cmd* lookup_mi_cmd( char *name, int len);
00074 
00075 static inline struct mi_root* run_mi_cmd(struct mi_cmd *cmd, struct mi_root *t)
00076 {
00077         return cmd->f( t, cmd->param);
00078 }
00079 
00080 void get_mi_cmds( struct mi_cmd** cmds, int *size);
00081 
00082 int init_mi_core(void);
00083 
00084 #endif
00085