outbound.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * This file is part of the Sofia-SIP package
  3. *
  4. * Copyright (C) 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. #ifndef OUTBOUND_H
  25. /** Defined when <outbound.h> has been included. */
  26. #define OUTBOUND_H
  27. /**@IFILE outbound.h
  28. *
  29. * @brief Interface to SIP NAT traversal and outbound
  30. *
  31. * @author Pekka Pessi <Pekka.Pessi@nokia.com>
  32. *
  33. * @date Created: Wed May 10 12:01:38 EEST 2006 ppessi
  34. */
  35. #ifndef SU_CONFIG_H
  36. #include <sofia-sip/su_config.h>
  37. #endif
  38. #ifndef NTA_H
  39. #include <sofia-sip/nta.h>
  40. #endif
  41. #ifndef AUTH_CLIENT_H
  42. #include <sofia-sip/auth_client.h>
  43. #endif
  44. SOFIA_BEGIN_DECLS
  45. /* ====================================================================== */
  46. /* Outbound connection */
  47. #ifndef OUTBOUND_OWNER_T
  48. #define OUTBOUND_OWNER_T struct nua_handle_s /* Just for now */
  49. #endif
  50. typedef struct outbound outbound_t;
  51. typedef struct outbound_owner_vtable outbound_owner_vtable;
  52. typedef OUTBOUND_OWNER_T outbound_owner_t;
  53. outbound_t *outbound_new(outbound_owner_t *owner,
  54. outbound_owner_vtable const *owner_methods,
  55. su_root_t *root,
  56. nta_agent_t *agent,
  57. char const *instance);
  58. void outbound_unref(outbound_t *ob);
  59. int outbound_set_options(outbound_t *ob,
  60. char const *options,
  61. unsigned dgram_interval,
  62. unsigned stream_interval);
  63. int outbound_set_proxy(outbound_t *ob,
  64. url_string_t *proxy);
  65. int outbound_get_contacts(outbound_t *ob,
  66. sip_contact_t **return_current_contact,
  67. sip_contact_t **return_previous_contact);
  68. int outbound_start_registering(outbound_t *ob);
  69. int outbound_register_response(outbound_t *ob,
  70. int terminating,
  71. sip_t const *request,
  72. sip_t const *response);
  73. /** Return values for outbound_register_response(). */
  74. enum {
  75. ob_register_error = -1, /* Or anything below zero */
  76. ob_register_ok = 0, /* No need to re-register */
  77. ob_reregister = 1, /* Re-register when oo_refresh() is called */
  78. ob_reregister_now = 2 /* Re-register immediately */
  79. };
  80. int outbound_set_contact(outbound_t *ob,
  81. sip_contact_t const *application_contact,
  82. sip_via_t const *v,
  83. int terminating);
  84. sip_contact_t const *outbound_dialog_contact(outbound_t const *ob);
  85. sip_contact_t const *outbound_dialog_gruu(outbound_t const *ob);
  86. int outbound_gruuize(outbound_t *ob, sip_t const *sip);
  87. void outbound_start_keepalive(outbound_t *ob,
  88. nta_outgoing_t *register_trans);
  89. void outbound_stop_keepalive(outbound_t *ob);
  90. int outbound_targeted_request(sip_t const *sip);
  91. int outbound_process_request(outbound_t *ob,
  92. nta_incoming_t *irq,
  93. sip_t const *sip);
  94. void outbound_peer_info(outbound_t *ob, sip_t const *sip);
  95. struct outbound_owner_vtable
  96. {
  97. int oo_size;
  98. sip_contact_t *(*oo_contact)(outbound_owner_t *,
  99. su_home_t *home,
  100. int used_in_dialog,
  101. sip_via_t const *v,
  102. char const *transport,
  103. char const *m_param,
  104. ...);
  105. int (*oo_refresh)(outbound_owner_t *, outbound_t *ob);
  106. int (*oo_status)(outbound_owner_t *, outbound_t *ob,
  107. int status, char const *phrase,
  108. tag_type_t tag, tag_value_t value, ...);
  109. int (*oo_probe_error)(outbound_owner_t *, outbound_t *ob,
  110. int status, char const *phrase,
  111. tag_type_t tag, tag_value_t value, ...);
  112. int (*oo_keepalive_error)(outbound_owner_t *, outbound_t *ob,
  113. int status, char const *phrase,
  114. tag_type_t tag, tag_value_t value, ...);
  115. int (*oo_credentials)(outbound_owner_t *, auth_client_t **auc);
  116. };
  117. SOFIA_END_DECLS
  118. #endif /* OUTBOUND_H */