1: <?php
2: 3: 4: 5: 6: 7: 8:
9:
10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:
21: class Horde_ActiveSync_Wbxml
22: {
23: const SWITCH_PAGE = 0x00;
24: const END = 0x01;
25: const ENTITY = 0x02;
26: const STR_I = 0x03;
27: const LITERAL = 0x04;
28: const EXT_I_0 = 0x40;
29: const EXT_I_1 = 0x41;
30: const EXT_I_2 = 0x42;
31: const PI = 0x43;
32: const LITERAL_C = 0x44;
33: const EXT_T_0 = 0x80;
34: const EXT_T_1 = 0x81;
35: const EXT_T_2 = 0x82;
36: const STR_T = 0x83;
37: const LITERAL_A = 0x84;
38: const EXT_0 = 0xC0;
39: const EXT_1 = 0xC1;
40: const EXT_2 = 0xC2;
41: const OPAQUE = 0xC3;
42: const LITERAL_AC = 0xC4;
43:
44: const EN_TYPE = 1;
45: const EN_TAG = 2;
46: const EN_CONTENT = 3;
47: const EN_FLAGS = 4;
48: const EN_ATTRIBUTES = 5;
49:
50: const EN_TYPE_STARTTAG = 1;
51: const EN_TYPE_ENDTAG = 2;
52: const EN_TYPE_CONTENT = 3;
53:
54: const EN_FLAGS_CONTENT = 1;
55: const EN_FLAGS_ATTRIBUTES = 2;
56:
57: 58: 59: 60: 61:
62: protected $_dtd = array(
63: 'codes' => array (
64: 0 => array (
65: 0x05 => 'Synchronize',
66: 0x06 => 'Replies',
67: 0x07 => 'Add',
68: 0x08 => 'Modify',
69: 0x09 => 'Remove',
70: 0x0a => 'Fetch',
71: 0x0b => 'SyncKey',
72: 0x0c => 'ClientEntryId',
73: 0x0d => 'ServerEntryId',
74: 0x0e => 'Status',
75: 0x0f => 'Folder',
76: 0x10 => 'FolderType',
77: 0x11 => 'Version',
78: 0x12 => 'FolderId',
79: 0x13 => 'GetChanges',
80: 0x14 => 'MoreAvailable',
81: 0x15 => 'WindowSize',
82: 0x16 => 'Commands',
83: 0x17 => 'Options',
84: 0x18 => 'FilterType',
85: 0x19 => 'Truncation',
86: 0x1a => 'RtfTruncation',
87: 0x1b => 'Conflict',
88: 0x1c => 'Folders',
89: 0x1d => 'Data',
90: 0x1e => 'DeletesAsMoves',
91: 0x1f => 'NotifyGUID',
92: 0x20 => 'Supported',
93: 0x21 => 'SoftDelete',
94: 0x22 => 'MIMESupport',
95: 0x23 => 'MIMETruncation',
96: ),
97:
98: 1 => array (
99: 0x05 => 'Anniversary',
100: 0x06 => 'AssistantName',
101: 0x07 => 'AssistnamePhoneNumber',
102: 0x08 => 'Birthday',
103: 0x09 => 'Body',
104: 0x0a => 'BodySize',
105: 0x0b => 'BodyTruncated',
106: 0x0c => 'Business2PhoneNumber',
107: 0x0d => 'BusinessCity',
108: 0x0e => 'BusinessCountry',
109: 0x0f => 'BusinessPostalCode',
110: 0x10 => 'BusinessState',
111: 0x11 => 'BusinessStreet',
112: 0x12 => 'BusinessFaxNumber',
113: 0x13 => 'BusinessPhoneNumber',
114: 0x14 => 'CarPhoneNumber',
115: 0x15 => 'Categories',
116: 0x16 => 'Category',
117: 0x17 => 'Children',
118: 0x18 => 'Child',
119: 0x19 => 'CompanyName',
120: 0x1a => 'Department',
121: 0x1b => 'Email1Address',
122: 0x1c => 'Email2Address',
123: 0x1d => 'Email3Address',
124: 0x1e => 'FileAs',
125: 0x1f => 'FirstName',
126: 0x20 => 'Home2PhoneNumber',
127: 0x21 => 'HomeCity',
128: 0x22 => 'HomeCountry',
129: 0x23 => 'HomePostalCode',
130: 0x24 => 'HomeState',
131: 0x25 => 'HomeStreet',
132: 0x26 => 'HomeFaxNumber',
133: 0x27 => 'HomePhoneNumber',
134: 0x28 => 'JobTitle',
135: 0x29 => 'LastName',
136: 0x2a => 'MiddleName',
137: 0x2b => 'MobilePhoneNumber',
138: 0x2c => 'OfficeLocation',
139: 0x2d => 'OtherCity',
140: 0x2e => 'OtherCountry',
141: 0x2f => 'OtherPostalCode',
142: 0x30 => 'OtherState',
143: 0x31 => 'OtherStreet',
144: 0x32 => 'PagerNumber',
145: 0x33 => 'RadioPhoneNumber',
146: 0x34 => 'Spouse',
147: 0x35 => 'Suffix',
148: 0x36 => 'Title',
149: 0x37 => 'WebPage',
150: 0x38 => 'YomiCompanyName',
151: 0x39 => 'YomiFirstName',
152: 0x3a => 'YomiLastName',
153: 0x3b => 'Rtf',
154: 0x3c => 'Picture',
155: ),
156:
157: 2 => array (
158: 0x05 => 'Attachment',
159: 0x06 => 'Attachments',
160: 0x07 => 'AttName',
161: 0x08 => 'AttSize',
162: 0x09 => 'AttOid',
163: 0x0a => 'AttMethod',
164: 0x0b => 'AttRemoved',
165: 0x0c => 'Body',
166: 0x0d => 'BodySize',
167: 0x0e => 'BodyTruncated',
168: 0x0f => 'DateReceived',
169: 0x10 => 'DisplayName',
170: 0x11 => 'DisplayTo',
171: 0x12 => 'Importance',
172: 0x13 => 'MessageClass',
173: 0x14 => 'Subject',
174: 0x15 => 'Read',
175: 0x16 => 'To',
176: 0x17 => 'Cc',
177: 0x18 => 'From',
178: 0x19 => 'Reply-To',
179: 0x1a => 'AllDayEvent',
180: 0x1b => 'Categories',
181: 0x1c => 'Category',
182: 0x1d => 'DtStamp',
183: 0x1e => 'EndTime',
184: 0x1f => 'InstanceType',
185: 0x20 => 'BusyStatus',
186: 0x21 => 'Location',
187: 0x22 => 'MeetingRequest',
188: 0x23 => 'Organizer',
189: 0x24 => 'RecurrenceId',
190: 0x25 => 'Reminder',
191: 0x26 => 'ResponseRequested',
192: 0x27 => 'Recurrences',
193: 0x28 => 'Recurrence',
194: 0x29 => 'Type',
195: 0x2a => 'Until',
196: 0x2b => 'Occurrences',
197: 0x2c => 'Interval',
198: 0x2d => 'DayOfWeek',
199: 0x2e => 'DayOfMonth',
200: 0x2f => 'WeekOfMonth',
201: 0x30 => 'MonthOfYear',
202: 0x31 => 'StartTime',
203: 0x32 => 'Sensitivity',
204: 0x33 => 'TimeZone',
205: 0x34 => 'GlobalObjId',
206: 0x35 => 'ThreadTopic',
207: 0x36 => 'MIMEData',
208: 0x37 => 'MIMETruncated',
209: 0x38 => 'MIMESize',
210: 0x39 => 'InternetCPID',
211: ),
212:
213: 3 => array (
214: 0x05 => 'Notify',
215: 0x06 => 'Notification',
216: 0x07 => 'Version',
217: 0x08 => 'Lifetime',
218: 0x09 => 'DeviceInfo',
219: 0x0a => 'Enable',
220: 0x0b => 'Folder',
221: 0x0c => 'ServerEntryId',
222: 0x0d => 'DeviceAddress',
223: 0x0e => 'ValidCarrierProfiles',
224: 0x0f => 'CarrierProfile',
225: 0x10 => 'Status',
226: 0x11 => 'Replies',
227: 0x12 => 'Devices',
228: 0x13 => 'Device',
229: 0x14 => 'Id',
230: 0x15 => 'Expiry',
231: 0x16 => 'NotifyGUID',
232: ),
233:
234: 4 => array (
235: 0x05 => 'Timezone',
236: 0x06 => 'AllDayEvent',
237: 0x07 => 'Attendees',
238: 0x08 => 'Attendee',
239: 0x09 => 'Email',
240: 0x0a => 'Name',
241: 0x0b => 'Body',
242: 0x0c => 'BodyTruncated',
243: 0x0d => 'BusyStatus',
244: 0x0e => 'Categories',
245: 0x0f => 'Category',
246: 0x10 => 'Rtf',
247: 0x11 => 'DtStamp',
248: 0x12 => 'EndTime',
249: 0x13 => 'Exception',
250: 0x14 => 'Exceptions',
251: 0x15 => 'Deleted',
252: 0x16 => 'ExceptionStartTime',
253: 0x17 => 'Location',
254: 0x18 => 'MeetingStatus',
255: 0x19 => 'OrganizerEmail',
256: 0x1a => 'OrganizerName',
257: 0x1b => 'Recurrence',
258: 0x1c => 'Type',
259: 0x1d => 'Until',
260: 0x1e => 'Occurrences',
261: 0x1f => 'Interval',
262: 0x20 => 'DayOfWeek',
263: 0x21 => 'DayOfMonth',
264: 0x22 => 'WeekOfMonth',
265: 0x23 => 'MonthOfYear',
266: 0x24 => 'Reminder',
267: 0x25 => 'Sensitivity',
268: 0x26 => 'Subject',
269: 0x27 => 'StartTime',
270: 0x28 => 'UID',
271:
272:
273:
274: ),
275:
276: 5 => array (
277: 0x05 => 'Moves',
278: 0x06 => 'Move',
279: 0x07 => 'SrcMsgId',
280: 0x08 => 'SrcFldId',
281: 0x09 => 'DstFldId',
282: 0x0a => 'Response',
283: 0x0b => 'Status',
284: 0x0c => 'DstMsgId',
285: ),
286:
287: 6 => array (
288: 0x05 => 'GetItemEstimate',
289: 0x06 => 'Version',
290: 0x07 => 'Folders',
291: 0x08 => 'Folder',
292: 0x09 => 'FolderType',
293: 0x0a => 'FolderId',
294: 0x0b => 'DateTime',
295: 0x0c => 'Estimate',
296: 0x0d => 'Response',
297: 0x0e => 'Status',
298: ),
299:
300: 7 => array (
301: 0x05 => 'Folders',
302: 0x06 => 'Folder',
303: 0x07 => 'DisplayName',
304: 0x08 => 'ServerEntryId',
305: 0x09 => 'ParentId',
306: 0x0a => 'Type',
307: 0x0b => 'Response',
308: 0x0c => 'Status',
309: 0x0d => 'ContentClass',
310: 0x0e => 'Changes',
311: 0x0f => 'Add',
312: 0x10 => 'Remove',
313: 0x11 => 'Update',
314: 0x12 => 'SyncKey',
315: 0x13 => 'FolderCreate',
316: 0x14 => 'FolderDelete',
317: 0x15 => 'FolderUpdate',
318: 0x16 => 'FolderSync',
319: 0x17 => 'Count',
320: 0x18 => 'Version',
321: ),
322:
323: 8 => array (
324: 0x05 => 'CalendarId',
325: 0x06 => 'FolderId',
326: 0x07 => 'MeetingResponse',
327: 0x08 => 'RequestId',
328: 0x09 => 'Request',
329: 0x0a => 'Result',
330: 0x0b => 'Status',
331: 0x0c => 'UserResponse',
332: 0x0d => 'Version',
333: ),
334:
335: 9 => array (
336: 0x05 => 'Body',
337: 0x06 => 'BodySize',
338: 0x07 => 'BodyTruncated',
339: 0x08 => 'Categories',
340: 0x09 => 'Category',
341: 0x0a => 'Complete',
342: 0x0b => 'DateCompleted',
343: 0x0c => 'DueDate',
344: 0x0d => 'UtcDueDate',
345: 0x0e => 'Importance',
346: 0x0f => 'Recurrence',
347: 0x10 => 'Type',
348: 0x11 => 'Start',
349: 0x12 => 'Until',
350: 0x13 => 'Occurrences',
351: 0x14 => 'Interval',
352: 0x16 => 'DayOfWeek',
353: 0x15 => 'DayOfMonth',
354: 0x17 => 'WeekOfMonth',
355: 0x18 => 'MonthOfYear',
356: 0x19 => 'Regenerate',
357: 0x1a => 'DeadOccur',
358: 0x1b => 'ReminderSet',
359: 0x1c => 'ReminderTime',
360: 0x1d => 'Sensitivity',
361: 0x1e => 'StartDate',
362: 0x1f => 'UtcStartDate',
363: 0x20 => 'Subject',
364: 0x21 => 'Rtf',
365: ),
366:
367: 0xa => array (
368: 0x05 => 'ResolveRecipients',
369: 0x06 => 'Response',
370: 0x07 => 'Status',
371: 0x08 => 'Type',
372: 0x09 => 'Recipient',
373: 0x0a => 'DisplayName',
374: 0x0b => 'EmailAddress',
375: 0x0c => 'Certificates',
376: 0x0d => 'Certificate',
377: 0x0e => 'MiniCertificate',
378: 0x0f => 'Options',
379: 0x10 => 'To',
380: 0x11 => 'CertificateRetrieval',
381: 0x12 => 'RecipientCount',
382: 0x13 => 'MaxCertificates',
383: 0x14 => 'MaxAmbiguousRecipients',
384: 0x15 => 'CertificateCount',
385: ),
386:
387: 0xb => array (
388: 0x05 => 'ValidateCert',
389: 0x06 => 'Certificates',
390: 0x07 => 'Certificate',
391: 0x08 => 'CertificateChain',
392: 0x09 => 'CheckCRL',
393: 0x0a => 'Status',
394: ),
395:
396: 0xc => array (
397: 0x05 => 'CustomerId',
398: 0x06 => 'GovernmentId',
399: 0x07 => 'IMAddress',
400: 0x08 => 'IMAddress2',
401: 0x09 => 'IMAddress3',
402: 0x0a => 'ManagerName',
403: 0x0b => 'CompanyMainPhone',
404: 0x0c => 'AccountName',
405: 0x0d => 'NickName',
406: 0x0e => 'MMS',
407: ),
408:
409: 0xd => array (
410: 0x05 => 'Ping',
411: 0x07 => 'Status',
412: 0x08 => 'HeartbeatInterval',
413: 0x09 => 'Folders',
414: 0x0a => 'Folder',
415: 0x0b => 'ServerEntryId',
416: 0x0c => 'FolderType',
417: ),
418:
419: 0xe => array (
420: 0x05 => 'Provision',
421: 0x06 => 'Policies',
422: 0x07 => 'Policy',
423: 0x08 => 'PolicyType',
424: 0x09 => 'PolicyKey',
425: 0x0A => 'Data',
426: 0x0B => 'Status',
427: 0x0C => 'RemoteWipe',
428: 0x0D => 'EASProvisionDoc',
429: ),
430:
431: 0xf => array(
432: 0x05 => 'Search',
433: 0x07 => 'Store',
434: 0x08 => 'Name',
435: 0x09 => 'Query',
436: 0x0A => 'Options',
437: 0x0B => 'Range',
438: 0x0C => 'Status',
439: 0x0D => 'Response',
440: 0x0E => 'Result',
441: 0x0F => 'Properties',
442: 0x10 => 'Total',
443: 0x11 => 'EqualTo',
444: 0x12 => 'Value',
445: 0x13 => 'And',
446: 0x14 => 'Or',
447: 0x15 => 'FreeText',
448: 0x17 => 'DeepTraversal',
449: 0x18 => 'LongId',
450: 0x19 => 'RebuildResults',
451: 0x1A => 'LessThan',
452: 0x1B => 'GreaterThan',
453: 0x1C => 'Schema',
454: 0x1D => 'Supported',
455: ),
456:
457: 0x10 => array(
458: 0x05 => 'DisplayName',
459: 0x06 => 'Phone',
460: 0x07 => 'Office',
461: 0x08 => 'Title',
462: 0x09 => 'Company',
463: 0x0A => 'Alias',
464: 0x0B => 'FirstName',
465: 0x0C => 'LastName',
466: 0x0D => 'HomePhone',
467: 0x0E => 'MobilePhone',
468: 0x0F => 'EmailAddress',
469: )
470: ),
471: 'namespaces' => array(
472: 1 => 'POOMCONTACTS',
473: 2 => 'POOMMAIL',
474: 3 => 'AirNotify',
475: 4 => 'POOMCAL',
476: 5 => 'Move',
477: 6 => 'GetItemEstimate',
478: 7 => 'FolderHierarchy',
479: 8 => 'MeetingResponse',
480: 9 => 'POOMTASKS',
481: 0xA => 'ResolveRecipients',
482: 0xB => 'ValidateCerts',
483: 0xC => 'POOMCONTACTS2',
484: 0xD => 'Ping',
485: 0xE => 'Provision',
486: 0xF => 'Search',
487: 0x10 => 'GAL',
488: )
489: );
490:
491: 492: 493: 494: 495: 496:
497: protected $_tagcp = 0;
498:
499: 500: 501: 502: 503: 504:
505: protected $_logStack = array();
506:
507: 508: 509: 510: 511:
512: protected $_logger;
513:
514: 515: 516: 517: 518:
519: protected $_stream;
520:
521: 522: 523:
524: public function __construct($stream)
525: {
526: $this->_stream = $stream;
527: $this->_logger = new Horde_Support_Stub();
528: }
529:
530: }