Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef XML_PARSER_DEFINES_H
6 #define XML_PARSER_DEFINES_H
8 #include "sll_lite.h"
9 #include "cc_constants.h"
12 /**
13 * In general, when a parser constructs a xml string,
14 * it should translate the enum to cooresponding string
15 * value that is defined in the accompanied xsd files.
16 */
17 /**
18 * Define the state values
19 */
20 typedef enum {
21 XML_STATE_PARTIAL = 0, //Encode as "partial"
22 XML_STATE_FULL //"full"
23 } xml_state_t;
25 /**
26 * Define the call orientation
27 */
28 typedef enum {
29 XML_CALL_ORIENTATION_UNSPECIFIED = 0,
30 XML_CALL_ORIENTATION_TO,
31 XML_CALL_ORIENTATION_FROM
32 } xml_call_orientation_t;
34 /**
35 * Define the call lock status
36 */
37 typedef enum {
38 XML_CALLLOCK_UNLOCKED = 0,
39 XML_CALLLOCK_LOCKED,
40 XML_CALLLOCK_REMOTE_LOCKED
41 } xml_calllock_t;
43 /**
44 * Define the direction values
45 */
46 typedef enum {
47 XML_DIRECTION_INITIATOR = 0,
48 XML_DIRECTION_RECIPIENT
49 } xml_direction_t;
51 /**
52 * Define the event values
53 */
54 typedef enum {
55 XML_EVENT_CANCELLED = 0,
56 XML_EVENT_REJECTED,
57 XML_EVENT_REPLACED,
58 XML_EVENT_LOCAL_BYE,
59 XML_EVENT_REMOTE_BYE,
60 XML_EVENT_ERROR,
61 XML_EVENT_TIMEOUT
62 } xml_event_t;
64 /**
65 * Define the yes or no values
66 */
67 typedef enum {
68 XML_NO = 0,
69 XML_YES,
70 XML_NONEAPPLICABLE //"na"
71 } xml_yes_no_t;
73 /**
74 * Define the on or off value
75 */
76 typedef enum {
77 XML_OFF = 0,
78 XML_ON
79 } xml_on_off_t;
81 /**
82 * Define the true or false values
83 */
84 typedef enum {
85 XML_FALSE = 0,
86 XML_TRUE
87 } xml_true_false_t;
89 /**
90 * Define the line key events
91 */
92 typedef enum {
93 XML_LINE_KEY_EVENT_LINE = 0,
94 XML_LINE_KEY_EVENT_SPEEDDIAL
95 } xml_line_key_event_t;
97 /**
98 * Define the persist types
99 */
100 typedef enum {
101 XML_PERSIST_TYPE_ONE_SHOT = 0,
102 XML_PERSIST_TYPE_PERSIST,
103 XML_PERSIST_TYPE_SINGLE_NOTIFY
104 } xml_persist_type_t;
106 /**
107 * Define the soft key invoke type
108 */
109 typedef enum {
110 XML_SKEY_INVOKE_EXPLICIT = 0,
111 XML_SKEY_NVOKE_IMPLICIT
112 } xml_skey_invoke_t;
114 /**
115 * Define the soft key event data
116 */
117 typedef enum {
118 XML_SKEY_EVENT_UNDEFINED = 0,
119 XML_SKEY_EVENT_REDIAL,
120 XML_SKEY_EVENT_NEWCALL,
121 XML_SKEY_EVENT_HOLD,
122 XML_SKEY_EVENT_TRANSFER,
123 XML_SKEY_EVENT_CFWDALL, //5
124 XML_SKEY_EVENT_CFWDBUSY,
125 XML_SKEY_EVENT_CFWDNOANSWER,
126 XML_SKEY_EVENT_BACKSPACE,
127 XML_SKEY_EVENT_ENDCALL,
128 XML_SKEY_EVENT_RESUME, //10
129 XML_SKEY_EVENT_ANSWER,
130 XML_SKEY_EVENT_INFO,
131 XML_SKEY_EVENT_CONFERENCE,
132 XML_SKEY_EVENT_JION, //15
133 XML_SKEY_EVENT_REMVOVE_LAST_CONF_PARTICIPANT,
134 XML_SKEY_EVENT_DIRECT_XFER,
135 XML_SKEY_EVENT_SELECT, //25
136 XML_SKEY_EVENT_TRANSFER_TO_VOICE_MAIL,
137 XML_SKEY_EVENT_SAC,
138 XML_SKEY_EVENT_UNSELECT, //35
139 XML_SKEY_EVENT_CANCEL,
140 XML_SKEY_EVENT_COPNFERENCE_DETAILS,//40
141 XML_SKEY_EVENT_TRASFMG = 65,
142 XML_SKEY_EVENT_INTRCPT,
143 XML_SKEY_EVENT_SETWTCH,
144 XML_SKEY_EVENT_TRNSFVM,
145 XML_SKEY_EVENT_TRNSFAS
146 } xml_skey_event_code_t;
148 /**
149 * Define the map for station sequence mapping
150 */
151 typedef enum {
152 XML_STATION_SEQ_FIRST = 0,
153 XML_STATION_SEQ_MORE,
154 XML_STATION_SEQ_LAST
155 } xml_stataionseq_t;
157 /**
158 * Define the hold reasons
159 */
160 typedef enum {
161 XML_HOLD_REASON_NONE = 0,
162 XML_HOLD_REASON_TRANSFER,
163 XML_HOLD_REASON_CONFERENCE,
164 XML_HOLD_REASON_INTERNAL
165 } xml_hold_reason_t;
167 /**
168 * Define the lamp status
169 */
170 typedef enum {
171 XML_LAMP_STATE_OFF = 0,
172 XML_LAMP_STATE_ON,
173 XML_LAMP_STATE_BLINK,
174 XML_LAMP_STATE_FLASH
175 } xml_lamp_state_t;
177 /**
178 * Define the lamp type
179 */
180 typedef enum {
181 XML_LAMP_TYPE_LINE = 1,
182 XML_LAMP_TYPE_VOICE_MAIL
183 } xml_lamp_type_t;
185 /**
186 * Define the image down load method
187 */
188 typedef enum {
189 XML_IMAGE_DOWNLOAD_METHOD_TFTP = 1,
190 XML_IMAGE_DOWNLAOD_METHOD_HTTP,
191 XML_IMAGE_DOWNLOAD_METHOD_PPID
192 } xml_image_dl_method_t;
194 /**
195 * Define the image download failure reason
196 */
197 typedef enum {
198 XML_IMAGE_DOWNLOAD_FAILURE_REASON_DISKFULL = 1,
199 XML_IMAGE_DOWNLOAD_FAILURE_REASON_IMAGE_NOT_AVAILABLE,
200 XML_IMAGE_DOWNLOAD_FAILURE_REASON_ACCESS_VIOLATION
201 } xml_image_dl_failure_reason_t;
203 typedef signed long xml_signed32;
204 typedef unsigned long xml_unsigned32;
205 typedef unsigned short xml_unsigned16;
206 typedef unsigned char xml_unsigned8;
208 // start of copy from ccsip_eventbodies.h
209 typedef struct State {
210 xml_signed32 event;
211 xml_signed32 code;
212 xml_signed32 state;
213 } State;
215 typedef struct Replaces {
216 char call_id[128];
217 char local_tag[64];
218 char remote_tag[64];
219 } Replaces;
221 typedef struct RefferedBy {
222 char display_name[64];
223 char uri[64];
224 } RefferedBy;
226 typedef struct RouteSet {
227 char hop[5][16];
228 } RouteSet;
230 typedef struct Identity {
231 char display_name[64];
232 char uri[64];
233 } Identity;
235 typedef struct Param {
236 char pname[32];
237 char pval[32];
238 } Param;
240 typedef struct Target {
241 Param param[4];
242 char uri[64];
243 } Target;
245 typedef struct SessionDescription {
246 char type[32];
247 } SessionDescription;
249 typedef struct Participant {
250 Identity identity;
251 Target target;
252 SessionDescription session_description;
253 xml_unsigned16 cseq;
254 } Participant;
256 typedef struct primCall {
257 char call_id[128];
258 char local_tag[64];
259 char remote_tag[64];
260 xml_signed32 h_reason;
261 } primCall;
263 typedef struct callFeature {
264 char cfwdall_set[128];
265 char cfwdall_clear[128];
266 } callFeature;
268 typedef struct Stream {
269 char reverse[16];
270 } Stream;
272 typedef struct Regex {
273 char regexData[32];
274 char tag[32];
275 char pre[32];
276 } Regex;
278 typedef struct Pattern {
279 xml_signed32 flush;
280 Regex regex;
281 xml_signed32 persist;
282 xml_unsigned32 interdigittimer;
283 xml_unsigned32 criticaldigittimer;
284 xml_unsigned32 extradigittimer;
285 xml_unsigned16 longhold;
286 xml_unsigned8 longrepeat;
287 xml_unsigned8 nopartial;
288 char enterkey[8];
289 } Pattern;
291 typedef struct KPMLRequest {
292 Stream stream;
293 Pattern pattern;
294 char version[16];
295 } KPMLRequest;
297 typedef struct KPMLResponse {
298 char version[16];
299 char code[16];
300 char text[16];
301 xml_unsigned8 suppressed;
302 char forced_flush[16];
303 char digits[16];
304 char tag[16];
305 } KPMLResponse;
307 typedef struct dialogID {
308 char callid[128];
309 char localtag[64];
310 char remotetag[64];
311 } dialogID;
313 typedef struct consultDialogID {
314 char callid[128];
315 char localtag[64];
316 char remotetag[64];
317 } consultDialogID;
319 typedef struct joindialogID {
320 char callid[128];
321 char localtag[64];
322 char remotetag[64];
323 } joindialogID;
325 typedef struct reg_contact_t {
326 char Register[16];
327 char Unregister[16];
328 xml_unsigned32 line;
329 xml_unsigned32 low;
330 xml_unsigned32 high;
331 xml_signed32 all;
332 } reg_contact_t;
335 typedef struct remotecc {
336 char status[16];
337 } remotecc;
339 typedef struct combine {
340 xml_unsigned16 max_bodies;
341 remotecc remotecc;
342 char service_control[16];
343 } combine;
345 typedef struct dialog {
346 char usage[64];
347 char unot[16];
348 char sub[16];
349 } dialog;
351 typedef struct presence {
352 char usage[64];
353 char unot[16];
354 char sub[16];
355 } presence;
357 typedef struct voice_msg_t {
358 xml_signed32 newCount;
359 xml_signed32 oldCount;
360 } voice_msg_t;
362 typedef struct voice_msg_hp_t {
363 xml_signed32 newCount;
364 xml_signed32 oldCount;
365 } voice_msg_hp_t;
367 typedef struct fax_msg_t {
368 xml_signed32 newCount;
369 xml_signed32 oldCount;
370 } fax_msg_t;
372 typedef struct fax_msg_hp_t {
373 xml_signed32 newCount;
374 xml_signed32 oldCount;
375 } fax_msg_hp_t;
377 typedef struct emwi_t {
378 voice_msg_t voice_msg;
379 voice_msg_hp_t voice_msg_hp;
380 fax_msg_t fax_msg;
381 fax_msg_hp_t fax_msg_hp;
382 } emwi_t;
384 typedef struct cfwdallupdate {
385 char fwdAddress[256];
386 } cfwdallupdate;
388 typedef struct Contact_t {
389 xml_unsigned32 line;
390 xml_unsigned32 high;
391 xml_unsigned32 low;
392 xml_signed32 all;
393 xml_signed32 mwi;
394 emwi_t emwi;
395 cfwdallupdate cfwdallupdate;
396 } Contact_t;
398 typedef struct dialog_t {
399 char usage[64];
400 char unot[12];
401 char sub[12];
402 } dialog_t;
404 typedef struct presence_t {
405 char usage[64];
406 char unot[12];
407 char sub[12];
408 } presence_t;
410 typedef struct options_ans_t {
411 combine combine;
412 dialog_t dialog;
413 presence_t presence;
414 } options_ans_t;
416 typedef struct PersonStatusStruct {
417 char basic[32];
418 } PersonStatusStruct;
420 typedef struct ActivitiesStruct {
421 char alerting[12];
422 char onThePhone[12];
423 char busy[12];
424 char away[12];
425 char meeting[12];
426 } ActivitiesStruct;
428 typedef struct PersonStruct {
429 char id[256];
430 PersonStatusStruct personStatus;
431 ActivitiesStruct activities;
432 } PersonStruct;
434 typedef struct StatusStruct {
435 char basic[32];
436 ActivitiesStruct activities;
437 } StatusStruct;
439 typedef struct TupleStruct {
440 char id[256];
441 StatusStruct status;
442 char contact[1][256];
443 char note[1][1024];
444 } TupleStruct;
446 typedef struct PresenceRPIDStruct {
447 char entity[256];
448 PersonStruct person;
449 TupleStruct tuple[1];
450 char note[5][1024];
451 } PresenceRPIDStruct;
453 typedef struct sipProfile {
454 xml_unsigned16 kpml_val;
455 } sipProfile;
457 typedef struct ConfigApp_req_data_t {
458 sipProfile sip_profile;
459 } ConfigApp_req_data_t;
461 typedef struct to_encoder_t {
462 xml_unsigned32 picture_fast_update;
463 } to_encoder_t;
465 typedef struct vc_primivite_t {
466 to_encoder_t to_encoder;
467 char stream_id[128];
468 } vc_primivite_t;
470 typedef struct Media_Control_t {
471 vc_primivite_t vc_primitive;
472 char general_error[128];
473 } Media_Control_t;
475 // end of copy from ccsip_eventbodies.h
477 typedef struct Presence_ext_t_ {
478 PresenceRPIDStruct presence_body;
479 /*
480 * Some of the tags' mere presence in the rpid document has a meaning. These tags
481 * may not contain any value between starting and ending tag. So we need a way to
482 * indicate the presence of a tag. We will use the following boolean memeber fields.
483 */
484 boolean onThePhone;
485 boolean busy;
486 boolean away;
487 boolean meeting;
488 boolean alerting;
489 } Presence_ext_t;
492 typedef enum {
493 EVENT_DATA_INVALID = 0,
494 EVENT_DATA_KPML_REQUEST,
495 EVENT_DATA_KPML_RESPONSE,
496 EVENT_DATA_REMOTECC_REQUEST,
497 EVENT_DATA_PRESENCE,
498 EVENT_DATA_DIALOG,
499 EVENT_DATA_RAW,
500 EVENT_DATA_CONFIGAPP_REQUEST,
501 EVENT_DATA_MEDIA_INFO
502 } ccsip_event_data_type_e;
504 typedef struct {
505 char *data;
506 uint32_t length;
507 } raw_data_t;
509 typedef struct {
510 Media_Control_t media_control;
511 uint32_t picture_fast_update;
512 } media_control_ext_t;
514 #define TAG_LENGTH 16
515 typedef struct {
516 char current_method[TAG_LENGTH];
517 char hookstate[TAG_LENGTH];
518 char presence[TAG_LENGTH];
519 } Options_ind_t;
523 typedef struct rcc_response_t {
524 xml_unsigned16 code;
525 char reason[128];
526 xml_unsigned32 applicationid;
527 xml_unsigned32 transactionid;
528 xml_signed32 stationsequence;
529 xml_unsigned16 displaypriority;
530 xml_unsigned16 appinstance;
531 xml_unsigned16 linenumber;
532 xml_unsigned32 routingid;
533 xml_unsigned32 confid;
534 char callID[128];
535 options_ans_t options_ind;
536 } rcc_response_t;
538 typedef enum {
539 RCC_NULL_REQ = 0,
540 RCC_INITCALL_REQ = 1,
541 RCC_MONITORCALL_REQ,
542 RCC_DIALCALL_REQ,
543 RCC_DIALDTMF_REQ,
544 RCC_ANSCALL_REQ,
545 RCC_DISCCALL_REQ,
546 RCC_XFERSETUP_REQ,
547 RCC_XFERCOMPLETE_REQ,
548 RCC_CONFSETUP_REQ,
549 RCC_CONFCOMPLETE_REQ,
550 RCC_HOLD_REQ,
551 RCC_HOLDRETRIEVE_REQ,
552 RCC_DATAPASSTHROUGH_REQ,
553 RCC_CFWDALL_REQ,
554 RCC_LINEKEY_EVT,
555 RCC_STATUS_UPDATE_REQ,
556 RCC_SET_IDLE_STATUS_PROMPT_REQ,
557 RCC_PLAY_TONE_REQ,
558 RCC_STOP_TONE_REQ,
559 RCC_CALL_SELECT_REQ,
560 RCC_SOFTKEY_EVT,
561 RCC_LINE_RINGER_SET_REQ,
562 RCC_HOLD_REVERSION_REQ,
563 RCC_LAMP_CONTROL_REQ,
564 RCC_LINEKEY_UPDATE,
565 RCC_BULKREGISTER_REQ,
566 RCC_OPTIONS_IND,
567 RCC_BULK_UPDATE,
568 RCC_CALL_JOIN_REQ,
569 RCC_NOTIFY_REQ,
570 RCC_MONITOR_UPDATE_REQ,
571 RCC_MAX_REQ
572 } rcc_request_type_t;
574 typedef struct rcc_softkey_event_msg_t {
575 xml_signed32 softkeyevent;
576 dialogID dialogid;
577 xml_unsigned16 linenumber;
578 xml_unsigned16 participantnum;
579 dialogID consultdialogid;
580 xml_unsigned8 state;
581 dialogID joindialogid;
582 //eventData eventdata;
583 char userdata[32];
584 xml_unsigned16 soktkeyid;
585 xml_unsigned16 applicationid;
586 } rcc_softkey_event_msg_t;
589 typedef struct RCC_req_data {
590 rcc_softkey_event_msg_t rcc_softkey_event_msg;
591 } RCC_req_data;
593 typedef struct rcc_int_t_ {
594 RCC_req_data rcc_int;
595 // User added fields
596 xml_unsigned8 iterations;
597 cc_lineid_t line;
598 cc_callid_t gsm_id;
599 cc_callid_t consult_gsm_id;
600 cc_callid_t join_gsm_id;
601 rcc_request_type_t rcc_request_type;
602 } RCC_data;
605 // Data for event generation
606 typedef struct ccsip_event_data_t_ {
607 struct ccsip_event_data_t_ *next;
608 ccsip_event_data_type_e type;
609 union {
610 KPMLResponse kpml_response;
611 KPMLRequest kpml_request;
612 RCC_data remotecc_data;
613 rcc_response_t remotecc_data_response;
614 Options_ind_t options_ind;
615 Presence_ext_t presence_rpid;
616 raw_data_t raw_data; // used for cmxml and other body types
617 ConfigApp_req_data_t configapp_data;
618 media_control_ext_t media_control_data;
619 } u;
620 } ccsip_event_data_t;
623 /**
624 * Request to allocate memory for external xml parser
625 * @param [in] size ofrequested memory
626 * @return pointer to memory allocated.
627 */
628 void *ccAllocXML(cc_size_t size);
630 /**
631 * Free xml memory
632 * @param [in] mem - memory to free
633 * @return void
634 */
635 void ccFreeXML(void *mem);
636 #endif