2
0

parse_fline.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. */
  27. /*! \file
  28. * \brief Parser :: SIP first line parsing automaton
  29. *
  30. * \ingroup parser
  31. */
  32. #ifndef PARSE_FLINE_H
  33. #define PARSE_FLINE_H
  34. #include "../str.h"
  35. /* Message is request */
  36. #define SIP_REQUEST 1
  37. /* Message is reply */
  38. #define SIP_REPLY 2
  39. /* Invalid message */
  40. #define SIP_INVALID 0
  41. #define SIP_VERSION "SIP/2.0"
  42. #define SIP_VERSION_LEN 7
  43. #define HTTP_VERSION "HTTP/1."
  44. #define HTTP_VERSION_LEN (sizeof(HTTP_VERSION)-1)
  45. #define CANCEL "CANCEL"
  46. #define ACK "ACK"
  47. #define INVITE "INVITE"
  48. #define INVITE_LEN 6
  49. #define CANCEL_LEN 6
  50. #define ACK_LEN 3
  51. #define BYE_LEN 3
  52. #define INFO_LEN 4
  53. #define REGISTER_LEN 8
  54. #define SUBSCRIBE_LEN 9
  55. #define NOTIFY_LEN 6
  56. #define MESSAGE_LEN 7
  57. #define OPTIONS_LEN 7
  58. #define PRACK_LEN 5
  59. #define UPDATE_LEN 6
  60. #define REFER_LEN 5
  61. #define PUBLISH_LEN 7
  62. struct msg_start {
  63. int type; /*!< Type of the Message - Request/Response */
  64. int len; /*!< length including delimiter */
  65. union {
  66. struct {
  67. str method; /*!< Method string */
  68. str uri; /*!< Request URI */
  69. str version; /*!< SIP version */
  70. int method_value;
  71. } request;
  72. struct {
  73. str version; /*!< SIP version */
  74. str status; /*!< Reply status */
  75. str reason; /*!< Reply reason phrase */
  76. unsigned int /*!< statusclass,*/ statuscode;
  77. } reply;
  78. }u;
  79. };
  80. char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl);
  81. char* parse_fline(char* buffer, char* end, struct msg_start* fl);
  82. #endif /* PARSE_FLINE_H */