2 * Asterisk -- A telephony toolkit for Linux.
4 * UDPTL support for T.38
6 * Copyright (C) 2005, Steve Underwood, partly based on RTP code which is
7 * Copyright (C) 1999-2004, Digium, Inc.
9 * Steve Underwood <steveu@coppice.org>
11 * This program is free software, distributed under the terms of
12 * the GNU General Public License
14 * A license has been granted to Digium (via disclaimer) for the use of
18 #ifndef _ASTERISK_UDPTL_H
19 #define _ASTERISK_UDPTL_H
21 #include "asterisk/frame.h"
22 #include "asterisk/io.h"
23 #include "asterisk/sched.h"
24 #include "asterisk/channel.h"
26 #include <netinet/in.h>
30 UDPTL_ERROR_CORRECTION_NONE
,
31 UDPTL_ERROR_CORRECTION_FEC
,
32 UDPTL_ERROR_CORRECTION_REDUNDANCY
35 #if defined(__cplusplus) || defined(c_plusplus)
39 struct ast_udptl_protocol
{
40 /* Get UDPTL struct, or NULL if unwilling to transfer */
41 struct ast_udptl
*(*get_udptl_info
)(struct ast_channel
*chan
);
43 int (* const set_udptl_peer
)(struct ast_channel
*chan
, struct ast_udptl
*peer
);
44 const char * const type
;
45 struct ast_udptl_protocol
*next
;
50 typedef int (*ast_udptl_callback
)(struct ast_udptl
*udptl
, struct ast_frame
*f
, void *data
);
52 struct ast_udptl
*ast_udptl_new(struct sched_context
*sched
, struct io_context
*io
, int callbackmode
);
54 struct ast_udptl
*ast_udptl_new_with_bindaddr(struct sched_context
*sched
, struct io_context
*io
, int callbackmode
, struct in_addr in
);
56 void ast_udptl_set_peer(struct ast_udptl
*udptl
, struct sockaddr_in
*them
);
58 void ast_udptl_get_peer(struct ast_udptl
*udptl
, struct sockaddr_in
*them
);
60 void ast_udptl_get_us(struct ast_udptl
*udptl
, struct sockaddr_in
*us
);
62 void ast_udptl_destroy(struct ast_udptl
*udptl
);
64 void ast_udptl_reset(struct ast_udptl
*udptl
);
66 void ast_udptl_set_callback(struct ast_udptl
*udptl
, ast_udptl_callback callback
);
68 void ast_udptl_set_data(struct ast_udptl
*udptl
, void *data
);
70 int ast_udptl_write(struct ast_udptl
*udptl
, struct ast_frame
*f
);
72 struct ast_frame
*ast_udptl_read(struct ast_udptl
*udptl
);
74 int ast_udptl_fd(struct ast_udptl
*udptl
);
76 int ast_udptl_settos(struct ast_udptl
*udptl
, int tos
);
78 void ast_udptl_set_m_type(struct ast_udptl
* udptl
, int pt
);
80 void ast_udptl_set_udptlmap_type(struct ast_udptl
* udptl
, int pt
,
81 char* mimeType
, char* mimeSubtype
);
83 int ast_udptl_lookup_code(struct ast_udptl
* udptl
, int isAstFormat
, int code
);
85 void ast_udptl_offered_from_local(struct ast_udptl
* udptl
, int local
);
87 int ast_udptl_get_error_correction_scheme(struct ast_udptl
* udptl
);
89 void ast_udptl_set_error_correction_scheme(struct ast_udptl
* udptl
, int ec
);
91 int ast_udptl_get_local_max_datagram(struct ast_udptl
* udptl
);
93 void ast_udptl_set_local_max_datagram(struct ast_udptl
* udptl
, int max_datagram
);
95 int ast_udptl_get_far_max_datagram(struct ast_udptl
* udptl
);
97 void ast_udptl_set_far_max_datagram(struct ast_udptl
* udptl
, int max_datagram
);
99 void ast_udptl_get_current_formats(struct ast_udptl
* udptl
,
100 int* astFormats
, int* nonAstFormats
);
102 void ast_udptl_setnat(struct ast_udptl
*udptl
, int nat
);
104 int ast_udptl_bridge(struct ast_channel
*c0
, struct ast_channel
*c1
, int flags
, struct ast_frame
**fo
, struct ast_channel
**rc
);
106 int ast_udptl_proto_register(struct ast_udptl_protocol
*proto
);
108 void ast_udptl_proto_unregister(struct ast_udptl_protocol
*proto
);
110 void ast_udptl_stop(struct ast_udptl
*udptl
);
112 void ast_udptl_init(void);
114 void ast_udptl_reload(void);
116 #if defined(__cplusplus) || defined(c_plusplus)