Wed Jan 27 20:02:16 2016

Asterisk developer's documentation


udptl.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- A telephony toolkit for Linux.
00003  *
00004  * UDPTL support for T.38
00005  * 
00006  * Copyright (C) 2005, Steve Underwood, partly based on RTP code which is
00007  * Copyright (C) 1999-2004, Digium, Inc.
00008  *
00009  * Steve Underwood <steveu@coppice.org>
00010  *
00011  * This program is free software, distributed under the terms of
00012  * the GNU General Public License
00013  *
00014  * A license has been granted to Digium (via disclaimer) for the use of
00015  * this code.
00016  */
00017 
00018 /*! \file
00019  * \brief UDPTL support for T.38
00020  * \author Steve Underwood <steveu@coppice.org>
00021  * \ref udptl.c
00022  * \todo add doxygen documentation to this file!
00023  */
00024 
00025 
00026 #ifndef _ASTERISK_UDPTL_H
00027 #define _ASTERISK_UDPTL_H
00028 
00029 #include "asterisk/network.h"
00030 #include "asterisk/frame.h"
00031 #include "asterisk/io.h"
00032 #include "asterisk/sched.h"
00033 #include "asterisk/channel.h"
00034 #include "asterisk/netsock2.h"
00035 
00036 
00037 enum ast_t38_ec_modes {
00038     UDPTL_ERROR_CORRECTION_NONE,
00039     UDPTL_ERROR_CORRECTION_FEC,
00040     UDPTL_ERROR_CORRECTION_REDUNDANCY
00041 };
00042 
00043 #if defined(__cplusplus) || defined(c_plusplus)
00044 extern "C" {
00045 #endif
00046 
00047 struct ast_udptl_protocol {
00048    /*! \brief Get UDPTL struct, or NULL if unwilling to transfer */
00049    struct ast_udptl *(*get_udptl_info)(struct ast_channel *chan);
00050    /*! \brief Set UDPTL peer */
00051    int (* const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer);
00052    const char * const type;
00053    AST_RWLIST_ENTRY(ast_udptl_protocol) list;
00054 };
00055 
00056 struct ast_udptl;
00057 
00058 typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
00059 
00060 struct ast_udptl *ast_udptl_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in);
00061 
00062 /*!
00063  * \brief Associates a character string 'tag' with a UDPTL session.
00064  * \param udptl The UDPTL session.
00065  * \param format printf-style format string used to construct the tag
00066  * 
00067  * This function formats a tag for the specified UDPTL
00068  * session, so that any log messages generated by the UDPTL stack
00069  * related to that session will include the tag and the reader of
00070  * the messages will be able to identify which endpoint caused them
00071  * to be generated.
00072  *
00073  * \retval none
00074  */
00075 void __attribute__((format(printf, 2, 3))) ast_udptl_set_tag(struct ast_udptl *udptl, const char *format, ...);
00076 
00077 void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them);
00078 
00079 void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them);
00080 
00081 void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us);
00082 
00083 void ast_udptl_destroy(struct ast_udptl *udptl);
00084 
00085 void ast_udptl_reset(struct ast_udptl *udptl);
00086 
00087 void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback);
00088 
00089 void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
00090 
00091 int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
00092 
00093 struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
00094 
00095 int ast_udptl_fd(const struct ast_udptl *udptl);
00096 
00097 int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos);
00098 
00099 void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt);
00100 
00101 void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt,
00102              char *mimeType, char *mimeSubtype);
00103 
00104 enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl);
00105 
00106 void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec);
00107 
00108 void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
00109 
00110 /*! 
00111  * \brief retrieves local_max_datagram.
00112  * 
00113  * \retval positive value representing max datagram size.
00114  * \retval 0 if no value is present
00115  */
00116 unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
00117 
00118 /*! 
00119  * \brief sets far max datagram size.  If max_datagram is = 0, the far max datagram
00120  *  size is set to a default value.
00121  */
00122 void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram);
00123 
00124 unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
00125 
00126 /*! 
00127  * \brief retrieves far max ifp
00128  * 
00129  * \retval positive value representing max ifp size
00130  * \retval 0 if no value is present
00131  */
00132 unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
00133 
00134 void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
00135 
00136 int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
00137            struct ast_frame **fo, struct ast_channel **rc);
00138 
00139 int ast_udptl_proto_register(struct ast_udptl_protocol *proto);
00140 
00141 void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto);
00142 
00143 void ast_udptl_stop(struct ast_udptl *udptl);
00144 
00145 void ast_udptl_init(void);
00146 
00147 /*!
00148  * \version 1.6.1 return changed to int
00149  */
00150 int ast_udptl_reload(void);
00151 
00152 #if defined(__cplusplus) || defined(c_plusplus)
00153 }
00154 #endif
00155 
00156 #endif

Generated on 27 Jan 2016 for Asterisk - The Open Source Telephony Project by  doxygen 1.6.1