diff options
Diffstat (limited to 'src/agent/mo-handler/dm_mo_common.c')
-rwxr-xr-x | src/agent/mo-handler/dm_mo_common.c | 1522 |
1 files changed, 1522 insertions, 0 deletions
diff --git a/src/agent/mo-handler/dm_mo_common.c b/src/agent/mo-handler/dm_mo_common.c new file mode 100755 index 0000000..5278757 --- /dev/null +++ b/src/agent/mo-handler/dm_mo_common.c @@ -0,0 +1,1522 @@ +/* + * oma-dm-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*lib*/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/*sync-agent*/ +#include <sync_agent.h> + +/*dm-agent*/ +#include "common/dm_common.h" +#include "common/util/util.h" +#include "serviceadapter/sa_session.h" +#include "serviceadapter/protocolbinder/syncml_def.h" +#include "serviceadapter/sa_elements_internal.h" +#include "mo-handler/dm_mo_common.h" +#include "mo-handler/dm_mo_handler.h" +#include "dm-engine/bootstrap/factory_bootstrap.h" + +#ifndef OMADM_AGENT_LOG +#undef LOG_TAG +#define LOG_TAG "MO_ENGINE" +#endif + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /* mo test interface */ + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* + +void dmacc_define_fumo() { + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DMACC; + + char *mo_full_path0 = FUMO_DM_ACC; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path00 = FUMO_DM_ACC_FUMO; + char *value00 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type00 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = FUMO_DM_ACC_APPID; + char *value1 = "w7"; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = FUMO_DM_ACC_SERVERID; + char *value2 = "x6g1q14r75"; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path3 = FUMO_DM_ACC_NAME; + char *value3 = "slp_msc_fumo"; + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path4 = FUMO_DM_ACC_PRECONREF; + char *value4 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = FUMO_DM_ACC_TOCONREF; + char *value5 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path6 =FUMO_DM_ACC_TOCONREF_X; + char *value6 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path7 =FUMO_DM_ACC_TOCONREF_X_CONREF; + char *value7 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path8 =FUMO_DM_ACC_APPADDR; + char *value8 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path9 =FUMO_DM_ACC_APPADDR_X; + char *value9 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path10 =FUMO_DM_ACC_APPADDR_X_ADDR; + char *value10 ="https://121.252.197.81:443/v1/device/magicsync/mdm"; + sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path11 =FUMO_DM_ACC_APPADDR_X_ADDRTYPE; + char *value11 = "IPv4"; + sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path12 =FUMO_DM_ACC_APPADDR_X_PORT; + char *value12 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path13 =FUMO_DM_ACC_APPADDR_X_PORT_X; + char *value13 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path14 =FUMO_DM_ACC_APPADDR_X_PORT_X_PORTNBR; + char *value14 ="443"; + sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path15 =FUMO_DM_ACC_AAUTHPREF; + char *value15 = "DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type15 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path16 =FUMO_DM_ACC_APPAUTH; + char *value16 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type16 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path17 = FUMO_DM_ACC_APPAUTH_X1; + char *value17 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type17 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path18 = FUMO_DM_ACC_APPAUTH_X1_AAUTHLEVEL; + char *value18 ="CLCRED"; + sync_agent_dm_mo_node_type_e mo_node_type18 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path19 = FUMO_DM_ACC_APPAUTH_X1_AAUTHTYPE; + char *value19 ="DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type19 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path20 = FUMO_DM_ACC_APPAUTH_X1_AAUTHNAME; + char *value20; + + sync_agent_get_devinfo(2, "DevID", &value20 );//"IMEI:004401055493403"; + MO_NODE_TYPE mo_node_type20 = MO_NODE_LEAF; + + char *mo_full_path21 = FUMO_DM_ACC_APPAUTH_X1_SECRET; + char *value21 = generate_Device_Password_temp( value20, value2); + sync_agent_dm_mo_node_type_e mo_node_type21 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path22 = FUMO_DM_ACC_APPAUTH_X1_AAUTHDATA; + char *value22 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type22 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path23 = FUMO_DM_ACC_APPAUTH_X2; + char *value23 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type23 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path24 = FUMO_DM_ACC_APPAUTH_X2_AAUTHLEVEL; + char *value24 ="SRVRED"; + sync_agent_dm_mo_node_type_e mo_node_type24 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path25 = FUMO_DM_ACC_APPAUTH_X2_AAUTHTYPE; + char *value25 ="DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type25 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path26 = FUMO_DM_ACC_APPAUTH_X2_AAUTHNAME; + char *value26 ="x6g1q14r75"; + sync_agent_dm_mo_node_type_e mo_node_type26 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path27 = FUMO_DM_ACC_APPAUTH_X2_SECRET; + char *value27 ="T1NQIERNIFNIcnZIcg=="; + sync_agent_dm_mo_node_type_e mo_node_type27 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path28 = FUMO_DM_ACC_APPAUTH_X2_AAUTHDATA; + char *value28 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type28 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path29 = FUMO_DM_ACC_EXT; + char *value29 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type29 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path00, value00, mo_node_type00, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property); + add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property); + add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property); + add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property); + add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property); + add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property); + add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property); + add_mo(type, mo_full_path15, value15, mo_node_type15, framework_property, runtime_property); + add_mo(type, mo_full_path16, value16, mo_node_type16, framework_property, runtime_property); + add_mo(type, mo_full_path17, value17, mo_node_type17, framework_property, runtime_property); + add_mo(type, mo_full_path18, value18, mo_node_type18, framework_property, runtime_property); + add_mo(type, mo_full_path19, value19, mo_node_type19, framework_property, runtime_property); + add_mo(type, mo_full_path20, value20, mo_node_type20, framework_property, runtime_property); + add_mo(type, mo_full_path21, value21, mo_node_type21, framework_property, runtime_property); + add_mo(type, mo_full_path22, value22, mo_node_type22, framework_property, runtime_property); + add_mo(type, mo_full_path23, value23, mo_node_type23, framework_property, runtime_property); + add_mo(type, mo_full_path24, value24, mo_node_type24, framework_property, runtime_property); + add_mo(type, mo_full_path25, value25, mo_node_type25, framework_property, runtime_property); + add_mo(type, mo_full_path26, value26, mo_node_type26, framework_property, runtime_property); + add_mo(type, mo_full_path27, value27, mo_node_type27, framework_property, runtime_property); + add_mo(type, mo_full_path28, value28, mo_node_type28, framework_property, runtime_property); + add_mo(type, mo_full_path29, value29, mo_node_type29, framework_property, runtime_property); + + _DEBUG_INFO( " end!!\n"); +} + +void dmacc_define_lawmo() { + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DMACC; + + char *mo_full_path0 = LAWMO_DM_ACC; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path00 = LAWMO_DM_ACC_LAWMO; + char *value00 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type00 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = LAWMO_DM_ACC_APPID; + char *value1 = "w7"; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = LAWMO_DM_ACC_SERVERID; + char *value2 = "5e8o9279r2"; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path3 = LAWMO_DM_ACC_NAME; + char *value3 = "slp_msc_lawmo"; + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path4 = LAWMO_DM_ACC_PRECONREF; + char *value4 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = LAWMO_DM_ACC_TOCONREF; + char *value5 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path6 =LAWMO_DM_ACC_TOCONREF_X; + char *value6 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path7 =LAWMO_DM_ACC_TOCONREF_X_CONREF; + char *value7 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path8 =LAWMO_DM_ACC_APPADDR; + char *value8 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path9 =LAWMO_DM_ACC_APPADDR_X; + char *value9 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path10 =LAWMO_DM_ACC_APPADDR_X_ADDR; + char *value10 ="https://dm.samsungdive.com:443/v1/sdm/magicsync/dm"; + sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path11 =LAWMO_DM_ACC_APPADDR_X_ADDRTYPE; + char *value11 = "IPv4"; + sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path12 =LAWMO_DM_ACC_APPADDR_X_PORT; + char *value12 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path13 =LAWMO_DM_ACC_APPADDR_X_PORT_X; + char *value13 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path14 =LAWMO_DM_ACC_APPADDR_X_PORT_X_PORTNBR; + char *value14 ="443"; + sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path15 =LAWMO_DM_ACC_AAUTHPREF; + char *value15 = "DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type15 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path16 =LAWMO_DM_ACC_APPAUTH; + char *value16 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type16 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path17 = LAWMO_DM_ACC_APPAUTH_X1; + char *value17 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type17 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path18 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHLEVEL; + char *value18 ="CLCRED"; + sync_agent_dm_mo_node_type_e mo_node_type18 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path19 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHTYPE; + char *value19 ="DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type19 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path20 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHNAME; + char *value20; + + sync_agent_get_devinfo(2, "DevID", &value20 );//"IMEI:004401055493403"; + sync_agent_dm_mo_node_type_e mo_node_type20 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path21 = LAWMO_DM_ACC_APPAUTH_X1_SECRET; + char *value21 = generate_Device_Password_temp( value20, value2); + sync_agent_dm_mo_node_type_e mo_node_type21 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path22 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHDATA; + char *value22 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type22 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path23 = LAWMO_DM_ACC_APPAUTH_X2; + char *value23 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type23 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path24 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHLEVEL; + char *value24 ="SRVRED"; + sync_agent_dm_mo_node_type_e mo_node_type24 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path25 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHTYPE; + char *value25 ="DIGEST"; + sync_agent_dm_mo_node_type_e mo_node_type25 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path26 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHNAME; + char *value26 ="5e8o9279r2"; + sync_agent_dm_mo_node_type_e mo_node_type26 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path27 = LAWMO_DM_ACC_APPAUTH_X2_SECRET; + char *value27 ="T1NQIERNIFNlcnZlcg=="; + sync_agent_dm_mo_node_type_e mo_node_type27 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path28 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHDATA; + char *value28 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type28 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path29 = LAWMO_DM_ACC_EXT; + char *value29 =NULL; + sync_agent_dm_mo_node_type_e mo_node_type29 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path00, value00, mo_node_type00, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property); + add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property); + add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property); + add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property); + add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property); + add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property); + add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property); + add_mo(type, mo_full_path15, value15, mo_node_type15, framework_property, runtime_property); + add_mo(type, mo_full_path16, value16, mo_node_type16, framework_property, runtime_property); + add_mo(type, mo_full_path17, value17, mo_node_type17, framework_property, runtime_property); + add_mo(type, mo_full_path18, value18, mo_node_type18, framework_property, runtime_property); + add_mo(type, mo_full_path19, value19, mo_node_type19, framework_property, runtime_property); + add_mo(type, mo_full_path20, value20, mo_node_type20, framework_property, runtime_property); + add_mo(type, mo_full_path21, value21, mo_node_type21, framework_property, runtime_property); + add_mo(type, mo_full_path22, value22, mo_node_type22, framework_property, runtime_property); + add_mo(type, mo_full_path23, value23, mo_node_type23, framework_property, runtime_property); + add_mo(type, mo_full_path24, value24, mo_node_type24, framework_property, runtime_property); + add_mo(type, mo_full_path25, value25, mo_node_type25, framework_property, runtime_property); + add_mo(type, mo_full_path26, value26, mo_node_type26, framework_property, runtime_property); + add_mo(type, mo_full_path27, value27, mo_node_type27, framework_property, runtime_property); + add_mo(type, mo_full_path28, value28, mo_node_type28, framework_property, runtime_property); + add_mo(type, mo_full_path29, value29, mo_node_type29, framework_property, runtime_property); + + _DEBUG_INFO( " end!!\n"); +} + + void devinfo_define() { + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DEVINFO; + + char *mo_full_path0 = DM_DEVINFO; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = DM_DEVINFO_BEARER; + char *value1 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = DM_DEVINFO_DEVID; + char *value2; + + sync_agent_get_devinfo(2, "DevID", &value2 );//"IMEI:004401055493403"; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path3 = DM_DEVINFO_MAN; + char *value3 = "samsung-electronics"; + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path4 = DM_DEVINFO_MOD; + char *value4 = "GT-I9500"; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = DM_DEVINFO_DMV; + char *value5 = "1.2"; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path6 =DM_DEVINFO_LANG; + char *value6 = "en-us"; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path7 =DM_DEVINFO_EXT; + char *value7 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + + _DEBUG_INFO( " end!!\n"); +} + void devdetail_define() { + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DEVDETAIL; + + char *mo_full_path0 = DM_DEVDETAIL; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = DM_DEVDETAIL_BEARER; + char *value1 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = DM_DEVINFO_URI; + char *value2 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path3 = DM_DEVINFO_URI_MAXDEPTH; + char *value3 = g_strdup_printf("%d",100); + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path4 = DM_DEVINFO_URI_MAXTOTLEN; + char *value4 = g_strdup_printf("%d",100);; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = DM_DEVINFO_URI_MAXSEGLEN; + char *value5 = g_strdup_printf("%d",100);; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path6 =DM_DEVINFO_DEVTYP; + char *value6 = "Smart"; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path7 =DM_DEVINFO_OEM; + char *value7 = "null"; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path8 =DM_DEVINFO_FWV; + char *value8 = "M.I9200XXKC1-P.I13-"; + sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path9 =DM_DEVINFO_SWV; + char *value9 = "M.I9200XXKC1-P.I13-"; + sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path10 =DM_DEVINFO_HWV; + char *value10 ="GT-I9500"; + sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path11 =DM_DEVINFO_LRGOBJ; + char *value11 = "IPv4"; + sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property); + add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property); + add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property); + add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property); + + _DEBUG_INFO( " ed!!\n"); + +} + + void fumo_define() { + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_FUMO; + + char *mo_full_path0 = DM_FUMO; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = DM_FUMO_PKGNAME; + char *value1 = "0830_0831_FW_delta.tar"; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = DM_FUMO_VERSION; + char *value2 = "M.I9200XXKC1-P.I13-"; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path3 = DM_FUMO_DOWNLOAD; + char *value3 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path4 = DM_FUMO_DWONLOAD_PKGURL; + char *value4 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = DM_FUMO_UPDATE; + char *value5 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path6 =DM_FUMO_UPDATE_PKG_DATA; + char *value6 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path7 =DM_FUMO_DOWNLOADAND_UPDATE; + char *value7 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path8 =DM_FUMO_DOWNLOADAND_UPDATE_PKGURL; + char *value8 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path9 =DM_FUMO_STATE; + char *value9 = "10"; + sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path10 =DM_FUMO_EXT; + char *value10 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property); + add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property); + add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property); + + _DEBUG_INFO( " end!!\n"); +} + void lawmo_define() { + + _DEBUG_INFO( " start!!\n"); + + sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_LAWMO; + + char *mo_full_path0 = DM_LAWMO; + char *value0 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path1 = DM_LAWMO_STATE; + char *value1 = "30"; + sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path2 = DM_LAWMO_AVAILABLEWIPELIST; + char *value2 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path3 = DM_LAWMO_AVAILABLEWIPELIST_x1; + char *value3 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path4 = DM_LAWMO_AVAILABLEWIPELIST_x1_LISTITEMNAME; + char *value4 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path5 = DM_LAWMO_AVAILABLEWIPELIST_x1_TOBEWIPED; + char *value5 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path6 =DM_LAWMO_LAWMOCONFIG; + char *value6 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path7 =DM_LAWMO_LAWMOCONFIG_NOFITYUSER; + char *value7 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path8 =DM_LAWMO_OPERATIONS; + char *value8 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + char *mo_full_path9 =DM_LAWMO_OPERATIONS_FULLYLOCK; + char *value9 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path10 =DM_LAWMO_OPERATIONS_PARTIALLYLOCK; + char *value10 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path11 =DM_LAWMO_OPERATIONS_UNLOCK; + char *value11 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path12 =DM_LAWMO_OPERATIONS_FACTORYRESET; + char *value12 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path13 =DM_LAWMO_OPERATIONS_WIPE; + char *value13 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_LEAF; + + char *mo_full_path14 =DM_LAWMO_EXT; + char *value14 = NULL; + sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_INTERIOR; + + sync_agent_dm_mo_framework_property_s *framework_property = NULL; + sync_agent_dm_mo_runtime_property_s *runtime_property = NULL; + + _DEBUG_INFO( " add start!!\n"); + + add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property); + add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property); + add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property); + add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property); + add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property); + add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property); + add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property); + add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property); + add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property); + add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property); + add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property); + add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property); + add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property); + add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property); + add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property); + + _DEBUG_INFO( " end!!\n"); +} + +*/ + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /* mo common inteface */ + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void free_dm_acc(dm_acc * dmaccount) +{ + _EXTERN_FUNC_ENTER; + + if (dmaccount == NULL) + return; + + if (dmaccount->server_url != NULL) { + free(dmaccount->server_url); + dmaccount->server_url = NULL; + } + if (dmaccount->server_id != NULL) { + free(dmaccount->server_id); + dmaccount->server_id = NULL; + } + if (dmaccount->server_pw != NULL) { + free(dmaccount->server_pw); + dmaccount->server_pw = NULL; + } + if (dmaccount->server_auth_type != NULL) { + free(dmaccount->server_auth_type); + dmaccount->server_auth_type = NULL; + } + if (dmaccount->user_id != NULL) { + free(dmaccount->user_id); + dmaccount->user_id = NULL; + } + if (dmaccount->user_pw != NULL) { + free(dmaccount->user_pw); + dmaccount->user_pw = NULL; + } + if (dmaccount->user_auth_type != NULL) { + free(dmaccount->user_auth_type); + dmaccount->user_auth_type = NULL; + } + if (dmaccount->user_nextNonce != NULL) { + free(dmaccount->user_nextNonce); + dmaccount->user_nextNonce = NULL; + } + if (dmaccount->server_nextNonce != NULL) { + free(dmaccount->server_nextNonce); + dmaccount->server_nextNonce = NULL; + } + + free(dmaccount); + dmaccount = NULL; + + _EXTERN_FUNC_EXIT; +} + +DM_ERROR get_client_dmacc(char *pServer_id, char **client_id, char **client_pwd, char **sourceUrl, char **targetUrl, int *isBase64, char **nextNonce, char **authType) +{ + + _EXTERN_FUNC_ENTER; + + DM_ERROR ret = DM_OK; + sync_agent_dev_return_e err; + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_acc_info_s *acc_info = NULL; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT; + sync_agent_mo_acc_info_item.serverid = pServer_id; + + err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info); + //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) { + _DEBUG_INFO(" acc null!!\n"); + ret = COMMON_ERR_IS_NULL; + goto error; + } + + _DEBUG_INFO(" id = %s\n", acc_info->auth_name); + _DEBUG_INFO(" pwd = %s\n", acc_info->auth_secret); +/* _DEBUG_INFO( " Session_id = %s\n", pSession_id);*/ + _DEBUG_INFO(" serverUrl = %s\n", acc_info->addr); + _DEBUG_INFO(" nextNonce = %s\n", acc_info->auth_data); + + if ((acc_info->auth_name) == NULL || (acc_info->auth_secret) == NULL || (acc_info->addr) == NULL) { + ret = COMMON_ERR_IS_NULL; + goto error; + } + + (*client_id) = strdup(acc_info->auth_name); + (*client_pwd) = strdup(acc_info->auth_secret); + (*targetUrl) = strdup(acc_info->addr); + if (acc_info->auth_data != NULL) { + str_free(nextNonce); + (*nextNonce) = strdup(acc_info->auth_data); + } + //(*sourceUrl) = strdup("IMEI:004401055493403"); + if (acc_info->auth_type != NULL) + (*authType) = strdup(acc_info->auth_type); + + err = sync_agent_get_devinfo(2, "DevID", sourceUrl); + _DEBUG_INFO(" sourceUrl = %s\n", (*sourceUrl)); + + *isBase64 = 1; + + sync_agent_free_mo_acc_item(&acc_info); + _EXTERN_FUNC_EXIT; + return ret; + error: + ret = COMMON_ERR_MO_NOT_FOUND_IN_DB; + sync_agent_free_mo_acc_item(&acc_info); + _DEBUG_INFO(" end!! error : %d\n", ret); + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR get_server_dmacc(char *pServer_id, char **server_id, char **server_pwd, char **sourceUrl, char **targetUrl, int *isBase64, char **nextNonce, char **authType) +{ + _EXTERN_FUNC_ENTER; + + retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!"); + + DM_ERROR ret = DM_OK; + sync_agent_dev_return_e err; + + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_acc_info_s *acc_info = NULL; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER; + sync_agent_mo_acc_info_item.serverid = pServer_id; + + err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info); + //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) { + _DEBUG_INFO(" acc null!!\n"); + ret = COMMON_ERR_IS_NULL; + goto error; + } + + _DEBUG_INFO(" id = %s\n", acc_info->auth_name); + _DEBUG_INFO(" pwd = %s\n", acc_info->auth_secret); +/* _DEBUG_INFO( " Session_id = %s\n", pSession_id);*/ + _DEBUG_INFO(" serverUrl = %s\n", acc_info->addr); + _DEBUG_INFO(" nextNonce = %s\n", acc_info->auth_data); + + if ((acc_info->auth_name) == NULL || (acc_info->auth_secret) == NULL || (acc_info->addr) == NULL) { + ret = COMMON_ERR_IS_NULL; + goto error; + } + + (*server_id) = strdup(acc_info->auth_name); + (*server_pwd) = strdup(acc_info->auth_secret); + (*targetUrl) = strdup(acc_info->addr); + if (acc_info->auth_data != NULL) + (*nextNonce) = strdup(acc_info->auth_data); + //(*sourceUrl) = strdup("IMEI:004401055493403"); + if (acc_info->auth_type != NULL) + (*authType) = strdup(acc_info->auth_type); + + err = sync_agent_get_devinfo(2, "DevID", sourceUrl); + _DEBUG_INFO(" sourceUrl = %s\n", (*sourceUrl)); + + *isBase64 = 1; + // temp test code + + sync_agent_free_mo_acc_item(&acc_info); + + _EXTERN_FUNC_EXIT; + return ret; + + error: + sync_agent_free_mo_acc_item(&acc_info); + ret = COMMON_ERR_MO_NOT_FOUND_IN_DB; + _EXTERN_FUNC_EXIT; + return ret; +} + +int update_dmacc(char *pServer_id, dm_acc * dmaccount) +{ + _EXTERN_FUNC_ENTER; + int ret = 1; + + retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!"); + + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_acc_info_s *acc_info_c = NULL; + sync_agent_dm_acc_info_s *acc_info_s = NULL; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_open_mo(); + err_code = sync_agent_begin_transaction_mo(); + _DEBUG_INFO("transanction begin : %d", err_code); + + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT; + sync_agent_mo_acc_info_item.serverid = pServer_id; + + err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info_c); + //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info_c == NULL) { + _DEBUG_INFO(" acc null!!\n"); + ret = COMMON_ERR_IS_NULL; + goto error; + } + + _DEBUG_INFO("user id = %s\n", dmaccount->user_id); + _DEBUG_INFO("user pwd = %s\n", dmaccount->user_pw); + _DEBUG_INFO("user auth type = %s\n", dmaccount->user_auth_type); + _DEBUG_INFO("user nextNonce = %s\n", dmaccount->user_nextNonce); + + //if ((acc_info_c->auth_name) == NULL || (acc_info_c->auth_secret) == NULL || (acc_info_c->addr) == NULL) { + if ( (acc_info_c->addr) == NULL) { + ret = 0; + goto error; + } + if (dmaccount->user_id != NULL) { + if(acc_info_c->auth_name != NULL) { + str_free(&(acc_info_c->auth_name)); + } + acc_info_c->auth_name = strdup(dmaccount->user_id); + } + if (dmaccount->user_pw != NULL) { + if(acc_info_c->auth_secret != NULL) { + str_free(&(acc_info_c->auth_secret)); + } + acc_info_c->auth_secret = strdup(dmaccount->user_pw); + } + if (dmaccount->user_auth_type != NULL) { + str_free(&(acc_info_c->auth_type)); + acc_info_c->auth_type = strdup(dmaccount->user_auth_type); + } else { + if (acc_info_c->auth_type != NULL) { + //do nothing + } else { + acc_info_c->auth_type = strdup("DIGEST"); + } + } + + if (dmaccount->user_nextNonce != NULL) { + str_free(&(acc_info_c->auth_data)); + acc_info_c->auth_data = strdup(dmaccount->user_nextNonce); + } + //acc_info_c->auth_level = dmaccount->base64; + err_code = sync_agent_update_mo_acc_item(&sync_agent_mo_acc_info_item, acc_info_c); + //err_code = sync_agent_set_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT, acc_info_c); + _DEBUG_INFO("sync agent update result : %d", err_code); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + ret = COMMON_ERR_IS_NULL; + goto error; + } + _DEBUG_INFO("set client account result : %d", err_code); + +/*************************************************************************************/ + + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER; + sync_agent_mo_acc_info_item.serverid = pServer_id; + + err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info_s); + //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info_s == NULL) { + _DEBUG_INFO(" acc null!!\n"); + ret = COMMON_ERR_IS_NULL; + goto error; + } + + _DEBUG_INFO("server id = %s\n", dmaccount->server_url); + _DEBUG_INFO("server id = %s\n", dmaccount->server_id); + _DEBUG_INFO("sever pwd = %s\n", dmaccount->server_pw); + _DEBUG_INFO("server auth type = %s\n", dmaccount->server_auth_type); + _DEBUG_INFO("server nextNonce = %s\n", dmaccount->server_nextNonce); + + //if ((acc_info_s->auth_name) == NULL || (acc_info_s->auth_secret) == NULL || (acc_info_s->addr) == NULL) { + if ((acc_info_s->auth_name) == NULL || (acc_info_s->addr) == NULL) { + ret = 0; + goto error; + } + + if (dmaccount->server_url != NULL) { + str_free(&(acc_info_s->addr)); + acc_info_s->addr = strdup(dmaccount->server_url); + } + if (dmaccount->server_id != NULL) { + str_free(&(acc_info_s->auth_name)); + acc_info_s->auth_name = strdup(dmaccount->server_id); + } + if (dmaccount->server_pw != NULL) { + if(acc_info_s->auth_secret != NULL) { + str_free(&(acc_info_s->auth_secret)); + } + acc_info_s->auth_secret = strdup(dmaccount->server_pw); + } + if (dmaccount->server_auth_type != NULL) { + str_free(&(acc_info_s->auth_type)); + acc_info_s->auth_type = strdup(dmaccount->server_auth_type); + } + if (dmaccount->server_nextNonce != NULL) { + str_free(&(acc_info_s->auth_data)); + acc_info_s->auth_data = strdup(dmaccount->server_nextNonce); + } + //acc_info_s->auth_level = dmaccount->base64; + err_code = sync_agent_update_mo_acc_item(&sync_agent_mo_acc_info_item, acc_info_s); + //err_code = sync_agent_set_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_SERVER, acc_info_s); + _DEBUG_INFO("set server account result : %d", err_code); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + ret = COMMON_ERR_IS_NULL; + goto error; + } + + /*************************************************************************************/ + + err_code = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_COMMIT); + _DEBUG_INFO("transanction commit : %d", err_code); + sync_agent_close_mo(); + + err_code = sync_agent_free_mo_acc_item(&acc_info_c); + _DEBUG_INFO("free mo acc result : %d", err_code); + + err_code = sync_agent_free_mo_acc_item(&acc_info_s); + _DEBUG_INFO("free mo acc result : %d", err_code); + + _EXTERN_FUNC_EXIT; + return ret; + + error: + err_code = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_ROLLBACK); + _DEBUG_INFO("transanction rollback : %d", err_code); + sync_agent_close_mo(); + + err_code = sync_agent_free_mo_acc_item(&acc_info_c); + _DEBUG_INFO("free mo acc result : %d", err_code); + + err_code = sync_agent_free_mo_acc_item(&acc_info_s); + _DEBUG_INFO("free mo acc result : %d", err_code); + + _DEBUG_INFO(" end!! error : %d\n", ret); + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR get_dmacc_authType(char *pServer_id, AuthType * pAuthType) +{ + _EXTERN_FUNC_ENTER; + DM_ERROR ret = DM_OK; + + retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!"); + + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_acc_info_s *acc_info = NULL; + sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item; + + sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT; + sync_agent_mo_acc_info_item.serverid = pServer_id; + + err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info); + //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) { + _DEBUG_INFO(" acc null!!\n"); + ret = COMMON_ERR_IS_NULL; + goto error; + } + + *pAuthType = __get_Session_AuthType_enum(acc_info->auth_type); + + _DEBUG_INFO(" end!! auth type : %d\n", *pAuthType); + + sync_agent_free_mo_acc_item(&acc_info); + + _EXTERN_FUNC_EXIT; + return ret; + error: + + ret = COMMON_ERR_MO_NOT_FOUND_IN_DB; + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR get_format(sync_agent_dm_mo_format_e format_enum, char **format) +{ + _EXTERN_FUNC_ENTER; + DM_ERROR ret = DM_OK; + + switch (format_enum) { + case SYNC_AGENT_DM_MO_FORMAT_NO_SET: + (*format) = strdup(ELEMENT_NULL); + break; + case SYNC_AGENT_DM_MO_FORMAT_B64: + (*format) = strdup(ELEMENT_B64); + break; + case SYNC_AGENT_DM_MO_FORMAT_BIN: + (*format) = strdup(ELEMENT_BIN); + break; + case SYNC_AGENT_DM_MO_FORMAT_BOOL: + (*format) = strdup(ELEMENT_BOOL); + break; + case SYNC_AGENT_DM_MO_FORMAT_CHR: + (*format) = strdup(ELEMENT_CHR); + break; + case SYNC_AGENT_DM_MO_FORMAT_INT: + (*format) = strdup(ELEMENT_INT); + break; + case SYNC_AGENT_DM_MO_FORMAT_NODE: + (*format) = strdup(ELEMENT_NODE); + break; + case SYNC_AGENT_DM_MO_FORMAT_NULL: + (*format) = strdup(ELEMENT_NULL); + break; + case SYNC_AGENT_DM_MO_FORMAT_XML: + (*format) = strdup(ELEMENT_XML); + break; + case SYNC_AGENT_DM_MO_FORMAT_DATE: + (*format) = strdup(ELEMENT_DATE); + break; + case SYNC_AGENT_DM_MO_FORMAT_TIME: + (*format) = strdup(ELEMENT_TIME); + break; + case SYNC_AGENT_DM_MO_FORMAT_FLOAT: + (*format) = strdup(ELEMENT_FLOAT); + break; + default: + break; + } + + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR get_format_enum(char *format, sync_agent_dm_mo_format_e * format_enum) +{ + _EXTERN_FUNC_ENTER; + DM_ERROR ret = DM_OK; + + retvm_if((format) == NULL, COMMON_ERR_IS_NULL, "format is NULL!!"); + + if (!strcmp(format, ELEMENT_NULL)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NO_SET; + } else if (!strcmp(format, ELEMENT_B64)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_B64; + } else if (!strcmp(format, ELEMENT_BIN)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_BIN; + } else if (!strcmp(format, ELEMENT_BOOL)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_BOOL; + } else if (!strcmp(format, ELEMENT_CHR)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_CHR; + } else if (!strcmp(format, ELEMENT_INT)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_INT; + } else if (!strcmp(format, ELEMENT_NODE)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NODE; + } else if (!strcmp(format, ELEMENT_NULL)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NULL; + } else if (!strcmp(format, ELEMENT_XML)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_XML; + } else if (!strcmp(format, ELEMENT_DATE)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_DATE; + } else if (!strcmp(format, ELEMENT_TIME)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_TIME; + } else if (!strcmp(format, ELEMENT_FLOAT)) { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_FLOAT; + } else { + (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NULL; + } + + _EXTERN_FUNC_EXIT; + return ret; +} + +/* + +DM_ERROR get_contenttype(sync_agent_dm_mo_df_type_e contenttype_enum, char** contenttype) +{ + _DEBUG_INFO( " start!!\n"); + DM_ERROR ret; + + switch(contenttype_enum){ + case SYNC_AGENT_DM_MO_DF_TYPE_NO_SET: + //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value ); + break; + case SYNC_AGENT_DM_MO_DF_TYPE_MIME: + //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value ); + break; + case SYNC_AGENT_DM_MO_DF_TYPE_DDFNAME: + //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value ); + break; + default: + break; + } + + _DEBUG_INFO( " end!!\n"); +} +*/ + +void reset_dmacc_mscserver() +{ + _EXTERN_FUNC_ENTER; + + sync_agent_open_mo(); + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + + int is_exist = 0; + + err_code = sync_agent_is_exist_mo(DM_DMACC_MSCSERVER, &is_exist); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("exist mo error : %d", err_code); + _EXTERN_FUNC_EXIT; + return; + } + + if (is_exist != 1) { + _DEBUG_INFO("dm acc not exist"); + _EXTERN_FUNC_EXIT; + return; + } + + err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 5, DM_DMACC_MSCSERVER); + _DEBUG_INFO(" end!!: err_code : %d", err_code); + sync_agent_close_mo(); + + _EXTERN_FUNC_EXIT; + +} + +void reset_dmacc_msctestserver() +{ + _EXTERN_FUNC_ENTER; + + sync_agent_open_mo(); + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + int is_exist = 0; + + err_code = sync_agent_is_exist_mo(DM_DMACC_MSCTESTSERVER, &is_exist); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("exist mo error : %d", err_code); + _EXTERN_FUNC_EXIT; + return; + } + + if (is_exist != 1) { + _DEBUG_INFO("dm acc not exist"); + _EXTERN_FUNC_EXIT; + return; + } + + err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 6, DM_DMACC_MSCTESTSERVER); + _DEBUG_INFO(" end!!: err_code : %d", err_code); + sync_agent_close_mo(); + + _EXTERN_FUNC_EXIT; +} + +void reset_dmacc_gcf() +{ + _EXTERN_FUNC_ENTER; + + sync_agent_open_mo(); + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + + int is_exist = 0; + + err_code = sync_agent_is_exist_mo(DM_DMACC_GCF, &is_exist); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("exist mo error : %d", err_code); + _EXTERN_FUNC_EXIT; + return; + } + + if (is_exist != 1) { + _DEBUG_INFO("dm acc not exist"); + _EXTERN_FUNC_EXIT; + return; + } + + err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 4, DM_DMACC_GCF); + _DEBUG_INFO(" end!!: err_code : %d", err_code); + sync_agent_close_mo(); + + _EXTERN_FUNC_EXIT; +} + +void reset_devinfo() +{ + _EXTERN_FUNC_ENTER; + + sync_agent_dm_mo_error_e err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DEVINFO, 2, DM_DEVINFO); + _DEBUG_INFO(" end!!: err_code : %d", err_code); + + _EXTERN_FUNC_EXIT; +} + +void reset_devdetail() +{ + _EXTERN_FUNC_ENTER; + + sync_agent_dm_mo_error_e err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DEVDETAIL, 1, DM_DEVDETAIL); + _DEBUG_INFO(" end!! : err_code : %d", err_code); + + _EXTERN_FUNC_EXIT; +} + +DM_ERROR get_mo_root_path(const char *mo_full_path, char **root_path) +{ + _EXTERN_FUNC_ENTER; + + DM_ERROR ret = DM_OK; + char *temp_root = NULL; + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + + retvm_if((mo_full_path) == NULL, COMMON_ERR_IS_NULL, "mo_full_path is NULL!!"); + + err_code = sync_agent_get_root_path(mo_full_path, &temp_root); + _DEBUG_INFO("get root path : %d", err_code); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + _EXTERN_FUNC_EXIT; + return COMMON_ERR_IS_NULL; + } + + _DEBUG_INFO("get root path : %s", temp_root); + + if (temp_root != NULL) { + (*root_path) = strdup(temp_root); + _DEBUG_INFO(" root : %s\n", (*root_path)); + } + _DEBUG_INFO(" root : %s\n", temp_root); + /*root_size = strlen(temp_root) - 2 ; + memcpy( (*root_path), temp_root + 2, root_size); */ + + if ((*root_path) == NULL) { + ret = COMMON_ERR_INTERNAL_NOT_DEFINED; + goto error; + } + + _EXTERN_FUNC_EXIT; + return ret; + + error: + _DEBUG_INFO(" end!! error : %d\n", ret); + _EXTERN_FUNC_EXIT; + return ret; + +} + +SERVICE_SERVER_TYPE get_engine_type_by_serverid(const char *server_id) +{ + _EXTERN_FUNC_ENTER; + + retvm_if((server_id) == NULL, COMMON_ERR_IS_NULL, "server_id is NULL!!"); + + sync_agent_open_mo(); + SERVICE_SERVER_TYPE engine_type = NO_ENGINE_TYPE; + SERVICE_SERVER_TYPE service_engine_type = NO_ENGINE_TYPE; + + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + err_code = sync_agent_get_server_type(server_id, (int *)(&service_engine_type)); + _DEBUG_INFO("get server type result : %d", err_code); + _DEBUG_INFO("service engine type : %d", service_engine_type); + if (service_engine_type != NO_ENGINE_TYPE) { + //todo change & operation + if ((service_engine_type & SAMSUNG_FUMO_TYPE) == SAMSUNG_FUMO_TYPE) { + engine_type = SAMSUNG_FUMO_TYPE; + _DEBUG_INFO("FUMO SERVICE"); + } else if ((service_engine_type & SAMSUNG_FMM_TYPE) == SAMSUNG_FMM_TYPE) { + engine_type = SAMSUNG_FMM_TYPE; + _DEBUG_INFO("LAWMO SERVICE"); + } else if ((service_engine_type & GCF_TYPE) == GCF_TYPE) { + engine_type = GCF_TYPE; + _DEBUG_INFO("GCF_TYPE"); + } + + _EXTERN_FUNC_EXIT; + return engine_type; + } else { + //error; + } + + sync_agent_close_mo(); + + _EXTERN_FUNC_EXIT; + return NO_ENGINE_TYPE; +} + +SERVICE_SERVER_TYPE get_service_type(const char *mo_full_path) +{ + //sync_agent_open_mo(); + _EXTERN_FUNC_ENTER; + + retvm_if((mo_full_path) == NULL, COMMON_ERR_IS_NULL, "mo_full_path is NULL!!"); + + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_mo_type_e engine_type; + err_code = sync_agent_get_mo_type(mo_full_path, &engine_type); + _DEBUG_INFO("get mo type result : %d", err_code); + + //sync_agent_close_mo(); + _EXTERN_FUNC_EXIT; + return engine_type; +} + +DM_ERROR get_Serverid(SERVICE_SERVER_TYPE mo_type, char **server_id) +{ + _EXTERN_FUNC_ENTER; + + sync_agent_open_mo(); + char *temp_server_id = 0; + sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS; + err_code = sync_agent_get_serverid(mo_type, &temp_server_id); + _DEBUG_INFO("get server id : %d", err_code); + if (err_code != SYNC_AGENT_DM_MO_SUCCESS) { + _EXTERN_FUNC_EXIT; + return COMMON_ERR_IS_NULL; + } + + _DEBUG_INFO("get server id : %s", temp_server_id); + + if (temp_server_id != NULL) { + (*server_id) = strdup(temp_server_id); + str_free(&temp_server_id); + } else { + _EXTERN_FUNC_EXIT; + return COMMON_ERR_IS_NULL; + } + + //sync_agent_close_mo(); + _EXTERN_FUNC_EXIT; + return DM_OK; +} + +DM_ERROR get_server_type(char *server_id, int *server_type) +{ + _EXTERN_FUNC_ENTER; + retvm_if((server_id) == NULL, COMMON_ERR_IS_NULL, "server id is NULL!!"); + + DM_ERROR ret = DM_OK; + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS; + sync_agent_dm_server_info_s *server_info = NULL; + sync_agent_dm_server_info_s *cursor_ptr = NULL; + + err = sync_agent_get_serverinfo(&server_info); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("get server info : %d", err); + return COMMON_ERR_IS_NULL; + } + + *server_type = SYNC_AGENT_DM_MO_TYPE_NO_TYPE; + cursor_ptr = server_info; + + _DEBUG_INFO("server_id : %s", server_id); + + while (cursor_ptr != NULL) { + _DEBUG_INFO("server_id list : %s", cursor_ptr->server_id); + _DEBUG_INFO("server_type list: %d", cursor_ptr->server_type); + + cursor_ptr = cursor_ptr->next; + } + + cursor_ptr = server_info; + while (cursor_ptr != NULL) { + _DEBUG_INFO("server_id : %s", cursor_ptr->server_id); + _DEBUG_INFO("server_type : %d", cursor_ptr->server_type); + + if (cursor_ptr->server_id != NULL) { + if (!strncmp(server_id, cursor_ptr->server_id, strlen(server_id))) { + _DEBUG_INFO("server_id : %s", server_id); + _DEBUG_INFO("same server type : %d", cursor_ptr->server_type); + *server_type = cursor_ptr->server_type; + + sync_agent_free_serverinfo(server_info); + _EXTERN_FUNC_EXIT; + return ret; + } else { + _DEBUG_INFO("not same server id"); + } + } + + cursor_ptr = cursor_ptr->next; + } + + sync_agent_free_serverinfo(server_info); + + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR add_dm_acc(SERVICE_SERVER_TYPE server_type) +{ + _EXTERN_FUNC_ENTER; + + DM_ERROR ret = DM_OK; + + ret = factory_bootstrap(server_type); + if (ret != DM_OK) { + _DEBUG_INFO("factory bootstrap fail : %d", ret); + } + + _EXTERN_FUNC_EXIT; + return ret; +} + +DM_ERROR remove_dm_acc(char *mo_path) +{ + _EXTERN_FUNC_ENTER; + DM_ERROR ret = DM_OK; + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_FAIL; + + err = sync_agent_delete_mo_tree_item(mo_path); + _DEBUG_INFO("delete dmacc mo %d", err); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("delete dmacc mo fail"); + ret = DM_ERR_BOOTSTRAP; + } + + _EXTERN_FUNC_EXIT; + + return ret; +} + +DM_ERROR is_exist_dmacc(SERVICE_SERVER_TYPE dmacc_type, int *is_exist) +{ + _EXTERN_FUNC_ENTER; + DM_ERROR ret = DM_OK; + sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_FAIL; + char *mo_path = NULL; + + switch (dmacc_type) { + case SAMSUNG_FUMO_TYPE: + mo_path = DM_DMACC_MSCTESTSERVER; + + break; + case SAMSUNG_FMM_TYPE: + mo_path = DM_DMACC_MSCSERVER; + + break; + case GCF_TYPE: + mo_path = DM_DMACC_GCF; + + break; + default: + break; + + } + + err = sync_agent_is_exist_mo(mo_path, is_exist); + if (err != SYNC_AGENT_DM_MO_SUCCESS) { + _DEBUG_INFO("exist dmacc mo fail %d", err); + ret = COMMON_ERR_NOT_FOUND; + } + _EXTERN_FUNC_EXIT; + + return ret; +} |