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: dmtAsyncAPI.cc 20 21 General Description: This file contains implementation of the DMT async APIs 22 23 ==============================================================================*/ 24 25 #include "dmtAsyncMessage.h" 26 #include "xpl_Message.h" 27 #include "xpl_Time.h" 28 #include "dmAsyncMessageID.h" 29 #include "dm_tree_util.h" 30 #include "dmt.hpp" 31 #include "dmMemory.h" 32 #include "xpl_Logger.h" 33 34 static DMVector<PDmtTree> treeHandlerVector; 35 static DMVector<PDmtNode> nodeHandlerVector; 36 37 void dmtBuildCallbackData(DMT_DATA_T * pCallbackData, const DmtData & oDmtData) 38 { 39 SYNCML_DM_DATAFORMAT_T format; 40 DMString & strData = (DMString&)oDmtData.GetStringValue(); 41 DMVector<UINT8> & binData = (DMVector<UINT8>&)oDmtData.GetBinaryValue(); 42 43 pCallbackData->meta_format = SYNCML_DM_DATAFORMAT_UNDEFINED; 44 format = oDmtData.GetType(); 45 switch ( format ) 46 { 47 case SYNCML_DM_DATAFORMAT_STRING: 48 case SYNCML_DM_DATAFORMAT_FLOAT: 49 case SYNCML_DM_DATAFORMAT_DATE: 50 case SYNCML_DM_DATAFORMAT_TIME: 51 pCallbackData->meta_format = format; 52 pCallbackData->data.str_value = strData.detach(); 53 break; 54 55 case SYNCML_DM_DATAFORMAT_INT: 56 pCallbackData->meta_format = format; 57 oDmtData.GetInt(pCallbackData->data.int_value); 58 break; 59 60 case SYNCML_DM_DATAFORMAT_BOOL: 61 pCallbackData->meta_format = format; 62 oDmtData.GetBoolean((BOOLEAN&)pCallbackData->data.int_value); 63 break; 64 65 case SYNCML_DM_DATAFORMAT_BIN: 66 pCallbackData->meta_format = format; 67 pCallbackData->data.bin.bin_value = binData.get_data(); 68 pCallbackData->data.bin.len_bin_data = binData.size(); 69 binData.detach(); 70 break; 71 } 72 73 } 74 75 76 void dmtBuildStatusStruct(DMT_CALLBACK_STRUCT_STATUS_T *pStruct, 77 UINT32 pUserData, 78 DMT_OPERATION_TYPE_T nCallbackType, 79 SYNCML_DM_RET_STATUS_T nStatusCode) 80 { 81 pStruct->pUserData = (void*)pUserData; 82 pStruct->nCallbackType = nCallbackType; 83 pStruct->nStatusCode = nStatusCode; 84 } 85 86 87 void dmtSendStatusStruct(DMT_CALLBACK_STRUCT_STATUS_T *pStruct, 88 DMT_CallbackStatusCode callback, 89 UINT32 messageID) 90 { 91 if ( callback ) 92 callback(pStruct); 93 else 94 if ( messageID ) 95 XPL_MSG_Send(XPL_PORT_DM,messageID,pStruct,sizeof(DMT_CALLBACK_STRUCT_STATUS_T)); 96 } 97 98 99 100 INT32 dmtFindTreeHandler(DMT_H_TREE htree) 101 { 102 INT32 size = treeHandlerVector.size(); 103 for (INT32 index=0; index<size; index++) 104 { 105 PDmtTree & tree = treeHandlerVector[index]; 106 if ( tree == (DmtTree*)htree ) 107 return index; 108 } 109 return -1; 110 } 111 112 113 INT32 dmtFindNodeHandler(DMT_H_NODE hnode) 114 { 115 INT32 size = nodeHandlerVector.size(); 116 for (INT32 index=0; index<size; index++) 117 { 118 PDmtNode & node = nodeHandlerVector[index]; 119 if ( node == (DmtNode*)hnode ) 120 return index; 121 } 122 return -1; 123 } 124 125 DmtTree * dmtGetTreeHandler(DMT_H_TREE htree) 126 { 127 if ( dmtFindTreeHandler(htree) == -1 ) 128 return NULL; 129 else 130 return (DmtTree*)htree; 131 } 132 133 134 DmtNode * dmtGetNodeHandler(DMT_H_NODE hnode) 135 { 136 if ( dmtFindNodeHandler(hnode) == -1 ) 137 return NULL; 138 else 139 return (DmtNode*)hnode; 140 } 141 142 143 void dmtNotifyHandler(void *data) 144 { 145 SYNCML_DM_NOTIFY_MESSAGE_T *pMessage = (SYNCML_DM_NOTIFY_MESSAGE_T *)data; 146 147 if ( pMessage->callback ) 148 pMessage->callback(); 149 else 150 if ( pMessage->messageID ) 151 XPL_MSG_Send(XPL_PORT_DM,pMessage->messageID,NULL,0); 152 } 153 154 155 #ifdef DM_NO_LOCKING 156 void dmtHandleTimer(void * data) 157 { 158 SYNCML_DM_TIMER_MSG_T *pMessage = (SYNCML_DM_TIMER_MSG_T *)data; 159 160 //XPL_CLK_StopTimer(pMessage->timerHandle); 161 pMessage->callback(); 162 } 163 #endif 164 165 166 void dmtEngineHandler(SYNCML_DM_TASK_MESSAGE_ID operation, void *data) 167 { 168 SYNCML_DM_ENGINE_MESSAGE_T *pMessage = (SYNCML_DM_ENGINE_MESSAGE_T *)data; 169 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 170 SYNCML_DM_RET_STATUS_T res; 171 172 treeHandlerVector.clear(); 173 nodeHandlerVector.clear(); 174 175 if ( operation == SYNCML_DM_INIT_MSG_ID ) 176 res = DmtTreeFactory::Initialize(); 177 else 178 res = DmtTreeFactory::Uninitialize(); 179 180 dmtBuildStatusStruct(&statusStruct,pMessage->pUserData,operation,res); 181 dmtSendStatusStruct(&statusStruct,pMessage->callback,pMessage->messageID); 182 } 183 184 185 186 void dmtGetSubtreeExHandler(void * data) 187 { 188 189 SYNCML_DM_GET_SUB_TREE_MESSAGE_T *pMessage = (SYNCML_DM_GET_SUB_TREE_MESSAGE_T *)data; 190 PDmtTree ptrTree; 191 192 DMT_CALLBACK_STRUCT_GETTREE_T treeStruct; 193 194 treeStruct.pUserData = (void*)pMessage->pMsg->pUserData; 195 treeStruct.htree = 0; 196 197 treeStruct.nStatusCode = DmtTreeFactory::GetSubtreeEx(pMessage->pMsg->principal, 198 pMessage->pMsg->subtreeRoot, 199 pMessage->pMsg->nLockType, 200 ptrTree); 201 202 if ( treeStruct.nStatusCode == SYNCML_DM_SUCCESS ) 203 { 204 treeHandlerVector.push_back(ptrTree); 205 treeStruct.htree = (DMT_H_TREE)ptrTree.GetPtr(); 206 } 207 if ( pMessage->pMsg->callback ) 208 pMessage->pMsg->callback(&treeStruct); 209 else 210 if ( pMessage->pMsg->messageID ) 211 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&treeStruct,sizeof(DMT_CALLBACK_STRUCT_GETTREE_T)); 212 delete pMessage->pMsg; 213 214 } 215 216 217 void dmtTreeReleaseHandler(void * data) 218 { 219 220 SYNCML_DM_TREE_MESSAGE_T *pMessage = (SYNCML_DM_TREE_MESSAGE_T*)data; 221 INT32 pos; 222 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 223 224 pos = dmtFindTreeHandler(pMessage->htree); 225 226 if ( pos != -1 ) 227 { 228 treeHandlerVector.remove(pos); 229 dmtBuildStatusStruct(&statusStruct,pMessage->pUserData,DMT_OPERATION_RELEASE_TREE,SYNCML_DM_SUCCESS); 230 } 231 else 232 dmtBuildStatusStruct(&statusStruct,pMessage->pUserData,DMT_OPERATION_RELEASE_TREE,SYNCML_DM_FAIL); 233 234 dmtSendStatusStruct(&statusStruct,pMessage->callback,pMessage->messageID); 235 } 236 237 238 239 void dmtProcessScriptHandler(void * data) 240 { 241 242 SYNCML_DM_PROCESS_SCRIPT_MESSAGE_T *pMessage = (SYNCML_DM_PROCESS_SCRIPT_MESSAGE_T*)data; 243 DMT_CALLBACK_STRUCT_PROCESS_SCRIPT_T scriptStruct; 244 DMString oResult; 245 246 scriptStruct.nStatusCode = DmtTreeFactory::ProcessScript(pMessage->pMsg->principal, 247 pMessage->pMsg->buf.getBuffer(), 248 pMessage->pMsg->buf.getSize(), 249 pMessage->pMsg->isWBXML, 250 oResult); 251 252 scriptStruct.pUserData = (void*)pMessage->pMsg->pUserData; 253 scriptStruct.result_len = oResult.length(); 254 scriptStruct.result = oResult.detach(); 255 256 if ( pMessage->pMsg->callback ) 257 { 258 pMessage->pMsg->callback(&scriptStruct); 259 DMT_Free_ProcessScriptStruct(&scriptStruct); 260 } 261 else 262 if ( pMessage->pMsg->messageID ) 263 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&scriptStruct,sizeof(DMT_CALLBACK_STRUCT_PROCESS_SCRIPT_T)); 264 delete pMessage->pMsg; 265 266 } 267 268 269 270 void dmtBootstrapHandler(void * data) 271 { 272 273 SYNCML_DM_BOOTSTRAP_MESSAGE_T *pMessage = (SYNCML_DM_BOOTSTRAP_MESSAGE_T*)data; 274 DMT_CALLBACK_STRUCT_BOOTSTRAP_T scriptStruct; 275 DMString serverID; 276 277 scriptStruct.nStatusCode = DmtTreeFactory::Bootstrap(pMessage->pMsg->principal, 278 pMessage->pMsg->buf.getBuffer(), 279 pMessage->pMsg->buf.getSize(), 280 pMessage->pMsg->isWBXML, 281 pMessage->pMsg->isProcess, 282 serverID); 283 284 scriptStruct.pUserData = (void*)pMessage->pMsg->pUserData; 285 scriptStruct.serverID = serverID.detach(); 286 if ( pMessage->pMsg->callback ) 287 { 288 pMessage->pMsg->callback(&scriptStruct); 289 DMT_Free_BootstrapStruct(&scriptStruct); 290 } 291 else 292 if ( pMessage->pMsg->messageID ) 293 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&scriptStruct,sizeof(DMT_CALLBACK_STRUCT_BOOTSTRAP_T)); 294 delete pMessage->pMsg; 295 296 } 297 298 299 #ifdef DM_NOTIFICATION_AGENT 300 void dmtProcessNotificationHandler(void * data) 301 { 302 303 SYNCML_DM_PROCESS_NOTIFICATION_MESSAGE_T *pMessage = (SYNCML_DM_PROCESS_NOTIFICATION_MESSAGE_T*)data; 304 DMT_CALLBACK_STRUCT_PROCESS_NOTIFICATION_T notifStruct; 305 DmtNotification notification; 306 307 notifStruct.nStatusCode = DmtTreeFactory::ProcessNotification(pMessage->pMsg->principal, 308 pMessage->pMsg->buf.getBuffer(), 309 pMessage->pMsg->buf.getSize(), 310 notification); 311 312 notifStruct.pUserData = (void*)pMessage->pMsg->pUserData; 313 314 notifStruct.notification.uiMode = notification.getUIMode(); 315 notifStruct.notification.initiator = notification.getInitiator(); 316 notifStruct.notification.sessionID = notification.getSessionID(); 317 notifStruct.notification.authFlag = notification.getAuthFlag(); 318 DMString & serverID = (DMString&)notification.getServerID(); 319 320 notifStruct.notification.serverID = serverID.detach(); 321 322 if ( pMessage->pMsg->callback ) 323 { 324 pMessage->pMsg->callback(¬ifStruct); 325 DMT_Free_ProcessNotificationStruct(¬ifStruct); 326 } 327 else 328 if ( pMessage->pMsg->messageID ) 329 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,¬ifStruct,sizeof(DMT_CALLBACK_STRUCT_PROCESS_NOTIFICATION_T)); 330 delete pMessage->pMsg; 331 332 } 333 #endif 334 335 void dmtStartServerSessionHandler(void * data) 336 { 337 SYNCML_DM_START_SERVER_SESSION_MESSAGE_T *pMessage = (SYNCML_DM_START_SERVER_SESSION_MESSAGE_T*)data; 338 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 339 SYNCML_DM_RET_STATUS_T res; 340 341 res = DmtTreeFactory::StartServerSession(pMessage->pMsg->principal,pMessage->pMsg->sessionProp); 342 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_START_SRV_SESSION,res); 343 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 344 delete pMessage->pMsg; 345 } 346 347 void dmtGetNodeHandler(void * data) 348 { 349 350 SYNCML_DM_GET_NODE_MESSAGE_T *pMessage = (SYNCML_DM_GET_NODE_MESSAGE_T*)data; 351 DMT_CALLBACK_STRUCT_GETNODE_T nodeStruct; 352 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 353 PDmtNode ptrNode; 354 355 nodeStruct.hnode = 0; 356 nodeStruct.pUserData = (void*)pMessage->pMsg->pUserData; 357 if ( pTree == NULL ) 358 nodeStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 359 else 360 { 361 362 nodeStruct.nStatusCode = pTree->GetNode(pMessage->pMsg->path, ptrNode); 363 if ( nodeStruct.nStatusCode == SYNCML_DM_SUCCESS ) 364 { 365 nodeHandlerVector.push_back(ptrNode); 366 nodeStruct.hnode = (DMT_H_NODE)ptrNode.GetPtr(); 367 nodeStruct.leaf_node = ptrNode->IsLeaf(); 368 nodeStruct.external_storage_node = ptrNode->IsExternalStorageNode(); 369 } 370 } 371 if ( pMessage->pMsg->callback ) 372 pMessage->pMsg->callback(&nodeStruct); 373 else 374 if ( pMessage->pMsg->messageID ) 375 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&nodeStruct,sizeof(DMT_CALLBACK_STRUCT_GETNODE_T)); 376 delete pMessage->pMsg; 377 } 378 379 void dmtNodeReleaseHandler(void * data) 380 { 381 SYNCML_DM_NODE_MESSAGE_T *pMessage = (SYNCML_DM_NODE_MESSAGE_T*)data; 382 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 383 INT32 pos; 384 385 pos = dmtFindNodeHandler(pMessage->pMsg->hnode); 386 if ( pos != -1 ) 387 { 388 nodeHandlerVector.remove(pos); 389 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_RELEASE_NODE,SYNCML_DM_SUCCESS); 390 } 391 else 392 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_RELEASE_NODE,SYNCML_DM_FAIL); 393 394 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 395 delete pMessage->pMsg; 396 397 } 398 399 400 void dmtTreeNodeHandler(SYNCML_DM_TASK_MESSAGE_ID operation, void * data) 401 { 402 SYNCML_DM_TREENODE_MESSAGE_T *pMessage = (SYNCML_DM_TREENODE_MESSAGE_T*)data; 403 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 404 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 405 406 if ( pTree == NULL ) 407 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,operation,SYNCML_DM_INVALID_PARAMETER); 408 else 409 { 410 SYNCML_DM_RET_STATUS_T res; 411 switch ( operation ) 412 { 413 case SYNCML_DM_DELETE_NODE_MSG_ID: 414 res = pTree->DeleteNode(pMessage->pMsg->path); 415 break; 416 case SYNCML_DM_RENAME_NODE_MSG_ID: 417 res = pTree->RenameNode(pMessage->pMsg->path,pMessage->pMsg->str); 418 break; 419 case SYNCML_DM_CREATE_INTERIOR_NODE_MSG_ID: 420 { 421 PDmtNode ptrNode; 422 res = pTree->CreateInteriorNode(pMessage->pMsg->path, ptrNode); 423 } 424 break; 425 } 426 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,operation,res); 427 } 428 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 429 delete pMessage->pMsg; 430 } 431 432 433 434 void dmtCreateLeafNodeHandler(void * data) 435 { 436 437 SYNCML_DM_CREATE_LEAF_NODE_MESSAGE_T *pMessage = (SYNCML_DM_CREATE_LEAF_NODE_MESSAGE_T*)data; 438 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 439 440 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 441 442 if ( pTree == NULL ) 443 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_CREATEL_NODE,SYNCML_DM_INVALID_PARAMETER); 444 else 445 { 446 447 SYNCML_DM_RET_STATUS_T res; 448 PDmtNode ptrNode; 449 450 res = pTree->CreateLeafNode(pMessage->pMsg->path, ptrNode,pMessage->pMsg->data); 451 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_CREATEL_NODE,res); 452 } 453 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 454 delete pMessage->pMsg; 455 456 } 457 458 459 void dmtGetChildNodeNamesHandler(void * data) 460 { 461 462 SYNCML_DM_GET_CHILD_NODE_NAMES_MESSAGE_T *pMessage = (SYNCML_DM_GET_CHILD_NODE_NAMES_MESSAGE_T*)data; 463 DMT_CALLBACK_STRUCT_GET_CHILDNODE_NAMES_T nodeStruct; 464 DMStringVector mapNodes; 465 466 memset(&nodeStruct,0,sizeof(DMT_CALLBACK_STRUCT_GET_CHILDNODE_NAMES_T)); 467 nodeStruct.pUserData = (void*)pMessage->pMsg->pUserData; 468 469 470 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 471 472 if ( pTree == NULL ) 473 nodeStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 474 else 475 { 476 477 nodeStruct.nStatusCode = pTree->GetChildNodeNames(pMessage->pMsg->path, mapNodes); 478 if ( nodeStruct.nStatusCode == SYNCML_DM_SUCCESS ) 479 { 480 INT32 size = mapNodes.size(); 481 nodeStruct.ppChildren = (CPCHAR*)DmAllocMem(size*sizeof(CPCHAR)); 482 if ( nodeStruct.ppChildren == NULL ) 483 nodeStruct.nStatusCode = SYNCML_DM_DEVICE_FULL; 484 else 485 { 486 nodeStruct.num_children = size; 487 for (int index=0; index<size; index++) 488 { 489 DMString & str = mapNodes[index]; 490 nodeStruct.ppChildren[index] = str.detach(); 491 } 492 } 493 } 494 } 495 if ( pMessage->pMsg->callback ) 496 { 497 pMessage->pMsg->callback(&nodeStruct); 498 DMT_Free_GetChildNodeNamesStruct(&nodeStruct); 499 } 500 else 501 if ( pMessage->pMsg->messageID ) 502 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&nodeStruct,sizeof(DMT_CALLBACK_STRUCT_GET_CHILDNODE_NAMES_T)); 503 delete pMessage->pMsg; 504 505 506 } 507 508 509 void dmtTreeHandler(SYNCML_DM_TASK_MESSAGE_ID operation, void * data) 510 { 511 SYNCML_DM_TREE_MESSAGE_T *pMessage = (SYNCML_DM_TREE_MESSAGE_T*)data; 512 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 513 514 DmtTree * pTree = dmtGetTreeHandler(pMessage->htree); 515 516 if ( pTree == NULL ) 517 dmtBuildStatusStruct(&statusStruct,pMessage->pUserData,operation,SYNCML_DM_INVALID_PARAMETER); 518 else 519 { 520 SYNCML_DM_RET_STATUS_T res; 521 switch ( operation ) 522 { 523 case SYNCML_DM_FLUSH_MSG_ID: 524 res = pTree->Flush(); 525 break; 526 527 case SYNCML_DM_COMMIT_MSG_ID: 528 res = pTree->Commit(); 529 break; 530 531 case SYNCML_DM_ROLLBACK_MSG_ID: 532 res = pTree->Rollback(); 533 break; 534 535 case SYNCML_DM_BEGIN_MSG_ID: 536 res = pTree->Begin(); 537 break; 538 } 539 dmtBuildStatusStruct(&statusStruct,pMessage->pUserData,operation,res); 540 } 541 dmtSendStatusStruct(&statusStruct,pMessage->callback,pMessage->messageID); 542 543 } 544 545 546 547 void dmtGetChildValuesMapHandler(void * data) 548 { 549 550 SYNCML_DM_GET_CHILD_VALUES_MAP_MESSAGE_T *pMessage = (SYNCML_DM_GET_CHILD_VALUES_MAP_MESSAGE_T*)data; 551 DMT_CALLBACK_STRUCT_GET_CHILDVALUES_MAP_T nodeStruct; 552 DMMap<DMString, DmtData> mapNodes; 553 554 555 memset(&nodeStruct,0,sizeof(DMT_CALLBACK_STRUCT_GET_CHILDVALUES_MAP_T)); 556 nodeStruct.pUserData = (void*)pMessage->pMsg->pUserData; 557 558 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 559 560 if ( pTree == NULL ) 561 nodeStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 562 else 563 { 564 nodeStruct.nStatusCode = pTree->GetChildValuesMap(pMessage->pMsg->path, mapNodes); 565 if ( nodeStruct.nStatusCode == SYNCML_DM_SUCCESS ) 566 { 567 BOOLEAN isMemFailed = FALSE; 568 INT32 size = mapNodes.size(); 569 570 nodeStruct.data.ppChildren = (CPCHAR*)DmAllocMem(size*sizeof(CPCHAR)); 571 if ( nodeStruct.data.ppChildren == NULL ) 572 isMemFailed = TRUE; 573 else 574 { 575 nodeStruct.data.pData = (DMT_DATA_T*)DmAllocMem(size*sizeof(DMT_DATA_T)); 576 if ( nodeStruct.data.pData == NULL ) 577 isMemFailed = TRUE; 578 } 579 580 if ( isMemFailed == FALSE ) 581 { 582 nodeStruct.data.num_children = mapNodes.size(); 583 for (int POS=mapNodes.begin(); POS<mapNodes.end(); POS++) 584 { 585 nodeStruct.data.ppChildren[POS] = (CPCHAR)mapNodes.get_key(POS); 586 const DmtData & oData = mapNodes.get_value(POS); 587 dmtBuildCallbackData((DMT_DATA_T*)&nodeStruct.data.pData[POS], oData); 588 } 589 590 } 591 else 592 { 593 nodeStruct.nStatusCode = SYNCML_DM_DEVICE_FULL; 594 XPL_LOG_DM_API_Error(("dmtGetChildValuesMapHandler : unable allocate memory\n")); 595 } 596 } 597 598 } 599 600 if ( pMessage->pMsg->callback ) 601 { 602 pMessage->pMsg->callback(&nodeStruct); 603 DMT_Free_GetChildValuesStruct(&nodeStruct); 604 } 605 else 606 if ( pMessage->pMsg->messageID ) 607 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&nodeStruct,sizeof(DMT_CALLBACK_STRUCT_GET_CHILDVALUES_MAP_T)); 608 delete pMessage->pMsg; 609 610 } 611 612 613 void dmtSetChildValuesMapHandler(void * data) 614 { 615 616 SYNCML_DM_SET_CHILD_VALUES_MAP_MESSAGE_T *pMessage = (SYNCML_DM_SET_CHILD_VALUES_MAP_MESSAGE_T*)data; 617 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 618 DmtTree * pTree = dmtGetTreeHandler(pMessage->pMsg->htree); 619 620 if ( pTree == NULL ) 621 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_SET_CHILDVALUES_MAP,SYNCML_DM_INVALID_PARAMETER); 622 else 623 { 624 625 SYNCML_DM_RET_STATUS_T res; 626 627 res = pTree->SetChildValuesMap(pMessage->pMsg->path, pMessage->pMsg->data); 628 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_SET_CHILDVALUES_MAP,res); 629 } 630 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 631 delete pMessage->pMsg; 632 } 633 634 635 636 637 void dmtGetAttributesHandler(void * data) 638 { 639 640 SYNCML_DM_GET_ATTRIBUTES_MESSAGE_T *pMessage = (SYNCML_DM_GET_ATTRIBUTES_MESSAGE_T*)data; 641 DMT_CALLBACK_STRUCT_GET_ATTRIBUTES_T attrStruct; 642 DmtAttributes oAttr; 643 644 memset(&attrStruct,0,sizeof(DMT_CALLBACK_STRUCT_GET_ATTRIBUTES_T)); 645 attrStruct.pUserData = (void*)pMessage->pUserData; 646 647 DmtNode * pNode = dmtGetNodeHandler(pMessage->hnode); 648 649 if ( pNode == NULL ) 650 attrStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 651 else 652 { 653 attrStruct.nStatusCode = pNode->GetAttributes(oAttr); 654 if ( attrStruct.nStatusCode == SYNCML_DM_SUCCESS ) 655 { 656 DMString aclStr; 657 DMString & name = (DMString&)oAttr.GetName(); 658 DMString & format = (DMString&)oAttr.GetFormat(); 659 DMString & title = (DMString&)oAttr.GetTitle(); 660 DMString & type = (DMString&)oAttr.GetType(); 661 662 attrStruct.attributes.name = name.detach(); 663 attrStruct.attributes.format = format.detach(); 664 attrStruct.attributes.title = title.detach(); 665 attrStruct.attributes.type = type.detach(); 666 const DmtAcl & oAcl = oAttr.GetAcl(); 667 aclStr = oAcl.toString(); 668 attrStruct.attributes.acl = aclStr.detach(); 669 attrStruct.attributes.version = oAttr.GetVersion(); 670 attrStruct.attributes.size = oAttr.GetSize(); 671 attrStruct.attributes.timestamp = oAttr.GetTimestamp(); 672 } 673 } 674 675 if ( pMessage->callback ) 676 { 677 pMessage->callback(&attrStruct); 678 DMT_Free_GetAttributesStruct(&attrStruct); 679 } 680 else 681 if ( pMessage->messageID ) 682 XPL_MSG_Send(XPL_PORT_DM,pMessage->messageID,&attrStruct,sizeof(DMT_CALLBACK_STRUCT_GET_ATTRIBUTES_T)); 683 684 } 685 686 687 688 void dmtGetValueHandler(void * data) 689 { 690 691 SYNCML_DM_GET_VALUE_MESSAGE_T *pMessage = (SYNCML_DM_GET_VALUE_MESSAGE_T*)data; 692 DMT_CALLBACK_STRUCT_GET_VALUE_T valueStruct; 693 static DmtData oData; 694 695 memset(&valueStruct,0,sizeof(DMT_CALLBACK_STRUCT_GET_VALUE_T)); 696 valueStruct.pUserData = (void*)pMessage->pUserData; 697 698 DmtNode * pNode = dmtGetNodeHandler(pMessage->hnode); 699 700 if ( pNode == NULL ) 701 valueStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 702 else 703 { 704 705 valueStruct.nStatusCode = pNode->GetValue(oData); 706 if ( valueStruct.nStatusCode == SYNCML_DM_SUCCESS ) 707 dmtBuildCallbackData(&valueStruct.data, oData); 708 } 709 710 if ( pMessage->callback ) 711 { 712 pMessage->callback(&valueStruct); 713 DMT_Free_GetValueStruct(&valueStruct); 714 } 715 else 716 if ( pMessage->messageID ) 717 XPL_MSG_Send(XPL_PORT_DM,pMessage->messageID,&valueStruct,sizeof(DMT_CALLBACK_STRUCT_GET_VALUE_T)); 718 719 720 } 721 722 void dmtSetValueHandler(void * data) 723 { 724 SYNCML_DM_SET_VALUE_MESSAGE_T *pMessage = (SYNCML_DM_SET_VALUE_MESSAGE_T*)data; 725 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 726 727 DmtNode * pNode = dmtGetNodeHandler(pMessage->pMsg->hnode); 728 729 if ( pNode == NULL ) 730 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_SET_VALUE,SYNCML_DM_INVALID_PARAMETER); 731 else 732 { 733 SYNCML_DM_RET_STATUS_T res; 734 735 res = pNode->SetValue(pMessage->pMsg->data); 736 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,DMT_OPERATION_SET_VALUE,res); 737 } 738 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 739 delete pMessage->pMsg; 740 741 } 742 743 744 void dmtNodeHandler(SYNCML_DM_TASK_MESSAGE_ID operation, void * data) 745 { 746 SYNCML_DM_NODE_MESSAGE_T *pMessage = (SYNCML_DM_NODE_MESSAGE_T*)data; 747 DMT_CALLBACK_STRUCT_STATUS_T statusStruct; 748 749 DmtNode * pNode = dmtGetNodeHandler(pMessage->pMsg->hnode); 750 751 if ( pNode == NULL ) 752 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,operation,SYNCML_DM_INVALID_PARAMETER); 753 else 754 { 755 SYNCML_DM_RET_STATUS_T res; 756 switch ( operation ) 757 { 758 case SYNCML_DM_SET_TITLE_MSG_ID: 759 res = pNode->SetTitle(pMessage->pMsg->str); 760 break; 761 762 case SYNCML_DM_SET_ACL_MSG_ID: 763 { 764 DmtAcl oAcl(pMessage->pMsg->str); 765 res = pNode->SetAcl(oAcl); 766 } 767 break; 768 } 769 dmtBuildStatusStruct(&statusStruct,pMessage->pMsg->pUserData,operation,res); 770 } 771 dmtSendStatusStruct(&statusStruct,pMessage->pMsg->callback,pMessage->pMsg->messageID); 772 delete pMessage->pMsg; 773 } 774 775 776 void dmtExecuteHandler(void * data) 777 { 778 SYNCML_DM_EXECUTE_MESSAGE_T *pMessage = (SYNCML_DM_EXECUTE_MESSAGE_T*)data; 779 DMT_CALLBACK_STRUCT_EXECUTE_T execStruct; 780 DMString result; 781 782 execStruct.result = NULL; 783 execStruct.pUserData = (void*)pMessage->pMsg->pUserData; 784 785 DmtNode * pNode = dmtGetNodeHandler(pMessage->pMsg->hnode); 786 787 if ( pNode == NULL ) 788 execStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 789 else 790 { 791 execStruct.nStatusCode = pNode->Execute(pMessage->pMsg->params,result); 792 if ( execStruct.nStatusCode == SYNCML_DM_SUCCESS ) 793 execStruct.result = result.detach(); 794 } 795 796 if ( pMessage->pMsg->callback ) 797 { 798 pMessage->pMsg->callback(&execStruct); 799 DMT_Free_ExecuteStruct(&execStruct); 800 } 801 else 802 if ( pMessage->pMsg->messageID ) 803 XPL_MSG_Send(XPL_PORT_DM,pMessage->pMsg->messageID,&execStruct,sizeof(DMT_CALLBACK_STRUCT_EXECUTE_T)); 804 delete pMessage->pMsg; 805 } 806 807 #ifdef LOB_SUPPORT 808 void dmtDataChunkHandler(void * data, UINT32 msgtype) 809 { 810 SYNCML_DM_DATA_CHUNK_MESSAGE_T *pMessage = ( SYNCML_DM_DATA_CHUNK_MESSAGE_T*)data; 811 DMT_CALLBACK_STRUCT_DATA_CHUNK_T chunkStruct; 812 813 memset(&chunkStruct,0,sizeof(DMT_CALLBACK_STRUCT_DATA_CHUNK_T)); 814 chunkStruct.pUserData = (void*)pMessage->pUserData; 815 chunkStruct.datachunk = pMessage->datachunk; 816 DmtNode * pNode = dmtGetNodeHandler(pMessage->hnode); 817 818 if ( pNode == NULL ) 819 chunkStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 820 else 821 { 822 if(pMessage->datachunk != NULL && pMessage->datachunk->chunkBuffer != NULL ) 823 { 824 DmtDataChunk chunkData; 825 chunkData.attach(pMessage->datachunk->chunkBuffer, pMessage->datachunk->dataSize); 826 switch ( msgtype ) 827 { 828 case SYNCML_DM_GET_FIRST_CHUNK_MSG_ID: 829 chunkStruct.nStatusCode = pNode->GetFirstChunk(chunkData); 830 break; 831 case SYNCML_DM_GET_NEXT_CHUNK_MSG_ID: 832 chunkStruct.nStatusCode = pNode->GetNextChunk(chunkData); 833 break; 834 case SYNCML_DM_SET_FIRST_CHUNK_MSG_ID: 835 chunkStruct.nStatusCode = pNode->SetFirstChunk(chunkData); 836 break; 837 838 case SYNCML_DM_SET_NEXT_CHUNK_MSG_ID: 839 chunkStruct.nStatusCode = pNode->SetNextChunk(chunkData); 840 break; 841 case SYNCML_DM_SET_LAST_CHUNK_MSG_ID: 842 chunkStruct.nStatusCode = pNode->SetLastChunk(chunkData); 843 break; 844 } 845 if ( chunkStruct.nStatusCode == SYNCML_DM_SUCCESS ) 846 { 847 UINT32 dataLen; 848 // Get return len 849 chunkStruct.nStatusCode = chunkData.GetReturnLen(dataLen); 850 if( chunkStruct.nStatusCode == SYNCML_DM_SUCCESS) 851 chunkStruct.datachunk->returnLen = dataLen; 852 } 853 chunkData.detach(); 854 } 855 else 856 chunkStruct.nStatusCode = SYNCML_DM_INVALID_PARAMETER; 857 } 858 if ( pMessage->callback ) 859 { 860 pMessage->callback(&chunkStruct); 861 } 862 else 863 if ( pMessage->messageID ) 864 XPL_MSG_Send(XPL_PORT_DM,pMessage->messageID,&chunkStruct,sizeof(DMT_CALLBACK_STRUCT_DATA_CHUNK_T)); 865 } 866 #endif 867 868 void DMT_MessageHandler(UINT32 msgtype, void *data) 869 { 870 871 if ( data == NULL ) 872 return; 873 874 switch ( msgtype ) 875 { 876 case SYNCML_DM_TIMER_MSG_ID: 877 #ifdef DM_NO_LOCKING 878 dmtHandleTimer(data); 879 #endif 880 break; 881 882 883 case SYNCML_DM_NOTIFY_ON_IDLE_MSG_ID: 884 dmtNotifyHandler(data); 885 break; 886 887 case SYNCML_DM_INIT_MSG_ID: 888 case SYNCML_DM_UNINIT_MSG_ID: 889 dmtEngineHandler(msgtype,data); 890 break; 891 892 case SYNCML_DM_GET_SUBTREE_MSG_ID: 893 dmtGetSubtreeExHandler(data); 894 break; 895 896 case SYNCML_DM_RELEASE_TREE_ID: 897 dmtTreeReleaseHandler(data); 898 break; 899 900 case SYNCML_DM_START_SERVER_SESSION_MSG_ID: 901 dmtStartServerSessionHandler(data); 902 break; 903 904 case SYNCML_DM_PROCESS_SCRIPT_MSG_ID: 905 dmtProcessScriptHandler(data); 906 break; 907 908 case SYNCML_DM_BOOTSTRAP_MSG_ID: 909 dmtBootstrapHandler(data); 910 break; 911 912 #ifdef DM_NOTIFICATION_AGENT 913 case SYNCML_DM_PROCESS_NOTIFICATION_MSG_ID: 914 dmtProcessNotificationHandler(data); 915 break; 916 #endif 917 918 case SYNCML_DM_GET_NODE_MSG_ID: 919 dmtGetNodeHandler(data); 920 break; 921 922 case SYNCML_DM_RELEASE_NODE_MSG_ID: 923 dmtNodeReleaseHandler(data); 924 break; 925 926 case SYNCML_DM_DELETE_NODE_MSG_ID: 927 case SYNCML_DM_RENAME_NODE_MSG_ID: 928 case SYNCML_DM_CREATE_INTERIOR_NODE_MSG_ID: 929 dmtTreeNodeHandler(msgtype,data); 930 break; 931 932 case SYNCML_DM_CREATE_LEAF_NODE_MSG_ID: 933 dmtCreateLeafNodeHandler(data); 934 break; 935 936 case SYNCML_DM_GET_CHULD_NODE_NAMES_MSG_ID: 937 dmtGetChildNodeNamesHandler(data); 938 break; 939 940 case SYNCML_DM_FLUSH_MSG_ID: 941 case SYNCML_DM_COMMIT_MSG_ID: 942 case SYNCML_DM_ROLLBACK_MSG_ID: 943 case SYNCML_DM_BEGIN_MSG_ID: 944 dmtTreeHandler(msgtype,data); 945 break; 946 947 case SYNCML_DM_GET_CHILD_VALUES_MAP_MSG_ID: 948 dmtGetChildValuesMapHandler(data); 949 break; 950 951 case SYNCML_DM_SET_CHILD_VALUES_MAP_MSG_ID: 952 dmtSetChildValuesMapHandler(data); 953 break; 954 955 case SYNCML_DM_GET_ATTRIBUTES_MSG_ID: 956 dmtGetAttributesHandler(data); 957 break; 958 959 case SYNCML_DM_GET_VALUE_MSG_ID: 960 dmtGetValueHandler(data); 961 break; 962 963 case SYNCML_DM_SET_VALUE_MSG_ID: 964 dmtSetValueHandler(data); 965 break; 966 967 case SYNCML_DM_SET_TITLE_MSG_ID: 968 case SYNCML_DM_SET_ACL_MSG_ID: 969 dmtNodeHandler(msgtype,data); 970 break; 971 972 case SYNCML_DM_EXECUTE_MSG_ID: 973 dmtExecuteHandler(data); 974 break; 975 #ifdef LOB_SUPPORT 976 case SYNCML_DM_GET_FIRST_CHUNK_MSG_ID: 977 case SYNCML_DM_GET_NEXT_CHUNK_MSG_ID: 978 case SYNCML_DM_SET_FIRST_CHUNK_MSG_ID: 979 case SYNCML_DM_SET_NEXT_CHUNK_MSG_ID: 980 case SYNCML_DM_SET_LAST_CHUNK_MSG_ID: 981 dmtDataChunkHandler(data, msgtype); 982 break; 983 #endif 984 } 985 986 } 987 988 989 #ifdef __cplusplus 990 extern "C" { 991 #endif 992 993 994 995 SYNCML_DM_RET_STATUS_T 996 dmtNotifyOnIdle_Post(DMT_CallbackNotifyOnIdle callback, 997 void* pUserData, 998 UINT32 messageID) 999 { 1000 1001 SYNCML_DM_NOTIFY_MESSAGE_T message; 1002 XPL_MSG_RET_STATUS_T res; 1003 1004 message.callback = callback; 1005 message.messageID = messageID; 1006 message.pUserData = (UINT32)pUserData; 1007 1008 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_NOTIFY_ON_IDLE_MSG_ID,&message,sizeof(SYNCML_DM_NOTIFY_MESSAGE_T)); 1009 if ( res == XPL_MSG_RET_SUCCESS ) 1010 return SYNCML_DM_SUCCESS; 1011 else 1012 return SYNCML_DM_FAIL; 1013 1014 } 1015 1016 1017 1018 SYNCML_DM_RET_STATUS_T 1019 dmtEngine_Post(DMT_CallbackStatusCode callback, 1020 void* pUserData, 1021 UINT32 messageID, 1022 UINT32 apiMessageID) 1023 { 1024 1025 SYNCML_DM_ENGINE_MESSAGE_T message; 1026 XPL_MSG_RET_STATUS_T res; 1027 1028 message.callback = callback; 1029 message.messageID = messageID; 1030 message.pUserData = (UINT32)pUserData; 1031 1032 res = XPL_MSG_Send(XPL_PORT_DM_TASK,apiMessageID,&message,sizeof(SYNCML_DM_ENGINE_MESSAGE_T)); 1033 if ( res == XPL_MSG_RET_SUCCESS ) 1034 return SYNCML_DM_SUCCESS; 1035 else 1036 return SYNCML_DM_FAIL; 1037 1038 } 1039 1040 1041 1042 SYNCML_DM_RET_STATUS_T 1043 dmtGetSubtreeEx_Post(CPCHAR szPrincipal, 1044 CPCHAR szSubtreeRoot, 1045 SYNCML_DM_TREE_LOCK_TYPE_T nLockType, 1046 DMT_CallbackGetTree callback, 1047 void* pUserData, 1048 UINT32 messageID ) 1049 { 1050 1051 if ( szPrincipal == 0 ) 1052 return SYNCML_DM_INVALID_PARAMETER; 1053 1054 SYNCML_DM_GET_SUB_TREE_MESSAGE_T message; 1055 XPL_MSG_RET_STATUS_T res; 1056 SYNCML_DM_RET_STATUS_T status; 1057 1058 message.pMsg = (DMGetSubTreeMessage*) new DMGetSubTreeMessage(); 1059 if ( message.pMsg == NULL ) 1060 { 1061 XPL_LOG_DM_API_Error(("dmtGetSubtreeEx_Post : unable allocate memory\n")); 1062 return SYNCML_DM_DEVICE_FULL; 1063 } 1064 1065 status = message.pMsg->set(szPrincipal, szSubtreeRoot, nLockType, callback,messageID,(UINT32)pUserData); 1066 1067 if ( status == SYNCML_DM_SUCCESS ) 1068 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_SUBTREE_MSG_ID,&message,sizeof( SYNCML_DM_GET_SUB_TREE_MESSAGE_T)); 1069 1070 if ( res != XPL_MSG_RET_SUCCESS || status != SYNCML_DM_SUCCESS ) 1071 { 1072 delete message.pMsg; 1073 return SYNCML_DM_FAIL; 1074 } 1075 return status; 1076 } 1077 1078 1079 SYNCML_DM_RET_STATUS_T 1080 dmtTree_Post(DMT_H_TREE htree, 1081 DMT_CallbackStatusCode callback, 1082 void* pUserData, 1083 UINT32 messageID, 1084 UINT32 apiMessageID) 1085 { 1086 if ( htree == 0 ) 1087 return SYNCML_DM_INVALID_PARAMETER; 1088 1089 SYNCML_DM_TREE_MESSAGE_T message; 1090 XPL_MSG_RET_STATUS_T res; 1091 1092 message.htree = htree; 1093 message.callback = callback; 1094 message.messageID = messageID; 1095 message.pUserData = (UINT32)pUserData; 1096 1097 res = XPL_MSG_Send(XPL_PORT_DM_TASK,apiMessageID,&message,sizeof(SYNCML_DM_TREE_MESSAGE_T)); 1098 if ( res == XPL_MSG_RET_SUCCESS ) 1099 return SYNCML_DM_SUCCESS; 1100 else 1101 return SYNCML_DM_FAIL; 1102 1103 } 1104 1105 1106 1107 SYNCML_DM_RET_STATUS_T 1108 dmtProcessScript_Post(CPCHAR szPrincipal, 1109 const UINT8 * buf, 1110 INT32 len, 1111 BOOLEAN isWBXML, 1112 DMT_CallbackProcessScript callback, 1113 void* pUserData, 1114 UINT32 messageID ) 1115 { 1116 1117 if ( szPrincipal == 0 || buf == NULL || len == 0 ) 1118 return SYNCML_DM_INVALID_PARAMETER; 1119 1120 SYNCML_DM_PROCESS_SCRIPT_MESSAGE_T message; 1121 XPL_MSG_RET_STATUS_T res; 1122 SYNCML_DM_RET_STATUS_T status; 1123 1124 message.pMsg = (DMProcessScriptMessage*)new DMProcessScriptMessage(); 1125 if ( message.pMsg == NULL ) 1126 { 1127 XPL_LOG_DM_API_Error(("dmtProcessScript_Post : unable allocate memory\n")); 1128 return SYNCML_DM_DEVICE_FULL; 1129 } 1130 1131 status = message.pMsg->set(szPrincipal, buf, len, isWBXML, callback,messageID,(UINT32)pUserData); 1132 1133 if ( status == SYNCML_DM_SUCCESS ) 1134 { 1135 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_PROCESS_SCRIPT_MSG_ID,&message,sizeof(SYNCML_DM_PROCESS_SCRIPT_MESSAGE_T)); 1136 if ( res != XPL_MSG_RET_SUCCESS ) 1137 { 1138 delete message.pMsg; 1139 return SYNCML_DM_FAIL; 1140 } 1141 } 1142 return status; 1143 } 1144 1145 1146 1147 SYNCML_DM_RET_STATUS_T 1148 dmtStartServerSession_Post(CPCHAR szPrincipal, 1149 const DMT_SESSION_PROP_T * pSessionProp, 1150 DMT_CallbackStatusCode callback, 1151 void* pUserData, 1152 UINT32 messageID ) 1153 { 1154 1155 if ( szPrincipal == 0 || pSessionProp == 0 ) 1156 return SYNCML_DM_INVALID_PARAMETER; 1157 1158 SYNCML_DM_START_SERVER_SESSION_MESSAGE_T message; 1159 XPL_MSG_RET_STATUS_T res; 1160 SYNCML_DM_RET_STATUS_T status; 1161 1162 message.pMsg = (DMStartServerSessionMessage*)new DMStartServerSessionMessage(); 1163 if ( message.pMsg == NULL ) 1164 { 1165 XPL_LOG_DM_API_Error(("dmtStartServerSession_Post : unable allocate memory\n")); 1166 return SYNCML_DM_DEVICE_FULL; 1167 } 1168 1169 status = message.pMsg->set(szPrincipal, pSessionProp, callback,messageID,(UINT32)pUserData); 1170 1171 if ( status == SYNCML_DM_SUCCESS ) 1172 { 1173 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_START_SERVER_SESSION_MSG_ID,&message,sizeof(SYNCML_DM_START_SERVER_SESSION_MESSAGE_T)); 1174 if ( res != XPL_MSG_RET_SUCCESS ) 1175 { 1176 delete message.pMsg; 1177 return SYNCML_DM_FAIL; 1178 } 1179 } 1180 return status; 1181 } 1182 1183 1184 SYNCML_DM_RET_STATUS_T 1185 dmtBootstrap_Post(CPCHAR szPrincipal, 1186 const UINT8 * buf, 1187 INT32 len, 1188 BOOLEAN isWBXML, 1189 BOOLEAN isProcess, 1190 DMT_CallbackBootstrap callback, 1191 void* pUserData, 1192 UINT32 messageID ) 1193 { 1194 1195 if ( szPrincipal == 0 || buf == NULL || len == 0 ) 1196 return SYNCML_DM_INVALID_PARAMETER; 1197 1198 SYNCML_DM_BOOTSTRAP_MESSAGE_T message; 1199 XPL_MSG_RET_STATUS_T res; 1200 SYNCML_DM_RET_STATUS_T status; 1201 1202 message.pMsg = (DMBootstrapMessage*)new DMBootstrapMessage(); 1203 if ( message.pMsg == NULL ) 1204 { 1205 XPL_LOG_DM_API_Error(("dmtExtractServerID_Post : unable allocate memory\n")); 1206 return SYNCML_DM_DEVICE_FULL; 1207 } 1208 1209 status = message.pMsg->set(szPrincipal, buf, len, isWBXML, isProcess, callback,messageID,(UINT32)pUserData); 1210 1211 if ( status == SYNCML_DM_SUCCESS ) 1212 { 1213 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_BOOTSTRAP_MSG_ID,&message,sizeof(SYNCML_DM_BOOTSTRAP_MESSAGE_T)); 1214 if ( res != XPL_MSG_RET_SUCCESS ) 1215 { 1216 delete message.pMsg; 1217 return SYNCML_DM_FAIL; 1218 } 1219 } 1220 return status; 1221 } 1222 1223 1224 SYNCML_DM_RET_STATUS_T 1225 dmtProcessNotification_Post(CPCHAR szPrincipal, 1226 const UINT8 *buf, 1227 INT32 len, 1228 DMT_CallbackProcessNotification callback, 1229 void* pUserData, 1230 UINT32 messageID ) 1231 { 1232 1233 #ifdef DM_NOTIFICATION_AGENT 1234 if ( szPrincipal == 0 || buf == NULL || len == 0 ) 1235 return SYNCML_DM_INVALID_PARAMETER; 1236 1237 SYNCML_DM_PROCESS_NOTIFICATION_MESSAGE_T message; 1238 XPL_MSG_RET_STATUS_T res; 1239 SYNCML_DM_RET_STATUS_T status; 1240 1241 message.pMsg = (DMProcessNotificationMessage*)new DMProcessNotificationMessage(); 1242 if ( message.pMsg == NULL ) 1243 { 1244 XPL_LOG_DM_API_Error(("dmtProcessNotification_Post : unable allocate memory\n")); 1245 return SYNCML_DM_DEVICE_FULL; 1246 } 1247 1248 status = message.pMsg->set(szPrincipal, buf, len, callback, messageID,(UINT32)pUserData); 1249 1250 if ( status == SYNCML_DM_SUCCESS ) 1251 { 1252 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_PROCESS_NOTIFICATION_MSG_ID,&message,sizeof(SYNCML_DM_PROCESS_NOTIFICATION_MESSAGE_T)); 1253 if ( res != XPL_MSG_RET_SUCCESS ) 1254 { 1255 delete message.pMsg; 1256 return SYNCML_DM_FAIL; 1257 } 1258 } 1259 return status; 1260 #else 1261 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 1262 #endif 1263 1264 } 1265 1266 1267 SYNCML_DM_RET_STATUS_T 1268 dmtGetNode_Post(DMT_H_TREE htree, 1269 CPCHAR path, 1270 DMT_CallbackGetNode callback, 1271 void* pUserData, UINT32 messageID ) 1272 { 1273 1274 if ( htree == 0 || path == NULL ) 1275 return SYNCML_DM_INVALID_PARAMETER; 1276 1277 1278 SYNCML_DM_GET_NODE_MESSAGE_T message; 1279 XPL_MSG_RET_STATUS_T res; 1280 SYNCML_DM_RET_STATUS_T status; 1281 1282 message.pMsg = (DMGetNodeMessage*)new DMGetNodeMessage(); 1283 if ( message.pMsg == NULL ) 1284 { 1285 XPL_LOG_DM_API_Error(("dmtGetNode_Post : unable allocate memory\n")); 1286 return SYNCML_DM_DEVICE_FULL; 1287 } 1288 1289 status = message.pMsg->set(htree, path, callback, messageID,(UINT32)pUserData); 1290 1291 if ( status == SYNCML_DM_SUCCESS ) 1292 { 1293 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_NODE_MSG_ID,&message,sizeof(SYNCML_DM_GET_NODE_MESSAGE_T)); 1294 if ( res != XPL_MSG_RET_SUCCESS ) 1295 { 1296 delete message.pMsg; 1297 return SYNCML_DM_FAIL; 1298 } 1299 } 1300 return status; 1301 } 1302 1303 1304 SYNCML_DM_RET_STATUS_T 1305 dmtTreeNode_Post(DMT_H_TREE htree, 1306 CPCHAR path, 1307 CPCHAR str, 1308 DMT_CallbackStatusCode callback, 1309 void* pUserData, 1310 UINT32 messageID, 1311 UINT32 apiMessageID) 1312 { 1313 if ( htree == 0 || path == NULL ) 1314 return SYNCML_DM_INVALID_PARAMETER; 1315 1316 SYNCML_DM_TREENODE_MESSAGE_T message; 1317 XPL_MSG_RET_STATUS_T res; 1318 SYNCML_DM_RET_STATUS_T status; 1319 1320 message.pMsg = (DMTreeNodeMessage*)new DMTreeNodeMessage(); 1321 if ( message.pMsg == NULL ) 1322 { 1323 XPL_LOG_DM_API_Error(("dmtDeleteNode_Post : unable allocate memory\n")); 1324 return SYNCML_DM_DEVICE_FULL; 1325 } 1326 1327 status = message.pMsg->set(htree, path,str,callback,messageID,(UINT32)pUserData); 1328 1329 if ( status == SYNCML_DM_SUCCESS ) 1330 { 1331 res = XPL_MSG_Send(XPL_PORT_DM_TASK,apiMessageID,&message,sizeof(SYNCML_DM_TREENODE_MESSAGE_T)); 1332 if ( res != XPL_MSG_RET_SUCCESS ) 1333 { 1334 delete message.pMsg; 1335 return SYNCML_DM_FAIL; 1336 } 1337 } 1338 return status; 1339 } 1340 1341 1342 SYNCML_DM_RET_STATUS_T 1343 dmtRenameNode_Post(DMT_H_TREE htree, 1344 CPCHAR path, 1345 CPCHAR new_node_name, 1346 DMT_CallbackStatusCode callback, 1347 void* pUserData, 1348 UINT32 messageID ) 1349 { 1350 if ( new_node_name == NULL ) 1351 return SYNCML_DM_INVALID_PARAMETER; 1352 1353 return dmtTreeNode_Post(htree, path, new_node_name, callback, pUserData, messageID,SYNCML_DM_RENAME_NODE_MSG_ID); 1354 } 1355 1356 1357 1358 SYNCML_DM_RET_STATUS_T 1359 dmtCreateLeafNode_Post(DMT_H_TREE htree, 1360 CPCHAR path, 1361 const DMT_DATA_T* data, 1362 DMT_CallbackStatusCode callback, 1363 void* pUserData, 1364 UINT32 messageID ) 1365 { 1366 1367 if ( htree == 0 || path == NULL ) 1368 return SYNCML_DM_INVALID_PARAMETER; 1369 1370 if ( data && data->meta_format == SYNCML_DM_DATAFORMAT_NODE ) 1371 return SYNCML_DM_INVALID_PARAMETER; 1372 1373 SYNCML_DM_CREATE_LEAF_NODE_MESSAGE_T message; 1374 XPL_MSG_RET_STATUS_T res; 1375 SYNCML_DM_RET_STATUS_T status; 1376 1377 message.pMsg = (DMCreateLeafNodeMessage*)new DMCreateLeafNodeMessage(); 1378 if ( message.pMsg == NULL ) 1379 { 1380 XPL_LOG_DM_API_Error(("dmtCreateLeafNode_Post : unable allocate memory\n")); 1381 return SYNCML_DM_DEVICE_FULL; 1382 } 1383 1384 status = message.pMsg->set(htree, path, data, callback,messageID,(UINT32)pUserData); 1385 1386 if ( status == SYNCML_DM_SUCCESS ) 1387 { 1388 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_CREATE_LEAF_NODE_MSG_ID,&message,sizeof(SYNCML_DM_CREATE_LEAF_NODE_MESSAGE_T)); 1389 if ( res != XPL_MSG_RET_SUCCESS ) 1390 { 1391 delete message.pMsg; 1392 return SYNCML_DM_FAIL; 1393 } 1394 } 1395 return status; 1396 } 1397 1398 1399 SYNCML_DM_RET_STATUS_T 1400 dmtGetChildNodeNames_Post(DMT_H_TREE htree, 1401 CPCHAR path, 1402 DMT_CallbackGetChildNodeNames callback, 1403 void* pUserData, 1404 UINT32 messageID) 1405 { 1406 1407 if ( htree == 0 || path == NULL ) 1408 return SYNCML_DM_INVALID_PARAMETER; 1409 1410 1411 SYNCML_DM_GET_CHILD_NODE_NAMES_MESSAGE_T message; 1412 XPL_MSG_RET_STATUS_T res; 1413 SYNCML_DM_RET_STATUS_T status; 1414 1415 message.pMsg = (DMGetChildNodeNamesMessage*)new DMGetChildNodeNamesMessage(); 1416 if ( message.pMsg == NULL ) 1417 { 1418 XPL_LOG_DM_API_Error(("dmtGetChildNodeNames_Post : unable allocate memory\n")); 1419 return SYNCML_DM_DEVICE_FULL; 1420 } 1421 1422 status = message.pMsg->set(htree, path, callback,messageID,(UINT32)pUserData); 1423 1424 if ( status == SYNCML_DM_SUCCESS ) 1425 { 1426 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_CHULD_NODE_NAMES_MSG_ID,&message,sizeof(SYNCML_DM_GET_CHILD_NODE_NAMES_MESSAGE_T)); 1427 if ( res != XPL_MSG_RET_SUCCESS ) 1428 { 1429 delete message.pMsg; 1430 return SYNCML_DM_FAIL; 1431 } 1432 } 1433 return status; 1434 } 1435 1436 1437 1438 1439 SYNCML_DM_RET_STATUS_T 1440 dmtGetChildValuesMap_Post(DMT_H_TREE htree, 1441 CPCHAR path, 1442 DMT_CallbackGetChildValuesMap callback, 1443 void* pUserData, 1444 UINT32 messageID) 1445 { 1446 if ( htree == 0 || path == NULL ) 1447 return SYNCML_DM_INVALID_PARAMETER; 1448 1449 SYNCML_DM_GET_CHILD_VALUES_MAP_MESSAGE_T message; 1450 XPL_MSG_RET_STATUS_T res; 1451 SYNCML_DM_RET_STATUS_T status; 1452 1453 message.pMsg = (DMGetChildValuesMapMessage*)new DMGetChildValuesMapMessage(); 1454 if ( message.pMsg == NULL ) 1455 { 1456 XPL_LOG_DM_API_Error(("dmtGetChildValuesMap_Post : unable allocate memory\n")); 1457 return SYNCML_DM_DEVICE_FULL; 1458 } 1459 1460 status = message.pMsg->set(htree, path, callback, messageID,(UINT32)pUserData); 1461 1462 if ( status == SYNCML_DM_SUCCESS ) 1463 { 1464 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_CHILD_VALUES_MAP_MSG_ID,&message,sizeof(SYNCML_DM_GET_CHILD_VALUES_MAP_MESSAGE_T)); 1465 if ( res != XPL_MSG_RET_SUCCESS ) 1466 { 1467 delete message.pMsg; 1468 return SYNCML_DM_FAIL; 1469 } 1470 } 1471 return status; 1472 } 1473 1474 1475 SYNCML_DM_RET_STATUS_T 1476 dmtSetChildValuesMap_Post(DMT_H_TREE htree, 1477 CPCHAR path, 1478 const DMT_LEAF_CHILDREN_DATA_T* data, 1479 DMT_CallbackStatusCode callback, 1480 void* pUserData, UINT32 messageID) 1481 { 1482 if ( htree == 0 || path == NULL || data == NULL ) 1483 return SYNCML_DM_INVALID_PARAMETER; 1484 1485 if ( data->ppChildren == NULL ) 1486 return SYNCML_DM_INVALID_PARAMETER; 1487 1488 SYNCML_DM_SET_CHILD_VALUES_MAP_MESSAGE_T message; 1489 XPL_MSG_RET_STATUS_T res; 1490 SYNCML_DM_RET_STATUS_T status; 1491 1492 message.pMsg = (DMSetChildValuesMapMessage*)new DMSetChildValuesMapMessage(); 1493 if ( message.pMsg == NULL ) 1494 { 1495 XPL_LOG_DM_API_Error(("dmtSetChildValuesMap_Post : unable allocate memory\n")); 1496 return SYNCML_DM_DEVICE_FULL; 1497 } 1498 1499 status = message.pMsg->set(htree, path, data, callback, messageID,(UINT32)pUserData); 1500 1501 if ( status == SYNCML_DM_SUCCESS ) 1502 { 1503 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_SET_CHILD_VALUES_MAP_MSG_ID,&message,sizeof(SYNCML_DM_SET_CHILD_VALUES_MAP_MESSAGE_T)); 1504 if ( res != XPL_MSG_RET_SUCCESS ) 1505 { 1506 delete message.pMsg; 1507 return SYNCML_DM_FAIL; 1508 } 1509 } 1510 return status; 1511 } 1512 1513 1514 1515 SYNCML_DM_RET_STATUS_T 1516 dmtGetAttributes_Post(DMT_H_NODE hnode, 1517 DMT_CallbackGetAttributes callback, 1518 void* pUserData, UINT32 messageID) 1519 { 1520 if ( hnode == 0 ) 1521 return SYNCML_DM_INVALID_PARAMETER; 1522 1523 SYNCML_DM_GET_ATTRIBUTES_MESSAGE_T message; 1524 XPL_MSG_RET_STATUS_T res; 1525 1526 message.hnode = hnode; 1527 message.callback = callback; 1528 message.messageID = messageID; 1529 message.pUserData = (UINT32)pUserData; 1530 1531 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_ATTRIBUTES_MSG_ID,&message,sizeof(SYNCML_DM_GET_ATTRIBUTES_MESSAGE_T)); 1532 if ( res == XPL_MSG_RET_SUCCESS ) 1533 return SYNCML_DM_SUCCESS; 1534 else 1535 return SYNCML_DM_FAIL; 1536 1537 } 1538 1539 1540 1541 SYNCML_DM_RET_STATUS_T 1542 dmtGetValue_Post(DMT_H_NODE hnode, 1543 DMT_CallbackGetValue callback, 1544 void* pUserData, UINT32 messageID) 1545 { 1546 if ( hnode == 0 ) 1547 return SYNCML_DM_INVALID_PARAMETER; 1548 1549 1550 SYNCML_DM_GET_VALUE_MESSAGE_T message; 1551 XPL_MSG_RET_STATUS_T res; 1552 1553 message.hnode = hnode; 1554 message.callback = callback; 1555 message.messageID = messageID; 1556 message.pUserData = (UINT32)pUserData; 1557 1558 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_GET_VALUE_MSG_ID,&message,sizeof(SYNCML_DM_GET_VALUE_MESSAGE_T)); 1559 if ( res == XPL_MSG_RET_SUCCESS ) 1560 return SYNCML_DM_SUCCESS; 1561 else 1562 return SYNCML_DM_FAIL; 1563 1564 } 1565 1566 1567 SYNCML_DM_RET_STATUS_T 1568 dmtSetValue_Post(DMT_H_NODE hnode, 1569 const DMT_DATA_T* data, 1570 DMT_CallbackStatusCode callback, 1571 void* pUserData, UINT32 messageID) 1572 { 1573 if ( hnode == 0 ) 1574 return SYNCML_DM_INVALID_PARAMETER; 1575 1576 1577 SYNCML_DM_SET_VALUE_MESSAGE_T message; 1578 XPL_MSG_RET_STATUS_T res; 1579 SYNCML_DM_RET_STATUS_T status; 1580 1581 message.pMsg = (DMSetValueMessage*)new DMSetValueMessage(); 1582 if ( message.pMsg == NULL ) 1583 { 1584 XPL_LOG_DM_API_Error(("dmtSetValue_Post : unable allocate memory\n")); 1585 return SYNCML_DM_DEVICE_FULL; 1586 } 1587 1588 status = message.pMsg->set(hnode, data, callback, messageID,(UINT32)pUserData); 1589 1590 if ( status == SYNCML_DM_SUCCESS ) 1591 { 1592 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_SET_VALUE_MSG_ID,&message,sizeof(SYNCML_DM_SET_VALUE_MESSAGE_T)); 1593 if ( res != XPL_MSG_RET_SUCCESS ) 1594 { 1595 delete message.pMsg; 1596 return SYNCML_DM_FAIL; 1597 } 1598 } 1599 return status; 1600 } 1601 1602 1603 SYNCML_DM_RET_STATUS_T 1604 dmtNode_Post(DMT_H_NODE hnode, 1605 CPCHAR str, 1606 DMT_CallbackStatusCode callback, 1607 void* pUserData, 1608 UINT32 messageID, 1609 UINT32 apiMessageID) 1610 { 1611 if ( hnode == 0 ) 1612 return SYNCML_DM_INVALID_PARAMETER; 1613 1614 SYNCML_DM_NODE_MESSAGE_T message; 1615 XPL_MSG_RET_STATUS_T res; 1616 SYNCML_DM_RET_STATUS_T status; 1617 1618 message.pMsg = (DMNodeMessage*)new DMNodeMessage(); 1619 if ( message.pMsg == NULL ) 1620 { 1621 XPL_LOG_DM_API_Error(("dmtNode_Post : unable allocate memory\n")); 1622 return SYNCML_DM_DEVICE_FULL; 1623 } 1624 1625 status = message.pMsg->set(hnode, str, callback,messageID,(UINT32)pUserData); 1626 1627 if ( status == SYNCML_DM_SUCCESS ) 1628 { 1629 res = XPL_MSG_Send(XPL_PORT_DM_TASK,apiMessageID,&message,sizeof(SYNCML_DM_NODE_MESSAGE_T)); 1630 if ( res != XPL_MSG_RET_SUCCESS ) 1631 { 1632 delete message.pMsg; 1633 return SYNCML_DM_FAIL; 1634 } 1635 } 1636 return status; 1637 1638 } 1639 1640 1641 SYNCML_DM_RET_STATUS_T 1642 dmtNodeRelease_Post(DMT_H_NODE hnode, 1643 DMT_CallbackStatusCode callback, 1644 void* pUserData, 1645 UINT32 messageID, 1646 UINT32 apiMessageID) 1647 { 1648 return dmtNode_Post(hnode,NULL,callback,pUserData,messageID,apiMessageID); 1649 } 1650 1651 1652 SYNCML_DM_RET_STATUS_T 1653 dmtExecute_Post(DMT_H_NODE hnode, 1654 CPCHAR params, 1655 DMT_CallbackExecute callback, 1656 void* pUserData, UINT32 messageID) 1657 { 1658 if ( hnode == 0 ) 1659 return SYNCML_DM_INVALID_PARAMETER; 1660 1661 SYNCML_DM_EXECUTE_MESSAGE_T message; 1662 XPL_MSG_RET_STATUS_T res; 1663 SYNCML_DM_RET_STATUS_T status; 1664 1665 message.pMsg = (DMExecuteMessage*)new DMExecuteMessage(); 1666 if ( message.pMsg == NULL ) 1667 { 1668 XPL_LOG_DM_API_Error(("dmtExecute_Post : unable allocate memory\n")); 1669 return SYNCML_DM_DEVICE_FULL; 1670 } 1671 1672 status = message.pMsg->set(hnode, params, callback,messageID,(UINT32)pUserData); 1673 1674 if ( status == SYNCML_DM_SUCCESS ) 1675 { 1676 res = XPL_MSG_Send(XPL_PORT_DM_TASK,SYNCML_DM_EXECUTE_MSG_ID,&message,sizeof(SYNCML_DM_EXECUTE_MESSAGE_T)); 1677 if ( res != XPL_MSG_RET_SUCCESS ) 1678 { 1679 delete message.pMsg; 1680 return SYNCML_DM_FAIL; 1681 } 1682 } 1683 return status; 1684 1685 } 1686 #ifdef LOB_SUPPORT 1687 SYNCML_DM_RET_STATUS_T 1688 dmtDataChunk_Post(DMT_H_NODE hnode, 1689 DMT_DATACHUNK_T *datachunk, 1690 DMT_CallbackDataChunk callback, 1691 void* pUserData, UINT32 messageID,UINT32 msgtype) 1692 { 1693 if ( hnode == 0 ) 1694 return SYNCML_DM_INVALID_PARAMETER; 1695 1696 1697 SYNCML_DM_DATA_CHUNK_MESSAGE_T message; 1698 XPL_MSG_RET_STATUS_T res; 1699 1700 message.hnode = hnode; 1701 message.datachunk = datachunk; 1702 message.callback = callback; 1703 message.messageID = messageID; 1704 message.pUserData = (UINT32)pUserData; 1705 1706 res = XPL_MSG_Send(XPL_PORT_DM_TASK,msgtype, &message,sizeof(SYNCML_DM_DATA_CHUNK_MESSAGE_T)); 1707 if ( res == XPL_MSG_RET_SUCCESS ) 1708 return SYNCML_DM_SUCCESS; 1709 else 1710 return SYNCML_DM_FAIL; 1711 } 1712 SYNCML_DM_RET_STATUS_T 1713 dmtGetFirstChunk_Post(DMT_H_NODE hnode, 1714 DMT_DATACHUNK_T *datachunk, 1715 DMT_CallbackDataChunk callback, 1716 void* pUserData, UINT32 messageID) 1717 { 1718 return dmtDataChunk_Post(hnode, datachunk,callback, pUserData, messageID, SYNCML_DM_GET_FIRST_CHUNK_MSG_ID); 1719 } 1720 1721 SYNCML_DM_RET_STATUS_T 1722 dmtGetNextChunk_Post(DMT_H_NODE hnode, 1723 DMT_DATACHUNK_T *datachunk, 1724 DMT_CallbackDataChunk callback, 1725 void* pUserData, UINT32 messageID) 1726 { 1727 return dmtDataChunk_Post(hnode, datachunk,callback, pUserData, messageID, SYNCML_DM_GET_NEXT_CHUNK_MSG_ID); 1728 } 1729 1730 SYNCML_DM_RET_STATUS_T 1731 dmtSetFirstChunk_Post(DMT_H_NODE hnode, 1732 DMT_DATACHUNK_T *datachunk, 1733 DMT_CallbackDataChunk callback, 1734 void* pUserData, UINT32 messageID) 1735 { 1736 return dmtDataChunk_Post(hnode, datachunk,callback, pUserData, messageID, SYNCML_DM_SET_FIRST_CHUNK_MSG_ID); 1737 } 1738 1739 SYNCML_DM_RET_STATUS_T 1740 dmtSetNextChunk_Post(DMT_H_NODE hnode, 1741 DMT_DATACHUNK_T *datachunk, 1742 DMT_CallbackDataChunk callback, 1743 void* pUserData, UINT32 messageID) 1744 { 1745 return dmtDataChunk_Post(hnode, datachunk,callback, pUserData, messageID, SYNCML_DM_SET_NEXT_CHUNK_MSG_ID); 1746 } 1747 1748 SYNCML_DM_RET_STATUS_T 1749 dmtSetLastChunk_Post(DMT_H_NODE hnode, 1750 DMT_DATACHUNK_T *datachunk, 1751 DMT_CallbackDataChunk callback, 1752 void* pUserData, UINT32 messageID) 1753 { 1754 return dmtDataChunk_Post(hnode, datachunk,callback, pUserData, messageID, SYNCML_DM_SET_LAST_CHUNK_MSG_ID); 1755 } 1756 #endif 1757 1758 SYNCML_DM_ACL_PERMISSIONS_T 1759 DMT_AclGetPermissions(CPCHAR acl,CPCHAR principal ) 1760 { 1761 if ( acl == NULL || principal == NULL ) 1762 return 0; 1763 1764 DmtAcl oAcl(acl); 1765 1766 return oAcl.GetPermissions(DmtPrincipal(principal)); 1767 } 1768 1769 SYNCML_DM_RET_STATUS_T 1770 DMT_AclSetPermissions(char* acl, 1771 INT32 * buf_len, 1772 CPCHAR principal, 1773 SYNCML_DM_ACL_PERMISSIONS_T permissions ) 1774 { 1775 if ( buf_len == NULL || acl == NULL || principal == NULL ) 1776 return SYNCML_DM_INVALID_PARAMETER; 1777 1778 if ( *buf_len == 0 ) 1779 return SYNCML_DM_INVALID_PARAMETER; 1780 1781 DmtAcl oAcl(acl); 1782 DMString result; 1783 oAcl.SetPermission(DmtPrincipal(principal),permissions); 1784 1785 result = oAcl.toString(); 1786 if ( result == NULL ) 1787 { 1788 return SYNCML_DM_DEVICE_FULL; 1789 } 1790 1791 INT32 len = result.length(); 1792 if ( len < *buf_len ) 1793 { 1794 DmStrcpy(acl,result.c_str()); 1795 return SYNCML_DM_SUCCESS; 1796 } 1797 else 1798 { 1799 *buf_len = len; 1800 return SYNCML_DM_FAIL; 1801 } 1802 1803 } 1804 1805 1806 SYNCML_DM_RET_STATUS_T 1807 DMT_NotifyOnIdle(DMT_CallbackNotifyOnIdle callback, void* pUserData ) 1808 { 1809 1810 return dmtNotifyOnIdle_Post(callback, pUserData, 0); 1811 } 1812 1813 1814 SYNCML_DM_RET_STATUS_T 1815 DMT_Init(DMT_CallbackStatusCode callback, void* pUserData ) 1816 { 1817 return dmtEngine_Post(callback, pUserData, 0,SYNCML_DM_INIT_MSG_ID); 1818 1819 } 1820 1821 SYNCML_DM_RET_STATUS_T 1822 DMT_Uninit(DMT_CallbackStatusCode callback, void* pUserData) 1823 { 1824 return dmtEngine_Post(callback, pUserData, 0,SYNCML_DM_UNINIT_MSG_ID); 1825 1826 } 1827 1828 1829 SYNCML_DM_RET_STATUS_T 1830 DMT_GetTree(CPCHAR szPrincipal, 1831 DMT_CallbackGetTree callback, 1832 void* pUserData ) 1833 { 1834 return DMT_GetSubtree(szPrincipal,NULL,callback,pUserData); 1835 1836 } 1837 1838 SYNCML_DM_RET_STATUS_T 1839 DMT_GetSubtree(CPCHAR szPrincipal, 1840 CPCHAR szSubtreeRoot, 1841 DMT_CallbackGetTree callback, 1842 void* pUserData ) 1843 { 1844 1845 return DMT_GetSubtreeEx(szPrincipal,szSubtreeRoot,SYNCML_DM_LOCK_TYPE_AUTOMATIC,callback,pUserData); 1846 1847 } 1848 1849 1850 1851 SYNCML_DM_RET_STATUS_T 1852 DMT_GetSubtreeEx(CPCHAR szPrincipal, 1853 CPCHAR szSubtreeRoot, 1854 SYNCML_DM_TREE_LOCK_TYPE_T nLockType, 1855 DMT_CallbackGetTree callback, 1856 void* pUserData ) 1857 { 1858 if ( callback == NULL ) 1859 return SYNCML_DM_INVALID_PARAMETER; 1860 1861 return dmtGetSubtreeEx_Post(szPrincipal,szSubtreeRoot,nLockType,callback,pUserData,0); 1862 1863 } 1864 1865 1866 SYNCML_DM_RET_STATUS_T 1867 DMT_TreeRelease(DMT_H_TREE htree, 1868 DMT_CallbackStatusCode callback, 1869 void* pUserData ) 1870 { 1871 return dmtTree_Post(htree,callback,pUserData,0,SYNCML_DM_RELEASE_TREE_ID); 1872 } 1873 1874 1875 1876 SYNCML_DM_RET_STATUS_T 1877 DMT_ProcessScript(CPCHAR szPrincipal, 1878 const UINT8 * buf, 1879 INT32 len, 1880 BOOLEAN isWBXML, 1881 DMT_CallbackProcessScript callback, 1882 void* pUserData ) 1883 { 1884 if ( callback == NULL ) 1885 return SYNCML_DM_INVALID_PARAMETER; 1886 return dmtProcessScript_Post(szPrincipal,buf,len,isWBXML,callback,pUserData,0); 1887 } 1888 1889 1890 1891 SYNCML_DM_RET_STATUS_T 1892 DMT_StartServerSession(CPCHAR szPrincipal, 1893 const DMT_SESSION_PROP_T * pSessionProp, 1894 DMT_CallbackStatusCode callback, 1895 void* pUserData ) 1896 { 1897 if ( callback == NULL ) 1898 return SYNCML_DM_INVALID_PARAMETER; 1899 return dmtStartServerSession_Post(szPrincipal,pSessionProp,callback,pUserData,0); 1900 } 1901 1902 1903 SYNCML_DM_RET_STATUS_T 1904 DMT_Bootstrap(CPCHAR szPrincipal, 1905 const UINT8 * buf, 1906 INT32 len, 1907 BOOLEAN isWBXML, 1908 BOOLEAN isProcess, 1909 DMT_CallbackBootstrap callback, 1910 void* pUserData ) 1911 { 1912 if ( callback == NULL ) 1913 return SYNCML_DM_INVALID_PARAMETER; 1914 return dmtBootstrap_Post(szPrincipal,buf,len,isWBXML,isProcess,callback,pUserData,0); 1915 } 1916 1917 1918 SYNCML_DM_RET_STATUS_T 1919 DMT_ProcessNotification(CPCHAR szPrincipal, 1920 const UINT8 *buf, 1921 INT32 len, 1922 DMT_CallbackProcessNotification callback, 1923 void* pUserData ) 1924 { 1925 if ( callback == NULL ) 1926 return SYNCML_DM_INVALID_PARAMETER; 1927 return dmtProcessNotification_Post(szPrincipal,buf,len,callback,pUserData,0); 1928 } 1929 1930 1931 SYNCML_DM_RET_STATUS_T 1932 DMT_GetNode(DMT_H_TREE htree, 1933 CPCHAR path, 1934 DMT_CallbackGetNode callback, 1935 void* pUserData ) 1936 { 1937 if ( callback == NULL ) 1938 return SYNCML_DM_INVALID_PARAMETER; 1939 return dmtGetNode_Post(htree,path,callback,pUserData,0); 1940 } 1941 1942 1943 SYNCML_DM_RET_STATUS_T 1944 DMT_NodeRelease(DMT_H_NODE hnode, 1945 DMT_CallbackStatusCode callback, 1946 void* pUserData ) 1947 { 1948 return dmtNodeRelease_Post(hnode,callback,pUserData,0,SYNCML_DM_RELEASE_NODE_MSG_ID); 1949 } 1950 1951 1952 SYNCML_DM_RET_STATUS_T 1953 DMT_DeleteNode(DMT_H_TREE htree, 1954 CPCHAR path, 1955 DMT_CallbackStatusCode callback, 1956 void* pUserData ) 1957 { 1958 return dmtTreeNode_Post(htree,path,NULL,callback,pUserData,0,SYNCML_DM_DELETE_NODE_MSG_ID); 1959 } 1960 1961 1962 SYNCML_DM_RET_STATUS_T 1963 DMT_RenameNode(DMT_H_TREE htree, 1964 CPCHAR path, 1965 CPCHAR new_node_name, 1966 DMT_CallbackStatusCode callback, 1967 void* pUserData ) 1968 { 1969 return dmtRenameNode_Post(htree,path,new_node_name,callback,pUserData,0); 1970 } 1971 1972 1973 SYNCML_DM_RET_STATUS_T 1974 DMT_CreateInteriorNode(DMT_H_TREE htree, 1975 CPCHAR path, 1976 DMT_CallbackStatusCode callback, 1977 void* pUserData ) 1978 { 1979 return dmtTreeNode_Post(htree,path,NULL,callback,pUserData,0,SYNCML_DM_CREATE_INTERIOR_NODE_MSG_ID); 1980 } 1981 1982 1983 SYNCML_DM_RET_STATUS_T 1984 DMT_CreateLeafNode(DMT_H_TREE htree, 1985 CPCHAR path, 1986 const DMT_DATA_T* data, 1987 DMT_CallbackStatusCode callback, 1988 void* pUserData ) 1989 { 1990 return dmtCreateLeafNode_Post(htree,path,data,callback,pUserData,0); 1991 1992 1993 } 1994 1995 1996 SYNCML_DM_RET_STATUS_T 1997 DMT_GetChildNodeNames(DMT_H_TREE htree, 1998 CPCHAR path, 1999 DMT_CallbackGetChildNodeNames callback, 2000 void* pUserData ) 2001 { 2002 if ( callback == NULL ) 2003 return SYNCML_DM_INVALID_PARAMETER; 2004 return dmtGetChildNodeNames_Post(htree,path,callback,pUserData,0); 2005 } 2006 2007 2008 SYNCML_DM_RET_STATUS_T 2009 DMT_Flush(DMT_H_TREE htree, DMT_CallbackStatusCode callback, void* pUserData ) 2010 { 2011 return dmtTree_Post(htree,callback,pUserData,0,SYNCML_DM_FLUSH_MSG_ID); 2012 } 2013 2014 2015 SYNCML_DM_RET_STATUS_T 2016 DMT_Commit(DMT_H_TREE htree, DMT_CallbackStatusCode callback, void* pUserData ) 2017 { 2018 return dmtTree_Post(htree,callback,pUserData,0,SYNCML_DM_COMMIT_MSG_ID); 2019 } 2020 2021 2022 SYNCML_DM_RET_STATUS_T 2023 DMT_Rollback(DMT_H_TREE htree, DMT_CallbackStatusCode callback, void* pUserData ) 2024 { 2025 return dmtTree_Post(htree,callback,pUserData,0,SYNCML_DM_ROLLBACK_MSG_ID); 2026 } 2027 2028 2029 SYNCML_DM_RET_STATUS_T 2030 DMT_Begin(DMT_H_TREE htree, DMT_CallbackStatusCode callback, void* pUserData ) 2031 { 2032 return dmtTree_Post(htree,callback,pUserData,0,SYNCML_DM_BEGIN_MSG_ID); 2033 } 2034 2035 2036 2037 SYNCML_DM_RET_STATUS_T 2038 DMT_GetChildValuesMap(DMT_H_TREE htree, 2039 CPCHAR path, 2040 DMT_CallbackGetChildValuesMap callback, 2041 void* pUserData ) 2042 { 2043 if ( callback == NULL ) 2044 return SYNCML_DM_INVALID_PARAMETER; 2045 return dmtGetChildValuesMap_Post(htree,path,callback,pUserData,0); 2046 } 2047 2048 2049 SYNCML_DM_RET_STATUS_T 2050 DMT_SetChildValuesMap(DMT_H_TREE htree, 2051 CPCHAR path, 2052 const DMT_LEAF_CHILDREN_DATA_T* data, 2053 DMT_CallbackStatusCode callback, 2054 void* pUserData ) 2055 { 2056 return dmtSetChildValuesMap_Post(htree,path,data,callback,pUserData,0); 2057 } 2058 2059 2060 2061 SYNCML_DM_RET_STATUS_T 2062 DMT_GetAttributes(DMT_H_NODE hnode, 2063 DMT_CallbackGetAttributes callback, 2064 void* pUserData ) 2065 { 2066 if ( callback == NULL ) 2067 return SYNCML_DM_INVALID_PARAMETER; 2068 return dmtGetAttributes_Post(hnode,callback,pUserData,0); 2069 } 2070 2071 2072 2073 SYNCML_DM_RET_STATUS_T 2074 DMT_GetValue(DMT_H_NODE hnode, 2075 DMT_CallbackGetValue callback, 2076 void* pUserData ) 2077 { 2078 if ( callback == NULL ) 2079 return SYNCML_DM_INVALID_PARAMETER; 2080 return dmtGetValue_Post(hnode,callback,pUserData,0); 2081 } 2082 2083 2084 SYNCML_DM_RET_STATUS_T 2085 DMT_SetValue(DMT_H_NODE hnode, 2086 const DMT_DATA_T* data, 2087 DMT_CallbackStatusCode callback, 2088 void* pUserData ) 2089 { 2090 return dmtSetValue_Post(hnode,data,callback,pUserData,0); 2091 } 2092 2093 2094 SYNCML_DM_RET_STATUS_T 2095 DMT_SetTitle(DMT_H_NODE hnode, 2096 CPCHAR title, 2097 DMT_CallbackStatusCode callback, 2098 void* pUserData ) 2099 { 2100 return dmtNode_Post(hnode,title,callback,pUserData,0,SYNCML_DM_SET_TITLE_MSG_ID); 2101 } 2102 2103 2104 SYNCML_DM_RET_STATUS_T 2105 DMT_SetACL(DMT_H_NODE hnode, 2106 CPCHAR acl, 2107 DMT_CallbackStatusCode callback, 2108 void* pUserData ) 2109 { 2110 return dmtNode_Post(hnode,acl,callback,pUserData,0,SYNCML_DM_SET_ACL_MSG_ID); 2111 } 2112 2113 2114 SYNCML_DM_RET_STATUS_T 2115 DMT_Execute(DMT_H_NODE hnode, 2116 CPCHAR params, 2117 DMT_CallbackExecute callback, 2118 void* pUserData ) 2119 { 2120 if ( callback == NULL ) 2121 return SYNCML_DM_INVALID_PARAMETER; 2122 return dmtExecute_Post(hnode,params,callback,pUserData,0); 2123 } 2124 #ifdef LOB_SUPPORT 2125 SYNCML_DM_RET_STATUS_T 2126 DMT_GetFirstChunk(DMT_H_NODE hnode, 2127 DMT_DATACHUNK_T *datachunk, 2128 DMT_CallbackDataChunk callback, 2129 void* pUserData ) 2130 { 2131 if ( callback == NULL ) 2132 return SYNCML_DM_INVALID_PARAMETER; 2133 return dmtGetFirstChunk_Post(hnode, datachunk, callback,pUserData,0); 2134 } 2135 SYNCML_DM_RET_STATUS_T 2136 DMT_GetNextChunk(DMT_H_NODE hnode, 2137 DMT_DATACHUNK_T *datachunk, 2138 DMT_CallbackDataChunk callback, 2139 void* pUserData ) 2140 { 2141 if ( callback == NULL ) 2142 return SYNCML_DM_INVALID_PARAMETER; 2143 return dmtGetNextChunk_Post(hnode, datachunk, callback,pUserData,0); 2144 } 2145 2146 SYNCML_DM_RET_STATUS_T 2147 DMT_SetFirstChunk(DMT_H_NODE hnode, 2148 DMT_DATACHUNK_T *datachunk, 2149 DMT_CallbackDataChunk callback, 2150 void* pUserData ) 2151 { 2152 if ( callback == NULL ) 2153 return SYNCML_DM_INVALID_PARAMETER; 2154 return dmtSetFirstChunk_Post(hnode, datachunk, callback,pUserData,0); 2155 } 2156 2157 SYNCML_DM_RET_STATUS_T 2158 DMT_SetNextChunk(DMT_H_NODE hnode, 2159 DMT_DATACHUNK_T *datachunk, 2160 DMT_CallbackDataChunk callback, 2161 void* pUserData ) 2162 { 2163 if ( callback == NULL ) 2164 return SYNCML_DM_INVALID_PARAMETER; 2165 return dmtSetNextChunk_Post(hnode, datachunk ,callback,pUserData,0); 2166 } 2167 2168 SYNCML_DM_RET_STATUS_T 2169 DMT_SetLastChunk(DMT_H_NODE hnode, 2170 DMT_DATACHUNK_T *datachunk, 2171 DMT_CallbackDataChunk callback, 2172 void* pUserData ) 2173 { 2174 if ( callback == NULL ) 2175 return SYNCML_DM_INVALID_PARAMETER; 2176 return dmtSetLastChunk_Post(hnode, datachunk, callback,pUserData,0); 2177 } 2178 2179 INT32 DMT_GetChunkSize() 2180 { 2181 return DmtDataChunk::GetChunkSize(); 2182 } 2183 #else 2184 SYNCML_DM_RET_STATUS_T 2185 DMT_GetFirstChunk(DMT_H_NODE hnode, 2186 DMT_DATACHUNK_T *datachunk, 2187 DMT_CallbackDataChunk callback, 2188 void* pUserData ) 2189 { 2190 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2191 } 2192 SYNCML_DM_RET_STATUS_T 2193 DMT_GetNextChunk(DMT_H_NODE hnode, 2194 DMT_DATACHUNK_T *datachunk, 2195 DMT_CallbackDataChunk callback, 2196 void* pUserData ) 2197 { 2198 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2199 } 2200 2201 SYNCML_DM_RET_STATUS_T 2202 DMT_SetFirstChunk(DMT_H_NODE hnode, 2203 DMT_DATACHUNK_T *datachunk, 2204 DMT_CallbackDataChunk callback, 2205 void* pUserData ) 2206 { 2207 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2208 } 2209 2210 SYNCML_DM_RET_STATUS_T 2211 DMT_SetNextChunk(DMT_H_NODE hnode, 2212 DMT_DATACHUNK_T *datachunk, 2213 DMT_CallbackDataChunk callback, 2214 void* pUserData ) 2215 { 2216 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2217 } 2218 2219 SYNCML_DM_RET_STATUS_T 2220 DMT_SetLastChunk(DMT_H_NODE hnode, 2221 DMT_DATACHUNK_T *datachunk, 2222 DMT_CallbackDataChunk callback, 2223 void* pUserData ) 2224 { 2225 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2226 } 2227 2228 INT32 DMT_GetChunkSize() 2229 { 2230 return 0; 2231 } 2232 #endif 2233 2234 SYNCML_DM_RET_STATUS_T 2235 DMT_NotifyOnIdle_Msg(UINT32 messageID, void* pUserData ) 2236 { 2237 2238 if ( messageID == 0 ) 2239 return SYNCML_DM_INVALID_PARAMETER; 2240 2241 return dmtNotifyOnIdle_Post(NULL, pUserData, messageID); 2242 } 2243 2244 2245 /* Async APIs used message posting instead of callback */ 2246 SYNCML_DM_RET_STATUS_T 2247 DMT_Init_Msg(UINT32 messageID, void* pUserData) 2248 { 2249 2250 if ( messageID == 0 ) 2251 return SYNCML_DM_INVALID_PARAMETER; 2252 2253 return dmtEngine_Post(NULL, pUserData, messageID,SYNCML_DM_INIT_MSG_ID); 2254 } 2255 2256 SYNCML_DM_RET_STATUS_T 2257 DMT_Uninit_Msg(UINT32 messageID, void* pUserData) 2258 { 2259 if ( messageID == 0 ) 2260 return SYNCML_DM_INVALID_PARAMETER; 2261 2262 return dmtEngine_Post(NULL, pUserData, messageID,SYNCML_DM_UNINIT_MSG_ID); 2263 } 2264 2265 SYNCML_DM_RET_STATUS_T 2266 DMT_GetTree_Msg(CPCHAR szPrincipal, 2267 UINT32 messageID, 2268 void* pUserData ) 2269 { 2270 if ( messageID == 0 ) 2271 return SYNCML_DM_INVALID_PARAMETER; 2272 2273 return DMT_GetSubtree_Msg(szPrincipal,NULL,messageID,pUserData); 2274 2275 } 2276 2277 SYNCML_DM_RET_STATUS_T 2278 DMT_GetSubtree_Msg(CPCHAR szPrincipal, 2279 CPCHAR szSubtreeRoot, 2280 UINT32 messageID, 2281 void* pUserData ) 2282 { 2283 2284 return DMT_GetSubtreeEx_Msg(szPrincipal,szSubtreeRoot,SYNCML_DM_LOCK_TYPE_AUTOMATIC,messageID,pUserData); 2285 2286 } 2287 2288 2289 SYNCML_DM_RET_STATUS_T 2290 DMT_GetSubtreeEx_Msg(CPCHAR szPrincipal, 2291 CPCHAR szSubtreeRoot, 2292 SYNCML_DM_TREE_LOCK_TYPE_T nLockType, 2293 UINT32 messageID, 2294 void* pUserData ) 2295 { 2296 if ( messageID == 0 ) 2297 return SYNCML_DM_INVALID_PARAMETER; 2298 2299 return dmtGetSubtreeEx_Post(szPrincipal,szSubtreeRoot,nLockType,NULL,pUserData,messageID); 2300 2301 } 2302 2303 SYNCML_DM_RET_STATUS_T 2304 DMT_TreeRelease_Msg(DMT_H_TREE htree, 2305 UINT32 messageID, 2306 void* pUserData ) 2307 { 2308 if ( messageID == 0 ) 2309 return SYNCML_DM_INVALID_PARAMETER; 2310 2311 return dmtTree_Post(htree,NULL,pUserData,messageID,SYNCML_DM_RELEASE_TREE_ID); 2312 } 2313 2314 2315 SYNCML_DM_RET_STATUS_T 2316 DMT_ProcessScript_Msg(CPCHAR szPrincipal, 2317 const UINT8 * buf, 2318 INT32 len, 2319 BOOLEAN isWBXML, 2320 UINT32 messageID, 2321 void* pUserData ) 2322 { 2323 2324 if ( messageID == 0 ) 2325 return SYNCML_DM_INVALID_PARAMETER; 2326 2327 return dmtProcessScript_Post(szPrincipal,buf,len,isWBXML,NULL,pUserData,messageID); 2328 2329 } 2330 2331 2332 SYNCML_DM_RET_STATUS_T 2333 DMT_StartServerSession_Msg(CPCHAR szPrincipal, 2334 const DMT_SESSION_PROP_T * pSessionProp, 2335 UINT32 messageID, 2336 void* pUserData ) 2337 { 2338 if ( messageID == 0 ) 2339 return SYNCML_DM_INVALID_PARAMETER; 2340 2341 return dmtStartServerSession_Post(szPrincipal,pSessionProp,NULL,pUserData,messageID); 2342 } 2343 2344 SYNCML_DM_RET_STATUS_T 2345 DMT_ProcessNotification_Msg(CPCHAR szPrincipal, 2346 const UINT8 *buf, 2347 INT32 len, 2348 UINT32 messageID, 2349 void* pUserData ) 2350 { 2351 if ( messageID == 0 ) 2352 return SYNCML_DM_INVALID_PARAMETER; 2353 2354 return dmtProcessNotification_Post(szPrincipal,buf,len,NULL,pUserData,messageID); 2355 } 2356 2357 2358 SYNCML_DM_RET_STATUS_T 2359 DMT_Bootstrap_Msg(CPCHAR szPrincipal, 2360 const UINT8 * buf, 2361 INT32 len, 2362 BOOLEAN isWBXML, 2363 BOOLEAN isProcess, 2364 UINT32 messageID, 2365 void* pUserData ) 2366 { 2367 if ( messageID == 0 ) 2368 return SYNCML_DM_INVALID_PARAMETER; 2369 2370 return dmtBootstrap_Post(szPrincipal,buf,len,isWBXML,isProcess, NULL,pUserData,messageID); 2371 } 2372 2373 2374 SYNCML_DM_RET_STATUS_T 2375 DMT_GetNode_Msg(DMT_H_TREE htree, 2376 CPCHAR path, 2377 UINT32 messageID, 2378 void* pUserData ) 2379 { 2380 if ( messageID == 0 ) 2381 return SYNCML_DM_INVALID_PARAMETER; 2382 2383 return dmtGetNode_Post(htree,path,NULL,pUserData,messageID); 2384 2385 } 2386 2387 SYNCML_DM_RET_STATUS_T 2388 DMT_NodeRelease_Msg(DMT_H_NODE hnode, 2389 UINT32 messageID, 2390 void* pUserData ) 2391 { 2392 if ( messageID == 0 ) 2393 return SYNCML_DM_INVALID_PARAMETER; 2394 2395 return dmtNodeRelease_Post(hnode,NULL,pUserData,messageID,SYNCML_DM_RELEASE_NODE_MSG_ID); 2396 } 2397 2398 SYNCML_DM_RET_STATUS_T 2399 DMT_DeleteNode_Msg(DMT_H_TREE htree, 2400 CPCHAR path, 2401 UINT32 messageID, 2402 void* pUserData ) 2403 { 2404 if ( messageID == 0 ) 2405 return SYNCML_DM_INVALID_PARAMETER; 2406 2407 return dmtTreeNode_Post(htree,path,NULL,NULL,pUserData,messageID,SYNCML_DM_DELETE_NODE_MSG_ID); 2408 2409 2410 } 2411 2412 SYNCML_DM_RET_STATUS_T 2413 DMT_RenameNode_Msg(DMT_H_TREE htree, 2414 CPCHAR path, 2415 CPCHAR new_node_name, 2416 UINT32 messageID, 2417 void* pUserData ) 2418 { 2419 if ( messageID == 0 ) 2420 return SYNCML_DM_INVALID_PARAMETER; 2421 2422 return dmtRenameNode_Post(htree,path,new_node_name,NULL,pUserData,messageID); 2423 2424 } 2425 2426 SYNCML_DM_RET_STATUS_T 2427 DMT_CreateInteriorNode_Msg(DMT_H_TREE htree, 2428 CPCHAR path, 2429 UINT32 messageID, 2430 void* pUserData ) 2431 { 2432 if ( messageID == 0 ) 2433 return SYNCML_DM_INVALID_PARAMETER; 2434 2435 return dmtTreeNode_Post(htree,path,NULL,NULL,pUserData,messageID,SYNCML_DM_CREATE_INTERIOR_NODE_MSG_ID); 2436 2437 } 2438 2439 SYNCML_DM_RET_STATUS_T 2440 DMT_CreateLeafNode_Msg(DMT_H_TREE htree, 2441 CPCHAR path, 2442 const DMT_DATA_T* data, 2443 UINT32 messageID, 2444 void* pUserData ) 2445 { 2446 if ( messageID == 0 ) 2447 return SYNCML_DM_INVALID_PARAMETER; 2448 2449 return dmtCreateLeafNode_Post(htree,path,data,NULL,pUserData,messageID); 2450 2451 } 2452 2453 SYNCML_DM_RET_STATUS_T 2454 DMT_GetChildNodeNames_Msg(DMT_H_TREE htree, 2455 CPCHAR path, 2456 UINT32 messageID, 2457 void* pUserData ) 2458 { 2459 if ( messageID == 0 ) 2460 return SYNCML_DM_INVALID_PARAMETER; 2461 2462 return dmtGetChildNodeNames_Post(htree,path,NULL,pUserData,messageID); 2463 2464 } 2465 2466 SYNCML_DM_RET_STATUS_T 2467 DMT_Flush_Msg(DMT_H_TREE htree, UINT32 messageID, void* pUserData ) 2468 { 2469 if ( messageID == 0 ) 2470 return SYNCML_DM_INVALID_PARAMETER; 2471 2472 return dmtTree_Post(htree,NULL,pUserData,messageID,SYNCML_DM_FLUSH_MSG_ID); 2473 } 2474 2475 SYNCML_DM_RET_STATUS_T 2476 DMT_Commit_Msg(DMT_H_TREE htree, UINT32 messageID, void* pUserData ) 2477 { 2478 if ( messageID == 0 ) 2479 return SYNCML_DM_INVALID_PARAMETER; 2480 2481 return dmtTree_Post(htree,NULL,pUserData,messageID,SYNCML_DM_COMMIT_MSG_ID); 2482 } 2483 2484 SYNCML_DM_RET_STATUS_T 2485 DMT_Rollback_Msg(DMT_H_TREE htree, UINT32 messageID, void* pUserData ) 2486 { 2487 if ( messageID == 0 ) 2488 return SYNCML_DM_INVALID_PARAMETER; 2489 2490 return dmtTree_Post(htree,NULL,pUserData,messageID,SYNCML_DM_ROLLBACK_MSG_ID); 2491 } 2492 2493 SYNCML_DM_RET_STATUS_T 2494 DMT_Begin_Msg(DMT_H_TREE htree, UINT32 messageID, void* pUserData ) 2495 { 2496 if ( messageID == 0 ) 2497 return SYNCML_DM_INVALID_PARAMETER; 2498 2499 return dmtTree_Post(htree,NULL,pUserData,messageID,SYNCML_DM_BEGIN_MSG_ID); 2500 } 2501 2502 2503 SYNCML_DM_RET_STATUS_T 2504 DMT_GetChildValuesMap_Msg(DMT_H_TREE htree, 2505 CPCHAR path, 2506 UINT32 messageID, 2507 void* pUserData ) 2508 { 2509 if ( messageID == 0 ) 2510 return SYNCML_DM_INVALID_PARAMETER; 2511 2512 return dmtGetChildValuesMap_Post(htree,path,NULL,pUserData,messageID); 2513 } 2514 2515 2516 SYNCML_DM_RET_STATUS_T 2517 DMT_SetChildValuesMap_Msg(DMT_H_TREE htree, 2518 CPCHAR path, 2519 const DMT_LEAF_CHILDREN_DATA_T* data, 2520 UINT32 messageID, 2521 void* pUserData ) 2522 { 2523 if ( messageID == 0 ) 2524 return SYNCML_DM_INVALID_PARAMETER; 2525 2526 return dmtSetChildValuesMap_Post(htree,path,data,NULL,pUserData,messageID); 2527 } 2528 2529 2530 SYNCML_DM_RET_STATUS_T 2531 DMT_GetAttributes_Msg(DMT_H_NODE hnode, UINT32 messageID, void* pUserData ) 2532 { 2533 if ( messageID == 0 ) 2534 return SYNCML_DM_INVALID_PARAMETER; 2535 2536 return dmtGetAttributes_Post(hnode,NULL,pUserData,messageID); 2537 2538 } 2539 2540 SYNCML_DM_RET_STATUS_T 2541 DMT_GetValue_Msg(DMT_H_NODE hnode, UINT32 messageID, void* pUserData ) 2542 { 2543 if ( messageID == 0 ) 2544 return SYNCML_DM_INVALID_PARAMETER; 2545 2546 return dmtGetValue_Post(hnode,NULL,pUserData,messageID); 2547 } 2548 2549 SYNCML_DM_RET_STATUS_T 2550 DMT_SetValue_Msg(DMT_H_NODE hnode, 2551 const DMT_DATA_T* data, 2552 UINT32 messageID, 2553 void* pUserData ) 2554 { 2555 if ( messageID == 0 ) 2556 return SYNCML_DM_INVALID_PARAMETER; 2557 2558 return dmtSetValue_Post(hnode,data,NULL,pUserData,messageID); 2559 } 2560 2561 SYNCML_DM_RET_STATUS_T 2562 DMT_SetTitle_Msg(DMT_H_NODE hnode, 2563 CPCHAR title, 2564 UINT32 messageID, 2565 void* pUserData ) 2566 { 2567 if ( messageID == 0 ) 2568 return SYNCML_DM_INVALID_PARAMETER; 2569 2570 return dmtNode_Post(hnode,title,NULL,pUserData,messageID,SYNCML_DM_SET_TITLE_MSG_ID); 2571 2572 } 2573 2574 SYNCML_DM_RET_STATUS_T 2575 DMT_SetACL_Msg(DMT_H_NODE hnode, 2576 CPCHAR acl, 2577 UINT32 messageID, 2578 void* pUserData ) 2579 { 2580 if ( messageID == 0 ) 2581 return SYNCML_DM_INVALID_PARAMETER; 2582 2583 return dmtNode_Post(hnode,acl,NULL,pUserData,messageID,SYNCML_DM_SET_ACL_MSG_ID); 2584 2585 } 2586 2587 SYNCML_DM_RET_STATUS_T 2588 DMT_Execute_Msg(DMT_H_NODE hnode, 2589 CPCHAR params, 2590 UINT32 messageID, 2591 void* pUserData ) 2592 { 2593 if ( messageID == 0 ) 2594 return SYNCML_DM_INVALID_PARAMETER; 2595 2596 return dmtExecute_Post(hnode,params,NULL,pUserData,messageID); 2597 } 2598 2599 #ifdef LOB_SUPPORT 2600 2601 SYNCML_DM_RET_STATUS_T 2602 DMT_GetFirstChunk_Msg(DMT_H_NODE hnode, 2603 DMT_DATACHUNK_T *datachunk, 2604 UINT32 messageID, 2605 void* pUserData ) 2606 { 2607 if ( messageID == 0 ) 2608 return SYNCML_DM_INVALID_PARAMETER; 2609 2610 return dmtGetFirstChunk_Post(hnode, datachunk, NULL,pUserData,messageID); 2611 } 2612 2613 SYNCML_DM_RET_STATUS_T 2614 DMT_GetNextChunk_Msg(DMT_H_NODE hnode, 2615 DMT_DATACHUNK_T *datachunk, 2616 UINT32 messageID, 2617 void* pUserData ) 2618 { 2619 if ( messageID == 0 ) 2620 return SYNCML_DM_INVALID_PARAMETER; 2621 2622 return dmtGetNextChunk_Post(hnode, datachunk, NULL,pUserData,messageID); 2623 } 2624 2625 SYNCML_DM_RET_STATUS_T 2626 DMT_SetFirstChunk_Msg(DMT_H_NODE hnode, 2627 DMT_DATACHUNK_T *datachunk, 2628 UINT32 messageID, 2629 void* pUserData ) 2630 { 2631 if ( messageID == 0 ) 2632 return SYNCML_DM_INVALID_PARAMETER; 2633 2634 return dmtSetFirstChunk_Post(hnode, datachunk, NULL,pUserData,messageID); 2635 } 2636 2637 SYNCML_DM_RET_STATUS_T 2638 DMT_SetNextChunk_Msg(DMT_H_NODE hnode, 2639 DMT_DATACHUNK_T *datachunk, 2640 UINT32 messageID, 2641 void* pUserData ) 2642 { 2643 if ( messageID == 0 ) 2644 return SYNCML_DM_INVALID_PARAMETER; 2645 2646 return dmtSetNextChunk_Post(hnode, datachunk, NULL,pUserData,messageID); 2647 } 2648 2649 SYNCML_DM_RET_STATUS_T 2650 DMT_SetLastChunk_Msg(DMT_H_NODE hnode, 2651 DMT_DATACHUNK_T *datachunk, 2652 UINT32 messageID, 2653 void* pUserData ) 2654 { 2655 if ( messageID == 0 ) 2656 return SYNCML_DM_INVALID_PARAMETER; 2657 2658 return dmtSetLastChunk_Post(hnode, datachunk, NULL,pUserData,messageID); 2659 } 2660 2661 #else // LOB_SUPPORT 2662 2663 SYNCML_DM_RET_STATUS_T 2664 DMT_GetFirstChunk_Msg(DMT_H_NODE hnode, 2665 DMT_DATACHUNK_T *datachunk, 2666 UINT32 messageID, 2667 void* pUserData ) 2668 { 2669 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2670 } 2671 2672 SYNCML_DM_RET_STATUS_T 2673 DMT_GetNextChunk_Msg(DMT_H_NODE hnode, 2674 DMT_DATACHUNK_T *datachunk, 2675 UINT32 messageID, 2676 void* pUserData ) 2677 { 2678 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2679 } 2680 2681 SYNCML_DM_RET_STATUS_T 2682 DMT_SetFirstChunk_Msg(DMT_H_NODE hnode, 2683 DMT_DATACHUNK_T *datachunk, 2684 UINT32 messageID, 2685 void* pUserData ) 2686 { 2687 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2688 } 2689 2690 SYNCML_DM_RET_STATUS_T 2691 DMT_SetNextChunk_Msg(DMT_H_NODE hnode, 2692 DMT_DATACHUNK_T *datachunk, 2693 UINT32 messageID, 2694 void* pUserData ) 2695 { 2696 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2697 } 2698 2699 SYNCML_DM_RET_STATUS_T 2700 DMT_SetLastChunk_Msg(DMT_H_NODE hnode, 2701 DMT_DATACHUNK_T *datachunk, 2702 UINT32 messageID, 2703 void* pUserData ) 2704 { 2705 return SYNCML_DM_FEATURE_NOT_SUPPORTED; 2706 } 2707 2708 #endif // LOB_SUPPORT 2709 2710 #ifdef __cplusplus 2711 } 2712 #endif 2713