Home | History | Annotate | Download | only in hdr
      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 /*============================================================================
     18 
     19     Header Name: dmtAsyncData.h
     20 
     21     General Description: This file contains declaration of structures for
     22     async APIs
     23 
     24 ==============================================================================*/
     25 
     26 #ifndef DMT_ASYNC_STRUCT_H
     27 #define DMT_ASYNC_STRUCT_H
     28 
     29 /************** HEADER FILE INCLUDES *****************************************/
     30 
     31 #include "dmtAsyncAPI.h"
     32 #include "dmbuffer.h"
     33 #include "dmMemory.h"
     34 #include "dmt.hpp"
     35 
     36 
     37 /************** STRUCTURES, ENUMS, AND TYPEDEFS ******************************/
     38 
     39 class DMAsyncMessage
     40 {
     41 
     42 public:
     43 
     44     UINT32 messageID;
     45     UINT32 pUserData;
     46 
     47     DMAsyncMessage()
     48     {
     49       messageID = 0;
     50       pUserData = 0;
     51 
     52     }
     53 
     54     inline void* operator new(size_t sz)
     55     {
     56       return (DmAllocMem(sz));
     57     }
     58 
     59     inline void operator delete(void* buf)
     60     {
     61       DmFreeMem(buf);
     62     }
     63 
     64 
     65     SYNCML_DM_RET_STATUS_T set(UINT32 messageID, UINT32 pUserData)
     66     {
     67       this->messageID = messageID;
     68       this->pUserData = pUserData;
     69       return SYNCML_DM_SUCCESS;
     70     }
     71 
     72 };
     73 
     74 
     75 
     76 
     77 class DMPrincipalMessage : public DMAsyncMessage
     78 {
     79 
     80 public:
     81 
     82     DmtPrincipal principal;
     83 
     84     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
     85                                UINT32 messageID,
     86                                UINT32 pUserData);
     87 };
     88 
     89 
     90 class DMGetSubTreeMessage : public DMPrincipalMessage
     91 {
     92 
     93 public:
     94 
     95 
     96     DMString subtreeRoot;
     97     SYNCML_DM_TREE_LOCK_TYPE_T nLockType;
     98     DMT_CallbackGetTree callback;
     99 
    100 
    101     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    102                                 CPCHAR subtreeRoot,
    103                                 SYNCML_DM_TREE_LOCK_TYPE_T nLockType,
    104                                 DMT_CallbackGetTree callback,
    105                                 UINT32 messageID,
    106                                 UINT32 pUserData);
    107 
    108 };
    109 
    110 
    111 
    112 class DMScriptMessage : public DMPrincipalMessage
    113 {
    114 
    115 public:
    116     DMBuffer buf;
    117     BOOLEAN isWBXML;
    118 
    119 
    120     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    121                                const UINT8 * buf,
    122                                INT32 len,
    123                                BOOLEAN isWBXML,
    124                                UINT32 messageID,
    125                                UINT32 pUserData);
    126 
    127 };
    128 
    129 
    130 class DMProcessScriptMessage : public DMScriptMessage
    131 {
    132 
    133 public:
    134     DMT_CallbackProcessScript callback;
    135 
    136     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    137                                const UINT8 * buf,
    138                                INT32 len,
    139                                BOOLEAN isWBXML,
    140                                DMT_CallbackProcessScript callback,
    141                                UINT32 messageID,
    142                                UINT32 pUserData);
    143 
    144 };
    145 
    146 class DMBootstrapMessage : public DMScriptMessage
    147 {
    148 public:
    149     DMT_CallbackBootstrap callback;
    150     BOOLEAN isProcess;
    151 
    152     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    153                                const UINT8 * buf,
    154                                INT32 len,
    155                                BOOLEAN isWBXML,
    156                                BOOLEAN isProcess,
    157                                DMT_CallbackBootstrap callback,
    158                                UINT32 messageID,
    159                                UINT32 pUserData);
    160 
    161 };
    162 
    163 
    164 class DMStartServerSessionMessage : public DMPrincipalMessage
    165 {
    166 public:
    167     DmtSessionProp sessionProp;
    168     DMT_CallbackStatusCode callback;
    169 
    170     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    171                                const DMT_SESSION_PROP_T * pSessionProp,
    172                                DMT_CallbackStatusCode callback,
    173                                UINT32 messageID,
    174                                UINT32 pUserData);
    175 
    176 };
    177 
    178 class DMProcessNotificationMessage : public DMPrincipalMessage
    179 {
    180 public:
    181     DMBuffer buf;
    182     DMT_CallbackProcessNotification callback;
    183 
    184     SYNCML_DM_RET_STATUS_T set(CPCHAR szPrincipal,
    185                                const UINT8 * buf,
    186                                INT32 len,
    187                                DMT_CallbackProcessNotification callback,
    188                                UINT32 messageID,
    189                                UINT32 pUserData);
    190 
    191 };
    192 
    193 
    194 class DMTreeMessage : public DMAsyncMessage
    195 {
    196 public:
    197     DMT_H_TREE htree;
    198     DMString path;
    199 
    200     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    201                                CPCHAR path,
    202                                UINT32 messageID,
    203                                UINT32 pUserData);
    204 
    205 };
    206 
    207 
    208 class DMGetNodeMessage : public DMTreeMessage
    209 {
    210 public:
    211     DMT_CallbackGetNode callback;
    212 
    213     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    214                                CPCHAR path,
    215                                DMT_CallbackGetNode callback,
    216                                UINT32 messageID,
    217                                UINT32 pUserData);
    218 
    219 };
    220 
    221 
    222 class DMTreeNodeMessage : public DMTreeMessage
    223 {
    224 public:
    225     DMT_CallbackStatusCode callback;
    226     DMString str;
    227 
    228     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    229                                CPCHAR path,
    230                                CPCHAR str,
    231                                DMT_CallbackStatusCode callback,
    232                                UINT32 messageID,
    233                                UINT32 pUserData);
    234 
    235 };
    236 
    237 
    238 
    239 class DMCreateLeafNodeMessage : public DMTreeMessage
    240 {
    241 public:
    242     DmtData data;
    243     DMT_CallbackStatusCode callback;
    244 
    245     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    246                                CPCHAR path,
    247                                const DMT_DATA_T* data,
    248                                DMT_CallbackStatusCode callback,
    249                                UINT32 messageID,
    250                                UINT32 pUserData);
    251 
    252 };
    253 
    254 
    255 class DMGetChildNodeNamesMessage : public DMTreeMessage
    256 {
    257 public:
    258     DMT_CallbackGetChildNodeNames callback;
    259 
    260     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    261                                CPCHAR path,
    262                                DMT_CallbackGetChildNodeNames callback,
    263                                UINT32 messageID,
    264                                UINT32 pUserData);
    265 
    266 
    267 };
    268 
    269 class DMGetChildValuesMapMessage : public DMTreeMessage
    270 {
    271 public:
    272     DMT_CallbackGetChildValuesMap callback;
    273 
    274     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    275                                 CPCHAR path,
    276                                 DMT_CallbackGetChildValuesMap callback,
    277                                 UINT32 messageID,
    278                                 UINT32 pUserData);
    279 
    280 };
    281 
    282 
    283 class DMSetChildValuesMapMessage : public DMTreeMessage
    284 {
    285 public:
    286     DMMap<DMString, DmtData> data;
    287     DMT_CallbackStatusCode callback;
    288 
    289     SYNCML_DM_RET_STATUS_T set(DMT_H_TREE htree,
    290                                CPCHAR path,
    291                                const DMT_LEAF_CHILDREN_DATA_T*  data,
    292                                DMT_CallbackStatusCode callback,
    293                                UINT32 messageID,
    294                                UINT32 pUserData);
    295 
    296 };
    297 
    298 
    299 class DMSetValueMessage : public DMAsyncMessage
    300 {
    301 public:
    302     DMT_H_NODE hnode;
    303     DmtData data;
    304     DMT_CallbackStatusCode callback;
    305 
    306     SYNCML_DM_RET_STATUS_T set(DMT_H_NODE hnode,
    307                                 const DMT_DATA_T* data,
    308                                 DMT_CallbackStatusCode callback,
    309                                 UINT32 messageID,
    310                                 UINT32 pUserData);
    311 
    312 };
    313 
    314 
    315 class DMNodeMessage : public DMAsyncMessage
    316 {
    317 public:
    318     DMString str;
    319     DMT_H_NODE hnode;
    320     DMT_CallbackStatusCode callback;
    321 
    322     SYNCML_DM_RET_STATUS_T set(DMT_H_NODE hnode,
    323                                CPCHAR str,
    324                                DMT_CallbackStatusCode callback,
    325                                UINT32 messageID,
    326                                UINT32 pUserData);
    327 
    328 };
    329 
    330 
    331 class DMExecuteMessage :  public DMNodeMessage
    332 {
    333 public:
    334     DMString params;
    335     DMT_CallbackExecute callback;
    336 
    337     SYNCML_DM_RET_STATUS_T set(DMT_H_NODE hnode,
    338                                CPCHAR params,
    339                                DMT_CallbackExecute callback,
    340                                UINT32 messageID,
    341                                UINT32 pUserData);
    342 
    343 };
    344 
    345 #endif
    346