parse_date.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (c) 2007 iptelorg GmbH
  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. * ser is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. /*! \file
  23. * \brief Parser :: Date header
  24. *
  25. * \ingroup parser
  26. */
  27. #ifndef PARSE_DATE
  28. #define PARSE_DATE
  29. #include <time.h>
  30. #include "msg_parser.h"
  31. #define RFC1123DATELENGTH 29
  32. struct date_body{
  33. int error; /* Error code */
  34. struct tm date;
  35. };
  36. /* casting macro for accessing DATE body */
  37. #define get_date(p_msg) ((struct date_body*)(p_msg)->date->parsed)
  38. /*
  39. * Parse Date header field
  40. */
  41. void parse_date(char *buf, char *end, struct date_body *db);
  42. int parse_date_header(struct sip_msg *msg);
  43. /*
  44. * Free all associated memory
  45. */
  46. void free_date(struct date_body *db);
  47. #endif