1/*************************************************************************/
2/* module:          SyncML internal API of the MGR module                */
3/*                                                                       */
4/* file:            mgr.h                                                */
5/* target system:   all                                                  */
6/* target OS:       all                                                  */
7/*                                                                       */
8/* Description:                                                          */
9/* Definitions for internal use within the SyncML implementation         */
10/*************************************************************************/
11
12
13
14/*
15 * Copyright Notice
16 * Copyright (c) Ericsson, IBM, Lotus, Matsushita Communication
17 * Industrial Co., Ltd., Motorola, Nokia, Openwave Systems, Inc.,
18 * Palm, Inc., Psion, Starfish Software, Symbian, Ltd. (2001).
19 * All Rights Reserved.
20 * Implementation of all or part of any Specification may require
21 * licenses under third party intellectual property rights,
22 * including without limitation, patent rights (such a third party
23 * may or may not be a Supporter). The Sponsors of the Specification
24 * are not responsible and shall not be held responsible in any
25 * manner for identifying or failing to identify any or all such
26 * third party intellectual property rights.
27 *
28 * THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN ARE PROVIDED
29 * ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND AND ERICSSON, IBM,
30 * LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO. LTD, MOTOROLA,
31 * NOKIA, PALM INC., PSION, STARFISH SOFTWARE AND ALL OTHER SYNCML
32 * SPONSORS DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
33 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
34 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
35 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
36 * SHALL ERICSSON, IBM, LOTUS, MATSUSHITA COMMUNICATION INDUSTRIAL CO.,
37 * LTD, MOTOROLA, NOKIA, PALM INC., PSION, STARFISH SOFTWARE OR ANY
38 * OTHER SYNCML SPONSOR BE LIABLE TO ANY PARTY FOR ANY LOSS OF
39 * PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF
40 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL,
41 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH
42 * THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED
43 * OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
44 *
45 * The above notice and this paragraph must be included on all copies
46 * of this document that are made.
47 *
48 */
49
50
51#ifndef _MGR_H
52  #define _MGR_H
53
54
55/*************************************************************************
56 *  Definitions
57 *************************************************************************/
58
59
60#include <smldef.h>
61#include <sml.h>
62#include "wsm.h"
63#include <xlttagtbl.h>
64
65
66/**
67 * ========================================
68 * Definitions used for Instance Management
69 * ========================================
70 **/
71
72
73
74/**
75 * Current instance status
76 **/
77typedef enum {
78  MGR_IDLE,                                   // instance is idle (available for usage by applications)
79  MGR_USED,                                   // instance is in use, but currently inactive
80  MGR_RECEIVE,                                // actively used for receiving (locked by application)
81  MGR_SEND,                                   // actively used for sending (locked by application)
82  MGR_ENCODING,                               // actively used for encoding (locked by SyncML)
83  MGR_DECODING                                // actively used for decoding (locked by SyncML)
84} InstanceStatus_t;
85
86
87
88/**
89 * structure describing the current status of an instance,
90 **/
91typedef struct instance_info_s {
92  #ifndef NOWSM
93  InstanceID_t             id;                // unique ID of the instance
94  MemPtr_t                 workspaceHandle;   // handle to the  first position of the assigned workspace memory
95  #else
96  // buffer pointers for NOWSM simplified case
97  MemPtr_t                 instanceBuffer;    // pointer to instance work buffer
98  MemSize_t                instanceBufSiz;    // size of currently allocated buffer
99  Byte_t                   readLocked;        // set when buffer is locked for read
100  Byte_t                   writeLocked;       // set when buffer is locked for read
101  MemPtr_t                 readPointer;       // read pointer
102  MemPtr_t                 writePointer;      // write pointer
103  MemPtr_t                 outgoingMsgStart;  // set whenever a smlStartMessage is issued, NULL when invalid
104  MemSize_t                maxOutgoingSize;   // if<>0, smlXXXCmd will not modify the buffer when there's not enough room
105  #endif
106  InstanceStatus_t         status;            // current internal state of instance
107  SmlCallbacksPtr_t        callbacks;         // Defined callback refererences for this Instance
108  SmlInstanceOptionsPtr_t  instanceOptions;   // Defined options for this Instance (e.g. encoding type)
109  VoidPtr_t                userData;          // Pointer to a structure, which is passed to the invoked callback functions
110  #ifndef NOWSM
111  VoidPtr_t                workspaceState;	  // Pointer to a structure defining the current workspace status
112  #endif
113  VoidPtr_t                encoderState;	    // Pointer to a structure defining the current encoder status
114  VoidPtr_t                decoderState;	    // Pointer to a structure defining the current decoder status
115  #ifndef NOWSM
116  struct instance_info_s*  nextInfo;          // Pointer to next Instance Info in a list
117  #else
118  smlPrintFunc  defaultPrintFunc;             // default application callback for displaying strings (is a global in original version)
119  #endif
120} *InstanceInfoPtr_t, InstanceInfo_t;
121
122
123/* Pointers to store the global Tag tables */
124typedef struct tokeninfo_s {
125    TagPtr_t  SyncML;
126    TagPtr_t  MetInf;
127    TagPtr_t  DevInf;
128    TagPtr_t  DmTnd;
129} *TokenInfoPtr_t, TokenInfo_t;
130
131
132#ifndef NOWSM
133// Note, version without WSM has NO globals at all
134/**
135 * structure describing the current status of the global syncml module
136 * (holds all global variables within SyncML)
137 **/
138typedef struct syncml_info_s {
139  InstanceInfoPtr_t        instanceListAnchor;// Anchor of the global list of known SyncML instances
140  SmlOptionsPtr_t          syncmlOptions;     // Options valid for this SyncML Process
141  WsmGlobalsPtr_t          wsmGlobals;        // Workspace global variables
142  TokenInfoPtr_t           tokTbl;
143} *SyncMLInfoPtr_t, SyncMLInfo_t;
144#endif
145
146
147
148#ifndef NOWSM
149
150/*************************************************************************
151 *  External Function Declarations
152 *************************************************************************/
153
154
155/**
156 * FUNCTION:  mgrGetSyncMLInfo
157 * Retrieves a pointer to the structure holding all global informations within SyncML
158 *
159 * RETURN:    SyncMLInfoPtr_t
160 *            Pointer to the pGlobalAnchor
161 */
162SyncMLInfoPtr_t mgrGetSyncMLAnchor(void);
163
164
165/**
166 * FUNCTION:  mgrGetInstanceListAnchor
167 * Retrieves a pointer to the list holding all instance informations
168 *
169 * RETURN:    InstanceInfoPtr_t
170 *            Pointer to the pInstanceListAnchor
171 */
172InstanceInfoPtr_t mgrGetInstanceListAnchor(void);
173
174
175/**
176 * FUNCTION:  mgrSetInstanceListAnchor
177 * Set the pointer to the list holding all instance informations
178 *
179 * IN:        InstanceInfoPtr_t
180 *            Pointer to the pInstanceListAnchor
181 */
182void mgrSetInstanceListAnchor(InstanceInfoPtr_t newListAnchor);
183
184#endif // !defined(NOWSM)
185
186
187#endif // ifndef _MGR_H
188