action.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * $Id$
  3. *
  4. *
  5. * Copyright (C) 2001-2003 FhG Fokus
  6. *
  7. * This file is part of ser, a free SIP server.
  8. *
  9. * ser is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. * For a license to use the ser software under conditions
  15. * other than those described here, or to purchase support for this
  16. * software, please contact iptel.org by e-mail at the following addresses:
  17. * [email protected]
  18. *
  19. * ser is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  27. */
  28. /*!
  29. * \file
  30. * \brief SIP-router core ::
  31. * \ingroup core
  32. * Module: \ref core
  33. */
  34. #ifndef action_h
  35. #define action_h
  36. #define USE_LONGJMP
  37. #include "route_struct.h"
  38. #include "parser/msg_parser.h"
  39. #ifdef USE_LONGJMP
  40. #include <setjmp.h>
  41. #endif
  42. struct run_act_ctx{
  43. int rec_lev;
  44. int run_flags;
  45. int last_retcode; /* return from last route */
  46. #ifdef USE_LONGJMP
  47. jmp_buf jmp_env;
  48. #endif
  49. };
  50. #define init_run_actions_ctx(ph) \
  51. do{\
  52. (ph)->rec_lev=(ph)->run_flags=(ph)->last_retcode=0; \
  53. }while(0)
  54. int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
  55. int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
  56. int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
  57. cfg_action_t *get_cfg_crt_action(void);
  58. int get_cfg_crt_line(void);
  59. char *get_cfg_crt_name(void);
  60. void set_max_recursive_level(unsigned int lev);
  61. #ifdef USE_LONGJMP
  62. int run_actions_safe(struct run_act_ctx* c, struct action* a,
  63. struct sip_msg* msg);
  64. #else /*! USE_LONGJMP */
  65. #define run_actions_safe(c, a, m) run_actions(c, a, m)
  66. #endif /* USE_LONGJMP */
  67. void log_prefix_set(sip_msg_t *msg);
  68. #endif