tsip_header_Contact.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO 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 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO 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 DOUBANGO.
  20. *
  21. */
  22. /**@file tsip_header_Contact.h
  23. * @brief SIP header 'Contact' as per RFC 3261 subclause 20.1.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef _TSIP_HEADER_CONTACT_H_
  29. #define _TSIP_HEADER_CONTACT_H_
  30. #include "tinysip_config.h"
  31. #include "tinysip/tsip_uri.h"
  32. #include "tinysip/headers/tsip_header.h"
  33. TSIP_BEGIN_DECLS
  34. ////////////////////////////////////////////////////////////////////////////////////////////////////
  35. ///
  36. /// @brief SIP header 'Contact'.
  37. ///
  38. /// @par ABNF: Contact = ( "Contact" / "m" ) HCOLON ( STAR / (contact-param *(COMMA contact-param)))
  39. /// contact-param = (name-addr / addr-spec) *( SEMI contact-params)
  40. /// contact-params = c-p-q / c-p-expires / feature-param / temp-gruu / pub-gruu / c-p-instance / contact-extension
  41. /// c-p-q = "q" EQUAL qvalue
  42. /// c-p-expires = "expires" EQUAL delta-seconds
  43. /// feature-param = enc-feature-tag [ EQUAL LDQUOT (tag-value-list / string-value) RDQUOT ]
  44. /// enc-feature-tag = base-tags / other-tags
  45. /// base-tags = "audio" / "automata" / "class" / "duplex" / "data" / "control" / "mobility" / "description" / "events" / "priority" / "methods" / "schemes" / "application" / "video" / "language" / "type" / "isfocus" / "actor" / "text" / "extensions"
  46. /// other-tags = "+" ftag-name
  47. /// ftag-name = ALPHA *( ALPHA / DIGIT / "!" / "'" / "." / "-" / "%" )
  48. /// tag-value-list = tag-value *("," tag-value)
  49. /// tag-value = ["!"] (token-nobang / boolean / numeric)
  50. /// token-nobang = 1*( alphanum / "-" / "." / "%" / "*" / "_" / "+" / "`" / "'" / "~" )
  51. /// boolean = "TRUE" / "FALSE"
  52. /// numeric = "#" numeric-relation number
  53. /// numeric-relation = ">=" / "<=" / "=" / (number ":")
  54. /// number = [ "+" / "-" ] 1*DIGIT ["." 0*DIGIT]
  55. /// string-value = "<" *(qdtext-no-abkt / quoted-pair ) ">"
  56. /// qdtext-no-abkt = LWS / %x21 / %x23-3B / %x3D / %x3F-5B / %x5D-7E / UTF8-NONASCII
  57. /// temp-gruu = "temp-gruu" EQUAL LDQUOT *( qdtext / quoted-pair ) RDQUOT
  58. /// pub-gruu = "pub-gruu" EQUAL LDQUOT *( qdtext / quoted-pair ) RDQUOT
  59. /// c-p-instance = "+sip.instance" EQUAL LDQUOT "<" instance-val ">" RDQUOT
  60. /// instance-val = *uric
  61. /// contact-extension = generic-param
  62. ///
  63. ////////////////////////////////////////////////////////////////////////////////////////////////////
  64. typedef struct tsip_header_Contact_s {
  65. TSIP_DECLARE_HEADER;
  66. char *display_name;
  67. tsip_uri_t *uri;
  68. int64_t expires;
  69. }
  70. tsip_header_Contact_t;
  71. typedef tsk_list_t tsip_header_Contacts_L_t;
  72. TINYSIP_API tsip_header_Contact_t* tsip_header_Contact_create();
  73. TINYSIP_API tsip_header_Contacts_L_t *tsip_header_Contact_parse(const char *data, tsk_size_t size);
  74. TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Contact_def_t;
  75. TSIP_END_DECLS
  76. #endif /* _TSIP_HEADER_CONTACT_H_ */