cpl_run.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2001-2003 FhG Fokus
  5. *
  6. * This file is part of ser, a free SIP server.
  7. *
  8. * ser 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. * For a license to use the ser software under conditions
  14. * other than those described here, or to purchase support for this
  15. * software, please contact iptel.org by e-mail at the following addresses:
  16. * [email protected]
  17. *
  18. * ser is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  26. */
  27. #ifndef _CPL_RUN_H
  28. #define _CPL_RUN_H
  29. #include "../../str.h"
  30. #include "../../parser/msg_parser.h"
  31. #define SCRIPT_END 0
  32. #define SCRIPT_DEFAULT 1
  33. #define SCRIPT_TO_BE_CONTINUED 2
  34. #define SCRIPT_RUN_ERROR -1
  35. #define SCRIPT_FORMAT_ERROR -2
  36. #define CPL_RUN_OUTGOING (1<<0)
  37. #define CPL_RUN_INCOMING (1<<1)
  38. #define CPL_IS_STATEFUL (1<<2)
  39. #define CPL_FORCE_STATEFUL (1<<3)
  40. #define CPL_LOC_SET_MODIFIED (1<<5)
  41. #define CPL_PROXY_DONE (1<<6)
  42. #define CPL_RURI_DUPLICATED (1<<10)
  43. #define CPL_TO_DUPLICATED (1<<11)
  44. #define CPL_FROM_DUPLICATED (1<<12)
  45. #define CPL_SUBJECT_DUPLICATED (1<<13)
  46. #define CPL_ORGANIZATION_DUPLICATED (1<<14)
  47. #define CPL_USERAGENT_DUPLICATED (1<<15)
  48. #define CPL_ACCEPTLANG_DUPLICATED (1<<16)
  49. #define CPL_PRIORITY_DUPLICATED (1<<17)
  50. #define STR_NOT_FOUND ((str*)0xffffffff)
  51. struct cpl_interpreter {
  52. unsigned int flags;
  53. str user; /* user */
  54. str script; /* CPL script */
  55. char *ip; /* instruction pointer */
  56. int recv_time; /* receiving time stamp */
  57. struct sip_msg *msg;
  58. struct location *loc_set; /* location set */
  59. /* pointers to the string-headers needed for switches; can point directly
  60. * into the sip_msg structure (if no proxy took places) or to private
  61. * buffers into shm_memory (after a proxy happend); if a hdr is copy into a
  62. * private buffer, a corresponding flag will be set (xxxx_DUPLICATED) */
  63. str *ruri;
  64. str *to;
  65. str *from;
  66. str *subject;
  67. str *organization;
  68. str *user_agent;
  69. str *accept_language;
  70. str *priority;
  71. /* grouped date the is needed when doing proxy */
  72. struct proxy_st {
  73. unsigned short ordering;
  74. unsigned short recurse;
  75. /* I have to know which will be the last location that will be proxy */
  76. struct location *last_to_proxy;
  77. /* shortcuts to the subnodes */
  78. char *busy;
  79. char *noanswer;
  80. char *redirect;
  81. char *failure;
  82. char *default_;
  83. }proxy;
  84. };
  85. struct cpl_interpreter* new_cpl_interpreter( struct sip_msg *msg, str *script);
  86. void free_cpl_interpreter(struct cpl_interpreter *intr);
  87. int cpl_run_script( struct cpl_interpreter *cpl_intr );
  88. #endif