udptl.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * UDPTL support for T.38
  5. *
  6. * Copyright (C) 2005, Steve Underwood, partly based on RTP code which is
  7. * Copyright (C) 1999-2004, Digium, Inc.
  8. *
  9. * Steve Underwood <steveu@coppice.org>
  10. *
  11. * This program is free software, distributed under the terms of
  12. * the GNU General Public License
  13. *
  14. * A license has been granted to Digium (via disclaimer) for the use of
  15. * this code.
  16. */
  17. /*! \file
  18. * \brief UDPTL support for T.38
  19. * \author Steve Underwood <steveu@coppice.org>
  20. * \ref udptl.c
  21. * \todo add doxygen documentation to this file!
  22. */
  23. #ifndef _ASTERISK_UDPTL_H
  24. #define _ASTERISK_UDPTL_H
  25. #include "asterisk/network.h"
  26. #include "asterisk/frame.h"
  27. #include "asterisk/io.h"
  28. #include "asterisk/sched.h"
  29. #include "asterisk/channel.h"
  30. #include "asterisk/netsock2.h"
  31. enum ast_t38_ec_modes {
  32. UDPTL_ERROR_CORRECTION_NONE,
  33. UDPTL_ERROR_CORRECTION_FEC,
  34. UDPTL_ERROR_CORRECTION_REDUNDANCY
  35. };
  36. #if defined(__cplusplus) || defined(c_plusplus)
  37. extern "C" {
  38. #endif
  39. struct ast_udptl;
  40. typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
  41. struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in);
  42. /*!
  43. * \brief Associates a character string 'tag' with a UDPTL session.
  44. * \param udptl The UDPTL session.
  45. * \param format printf-style format string used to construct the tag
  46. *
  47. * This function formats a tag for the specified UDPTL
  48. * session, so that any log messages generated by the UDPTL stack
  49. * related to that session will include the tag and the reader of
  50. * the messages will be able to identify which endpoint caused them
  51. * to be generated.
  52. *
  53. * \retval none
  54. */
  55. void __attribute__((format(printf, 2, 3))) ast_udptl_set_tag(struct ast_udptl *udptl, const char *format, ...);
  56. void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them);
  57. void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them);
  58. void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us);
  59. void ast_udptl_destroy(struct ast_udptl *udptl);
  60. void ast_udptl_reset(struct ast_udptl *udptl);
  61. void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback);
  62. void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
  63. int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
  64. struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
  65. int ast_udptl_fd(const struct ast_udptl *udptl);
  66. int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos);
  67. void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt);
  68. void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt,
  69. char *mimeType, char *mimeSubtype);
  70. enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl);
  71. void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec);
  72. void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
  73. /*!
  74. * \brief retrieves local_max_datagram.
  75. *
  76. * \retval positive value representing max datagram size.
  77. * \retval 0 if no value is present
  78. */
  79. unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
  80. /*!
  81. * \brief sets far max datagram size. If max_datagram is = 0, the far max datagram
  82. * size is set to a default value.
  83. */
  84. void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram);
  85. unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
  86. /*!
  87. * \brief retrieves far max ifp
  88. *
  89. * \retval positive value representing max ifp size
  90. * \retval 0 if no value is present
  91. */
  92. unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
  93. void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
  94. void ast_udptl_stop(struct ast_udptl *udptl);
  95. void ast_udptl_init(void);
  96. /*!
  97. * \version 1.6.1 return changed to int
  98. */
  99. int ast_udptl_reload(void);
  100. #if defined(__cplusplus) || defined(c_plusplus)
  101. }
  102. #endif
  103. #endif