Asterisk - The Open Source Telephony Project  18.5.0
udptl.h
Go to the documentation of this file.
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 <[email protected]>
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 <[email protected]>
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 
47 struct ast_udptl;
48 
49 typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
50 
51 struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in);
52 
53 /*!
54  * \brief Associates a character string 'tag' with a UDPTL session.
55  * \param udptl The UDPTL session.
56  * \param format printf-style format string used to construct the tag
57  *
58  * This function formats a tag for the specified UDPTL
59  * session, so that any log messages generated by the UDPTL stack
60  * related to that session will include the tag and the reader of
61  * the messages will be able to identify which endpoint caused them
62  * to be generated.
63  *
64  * \retval none
65  */
66 void __attribute__((format(printf, 2, 3))) ast_udptl_set_tag(struct ast_udptl *udptl, const char *format, ...);
67 
68 void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them);
69 
70 void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them);
71 
72 void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us);
73 
74 void ast_udptl_destroy(struct ast_udptl *udptl);
75 
76 void ast_udptl_reset(struct ast_udptl *udptl);
77 
79 
80 void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
81 
82 int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
83 
84 struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
85 
86 int ast_udptl_fd(const struct ast_udptl *udptl);
87 
88 int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos);
89 
90 void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt);
91 
92 void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt,
93  char *mimeType, char *mimeSubtype);
94 
96 
98 
99 void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
100 
101 /*!
102  * \brief retrieves local_max_datagram.
103  *
104  * \retval positive value representing max datagram size.
105  * \retval 0 if no value is present
106  */
107 unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
108 
109 /*!
110  * \brief sets far max datagram size. If max_datagram is = 0, the far max datagram
111  * size is set to a default value.
112  */
113 void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_datagram);
114 
115 unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
116 
117 /*!
118  * \brief retrieves far max ifp
119  *
120  * \retval positive value representing max ifp size
121  * \retval 0 if no value is present
122  */
123 unsigned int ast_udptl_get_far_max_ifp(struct ast_udptl *udptl);
124 
125 void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
126 
127 void ast_udptl_stop(struct ast_udptl *udptl);
128 
129 #if defined(__cplusplus) || defined(c_plusplus)
130 }
131 #endif
132 
133 #endif
unsigned int cos
Definition: chan_iax2.c:352
void ast_udptl_set_data(struct ast_udptl *udptl, void *data)
Definition: udptl.c:735
void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp)
Definition: udptl.c:973
void ast_udptl_set_m_type(struct ast_udptl *udptl, unsigned int pt)
ast_udptl_callback callback
Definition: udptl.c:171
static int nat
Definition: chan_mgcp.c:168
void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback)
Definition: udptl.c:740
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:984
Definition: sched.c:76
Structure for an UDPTL session.
Definition: udptl.c:156
void ast_udptl_get_peer(const struct ast_udptl *udptl, struct ast_sockaddr *them)
Definition: udptl.c:1135
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:997
void ast_udptl_destroy(struct ast_udptl *udptl)
Definition: udptl.c:1150
I/O Management (derived from Cheops-NG)
struct ast_sockaddr us
Definition: udptl.c:164
Socket address structure.
Definition: netsock2.h:97
enum ast_t38_ec_modes ast_udptl_get_error_correction_scheme(const struct ast_udptl *udptl)
Definition: udptl.c:940
unsigned int tos
Definition: chan_iax2.c:351
void ast_udptl_get_us(const struct ast_udptl *udptl, struct ast_sockaddr *us)
Definition: udptl.c:1140
General Asterisk PBX channel definitions.
FILE * in
Definition: utils/frame.c:33
ast_t38_ec_modes
Definition: udptl.h:37
static struct io_context * io
Definition: chan_ooh323.c:401
int(* ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data)
Definition: udptl.h:49
Global IO variables are now in a struct in order to be made threadsafe.
Definition: io.c:71
Scheduler Routines (derived from cheops)
Asterisk internal frame definitions.
struct ast_sockaddr them
Definition: udptl.c:165
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:1016
void ast_udptl_set_peer(struct ast_udptl *udptl, const struct ast_sockaddr *them)
Definition: udptl.c:1130
int ast_udptl_setqos(struct ast_udptl *udptl, unsigned int tos, unsigned int cos)
Definition: udptl.c:1125
int ast_udptl_fd(const struct ast_udptl *udptl)
Definition: udptl.c:730
struct ast_udptl * ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, struct io_context *io, int callbackmode, struct ast_sockaddr *in)
Definition: udptl.c:1028
struct ast_frame * ast_udptl_read(struct ast_udptl *udptl)
Definition: udptl.c:762
void ast_udptl_set_udptlmap_type(struct ast_udptl *udptl, unsigned int pt, char *mimeType, char *mimeSubtype)
void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38_ec_modes ec)
Definition: udptl.c:945
void ast_udptl_stop(struct ast_udptl *udptl)
Definition: udptl.c:1145
int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f)
Definition: udptl.c:1161
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:1112
Data structure associated with a single frame of data.
unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl)
Definition: udptl.c:1008
union ast_frame::@263 data
static snd_pcm_format_t format
Definition: chan_alsa.c:102
void ast_udptl_setnat(struct ast_udptl *udptl, int nat)
Definition: udptl.c:745
void * data
Definition: udptl.c:169