hf.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 HF_H
  28. #define HF_H
  29. #include "../str.h"
  30. /* Header types and flags */
  31. #define HDR_EOH -1 /* End of header found */
  32. #define HDR_ERROR 0 /* Error while parsing */
  33. #define HDR_VIA 1 /* Via header field */
  34. #define HDR_VIA1 1 /* First Via header field */
  35. #define HDR_VIA2 (1 << 1) /* only used as flag*/
  36. #define HDR_TO (1 << 2) /* To header field */
  37. #define HDR_FROM (1 << 3) /* From header field */
  38. #define HDR_CSEQ (1 << 4) /* CSeq header field */
  39. #define HDR_CALLID (1 << 5) /* Call-Id header field */
  40. #define HDR_CONTACT (1 << 6) /* Contact header field */
  41. #define HDR_MAXFORWARDS (1 << 7) /* MaxForwards header field */
  42. #define HDR_ROUTE (1 << 8) /* Route header field */
  43. #define HDR_RECORDROUTE (1 << 9) /* Record-Route header field */
  44. #define HDR_CONTENTTYPE (1 << 10) /* Content-Type header field */
  45. #define HDR_CONTENTLENGTH (1 << 11) /* Content-Length header field */
  46. #define HDR_AUTHORIZATION (1 << 12) /* Authorization header field */
  47. #define HDR_EXPIRES (1 << 13) /* Expires header field */
  48. #define HDR_PROXYAUTH (1 << 14) /* Proxy-Authorization header field */
  49. #define HDR_WWWAUTH (1 << 15) /* WWW-Authorization header field */
  50. #define HDR_SUPPORTED (1 << 16) /* Supported header field */
  51. #define HDR_REQUIRE (1 << 17) /* Require header field */
  52. #define HDR_PROXYREQUIRE (1 << 18) /* Proxy-Require header field */
  53. #define HDR_UNSUPPORTED (1 << 19) /* Unsupported header field */
  54. #define HDR_ALLOW (1 << 20) /* Allow header field */
  55. #define HDR_EVENT (1 << 21) /* Event header field */
  56. #define HDR_OTHER (1 << 22) /* Some other header field */
  57. /*
  58. * Format: name':' body
  59. */
  60. struct hdr_field {
  61. int type; /* Header field type */
  62. str name; /* Header field name */
  63. str body; /* Header field body */
  64. void* parsed; /* Parsed data structures */
  65. struct hdr_field* next; /* Next header field in the list */
  66. };
  67. /* frees a hdr_field structure,
  68. * WARNING: it frees only parsed (and not name.s, body.s)
  69. */
  70. void clean_hdr_field(struct hdr_field* hf);
  71. /* frees a hdr_field list,
  72. * WARNING: frees only ->parsed and ->next
  73. */
  74. void free_hdr_field_lst(struct hdr_field* hf);
  75. void dump_hdr_field( struct hdr_field* hf );
  76. #endif /* HF_H */