Wed Jan 8 2020 09:49:51

Asterisk developer's documentation


udptl.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- A telephony toolkit for Linux.
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 
18 /*! \file
19  * \brief UDPTL support for T.38
20  * \author Steve Underwood <steveu@coppice.org>
21  * \ref udptl.c
22  * \todo add doxygen documentation to this file!
23  */
24 
25 
26 #ifndef _ASTERISK_UDPTL_H
27 #define _ASTERISK_UDPTL_H
28 
29 #include "asterisk/network.h"
30 #include "asterisk/frame.h"
31 #include "asterisk/io.h"
32 #include "asterisk/sched.h"
33 #include "asterisk/channel.h"
34 #include "asterisk/netsock2.h"
35 
36 
41 };
42 
43 #if defined(__cplusplus) || defined(c_plusplus)
44 extern "C" {
45 #endif
46 
48  /*! \brief Get UDPTL struct, or NULL if unwilling to transfer */
49  struct ast_udptl *(*get_udptl_info)(struct ast_channel *chan);
50  /*! \brief Set UDPTL peer */
51  int (* const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer);
52  const char * const type;
54 };
55 
56 struct ast_udptl;
57 
58 typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
59 
60 struct ast_udptl *ast_udptl_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in);
61 
62 /*!
63  * \brief Associates a character string 'tag' with a UDPTL session.
64  * \param udptl The UDPTL session.
65  * \param format printf-style format string used to construct the tag
66  *
67  * This function formats a tag for the specified UDPTL
68  * session, so that any log messages generated by the UDPTL stack
69  * related to that session will include the tag and the reader of
70  * the messages will be able to identify which endpoint caused them
71  * to be generated.
72  *
73  * \retval none
74  */
75 void __attribute__((format(printf, 2, 3))) ast_udptl_set_tag(struct ast_udptl *udptl, const char *format, ...);
76 
77 void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them);
78 
79 void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them);
80 
81 void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us);
82 
83 void ast_udptl_destroy(struct ast_udptl *udptl);
84 
85 void ast_udptl_reset(struct ast_udptl *udptl);
86 
87 void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback);
88 
89 void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
90 
91 int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
92 
93 struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
94 
95 int ast_udptl_fd(const struct ast_udptl *udptl);
96 
97 int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos);
98 
99 void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt);
100 
101 void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt,
102  char *mimeType, char *mimeSubtype);
103 
104 enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl);
105 
106 void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec);
107 
108 void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
109 
110 /*!
111  * \brief retrieves local_max_datagram.
112  *
113  * \retval positive value representing max datagram size.
114  * \retval 0 if no value is present
115  */
116 unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
117 
118 /*!
119  * \brief sets far max datagram size. If max_datagram is = 0, the far max datagram
120  * size is set to a default value.
121  */
122 void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram);
123 
124 unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
125 
126 /*!
127  * \brief retrieves far max ifp
128  *
129  * \retval positive value representing max ifp size
130  * \retval 0 if no value is present
131  */
132 unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
133 
134 void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
135 
136 int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
137  struct ast_frame **fo, struct ast_channel **rc);
138 
140 
142 
143 void ast_udptl_stop(struct ast_udptl *udptl);
144 
145 void ast_udptl_init(void);
146 
147 /*!
148  * \version 1.6.1 return changed to int
149  */
150 int ast_udptl_reload(void);
151 
152 #if defined(__cplusplus) || defined(c_plusplus)
153 }
154 #endif
155 
156 #endif
Main Channel structure associated with a channel.
Definition: channel.h:742
void ast_udptl_set_data(struct ast_udptl *udptl, void *data)
Definition: udptl.c:648
void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp)
Definition: udptl.c:874
static unsigned int tos
Definition: chan_h323.c:146
static struct io_context * io
Definition: chan_gtalk.c:228
void ast_udptl_init(void)
Definition: udptl.c:1436
void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt)
ast_udptl_callback callback
Definition: udptl.c:134
static int nat
Definition: chan_mgcp.c:161
void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback)
Definition: udptl.c:653
void ast_udptl_reset(struct ast_udptl *udptl)
unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl)
retrieves local_max_datagram.
Definition: udptl.c:885
Definition: sched.c:57
int(*const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer)
Set UDPTL peer.
Definition: udptl.h:51
Structure for an UDPTL session.
Definition: udptl.c:119
int ast_udptl_reload(void)
Definition: udptl.c:1421
void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them)
Definition: udptl.c:1029
void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram)
sets far max datagram size. If max_datagram is = 0, the far max datagram size is set to a default val...
Definition: udptl.c:898
void ast_udptl_destroy(struct ast_udptl *udptl)
Definition: udptl.c:1044
I/O Management (derived from Cheops-NG)
struct ast_sockaddr us
Definition: udptl.c:127
Socket address structure.
Definition: netsock2.h:63
enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl)
Definition: udptl.c:841
void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us)
Definition: udptl.c:1034
General Asterisk PBX channel definitions.
ast_t38_ec_modes
Definition: udptl.h:37
Asterisk internal frame definitions.
Global IO variables are now in a struct in order to be made threadsafe.
Definition: io.c:66
Scheduler Routines (derived from cheops)
struct ast_sockaddr them
Definition: udptl.c:128
Network socket handling.
Wrapper for network related headers, masking differences between various operating systems...
unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl)
retrieves far max ifp
Definition: udptl.c:917
void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto)
Definition: udptl.c:1108
void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them)
Definition: udptl.c:1024
int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc)
Definition: udptl.c:1146
int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos)
Definition: udptl.c:1019
int ast_udptl_fd(const struct ast_udptl *udptl)
Definition: udptl.c:643
static struct ast_format f[]
Definition: format_g726.c:181
#define AST_RWLIST_ENTRY
Definition: linkedlists.h:414
struct ast_frame * ast_udptl_read(struct ast_udptl *udptl)
Definition: udptl.c:675
int flags
Definition: udptl.c:126
void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt, char *mimeType, char *mimeSubtype)
struct ast_udptl * ast_udptl_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in)
Definition: udptl.c:929
int ast_udptl_proto_register(struct ast_udptl_protocol *proto)
Definition: udptl.c:1115
void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec)
Definition: udptl.c:846
void ast_udptl_stop(struct ast_udptl *udptl)
Definition: udptl.c:1039
int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f)
Definition: udptl.c:1055
void ast_udptl_set_tag(struct ast_udptl *udptl, const char *format,...)
Associates a character string &#39;tag&#39; with a UDPTL session.
Definition: udptl.c:1006
Data structure associated with a single frame of data.
Definition: frame.h:142
unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl)
Definition: udptl.c:909
const char *const type
Definition: udptl.h:52
int(* ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data)
Definition: udptl.h:58
static unsigned int cos
Definition: chan_h323.c:147
static snd_pcm_format_t format
Definition: chan_alsa.c:93
void ast_udptl_setnat(struct ast_udptl *udptl, int nat)
Definition: udptl.c:658
void * data
Definition: udptl.c:132