cpl_run.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  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. #ifndef _CPL_RUN_H
  23. #define _CPL_RUN_H
  24. #include "../../str.h"
  25. #include "../../parser/msg_parser.h"
  26. #define SCRIPT_END 0
  27. #define SCRIPT_DEFAULT 1
  28. #define SCRIPT_TO_BE_CONTINUED 2
  29. #define SCRIPT_RUN_ERROR -1
  30. #define SCRIPT_FORMAT_ERROR -2
  31. #define CPL_RUN_OUTGOING (1<<0)
  32. #define CPL_RUN_INCOMING (1<<1)
  33. #define CPL_IS_STATEFUL (1<<2)
  34. #define CPL_FORCE_STATEFUL (1<<3)
  35. #define CPL_LOC_SET_MODIFIED (1<<5)
  36. #define CPL_PROXY_DONE (1<<6)
  37. #define CPL_RURI_DUPLICATED (1<<10)
  38. #define CPL_TO_DUPLICATED (1<<11)
  39. #define CPL_FROM_DUPLICATED (1<<12)
  40. #define CPL_SUBJECT_DUPLICATED (1<<13)
  41. #define CPL_ORGANIZATION_DUPLICATED (1<<14)
  42. #define CPL_USERAGENT_DUPLICATED (1<<15)
  43. #define CPL_ACCEPTLANG_DUPLICATED (1<<16)
  44. #define CPL_PRIORITY_DUPLICATED (1<<17)
  45. #define STR_NOT_FOUND ((str*)0xffffffff)
  46. struct cpl_interpreter {
  47. unsigned int flags;
  48. str user; /* user */
  49. str script; /* CPL script */
  50. char *ip; /* instruction pointer */
  51. int recv_time; /* receiving time stamp */
  52. struct sip_msg *msg;
  53. struct location *loc_set; /* location set */
  54. /* pointers to the string-headers needed for switches; can point directly
  55. * into the sip_msg structure (if no proxy took places) or to private
  56. * buffers into shm_memory (after a proxy happend); if a hdr is copy into a
  57. * private buffer, a corresponding flag will be set (xxxx_DUPLICATED) */
  58. str *ruri;
  59. str *to;
  60. str *from;
  61. str *subject;
  62. str *organization;
  63. str *user_agent;
  64. str *accept_language;
  65. str *priority;
  66. /* grouped date the is needed when doing proxy */
  67. struct proxy_st {
  68. unsigned short ordering;
  69. unsigned short recurse;
  70. /* I have to know which will be the last location that will be proxy */
  71. struct location *last_to_proxy;
  72. /* shortcuts to the subnodes */
  73. char *busy;
  74. char *noanswer;
  75. char *redirect;
  76. char *failure;
  77. char *default_;
  78. }proxy;
  79. };
  80. struct cpl_interpreter* new_cpl_interpreter( struct sip_msg *msg, str *script);
  81. void free_cpl_interpreter(struct cpl_interpreter *intr);
  82. int cpl_run_script( struct cpl_interpreter *cpl_intr );
  83. #endif