1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef DMSESSION_H 18#define DMSESSION_H 19 20#ifndef __cplusplus 21#error "This is a C++ header file; it requires C++ to compile." 22#endif 23 24/*================================================================================================== 25 26 Header Name: DMSession.h 27 28 General Description: This file contains declaration of of base DMSession class. 29 30==================================================================================================*/ 31 32#include "dmtDefs.h" 33#include "dmMemory.h" 34#include "dmSessionDefs.h" 35 36extern "C" { 37#include "sml.h" 38#include "smlerr.h" 39} 40 41/*================================================================================================== 42 CLASSES DECLARATION 43==================================================================================================*/ 44 45class DMSession 46{ 47 48 public: 49 DMSession(); 50 51 virtual ~DMSession(); 52 53 inline void* operator new(size_t sz) 54 { 55 return (DmAllocMem(sz)); 56 } 57 58 inline void operator delete(void* buf) 59 { 60 DmFreeMem(buf); 61 } 62 63 protected: 64 virtual SYNCML_DM_RET_STATUS_T Init(BOOLEAN isWBXML); 65 66 /* This function will be called to register the DM Engine with the SyncML Toolkit. */ 67 SYNCML_DM_RET_STATUS_T RegisterDmEngineWithSyncmlToolkit(VoidPtr_t pUserData); 68 69 /* This function will be called to register the DM Engine with the SyncML Toolkit. */ 70 virtual SYNCML_DM_RET_STATUS_T SetToolkitCallbacks(SmlCallbacks_t * pSmlCallbacks); 71 72 /* This function will be called to un-register the DM Engine with the SyncML Toolkit. */ 73 virtual void UnRegisterDmEngineWithSyncmlToolkit(); 74 75 76 protected: 77 78 InstanceID_t sendInstanceId; /* Reference for Send DM doc SyncML instance */ 79 InstanceID_t recvInstanceId; /* Reference for Recv DM doc SyncML instance */ 80 81 MemPtr_t pReadPos; /* Workspace Pointer from which data can be read */ 82 MemPtr_t pWritePos; /* Workspace Pointer to which data can be written */ 83 84 MemSize_t workspaceFreeSize; /* Max free Size of available space for data */ 85 MemSize_t workspaceUsedSize; /* Size of used data in workspace which may be 86 read */ 87 UINT8 *smlContentType; 88 SmlEncoding_t smlEncodingType; 89 90 SYNCML_DM_INDIRECT_BUFFER_T sendSmlDoc; /* The SyncML document to be send to the 91 server */ 92 SYNCML_DM_INDIRECT_BUFFER_T recvSmlDoc; /* The SycnML document to be received from 93 the server */ 94}; 95 96#endif /* SYNCML_DM_MGMTSESSION_H */ 97