1/*************************************************************************/ 2/* module: SyncML DTD specific type definitions */ 3/* */ 4/* file: smldtd.h */ 5/* target system: all */ 6/* target OS: all */ 7/* */ 8/* Description: */ 9/* Definition of structures representing DTD elements */ 10/*************************************************************************/ 11 12 13/********************************************************************/ 14/* NOTE: */ 15/* These definitions are based on the DTD dated from July, 7th, 00 */ 16/********************************************************************/ 17 18/* 19 * Copyright Notice 20 * Copyright (c) Ericsson, IBM, Lotus, Matsushita Communication 21 * Industrial Co., Ltd., Motorola, Nokia, Openwave Systems, Inc., 22 * Palm, Inc., Psion, Starfish Software, Symbian, Ltd. (2001). 23 * All Rights Reserved. 24 * Implementation of all or part of any Specification may require 25 * licenses under third party intellectual property rights, 26 * including without limitation, patent rights (such a third party 27 * may or may not be a Supporter). The Sponsors of the Specification 28 * are not responsible and shall not be held responsible in any 29 * manner for identifying or failing to identify any or all such 30 * third party intellectual property rights. 31 * 32 * THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN ARE PROVIDED 33 * ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND AND ERICSSON, IBM, 34 * LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO. LTD, MOTOROLA, 35 * NOKIA, PALM INC., PSION, STARFISH SOFTWARE AND ALL OTHER SYNCML 36 * SPONSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 37 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 38 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 39 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 40 * SHALL ERICSSON, IBM, LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO., 41 * LTD, MOTOROLA, NOKIA, PALM INC., PSION, STARFISH SOFTWARE OR ANY 42 * OTHER SYNCML SPONSOR BE LIABLE TO ANY PARTY FOR ANY LOSS OF 43 * PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF 44 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, 45 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH 46 * THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED 47 * OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. 48 * 49 * The above notice and this paragraph must be included on all copies 50 * of this document that are made. 51 * 52 */ 53 54 55#ifndef _SML_DTD_H 56 #define _SML_DTD_H 57 58 59/*************************************************************************/ 60/* Definitions */ 61/*************************************************************************/ 62 63 64#include <smldef.h> 65 66 67 68 69/** 70 * =========================== 71 * Common used SyncML Elements 72 * =========================== 73 */ 74 75 76 77/** 78 * PCDATA - types of synchronization data which SyncML supports 79 **/ 80typedef enum { 81 SML_PCDATA_UNDEFINED = 0, 82 SML_PCDATA_STRING, // String type 83 SML_PCDATA_OPAQUE, // Opaque type 84 SML_PCDATA_EXTENSION, // Extention type - specified by PcdataExtension_t 85 SML_PCDATA_CDATA // XML CDATA type 86} SmlPcdataType_t; 87 88 89/** 90 * PCDATA - types of extensions for PCData elements 91 */ 92typedef enum { 93 SML_EXT_UNDEFINED = 0, 94 SML_EXT_METINF, // Meta Information 95 SML_EXT_DEVINF, // Device Information 96 SML_EXT_DMTND, // DM TNM DDF 97 SML_EXT_LAST // last codepage, needed for loops! 98} SmlPcdataExtension_t; 99 100 101 102/** 103 * PCDATA - into this structure SyncML wraps the synchronization data itself 104 **/ 105typedef struct sml_pcdata_s { 106 SmlPcdataType_t contentType; // The type of data which a PCDATA structure contains 107 SmlPcdataExtension_t extension; // PCData Extension type 108 MemSize_t length; // length of the data in this PCDATA structure 109 VoidPtr_t content; // Pointer to the data itself 110} *SmlPcdataPtr_t, SmlPcdata_t; 111 112/* generic list of PCData elements */ 113typedef struct sml_pcdata_list_s { 114 SmlPcdataPtr_t data; 115 struct sml_pcdata_list_s *next; 116} *SmlPcdataListPtr_t, SmlPcdataList_t; 117 118/** 119 * Various flags which are actually declared and (EMPTY) elements in 120 * SyncML. This assumes at least a 16-bit architecture for the 121 * underlying OS. We need to review this if that is deemed a problem. 122 **/ 123#define SmlArchive_f 0x8000 // Delete flags 124#define SmlSftDel_f 0x4000 // Delete flags 125#define SmlESNData_f 0x2000 // ESN data flags 126#define SmlESNBinary_f 0x1000 // ESN binary data flags 127#define SmlMoreData_f 0x0400 // MoreData flag 128#define SmlNoResults_f 0x0200 // No Results flag 129#define SmlNoResp_f 0x0100 // No Response flag 130#define SmlFinal_f 0x0001 // Header flag 131#ifdef __USE_METINF__ 132#define SmlMetInfSharedMem_f 0x0002 // MetInf Shared Memory Flag 133#endif 134#ifdef __USE_DEVINF__ 135#define SmlDevInfSharedMem_f 0x0004 // DevInf Shared Memory Flag 136/* SCTSTK - 18/03/2002, S.H. 2002-04-05 : SyncML 1.1 */ 137#define SmlDevInfUTC_f 0x0001 // DevInf utc Flag 138#define SmlDevInfNOfM_f 0x0002 // DevInf support n of m Flag 139#define SmlDevInfLargeObject_f 0x0008 // DevInf support large object Flag 140#endif 141 142 143/** 144 * Chal 145 **/ 146typedef struct sml_chal_s { 147 SmlPcdataPtr_t meta; 148} *SmlChalPtr_t, SmlChal_t; 149 150/** 151 * Credentials 152 **/ 153typedef struct sml_cred_s { 154 SmlPcdataPtr_t meta; // opt. 155 SmlPcdataPtr_t data; 156} *SmlCredPtr_t, SmlCred_t; 157 158 159 160/** 161 * Source or target location 162 **/ 163typedef struct sml_source_or_target_s { 164 SmlPcdataPtr_t locURI; 165 SmlPcdataPtr_t locName; // opt. 166} *SmlSourcePtr_t, SmlSource_t, 167 *SmlTargetPtr_t, SmlTarget_t; 168 169typedef struct sml_source_list_s { 170 SmlSourcePtr_t source; 171 struct sml_source_list_s *next; 172} *SmlSourceListPtr_t, SmlSourceList_t; 173 174 175 176/** 177 * ============================== 178 * SyncML Message Header Elements 179 * ============================== 180 **/ 181 182 183/** 184 * SyncML header 185 * As the header is needed for each SyncML message, it's also the parameter 186 * of the startMessage call. 187 **/ 188typedef struct sml_sync_hdr_s { 189 SmlProtoElement_t elementType; // Internal Toolkit Field 190 SmlPcdataPtr_t version; 191 SmlPcdataPtr_t proto; 192 SmlPcdataPtr_t sessionID; 193 SmlPcdataPtr_t msgID; 194 Flag_t flags; // NoResp 195 SmlTargetPtr_t target; 196 SmlSourcePtr_t source; 197 SmlPcdataPtr_t respURI; // opt. 198 SmlCredPtr_t cred; // opt. 199 SmlPcdataPtr_t meta; // opt. 200} *SmlSyncHdrPtr_t, SmlSyncHdr_t; 201 202// SyncML Body and SyncML container is not needed, as there are function calls 203// (smlStartMessage(), smlEndMessage()) that let the framework know when to start and end 204// the SyncML document 205 206 207 208/** 209 * ========================= 210 * Data description elements 211 * ========================= 212 **/ 213 214 215/** 216 * Data in SyncML is encapsulated in an "item" element. 217 **/ 218typedef struct sml_item_s { 219 SmlTargetPtr_t target; // opt. 220 SmlSourcePtr_t source; // opt. 221 SmlPcdataPtr_t meta; // opt. 222 SmlPcdataPtr_t data; // opt. 223 Flag_t flags; // opt. for MoreData 224} *SmlItemPtr_t, SmlItem_t; 225 226typedef struct sml_item_list_s { 227 SmlItemPtr_t item; 228 struct sml_item_list_s *next; 229} *SmlItemListPtr_t, SmlItemList_t; 230 231 232/** 233 * ============================================== 234 * SyncML Commands (Protocol Management Elements) 235 * ============================================== 236 **/ 237 238 239 240/** 241 * Generic commands: 242 * Add, Copy, Replace, Delete 243 **/ 244typedef struct sml_generic_s { 245 SmlProtoElement_t elementType; // Internal Toolkit Field 246 SmlPcdataPtr_t cmdID; 247 Flag_t flags; // NoResp, Archive (Delete), SftDel (Delete) 248 SmlCredPtr_t cred; // opt. 249 SmlPcdataPtr_t meta; // opt. 250 SmlItemListPtr_t itemList; 251} *SmlAddPtr_t, SmlAdd_t, 252 *SmlCopyPtr_t, SmlCopy_t, 253 *SmlReplacePtr_t, SmlReplace_t, 254 *SmlDeletePtr_t, SmlDelete_t, 255 *SmlGenericCmdPtr_t, SmlGenericCmd_t; 256 257/** 258 * Alert command: 259 **/ 260typedef struct sml_alert_s { 261 SmlProtoElement_t elementType; // Internal Toolkit Field 262 SmlPcdataPtr_t cmdID; 263 Flag_t flags; // NoResp 264 SmlCredPtr_t cred; // opt. 265 SmlPcdataPtr_t data; // opt. 266 SmlItemListPtr_t itemList; 267 SmlPcdataPtr_t correlator; // opt. 268} *SmlAlertPtr_t, SmlAlert_t; 269 270 271/** 272 * Atomic/Sequence command: 273 **/ 274typedef struct sml_atomic_s { 275 SmlProtoElement_t elementType; // Internal Toolkit Field 276 SmlPcdataPtr_t cmdID; 277 Flag_t flags; // NoResp 278 SmlPcdataPtr_t meta; // opt. 279} *SmlAtomicPtr_t, SmlAtomic_t, 280 *SmlSequencePtr_t, SmlSequence_t; 281 282 283/** 284 * Sync command: 285 **/ 286typedef struct sml_sync_s { 287 SmlProtoElement_t elementType; // Internal Toolkit Field 288 SmlPcdataPtr_t cmdID; 289 Flag_t flags; // NoResp 290 SmlCredPtr_t cred; // opt. 291 SmlTargetPtr_t target; // opt. 292 SmlSourcePtr_t source; // opt. 293 SmlPcdataPtr_t meta; // opt. 294 SmlPcdataPtr_t noc; // opt. (SyncML 1.1) 295} *SmlSyncPtr_t, SmlSync_t; 296 297 298/** 299 * Exec command: 300 **/ 301typedef struct sml_exec_s { 302 SmlProtoElement_t elementType; 303 SmlPcdataPtr_t cmdID; 304 Flag_t flags; // NoResp 305 SmlCredPtr_t cred; // opt. 306 SmlPcdataPtr_t meta; // opt. 307 SmlItemPtr_t item; 308 SmlPcdataPtr_t correlator; // opt. 309 310} *SmlExecPtr_t, SmlExec_t; 311 312 313/** 314 * Get and Put command: 315 **/ 316typedef struct sml_get_put_s { 317 SmlProtoElement_t elementType; // Internal Toolkit Field 318 SmlPcdataPtr_t cmdID; 319 Flag_t flags; // NoResp 320 SmlPcdataPtr_t lang; // opt. 321 SmlCredPtr_t cred; // opt. 322 SmlPcdataPtr_t meta; // opt. 323 SmlItemListPtr_t itemList; 324} *SmlPutPtr_t, SmlPut_t, 325 *SmlGetPtr_t, SmlGet_t; 326 327 328/** 329 * Map command: 330 **/ 331typedef struct sml_map_item_s { 332 SmlTargetPtr_t target; 333 SmlSourcePtr_t source; 334} *SmlMapItemPtr_t, SmlMapItem_t; 335 336typedef struct sml_map_item_list_s { 337 SmlMapItemPtr_t mapItem; 338 struct sml_map_item_list_s *next; 339} *SmlMapItemListPtr_t, SmlMapItemList_t; 340 341typedef struct sml_map_s { 342 SmlProtoElement_t elementType; // InternalToolkit Field 343 SmlPcdataPtr_t cmdID; 344 SmlTargetPtr_t target; 345 SmlSourcePtr_t source; 346 SmlCredPtr_t cred; // opt. 347 SmlPcdataPtr_t meta; // opt. 348 SmlMapItemListPtr_t mapItemList; 349} *SmlMapPtr_t, SmlMap_t; 350 351 352 353/** 354 * Results command: 355 **/ 356typedef struct sml_results_s { 357 SmlProtoElement_t elementType; // Internal Toolkit Field 358 SmlPcdataPtr_t cmdID; 359 SmlPcdataPtr_t msgRef; // opt. 360 SmlPcdataPtr_t cmdRef; 361 SmlPcdataPtr_t meta; // opt. 362 SmlPcdataPtr_t targetRef; // opt. 363 SmlPcdataPtr_t sourceRef; // opt. 364 SmlItemListPtr_t itemList; 365} *SmlResultsPtr_t, SmlResults_t; 366 367 368/** 369 * Search command: 370 **/ 371typedef struct sml_search_s { 372 SmlProtoElement_t elementType; // Internal Toolkit Field 373 SmlPcdataPtr_t cmdID; 374 Flag_t flags; // NoResp, NoResults 375 SmlCredPtr_t cred; // opt. 376 SmlTargetPtr_t target; // opt. 377 SmlSourceListPtr_t sourceList; 378 SmlPcdataPtr_t lang; // opt. 379 SmlPcdataPtr_t meta; 380 SmlPcdataPtr_t data; 381} *SmlSearchPtr_t, SmlSearch_t; 382 383 384/** 385 * Status command: 386 **/ 387 388typedef struct sml_target_ref_list_s { 389 SmlPcdataPtr_t targetRef; 390 struct sml_target_ref_list_s *next; 391} *SmlTargetRefListPtr_t, SmlTargetRefList_t; 392 393typedef struct sml_source_ref_list_s { 394 SmlPcdataPtr_t sourceRef; 395 struct sml_source_ref_list_s *next; 396} *SmlSourceRefListPtr_t, SmlSourceRefList_t; 397 398typedef struct sml_status_s { 399 SmlProtoElement_t elementType; // Internal Toolkit Field 400 SmlPcdataPtr_t cmdID; 401 SmlPcdataPtr_t msgRef; // Opt. 402 SmlPcdataPtr_t cmdRef; 403 SmlPcdataPtr_t cmd; 404 SmlTargetRefListPtr_t targetRefList; // opt. 405 SmlSourceRefListPtr_t sourceRefList; // opt. 406 SmlCredPtr_t cred; // opt. 407 SmlChalPtr_t chal; // opt. 408 SmlPcdataPtr_t data; 409 SmlItemListPtr_t itemList; // opt. 410} *SmlStatusPtr_t, SmlStatus_t; 411 412 413/** 414 * a little helper for typecasting 415 **/ 416typedef struct sml_unknown_proto_element_s { 417 SmlProtoElement_t elementType; // Internal Toolkit Field 418} *SmlUnknownProtoElementPtr_t, SmlUnknownProtoElement_t; 419 420 421#endif 422