1/*
2 * Copyright Notice
3 * Copyright (c) Ericsson, IBM, Lotus, Matsushita Communication
4 * Industrial Co., Ltd., Motorola, Nokia, Openwave Systems, Inc.,
5 * Palm, Inc., Psion, Starfish Software, Symbian, Ltd. (2001).
6 * All Rights Reserved.
7 * Implementation of all or part of any Specification may require
8 * licenses under third party intellectual property rights,
9 * including without limitation, patent rights (such a third party
10 * may or may not be a Supporter). The Sponsors of the Specification
11 * are not responsible and shall not be held responsible in any
12 * manner for identifying or failing to identify any or all such
13 * third party intellectual property rights.
14 *
15 * THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN ARE PROVIDED
16 * ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND AND ERICSSON, IBM,
17 * LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO. LTD, MOTOROLA,
18 * NOKIA, PALM INC., PSION, STARFISH SOFTWARE AND ALL OTHER SYNCML
19 * SPONSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
20 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
21 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
22 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
23 * SHALL ERICSSON, IBM, LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO.,
24 * LTD, MOTOROLA, NOKIA, PALM INC., PSION, STARFISH SOFTWARE OR ANY
25 * OTHER SYNCML SPONSOR BE LIABLE TO ANY PARTY FOR ANY LOSS OF
26 * PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF
27 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL,
28 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH
29 * THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED
30 * OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
31 *
32 * The above notice and this paragraph must be included on all copies
33 * of this document that are made.
34 *
35 */
36/*************************************************************************/
37/*  Definitions                                                          */
38/*************************************************************************/
39
40#ifndef _XLT_ENC_COM_H
41#define _XLT_ENC_COM_H
42
43#include <smldef.h>
44#include <smldtd.h>
45#include <sml.h>
46
47#include "xlttags.h"
48
49
50#ifdef _cplusplus
51extern "C" {
52#endif
53
54// flags if a (WB)XML block is required or optional
55typedef enum {
56  OPTIONAL = 0,
57  REQUIRED
58} XltRO_t;
59
60/* Tag Types (TT) - begin tags, end tags, ...
61 */
62typedef enum {
63  TT_END = 0,
64  TT_BEG,
65  TT_ALL
66} XltTagType_t;
67
68/* Structure elements which are not directly relied to a tag
69*/
70typedef enum {
71  ITEM_LIST,
72  TARGET_LIST,
73  SOURCE_LIST,
74  META_LIST,
75  MAPITEM_LIST,
76  TARGETREF_LIST,
77  SOURCEREF_LIST
78} XltListType_t;
79
80// Type for storing free mem size evaluation information
81typedef struct XltSpaceEvaluation_s
82{
83  MemSize_t written_bytes;
84  MemSize_t end_tag_size;
85  // %%% luz 2002-09-03: evaluation needs private shadow copies of these:
86  SmlPcdataExtension_t cur_ext;
87  SmlPcdataExtension_t last_ext;
88} XltSpaceEvaluation_t, *XltSpaceEvaluationPtr_t;
89
90
91typedef struct bufferMgmt_s
92{
93  MemPtr_t smlXltBufferP;
94  MemPtr_t smlXltStoreBufP;
95  MemSize_t smlXltWrittenBytes;
96  MemSize_t smlXltBufferLen;
97  XltTagID_t           switchExtTag;
98  SmlPcdataExtension_t smlCurExt;
99  SmlPcdataExtension_t smlLastExt;
100  SmlPcdataExtension_t smlActiveExt;
101  MemSize_t endTagSize;
102  Boolean_t spaceEvaluation;
103  // %%% luz:2003-04-24: added syncmlvers
104  // %%% luz:2003-07-31: made it an enum, now called vers
105  SmlVersion_t vers;
106} BufferMgmt_t, *BufferMgmtPtr_t;
107
108/**
109 * FUNCTION: xltAddToBuffer
110 *
111 * Add a string to the global buffer
112 *
113 * PRE-Condition:  pContent contains some content bytes to write to the (WB) XML buffer
114 *
115 * POST-Condition: content is written to the buffer
116 *
117 * IN:             pContent, the character pointer referencing the content to
118 *                           write to the buffer
119 *                 size, the content length
120 *
121 * IN/OUT:         pBufMgr, pointer to a structure containing buffer management elements
122 *
123 * RETURN:         shows error codes of function,
124 *                 0, if OK
125 */
126Ret_t xltAddToBuffer(const MemPtr_t pContent, MemSize_t size, BufferMgmtPtr_t pBufMgr);
127
128#ifdef _cplusplus
129}
130#endif
131
132#endif
133