Ignore some files generated from 1.6.x/trunk build
[asterisk-bristuff.git] / channels / iax2-parser.h
blob0f3e18c008eecc4c2586d78e1d2b1457100e4737
1 /*
2 * Asterisk -- A telephony toolkit for Linux.
4 * Implementation of Inter-Asterisk eXchange
5 *
6 * Copyright (C) 2003, Digium
8 * Mark Spencer <markster@digium.com>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
14 /*!\file
15 * \brief Implementation of the IAX2 protocol
18 #ifndef _IAX2_PARSER_H
19 #define _IAX2_PARSER_H
21 #include "asterisk/linkedlists.h"
23 struct iax_ies {
24 char *called_number;
25 char *calling_number;
26 char *calling_ani;
27 char *calling_name;
28 int calling_ton;
29 int calling_tns;
30 int calling_pres;
31 char *called_context;
32 char *username;
33 char *password;
34 unsigned int capability;
35 unsigned int format;
36 char *codec_prefs;
37 char *language;
38 int version;
39 unsigned short adsicpe;
40 char *dnid;
41 char *rdnis;
42 unsigned int authmethods;
43 unsigned int encmethods;
44 char *challenge;
45 char *md5_result;
46 char *rsa_result;
47 struct sockaddr_in *apparent_addr;
48 unsigned short refresh;
49 unsigned short dpstatus;
50 unsigned short callno;
51 char *cause;
52 unsigned char causecode;
53 unsigned char iax_unknown;
54 int msgcount;
55 int autoanswer;
56 int musiconhold;
57 unsigned int transferid;
58 unsigned int datetime;
59 char *devicetype;
60 char *serviceident;
61 int firmwarever;
62 unsigned int fwdesc;
63 unsigned char *fwdata;
64 unsigned char fwdatalen;
65 unsigned char *enckey;
66 unsigned char enckeylen;
67 unsigned int provver;
68 unsigned short samprate;
69 int provverpres;
70 unsigned int rr_jitter;
71 unsigned int rr_loss;
72 unsigned int rr_pkts;
73 unsigned short rr_delay;
74 unsigned int rr_dropped;
75 unsigned int rr_ooo;
78 #define DIRECTION_INGRESS 1
79 #define DIRECTION_OUTGRESS 2
81 struct iax_frame {
82 #ifdef LIBIAX
83 struct iax_session *session;
84 struct iax_event *event;
85 #else
86 int sockfd;
87 #endif
89 /* /Our/ call number */
90 unsigned short callno;
91 /* /Their/ call number */
92 unsigned short dcallno;
93 /* Start of raw frame (outgoing only) */
94 void *data;
95 /* Length of frame (outgoing only) */
96 int datalen;
97 /* How many retries so far? */
98 int retries;
99 /* Outgoing relative timestamp (ms) */
100 unsigned int ts;
101 /* How long to wait before retrying */
102 int retrytime;
103 /* Are we received out of order? */
104 unsigned int outoforder:1;
105 /* Have we been sent at all yet? */
106 unsigned int sentyet:1;
107 /* Non-zero if should be sent to transfer peer */
108 unsigned int transfer:1;
109 /* Non-zero if this is the final message */
110 unsigned int final:1;
111 /* Ingress or outgres */
112 unsigned int direction:2;
113 /* Can this frame be cached? */
114 unsigned int cacheable:1;
115 /* Outgoing Packet sequence number */
116 int oseqno;
117 /* Next expected incoming packet sequence number */
118 int iseqno;
119 /* Retransmission ID */
120 int retrans;
121 /* Easy linking */
122 AST_LIST_ENTRY(iax_frame) list;
123 /* Actual, isolated frame header */
124 struct ast_frame af;
125 /*! Amount of space _allocated_ for data */
126 size_t afdatalen;
127 unsigned char unused[AST_FRIENDLY_OFFSET];
128 unsigned char afdata[0]; /* Data for frame */
131 struct iax_ie_data {
132 unsigned char buf[1024];
133 int pos;
136 /* Choose a different function for output */
137 void iax_set_output(void (*output)(const char *data));
138 /* Choose a different function for errors */
139 void iax_set_error(void (*output)(const char *data));
140 void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
142 const char *iax_ie2str(int ie);
144 int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen);
145 int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct sockaddr_in *sin);
146 int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
147 int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
148 int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str);
149 int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
150 int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
151 int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
153 int iax_get_frames(void);
154 int iax_get_iframes(void);
155 int iax_get_oframes(void);
157 void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
158 struct iax_frame *iax_frame_new(int direction, int datalen, unsigned int cacheable);
159 void iax_frame_free(struct iax_frame *fr);
160 #endif