sanity.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * $Id$
  3. *
  4. * Sanity Checks Module
  5. *
  6. * Copyright (C) 2006 iptelorg GbmH
  7. *
  8. * This file is part of ser, a free SIP server.
  9. *
  10. * ser is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * For a license to use the ser software under conditions
  16. * other than those described here, or to purchase support for this
  17. * software, please contact iptel.org by e-mail at the following addresses:
  18. * [email protected]
  19. *
  20. * ser is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  28. *
  29. */
  30. #ifndef SANITY_CHK_H
  31. #define SANITY_CHK_H
  32. #include "mod_sanity.h"
  33. #define SIP_VERSION_TWO_POINT_ZERO "2.0"
  34. #define SIP_VERSION_TWO_POINT_ZERO_LENGTH 3
  35. /* check if the given string is a valid unsigned int value
  36. * and converts it into _result. returns -1 on error and 0 on success*/
  37. int str2valid_uint(str* _number, unsigned int* _result);
  38. /* parses the given comma seperated string into a string list */
  39. strl* parse_str_list(str* _string);
  40. /* compare the protocol string in the Via header with the transport */
  41. int check_via_protocol(struct sip_msg* _msg);
  42. /* check if the SIP version in the Via header is 2.0 */
  43. int check_via_sip_version(struct sip_msg* _msg);
  44. /* compare the Content-Length value with the accutal body length */
  45. int check_cl(struct sip_msg* _msg);
  46. /* compare the method in the CSeq header with the request line value */
  47. int check_cseq_method(struct sip_msg* _msg);
  48. /* check the number within the CSeq header */
  49. int check_cseq_value(struct sip_msg* _msg);
  50. /* check the number within the Expires header */
  51. int check_expires_value(struct sip_msg* _msg);
  52. /* check for the presence of the minimal required headers */
  53. int check_required_headers(struct sip_msg* _msg);
  54. /* check the content of the Proxy-Require header */
  55. int check_proxy_require(struct sip_msg* _msg);
  56. /* check the SIP version in the request URI */
  57. int check_ruri_sip_version(struct sip_msg* _msg);
  58. /* check if the r-uri scheme */
  59. int check_ruri_scheme(struct sip_msg* _msg);
  60. /* check if the typical URIs are parseable */
  61. int check_parse_uris(struct sip_msg* _msg, int checks);
  62. /* Make sure that username attribute in all digest credentials
  63. * instances has a meaningful value
  64. */
  65. int check_digest(struct sip_msg* _msg, int checks);
  66. /* check if there are duplicate tag params in From/To headers */
  67. int check_duptags(sip_msg_t* _msg);
  68. #endif /* SANITY_CHK_H */