mi.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * $Id: mi.h 5003 2008-09-26 11:01:51Z henningw $
  3. *
  4. * Copyright (C) 2006 Voice Sistem SRL
  5. *
  6. * This file is part of Kamailio, a free SIP server.
  7. *
  8. * Kamailio is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Kamailio is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  21. *
  22. *
  23. * History:
  24. * ---------
  25. * 2006-09-08 first version (bogdan)
  26. * 2010-08-18 use mi types from ../../mi/mi_types.h (andrei)
  27. */
  28. /*!
  29. * \file
  30. * \brief MI :: Management
  31. * \ingroup mi
  32. */
  33. #ifndef _MI_MI_H_
  34. #define _MI_MI_H_
  35. #include "../../str.h"
  36. #include "../../mi/mi_types.h"
  37. #include "tree.h"
  38. #define MI_ASYNC_RPL_FLAG (1<<0)
  39. #define MI_NO_INPUT_FLAG (1<<1)
  40. #define MI_ROOT_ASYNC_RPL ((struct mi_root*)-1)
  41. struct mi_handler {
  42. mi_handler_f *handler_f;
  43. void * param;
  44. };
  45. struct mi_cmd {
  46. int id;
  47. str name;
  48. mi_child_init_f *init_f;
  49. mi_cmd_f *f;
  50. unsigned int flags;
  51. void *param;
  52. };
  53. int register_mi_cmd( mi_cmd_f f, char *name, void *param,
  54. mi_child_init_f in, unsigned int flags);
  55. int register_mi_mod( char *mod_name, mi_export_t *mis);
  56. int init_mi_child(int rank, int mode);
  57. struct mi_cmd* lookup_mi_cmd( char *name, int len);
  58. static inline struct mi_root* run_mi_cmd(struct mi_cmd *cmd, struct mi_root *t)
  59. {
  60. return cmd->f( t, cmd->param);
  61. }
  62. void get_mi_cmds( struct mi_cmd** cmds, int *size);
  63. int init_mi_core(void);
  64. #endif