Thu Oct 11 06:47:22 2012

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 
00035 
00036 enum ast_t38_ec_modes {
00037     UDPTL_ERROR_CORRECTION_NONE,
00038     UDPTL_ERROR_CORRECTION_FEC,
00039     UDPTL_ERROR_CORRECTION_REDUNDANCY
00040 };
00041 
00042 #if defined(__cplusplus) || defined(c_plusplus)
00043 extern "C" {
00044 #endif
00045 
00046 struct ast_udptl_protocol {
00047    /*! \brief Get UDPTL struct, or NULL if unwilling to transfer */
00048    struct ast_udptl *(*get_udptl_info)(struct ast_channel *chan);
00049    /*! \brief Set UDPTL peer */
00050    int (* const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer);
00051    const char * const type;
00052    AST_RWLIST_ENTRY(ast_udptl_protocol) list;
00053 };
00054 
00055 struct ast_udptl;
00056 
00057 typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
00058 
00059 struct ast_udptl *ast_udptl_new(struct sched_context *sched, struct io_context *io, int callbackmode);
00060 
00061 struct ast_udptl *ast_udptl_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int callbackmode, struct in_addr in);
00062 
00063 /*!
00064  * \brief Associates a character string 'tag' with a UDPTL session.
00065  * \param udptl The UDPTL session.
00066  * \param format printf-style format string used to construct the tag
00067  * 
00068  * This function formats a tag for the specified UDPTL
00069  * session, so that any log messages generated by the UDPTL stack
00070  * related to that session will include the tag and the reader of
00071  * the messages will be able to identify which endpoint caused them
00072  * to be generated.
00073  *
00074  * \retval none
00075  */
00076 void __attribute__((format(printf, 2, 3))) ast_udptl_set_tag(struct ast_udptl *udptl, const char *format, ...);
00077 
00078 void ast_udptl_set_peer(struct ast_udptl *udptl, const struct sockaddr_in *them);
00079 
00080 void ast_udptl_get_peer(const struct ast_udptl *udptl, struct sockaddr_in *them);
00081 
00082 void ast_udptl_get_us(const struct ast_udptl *udptl, struct sockaddr_in *us);
00083 
00084 void ast_udptl_destroy(struct ast_udptl *udptl);
00085 
00086 void ast_udptl_reset(struct ast_udptl *udptl);
00087 
00088 void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback);
00089 
00090 void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
00091 
00092 int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
00093 
00094 struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
00095 
00096 int ast_udptl_fd(const struct ast_udptl *udptl);
00097 
00098 int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos);
00099 
00100 void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt);
00101 
00102 void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt,
00103              char *mimeType, char *mimeSubtype);
00104 
00105 enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl);
00106 
00107 void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec);
00108 
00109 void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
00110 
00111 /*! 
00112  * \brief retrieves local_max_datagram.
00113  * 
00114  * \retval positive value representing max datagram size.
00115  * \retval 0 if no value is present
00116  */
00117 unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
00118 
00119 /*! 
00120  * \brief sets far max datagram size.  If max_datagram is = 0, the far max datagram
00121  *  size is set to a default value.
00122  */
00123 void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram);
00124 
00125 unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
00126 
00127 /*! 
00128  * \brief retrieves far max ifp
00129  * 
00130  * \retval positive value representing max ifp size
00131  * \retval 0 if no value is present
00132  */
00133 unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
00134 
00135 void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
00136 
00137 int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
00138            struct ast_frame **fo, struct ast_channel **rc);
00139 
00140 int ast_udptl_proto_register(struct ast_udptl_protocol *proto);
00141 
00142 void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto);
00143 
00144 void ast_udptl_stop(struct ast_udptl *udptl);
00145 
00146 void ast_udptl_init(void);
00147 
00148 /*!
00149  * \version 1.6.1 return changed to int
00150  */
00151 int ast_udptl_reload(void);
00152 
00153 #if defined(__cplusplus) || defined(c_plusplus)
00154 }
00155 #endif
00156 
00157 #endif

Generated on Thu Oct 11 06:47:22 2012 for Asterisk - the Open Source PBX by  doxygen 1.5.6