stun_tag.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. * This file is part of the Sofia-SIP package
  3. *
  4. * Copyright (C) 2005-2006 Nokia Corporation.
  5. *
  6. * Contact: Pekka Pessi <pekka.pessi@nokia.com>
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 2.1 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. *
  23. */
  24. /**@internal @CFILE stun_tag.c Tags and tag lists for Offer/Answer Engine
  25. *
  26. * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  27. * @author Martti Mela <Martti.Mela@nokia.com>
  28. * @author Kai Vehmanen <Kai.Vehmanen@nokia.com>
  29. *
  30. * @date Created: Wed Aug 3 20:28:17 EEST 2005
  31. */
  32. #include "config.h"
  33. #define TAG_NAMESPACE "stun"
  34. #include <sofia-sip/su_tag_class.h>
  35. #include <sofia-sip/stun_tag.h>
  36. /**@def STUNTAG_ANY()
  37. *
  38. * Filter tag matching any STUNTAG_*().
  39. */
  40. tag_typedef_t stuntag_any = NSTAG_TYPEDEF(*);
  41. /**@def STUNTAG_DOMAIN(x)
  42. *
  43. * The domain to use in DNS-SRV based STUN server discovery.
  44. * Note: this is commonly the domain part of a public SIP
  45. * address (AOR). See sect 9.1 of RFC3489.
  46. *
  47. * @par Used with
  48. * nua_set_params() \n
  49. * nua_get_params() \n
  50. * nua_invite() \n
  51. * nua_respond()
  52. *
  53. * @par Parameter type
  54. * char const *
  55. */
  56. tag_typedef_t stuntag_domain = STRTAG_TYPEDEF(domain);
  57. /**@def STUNTAG_SERVER(x)
  58. *
  59. * Fully qualified host name, or dotted IP address of the STUN server
  60. * address. If defined, the DNS-SRV based discovery (@see STUNTAG_DOMAIN())
  61. * will be skipped.
  62. *
  63. * @par Used with
  64. * nua_set_params() \n
  65. * nua_get_params() \n
  66. * nua_invite() \n
  67. * nua_respond()
  68. *
  69. * @par Parameter type
  70. * char const *
  71. *
  72. * @par Values
  73. * NULL terminated character string containing a domain name,
  74. * IPv4 address, or IPv6 address.
  75. *
  76. * Corresponding tag taking reference parameter is STUNTAG_SERVER_REF()
  77. */
  78. tag_typedef_t stuntag_server = STRTAG_TYPEDEF(server);
  79. /**@def STUNTAG_REQUIRE_INTEGRITY(x)
  80. *
  81. * Whether to require support for shared-secret based packet
  82. * authentication and integrity checks (see sect 9.2 of RFC3489).
  83. * If false, integrity checks are performed only when server supports it.
  84. *
  85. * @par Used with
  86. * nua_create() \n
  87. *
  88. * @par Parameter type
  89. * int (boolean)
  90. *
  91. * @par Values
  92. * @c !=0 enable
  93. * @c 0 disable
  94. *
  95. * Corresponding tag taking reference parameter is STUNTAG_INTEGRITY_REF()
  96. */
  97. tag_typedef_t stuntag_require_integrity = BOOLTAG_TYPEDEF(require_integrity);
  98. /**@def STUNTAG_INTEGRITY(x)
  99. *
  100. * XXX: should this tag be deprecated in favor of just supporting
  101. * STUNTAG_REQURIE_INTEGRITY() instead...?
  102. */
  103. tag_typedef_t stuntag_integrity = BOOLTAG_TYPEDEF(integrity);
  104. /**@def STUNTAG_SOCKET(x)
  105. *
  106. * Bind socket for STUN.
  107. *
  108. * @par Used with
  109. * stun_handle_bind() \n
  110. *
  111. * @par Parameter type
  112. * int (su_socket_t)
  113. *
  114. * @par Values
  115. * IPv4 (AF_INET) socket
  116. *
  117. * Corresponding tag taking reference parameter is STUNTAG_SOCKET_REF()
  118. */
  119. tag_typedef_t stuntag_socket = SOCKETTAG_TYPEDEF(socket);
  120. /**@def STUNTAG_REGISTER_EVENTS(x)
  121. *
  122. * Register socket events for eventloop owned by STUN.
  123. *
  124. * @par Used with
  125. * stun_bind() \n
  126. * stun_get_lifetime() \n
  127. * stun_get_nattype() \n
  128. * stun_keepalive() \n
  129. *
  130. * @par Parameter type
  131. * bool
  132. *
  133. * @par Values
  134. * false (0) or true (nonzero)
  135. *
  136. * Corresponding tag taking reference parameter is STUNTAG_REGISTER_EVENTS_REF()
  137. */
  138. tag_typedef_t stuntag_register_events = BOOLTAG_TYPEDEF(register_events);
  139. /**@def STUNTAG_ACTION(x)
  140. *
  141. * Command action for STUN request.
  142. *
  143. * @par Used with
  144. * stun_handle_bind() \n
  145. *
  146. * @par Parameter type
  147. * int (stun_action_t)
  148. *
  149. * @par Values
  150. * See types for stun_action_t in <sofia-sip/stun.h>
  151. *
  152. * Corresponding tag taking reference parameter is STUNTAG_ACTION_REF()
  153. */
  154. tag_typedef_t stuntag_action = INTTAG_TYPEDEF(action);
  155. /* ---------------------------------------------------------------------- */
  156. /**@def STUNTAG_CHANGE_IP(x)
  157. *
  158. * Add CHANGE-REQUEST attribute with "change IP" flag to the request.
  159. *
  160. * @par Used with
  161. * stun_make_binding_req() \n
  162. *
  163. * @par Parameter type
  164. * bool
  165. *
  166. * Corresponding tag taking reference parameter is STUNTAG_CHANGE_IP_REF()
  167. */
  168. tag_typedef_t stuntag_change_ip = BOOLTAG_TYPEDEF(change_ip);
  169. /**@def STUNTAG_CHANGE_PORT(x)
  170. *
  171. * Add CHANGE-REQUEST attribute with "change port" flag to the request.
  172. *
  173. * @par Used with
  174. * stun_make_binding_req() \n
  175. *
  176. * @par Parameter type
  177. * bool
  178. *
  179. * Corresponding tag taking reference parameter is STUNTAG_CHANGE_PORT_REF()
  180. */
  181. tag_typedef_t stuntag_change_port = BOOLTAG_TYPEDEF(change_port);
  182. /* ---------------------------------------------------------------------- */
  183. /**@def STUNTAG_TIMEOUT(x)
  184. *
  185. * Timeout controls the launching of the STUN keepalive timer.
  186. *
  187. * @par Used with
  188. * stun_keepalive() \n
  189. *
  190. * @par Parameter type
  191. * int
  192. *
  193. * Corresponding tag taking reference parameter is STUNTAG_TIMEOUT_REF()
  194. */
  195. tag_typedef_t stuntag_timeout = INTTAG_TYPEDEF(timeout);