parse_fline.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #ifndef PARSE_FLINE_H
  28. #define PARSE_FLINE_H
  29. #include "../str.h"
  30. /* Message is request */
  31. #define SIP_REQUEST 1
  32. /* Message is reply */
  33. #define SIP_REPLY 2
  34. /* Invalid message */
  35. #define SIP_INVALID 0
  36. #define SIP_VERSION "SIP/2.0"
  37. #define SIP_VERSION_LEN 7
  38. #define CANCEL "CANCEL"
  39. #define ACK "ACK"
  40. #define INVITE "INVITE"
  41. #define INVITE_LEN 6
  42. #define CANCEL_LEN 6
  43. #define ACK_LEN 3
  44. #define BYE_LEN 3
  45. struct msg_start {
  46. int type; /* Type of the Message - Request/Response */
  47. union {
  48. struct {
  49. str method; /* Method string */
  50. str uri; /* Request URI */
  51. str version; /* SIP version */
  52. int method_value;
  53. } request;
  54. struct {
  55. str version; /* SIP version */
  56. str status; /* Reply status */
  57. str reason; /* Reply reason phrase */
  58. unsigned int /* statusclass,*/ statuscode;
  59. } reply;
  60. }u;
  61. };
  62. char* parse_first_line(char* buffer, unsigned int len, struct msg_start * fl);
  63. char* parse_fline(char* buffer, char* end, struct msg_start* fl);
  64. #endif /* PARSE_FLINE_H */