00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _ASTERISK_UDPTL_H
00019 #define _ASTERISK_UDPTL_H
00020
00021 #include "asterisk/frame.h"
00022 #include "asterisk/io.h"
00023 #include "asterisk/sched.h"
00024 #include "asterisk/channel.h"
00025
00026 #include <netinet/in.h>
00027
00028 enum
00029 {
00030 UDPTL_ERROR_CORRECTION_NONE,
00031 UDPTL_ERROR_CORRECTION_FEC,
00032 UDPTL_ERROR_CORRECTION_REDUNDANCY
00033 };
00034
00035 #if defined(__cplusplus) || defined(c_plusplus)
00036 extern "C" {
00037 #endif
00038
00039 struct ast_udptl_protocol {
00040
00041 struct ast_udptl *(*get_udptl_info)(struct ast_channel *chan);
00042
00043 int (* const set_udptl_peer)(struct ast_channel *chan, struct ast_udptl *peer);
00044 const char * const type;
00045 struct ast_udptl_protocol *next;
00046 };
00047
00048 struct ast_udptl;
00049
00050 typedef int (*ast_udptl_callback)(struct ast_udptl *udptl, struct ast_frame *f, void *data);
00051
00052 struct ast_udptl *ast_udptl_new(struct sched_context *sched, struct io_context *io, int callbackmode);
00053
00054 struct ast_udptl *ast_udptl_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int callbackmode, struct in_addr in);
00055
00056 void ast_udptl_set_peer(struct ast_udptl *udptl, struct sockaddr_in *them);
00057
00058 void ast_udptl_get_peer(struct ast_udptl *udptl, struct sockaddr_in *them);
00059
00060 void ast_udptl_get_us(struct ast_udptl *udptl, struct sockaddr_in *us);
00061
00062 void ast_udptl_destroy(struct ast_udptl *udptl);
00063
00064 void ast_udptl_reset(struct ast_udptl *udptl);
00065
00066 void ast_udptl_set_callback(struct ast_udptl *udptl, ast_udptl_callback callback);
00067
00068 void ast_udptl_set_data(struct ast_udptl *udptl, void *data);
00069
00070 int ast_udptl_write(struct ast_udptl *udptl, struct ast_frame *f);
00071
00072 struct ast_frame *ast_udptl_read(struct ast_udptl *udptl);
00073
00074 int ast_udptl_fd(struct ast_udptl *udptl);
00075
00076 int ast_udptl_settos(struct ast_udptl *udptl, int tos);
00077
00078 void ast_udptl_set_m_type(struct ast_udptl* udptl, int pt);
00079
00080 void ast_udptl_set_udptlmap_type(struct ast_udptl* udptl, int pt,
00081 char* mimeType, char* mimeSubtype);
00082
00083 int ast_udptl_lookup_code(struct ast_udptl* udptl, int isAstFormat, int code);
00084
00085 void ast_udptl_offered_from_local(struct ast_udptl* udptl, int local);
00086
00087 int ast_udptl_get_error_correction_scheme(struct ast_udptl* udptl);
00088
00089 void ast_udptl_set_error_correction_scheme(struct ast_udptl* udptl, int ec);
00090
00091 int ast_udptl_get_local_max_datagram(struct ast_udptl* udptl);
00092
00093 void ast_udptl_set_local_max_datagram(struct ast_udptl* udptl, int max_datagram);
00094
00095 int ast_udptl_get_far_max_datagram(struct ast_udptl* udptl);
00096
00097 void ast_udptl_set_far_max_datagram(struct ast_udptl* udptl, int max_datagram);
00098
00099 void ast_udptl_get_current_formats(struct ast_udptl* udptl,
00100 int* astFormats, int* nonAstFormats);
00101
00102 void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
00103
00104 int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
00105
00106 int ast_udptl_proto_register(struct ast_udptl_protocol *proto);
00107
00108 void ast_udptl_proto_unregister(struct ast_udptl_protocol *proto);
00109
00110 void ast_udptl_stop(struct ast_udptl *udptl);
00111
00112 void ast_udptl_init(void);
00113
00114 void ast_udptl_reload(void);
00115
00116 #if defined(__cplusplus) || defined(c_plusplus)
00117 }
00118 #endif
00119
00120 #endif