3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
24 #include <sync_agent.h>
27 #include "common/dm_common.h"
28 #include "common/util/util.h"
29 #include "serviceadapter/sa_session.h"
30 #include "serviceadapter/protocolbinder/syncml_def.h"
31 #include "serviceadapter/sa_elements_internal.h"
32 #include "mo-handler/dm_mo_common.h"
33 #include "mo-handler/dm_mo_handler.h"
34 #include "dm-engine/bootstrap/factory_bootstrap.h"
36 #ifndef OMADM_AGENT_LOG
38 #define LOG_TAG "MO_ENGINE"
41 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
42 /* mo test interface */
43 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
46 void dmacc_define_fumo() {
47 _DEBUG_INFO( " start!!\n");
49 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DMACC;
51 char *mo_full_path0 = FUMO_DM_ACC;
53 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
55 char *mo_full_path00 = FUMO_DM_ACC_FUMO;
57 sync_agent_dm_mo_node_type_e mo_node_type00 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
59 char *mo_full_path1 = FUMO_DM_ACC_APPID;
61 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
63 char *mo_full_path2 = FUMO_DM_ACC_SERVERID;
64 char *value2 = "x6g1q14r75";
65 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF;
67 char *mo_full_path3 = FUMO_DM_ACC_NAME;
68 char *value3 = "slp_msc_fumo";
69 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF;
71 char *mo_full_path4 = FUMO_DM_ACC_PRECONREF;
73 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
75 char *mo_full_path5 = FUMO_DM_ACC_TOCONREF;
77 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
79 char *mo_full_path6 =FUMO_DM_ACC_TOCONREF_X;
81 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
83 char *mo_full_path7 =FUMO_DM_ACC_TOCONREF_X_CONREF;
85 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
87 char *mo_full_path8 =FUMO_DM_ACC_APPADDR;
89 sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
91 char *mo_full_path9 =FUMO_DM_ACC_APPADDR_X;
93 sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
95 char *mo_full_path10 =FUMO_DM_ACC_APPADDR_X_ADDR;
96 char *value10 ="https://121.252.197.81:443/v1/device/magicsync/mdm";
97 sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF;
99 char *mo_full_path11 =FUMO_DM_ACC_APPADDR_X_ADDRTYPE;
100 char *value11 = "IPv4";
101 sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF;
103 char *mo_full_path12 =FUMO_DM_ACC_APPADDR_X_PORT;
104 char *value12 = NULL;
105 sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
107 char *mo_full_path13 =FUMO_DM_ACC_APPADDR_X_PORT_X;
108 char *value13 = NULL;
109 sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
111 char *mo_full_path14 =FUMO_DM_ACC_APPADDR_X_PORT_X_PORTNBR;
112 char *value14 ="443";
113 sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_LEAF;
115 char *mo_full_path15 =FUMO_DM_ACC_AAUTHPREF;
116 char *value15 = "DIGEST";
117 sync_agent_dm_mo_node_type_e mo_node_type15 = SYNC_AGENT_DM_MO_NODE_LEAF;
119 char *mo_full_path16 =FUMO_DM_ACC_APPAUTH;
121 sync_agent_dm_mo_node_type_e mo_node_type16 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
123 char *mo_full_path17 = FUMO_DM_ACC_APPAUTH_X1;
125 sync_agent_dm_mo_node_type_e mo_node_type17 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
127 char *mo_full_path18 = FUMO_DM_ACC_APPAUTH_X1_AAUTHLEVEL;
128 char *value18 ="CLCRED";
129 sync_agent_dm_mo_node_type_e mo_node_type18 = SYNC_AGENT_DM_MO_NODE_LEAF;
131 char *mo_full_path19 = FUMO_DM_ACC_APPAUTH_X1_AAUTHTYPE;
132 char *value19 ="DIGEST";
133 sync_agent_dm_mo_node_type_e mo_node_type19 = SYNC_AGENT_DM_MO_NODE_LEAF;
135 char *mo_full_path20 = FUMO_DM_ACC_APPAUTH_X1_AAUTHNAME;
138 sync_agent_get_devinfo(2, "DevID", &value20 );//"IMEI:004401055493403";
139 MO_NODE_TYPE mo_node_type20 = MO_NODE_LEAF;
141 char *mo_full_path21 = FUMO_DM_ACC_APPAUTH_X1_SECRET;
142 char *value21 = generate_Device_Password_temp( value20, value2);
143 sync_agent_dm_mo_node_type_e mo_node_type21 = SYNC_AGENT_DM_MO_NODE_LEAF;
145 char *mo_full_path22 = FUMO_DM_ACC_APPAUTH_X1_AAUTHDATA;
146 char *value22 = NULL;
147 sync_agent_dm_mo_node_type_e mo_node_type22 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
149 char *mo_full_path23 = FUMO_DM_ACC_APPAUTH_X2;
151 sync_agent_dm_mo_node_type_e mo_node_type23 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
153 char *mo_full_path24 = FUMO_DM_ACC_APPAUTH_X2_AAUTHLEVEL;
154 char *value24 ="SRVRED";
155 sync_agent_dm_mo_node_type_e mo_node_type24 = SYNC_AGENT_DM_MO_NODE_LEAF;
157 char *mo_full_path25 = FUMO_DM_ACC_APPAUTH_X2_AAUTHTYPE;
158 char *value25 ="DIGEST";
159 sync_agent_dm_mo_node_type_e mo_node_type25 = SYNC_AGENT_DM_MO_NODE_LEAF;
161 char *mo_full_path26 = FUMO_DM_ACC_APPAUTH_X2_AAUTHNAME;
162 char *value26 ="x6g1q14r75";
163 sync_agent_dm_mo_node_type_e mo_node_type26 = SYNC_AGENT_DM_MO_NODE_LEAF;
165 char *mo_full_path27 = FUMO_DM_ACC_APPAUTH_X2_SECRET;
166 char *value27 ="T1NQIERNIFNIcnZIcg==";
167 sync_agent_dm_mo_node_type_e mo_node_type27 = SYNC_AGENT_DM_MO_NODE_LEAF;
169 char *mo_full_path28 = FUMO_DM_ACC_APPAUTH_X2_AAUTHDATA;
170 char *value28 = NULL;
171 sync_agent_dm_mo_node_type_e mo_node_type28 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
173 char *mo_full_path29 = FUMO_DM_ACC_EXT;
175 sync_agent_dm_mo_node_type_e mo_node_type29 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
177 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
178 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
180 _DEBUG_INFO( " add start!!\n");
182 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
183 add_mo(type, mo_full_path00, value00, mo_node_type00, framework_property, runtime_property);
184 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
185 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
186 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
187 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
188 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
189 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
190 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
191 add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property);
192 add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property);
193 add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property);
194 add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property);
195 add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property);
196 add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property);
197 add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property);
198 add_mo(type, mo_full_path15, value15, mo_node_type15, framework_property, runtime_property);
199 add_mo(type, mo_full_path16, value16, mo_node_type16, framework_property, runtime_property);
200 add_mo(type, mo_full_path17, value17, mo_node_type17, framework_property, runtime_property);
201 add_mo(type, mo_full_path18, value18, mo_node_type18, framework_property, runtime_property);
202 add_mo(type, mo_full_path19, value19, mo_node_type19, framework_property, runtime_property);
203 add_mo(type, mo_full_path20, value20, mo_node_type20, framework_property, runtime_property);
204 add_mo(type, mo_full_path21, value21, mo_node_type21, framework_property, runtime_property);
205 add_mo(type, mo_full_path22, value22, mo_node_type22, framework_property, runtime_property);
206 add_mo(type, mo_full_path23, value23, mo_node_type23, framework_property, runtime_property);
207 add_mo(type, mo_full_path24, value24, mo_node_type24, framework_property, runtime_property);
208 add_mo(type, mo_full_path25, value25, mo_node_type25, framework_property, runtime_property);
209 add_mo(type, mo_full_path26, value26, mo_node_type26, framework_property, runtime_property);
210 add_mo(type, mo_full_path27, value27, mo_node_type27, framework_property, runtime_property);
211 add_mo(type, mo_full_path28, value28, mo_node_type28, framework_property, runtime_property);
212 add_mo(type, mo_full_path29, value29, mo_node_type29, framework_property, runtime_property);
214 _DEBUG_INFO( " end!!\n");
217 void dmacc_define_lawmo() {
218 _DEBUG_INFO( " start!!\n");
220 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DMACC;
222 char *mo_full_path0 = LAWMO_DM_ACC;
224 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
226 char *mo_full_path00 = LAWMO_DM_ACC_LAWMO;
227 char *value00 = NULL;
228 sync_agent_dm_mo_node_type_e mo_node_type00 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
230 char *mo_full_path1 = LAWMO_DM_ACC_APPID;
232 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
234 char *mo_full_path2 = LAWMO_DM_ACC_SERVERID;
235 char *value2 = "5e8o9279r2";
236 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF;
238 char *mo_full_path3 = LAWMO_DM_ACC_NAME;
239 char *value3 = "slp_msc_lawmo";
240 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF;
242 char *mo_full_path4 = LAWMO_DM_ACC_PRECONREF;
244 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
246 char *mo_full_path5 = LAWMO_DM_ACC_TOCONREF;
248 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
250 char *mo_full_path6 =LAWMO_DM_ACC_TOCONREF_X;
252 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
254 char *mo_full_path7 =LAWMO_DM_ACC_TOCONREF_X_CONREF;
256 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
258 char *mo_full_path8 =LAWMO_DM_ACC_APPADDR;
260 sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
262 char *mo_full_path9 =LAWMO_DM_ACC_APPADDR_X;
264 sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
266 char *mo_full_path10 =LAWMO_DM_ACC_APPADDR_X_ADDR;
267 char *value10 ="https://dm.samsungdive.com:443/v1/sdm/magicsync/dm";
268 sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF;
270 char *mo_full_path11 =LAWMO_DM_ACC_APPADDR_X_ADDRTYPE;
271 char *value11 = "IPv4";
272 sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF;
274 char *mo_full_path12 =LAWMO_DM_ACC_APPADDR_X_PORT;
275 char *value12 = NULL;
276 sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
278 char *mo_full_path13 =LAWMO_DM_ACC_APPADDR_X_PORT_X;
279 char *value13 = NULL;
280 sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
282 char *mo_full_path14 =LAWMO_DM_ACC_APPADDR_X_PORT_X_PORTNBR;
283 char *value14 ="443";
284 sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_LEAF;
286 char *mo_full_path15 =LAWMO_DM_ACC_AAUTHPREF;
287 char *value15 = "DIGEST";
288 sync_agent_dm_mo_node_type_e mo_node_type15 = SYNC_AGENT_DM_MO_NODE_LEAF;
290 char *mo_full_path16 =LAWMO_DM_ACC_APPAUTH;
292 sync_agent_dm_mo_node_type_e mo_node_type16 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
294 char *mo_full_path17 = LAWMO_DM_ACC_APPAUTH_X1;
296 sync_agent_dm_mo_node_type_e mo_node_type17 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
298 char *mo_full_path18 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHLEVEL;
299 char *value18 ="CLCRED";
300 sync_agent_dm_mo_node_type_e mo_node_type18 = SYNC_AGENT_DM_MO_NODE_LEAF;
302 char *mo_full_path19 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHTYPE;
303 char *value19 ="DIGEST";
304 sync_agent_dm_mo_node_type_e mo_node_type19 = SYNC_AGENT_DM_MO_NODE_LEAF;
306 char *mo_full_path20 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHNAME;
309 sync_agent_get_devinfo(2, "DevID", &value20 );//"IMEI:004401055493403";
310 sync_agent_dm_mo_node_type_e mo_node_type20 = SYNC_AGENT_DM_MO_NODE_LEAF;
312 char *mo_full_path21 = LAWMO_DM_ACC_APPAUTH_X1_SECRET;
313 char *value21 = generate_Device_Password_temp( value20, value2);
314 sync_agent_dm_mo_node_type_e mo_node_type21 = SYNC_AGENT_DM_MO_NODE_LEAF;
316 char *mo_full_path22 = LAWMO_DM_ACC_APPAUTH_X1_AAUTHDATA;
317 char *value22 = NULL;
318 sync_agent_dm_mo_node_type_e mo_node_type22 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
320 char *mo_full_path23 = LAWMO_DM_ACC_APPAUTH_X2;
322 sync_agent_dm_mo_node_type_e mo_node_type23 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
324 char *mo_full_path24 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHLEVEL;
325 char *value24 ="SRVRED";
326 sync_agent_dm_mo_node_type_e mo_node_type24 = SYNC_AGENT_DM_MO_NODE_LEAF;
328 char *mo_full_path25 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHTYPE;
329 char *value25 ="DIGEST";
330 sync_agent_dm_mo_node_type_e mo_node_type25 = SYNC_AGENT_DM_MO_NODE_LEAF;
332 char *mo_full_path26 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHNAME;
333 char *value26 ="5e8o9279r2";
334 sync_agent_dm_mo_node_type_e mo_node_type26 = SYNC_AGENT_DM_MO_NODE_LEAF;
336 char *mo_full_path27 = LAWMO_DM_ACC_APPAUTH_X2_SECRET;
337 char *value27 ="T1NQIERNIFNlcnZlcg==";
338 sync_agent_dm_mo_node_type_e mo_node_type27 = SYNC_AGENT_DM_MO_NODE_LEAF;
340 char *mo_full_path28 = LAWMO_DM_ACC_APPAUTH_X2_AAUTHDATA;
341 char *value28 = NULL;
342 sync_agent_dm_mo_node_type_e mo_node_type28 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
344 char *mo_full_path29 = LAWMO_DM_ACC_EXT;
346 sync_agent_dm_mo_node_type_e mo_node_type29 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
348 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
349 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
351 _DEBUG_INFO( " add start!!\n");
353 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
354 add_mo(type, mo_full_path00, value00, mo_node_type00, framework_property, runtime_property);
355 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
356 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
357 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
358 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
359 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
360 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
361 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
362 add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property);
363 add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property);
364 add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property);
365 add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property);
366 add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property);
367 add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property);
368 add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property);
369 add_mo(type, mo_full_path15, value15, mo_node_type15, framework_property, runtime_property);
370 add_mo(type, mo_full_path16, value16, mo_node_type16, framework_property, runtime_property);
371 add_mo(type, mo_full_path17, value17, mo_node_type17, framework_property, runtime_property);
372 add_mo(type, mo_full_path18, value18, mo_node_type18, framework_property, runtime_property);
373 add_mo(type, mo_full_path19, value19, mo_node_type19, framework_property, runtime_property);
374 add_mo(type, mo_full_path20, value20, mo_node_type20, framework_property, runtime_property);
375 add_mo(type, mo_full_path21, value21, mo_node_type21, framework_property, runtime_property);
376 add_mo(type, mo_full_path22, value22, mo_node_type22, framework_property, runtime_property);
377 add_mo(type, mo_full_path23, value23, mo_node_type23, framework_property, runtime_property);
378 add_mo(type, mo_full_path24, value24, mo_node_type24, framework_property, runtime_property);
379 add_mo(type, mo_full_path25, value25, mo_node_type25, framework_property, runtime_property);
380 add_mo(type, mo_full_path26, value26, mo_node_type26, framework_property, runtime_property);
381 add_mo(type, mo_full_path27, value27, mo_node_type27, framework_property, runtime_property);
382 add_mo(type, mo_full_path28, value28, mo_node_type28, framework_property, runtime_property);
383 add_mo(type, mo_full_path29, value29, mo_node_type29, framework_property, runtime_property);
385 _DEBUG_INFO( " end!!\n");
388 void devinfo_define() {
389 _DEBUG_INFO( " start!!\n");
391 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DEVINFO;
393 char *mo_full_path0 = DM_DEVINFO;
395 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
397 char *mo_full_path1 = DM_DEVINFO_BEARER;
399 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
401 char *mo_full_path2 = DM_DEVINFO_DEVID;
404 sync_agent_get_devinfo(2, "DevID", &value2 );//"IMEI:004401055493403";
405 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF;
407 char *mo_full_path3 = DM_DEVINFO_MAN;
408 char *value3 = "samsung-electronics";
409 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF;
411 char *mo_full_path4 = DM_DEVINFO_MOD;
412 char *value4 = "GT-I9500";
413 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
415 char *mo_full_path5 = DM_DEVINFO_DMV;
416 char *value5 = "1.2";
417 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF;
419 char *mo_full_path6 =DM_DEVINFO_LANG;
420 char *value6 = "en-us";
421 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF;
423 char *mo_full_path7 =DM_DEVINFO_EXT;
425 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
427 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
428 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
430 _DEBUG_INFO( " add start!!\n");
432 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
433 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
434 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
435 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
436 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
437 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
438 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
439 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
441 _DEBUG_INFO( " end!!\n");
443 void devdetail_define() {
444 _DEBUG_INFO( " start!!\n");
446 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_DEVDETAIL;
448 char *mo_full_path0 = DM_DEVDETAIL;
450 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
452 char *mo_full_path1 = DM_DEVDETAIL_BEARER;
454 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
456 char *mo_full_path2 = DM_DEVINFO_URI;
458 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF;
460 char *mo_full_path3 = DM_DEVINFO_URI_MAXDEPTH;
461 char *value3 = g_strdup_printf("%d",100);
462 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_LEAF;
464 char *mo_full_path4 = DM_DEVINFO_URI_MAXTOTLEN;
465 char *value4 = g_strdup_printf("%d",100);;
466 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
468 char *mo_full_path5 = DM_DEVINFO_URI_MAXSEGLEN;
469 char *value5 = g_strdup_printf("%d",100);;
470 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF;
472 char *mo_full_path6 =DM_DEVINFO_DEVTYP;
473 char *value6 = "Smart";
474 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF;
476 char *mo_full_path7 =DM_DEVINFO_OEM;
477 char *value7 = "null";
478 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_LEAF;
480 char *mo_full_path8 =DM_DEVINFO_FWV;
481 char *value8 = "M.I9200XXKC1-P.I13-";
482 sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_LEAF;
484 char *mo_full_path9 =DM_DEVINFO_SWV;
485 char *value9 = "M.I9200XXKC1-P.I13-";
486 sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF;
488 char *mo_full_path10 =DM_DEVINFO_HWV;
489 char *value10 ="GT-I9500";
490 sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF;
492 char *mo_full_path11 =DM_DEVINFO_LRGOBJ;
493 char *value11 = "IPv4";
494 sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF;
496 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
497 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
499 _DEBUG_INFO( " add start!!\n");
501 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
502 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
503 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
504 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
505 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
506 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
507 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
508 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
509 add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property);
510 add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property);
511 add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property);
512 add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property);
514 _DEBUG_INFO( " ed!!\n");
519 _DEBUG_INFO( " start!!\n");
521 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_FUMO;
523 char *mo_full_path0 = DM_FUMO;
525 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
527 char *mo_full_path1 = DM_FUMO_PKGNAME;
528 char *value1 = "0830_0831_FW_delta.tar";
529 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
531 char *mo_full_path2 = DM_FUMO_VERSION;
532 char *value2 = "M.I9200XXKC1-P.I13-";
533 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_LEAF;
535 char *mo_full_path3 = DM_FUMO_DOWNLOAD;
537 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
539 char *mo_full_path4 = DM_FUMO_DWONLOAD_PKGURL;
541 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
543 char *mo_full_path5 = DM_FUMO_UPDATE;
545 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
547 char *mo_full_path6 =DM_FUMO_UPDATE_PKG_DATA;
549 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_LEAF;
551 char *mo_full_path7 =DM_FUMO_DOWNLOADAND_UPDATE;
553 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
555 char *mo_full_path8 =DM_FUMO_DOWNLOADAND_UPDATE_PKGURL;
557 sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_LEAF;
559 char *mo_full_path9 =DM_FUMO_STATE;
561 sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF;
563 char *mo_full_path10 =DM_FUMO_EXT;
564 char *value10 = NULL;
565 sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
567 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
568 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
570 _DEBUG_INFO( " add start!!\n");
572 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
573 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
574 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
575 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
576 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
577 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
578 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
579 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
580 add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property);
581 add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property);
582 add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property);
584 _DEBUG_INFO( " end!!\n");
586 void lawmo_define() {
588 _DEBUG_INFO( " start!!\n");
590 sync_agent_dm_mo_type_e type = SYNC_AGENT_DM_MO_TYPE_LAWMO;
592 char *mo_full_path0 = DM_LAWMO;
594 sync_agent_dm_mo_node_type_e mo_node_type0 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
596 char *mo_full_path1 = DM_LAWMO_STATE;
598 sync_agent_dm_mo_node_type_e mo_node_type1 = SYNC_AGENT_DM_MO_NODE_LEAF;
600 char *mo_full_path2 = DM_LAWMO_AVAILABLEWIPELIST;
602 sync_agent_dm_mo_node_type_e mo_node_type2 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
604 char *mo_full_path3 = DM_LAWMO_AVAILABLEWIPELIST_x1;
606 sync_agent_dm_mo_node_type_e mo_node_type3 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
608 char *mo_full_path4 = DM_LAWMO_AVAILABLEWIPELIST_x1_LISTITEMNAME;
610 sync_agent_dm_mo_node_type_e mo_node_type4 = SYNC_AGENT_DM_MO_NODE_LEAF;
612 char *mo_full_path5 = DM_LAWMO_AVAILABLEWIPELIST_x1_TOBEWIPED;
614 sync_agent_dm_mo_node_type_e mo_node_type5 = SYNC_AGENT_DM_MO_NODE_LEAF;
616 char *mo_full_path6 =DM_LAWMO_LAWMOCONFIG;
618 sync_agent_dm_mo_node_type_e mo_node_type6 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
620 char *mo_full_path7 =DM_LAWMO_LAWMOCONFIG_NOFITYUSER;
622 sync_agent_dm_mo_node_type_e mo_node_type7 = SYNC_AGENT_DM_MO_NODE_LEAF;
624 char *mo_full_path8 =DM_LAWMO_OPERATIONS;
626 sync_agent_dm_mo_node_type_e mo_node_type8 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
628 char *mo_full_path9 =DM_LAWMO_OPERATIONS_FULLYLOCK;
630 sync_agent_dm_mo_node_type_e mo_node_type9 = SYNC_AGENT_DM_MO_NODE_LEAF;
632 char *mo_full_path10 =DM_LAWMO_OPERATIONS_PARTIALLYLOCK;
633 char *value10 = NULL;
634 sync_agent_dm_mo_node_type_e mo_node_type10 = SYNC_AGENT_DM_MO_NODE_LEAF;
636 char *mo_full_path11 =DM_LAWMO_OPERATIONS_UNLOCK;
637 char *value11 = NULL;
638 sync_agent_dm_mo_node_type_e mo_node_type11 = SYNC_AGENT_DM_MO_NODE_LEAF;
640 char *mo_full_path12 =DM_LAWMO_OPERATIONS_FACTORYRESET;
641 char *value12 = NULL;
642 sync_agent_dm_mo_node_type_e mo_node_type12 = SYNC_AGENT_DM_MO_NODE_LEAF;
644 char *mo_full_path13 =DM_LAWMO_OPERATIONS_WIPE;
645 char *value13 = NULL;
646 sync_agent_dm_mo_node_type_e mo_node_type13 = SYNC_AGENT_DM_MO_NODE_LEAF;
648 char *mo_full_path14 =DM_LAWMO_EXT;
649 char *value14 = NULL;
650 sync_agent_dm_mo_node_type_e mo_node_type14 = SYNC_AGENT_DM_MO_NODE_INTERIOR;
652 sync_agent_dm_mo_framework_property_s *framework_property = NULL;
653 sync_agent_dm_mo_runtime_property_s *runtime_property = NULL;
655 _DEBUG_INFO( " add start!!\n");
657 add_mo(type, mo_full_path0, value0, mo_node_type0, framework_property, runtime_property);
658 add_mo(type, mo_full_path1, value1, mo_node_type1, framework_property, runtime_property);
659 add_mo(type, mo_full_path2, value2, mo_node_type2, framework_property, runtime_property);
660 add_mo(type, mo_full_path3, value3, mo_node_type3, framework_property, runtime_property);
661 add_mo(type, mo_full_path4, value4, mo_node_type4, framework_property, runtime_property);
662 add_mo(type, mo_full_path5, value5, mo_node_type5, framework_property, runtime_property);
663 add_mo(type, mo_full_path6, value6, mo_node_type6, framework_property, runtime_property);
664 add_mo(type, mo_full_path7, value7, mo_node_type7, framework_property, runtime_property);
665 add_mo(type, mo_full_path8, value8, mo_node_type8, framework_property, runtime_property);
666 add_mo(type, mo_full_path9, value9, mo_node_type9, framework_property, runtime_property);
667 add_mo(type, mo_full_path10, value10, mo_node_type10, framework_property, runtime_property);
668 add_mo(type, mo_full_path11, value11, mo_node_type11, framework_property, runtime_property);
669 add_mo(type, mo_full_path12, value12, mo_node_type12, framework_property, runtime_property);
670 add_mo(type, mo_full_path13, value13, mo_node_type13, framework_property, runtime_property);
671 add_mo(type, mo_full_path14, value14, mo_node_type14, framework_property, runtime_property);
673 _DEBUG_INFO( " end!!\n");
678 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
679 /* mo common inteface */
680 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
682 void free_dm_acc(dm_acc * dmaccount)
686 if (dmaccount == NULL)
689 if (dmaccount->server_url != NULL) {
690 free(dmaccount->server_url);
691 dmaccount->server_url = NULL;
693 if (dmaccount->server_id != NULL) {
694 free(dmaccount->server_id);
695 dmaccount->server_id = NULL;
697 if (dmaccount->server_pw != NULL) {
698 free(dmaccount->server_pw);
699 dmaccount->server_pw = NULL;
701 if (dmaccount->server_auth_type != NULL) {
702 free(dmaccount->server_auth_type);
703 dmaccount->server_auth_type = NULL;
705 if (dmaccount->user_id != NULL) {
706 free(dmaccount->user_id);
707 dmaccount->user_id = NULL;
709 if (dmaccount->user_pw != NULL) {
710 free(dmaccount->user_pw);
711 dmaccount->user_pw = NULL;
713 if (dmaccount->user_auth_type != NULL) {
714 free(dmaccount->user_auth_type);
715 dmaccount->user_auth_type = NULL;
717 if (dmaccount->user_nextNonce != NULL) {
718 free(dmaccount->user_nextNonce);
719 dmaccount->user_nextNonce = NULL;
721 if (dmaccount->server_nextNonce != NULL) {
722 free(dmaccount->server_nextNonce);
723 dmaccount->server_nextNonce = NULL;
732 DM_ERROR get_client_dmacc(char *pServer_id, char **client_id, char **client_pwd, char **sourceUrl, char **targetUrl, int *isBase64, char **nextNonce, char **authType)
737 DM_ERROR ret = DM_OK;
738 sync_agent_dev_return_e err;
739 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
740 sync_agent_dm_acc_info_s *acc_info = NULL;
741 sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item;
743 sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT;
744 sync_agent_mo_acc_info_item.serverid = pServer_id;
746 err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info);
747 //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT);
748 if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) {
749 _DEBUG_INFO(" acc null!!\n");
750 ret = COMMON_ERR_IS_NULL;
754 _DEBUG_INFO(" id = %s\n", acc_info->auth_name);
755 _DEBUG_INFO(" pwd = %s\n", acc_info->auth_secret);
756 /* _DEBUG_INFO( " Session_id = %s\n", pSession_id);*/
757 _DEBUG_INFO(" serverUrl = %s\n", acc_info->addr);
758 _DEBUG_INFO(" nextNonce = %s\n", acc_info->auth_data);
760 if ((acc_info->auth_name) == NULL || (acc_info->auth_secret) == NULL || (acc_info->addr) == NULL) {
761 ret = COMMON_ERR_IS_NULL;
765 (*client_id) = strdup(acc_info->auth_name);
766 (*client_pwd) = strdup(acc_info->auth_secret);
767 (*targetUrl) = strdup(acc_info->addr);
768 if (acc_info->auth_data != NULL) {
770 (*nextNonce) = strdup(acc_info->auth_data);
772 //(*sourceUrl) = strdup("IMEI:004401055493403");
773 if (acc_info->auth_type != NULL)
774 (*authType) = strdup(acc_info->auth_type);
776 err = sync_agent_get_devinfo(2, "DevID", sourceUrl);
777 _DEBUG_INFO(" sourceUrl = %s\n", (*sourceUrl));
781 sync_agent_free_mo_acc_item(&acc_info);
785 ret = COMMON_ERR_MO_NOT_FOUND_IN_DB;
786 sync_agent_free_mo_acc_item(&acc_info);
787 _DEBUG_INFO(" end!! error : %d\n", ret);
792 DM_ERROR get_server_dmacc(char *pServer_id, char **server_id, char **server_pwd, char **sourceUrl, char **targetUrl, int *isBase64, char **nextNonce, char **authType)
796 retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!");
798 DM_ERROR ret = DM_OK;
799 sync_agent_dev_return_e err;
801 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
802 sync_agent_dm_acc_info_s *acc_info = NULL;
803 sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item;
805 sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER;
806 sync_agent_mo_acc_info_item.serverid = pServer_id;
808 err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info);
809 //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT);
810 if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) {
811 _DEBUG_INFO(" acc null!!\n");
812 ret = COMMON_ERR_IS_NULL;
816 _DEBUG_INFO(" id = %s\n", acc_info->auth_name);
817 _DEBUG_INFO(" pwd = %s\n", acc_info->auth_secret);
818 /* _DEBUG_INFO( " Session_id = %s\n", pSession_id);*/
819 _DEBUG_INFO(" serverUrl = %s\n", acc_info->addr);
820 _DEBUG_INFO(" nextNonce = %s\n", acc_info->auth_data);
822 if ((acc_info->auth_name) == NULL || (acc_info->auth_secret) == NULL || (acc_info->addr) == NULL) {
823 ret = COMMON_ERR_IS_NULL;
827 (*server_id) = strdup(acc_info->auth_name);
828 (*server_pwd) = strdup(acc_info->auth_secret);
829 (*targetUrl) = strdup(acc_info->addr);
830 if (acc_info->auth_data != NULL)
831 (*nextNonce) = strdup(acc_info->auth_data);
832 //(*sourceUrl) = strdup("IMEI:004401055493403");
833 if (acc_info->auth_type != NULL)
834 (*authType) = strdup(acc_info->auth_type);
836 err = sync_agent_get_devinfo(2, "DevID", sourceUrl);
837 _DEBUG_INFO(" sourceUrl = %s\n", (*sourceUrl));
842 sync_agent_free_mo_acc_item(&acc_info);
848 sync_agent_free_mo_acc_item(&acc_info);
849 ret = COMMON_ERR_MO_NOT_FOUND_IN_DB;
854 int update_dmacc(char *pServer_id, dm_acc * dmaccount)
859 retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!");
861 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
862 sync_agent_dm_acc_info_s *acc_info_c = NULL;
863 sync_agent_dm_acc_info_s *acc_info_s = NULL;
864 sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item;
866 sync_agent_open_mo();
867 err_code = sync_agent_begin_transaction_mo();
868 _DEBUG_INFO("transanction begin : %d", err_code);
870 sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT;
871 sync_agent_mo_acc_info_item.serverid = pServer_id;
873 err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info_c);
874 //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT);
875 if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info_c == NULL) {
876 _DEBUG_INFO(" acc null!!\n");
877 ret = COMMON_ERR_IS_NULL;
881 _DEBUG_INFO("user id = %s\n", dmaccount->user_id);
882 _DEBUG_INFO("user pwd = %s\n", dmaccount->user_pw);
883 _DEBUG_INFO("user auth type = %s\n", dmaccount->user_auth_type);
884 _DEBUG_INFO("user nextNonce = %s\n", dmaccount->user_nextNonce);
886 //if ((acc_info_c->auth_name) == NULL || (acc_info_c->auth_secret) == NULL || (acc_info_c->addr) == NULL) {
887 if ( (acc_info_c->addr) == NULL) {
891 if (dmaccount->user_id != NULL) {
892 if(acc_info_c->auth_name != NULL) {
893 str_free(&(acc_info_c->auth_name));
895 acc_info_c->auth_name = strdup(dmaccount->user_id);
897 if (dmaccount->user_pw != NULL) {
898 if(acc_info_c->auth_secret != NULL) {
899 str_free(&(acc_info_c->auth_secret));
901 acc_info_c->auth_secret = strdup(dmaccount->user_pw);
903 if (dmaccount->user_auth_type != NULL) {
904 str_free(&(acc_info_c->auth_type));
905 acc_info_c->auth_type = strdup(dmaccount->user_auth_type);
907 if (acc_info_c->auth_type != NULL) {
910 acc_info_c->auth_type = strdup("DIGEST");
914 if (dmaccount->user_nextNonce != NULL) {
915 str_free(&(acc_info_c->auth_data));
916 acc_info_c->auth_data = strdup(dmaccount->user_nextNonce);
918 //acc_info_c->auth_level = dmaccount->base64;
919 err_code = sync_agent_update_mo_acc_item(&sync_agent_mo_acc_info_item, acc_info_c);
920 //err_code = sync_agent_set_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT, acc_info_c);
921 _DEBUG_INFO("sync agent update result : %d", err_code);
922 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
923 ret = COMMON_ERR_IS_NULL;
926 _DEBUG_INFO("set client account result : %d", err_code);
928 /*************************************************************************************/
930 sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_SERVER;
931 sync_agent_mo_acc_info_item.serverid = pServer_id;
933 err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info_s);
934 //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT);
935 if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info_s == NULL) {
936 _DEBUG_INFO(" acc null!!\n");
937 ret = COMMON_ERR_IS_NULL;
941 _DEBUG_INFO("server id = %s\n", dmaccount->server_url);
942 _DEBUG_INFO("server id = %s\n", dmaccount->server_id);
943 _DEBUG_INFO("sever pwd = %s\n", dmaccount->server_pw);
944 _DEBUG_INFO("server auth type = %s\n", dmaccount->server_auth_type);
945 _DEBUG_INFO("server nextNonce = %s\n", dmaccount->server_nextNonce);
947 //if ((acc_info_s->auth_name) == NULL || (acc_info_s->auth_secret) == NULL || (acc_info_s->addr) == NULL) {
948 if ((acc_info_s->auth_name) == NULL || (acc_info_s->addr) == NULL) {
953 if (dmaccount->server_url != NULL) {
954 str_free(&(acc_info_s->addr));
955 acc_info_s->addr = strdup(dmaccount->server_url);
957 if (dmaccount->server_id != NULL) {
958 str_free(&(acc_info_s->auth_name));
959 acc_info_s->auth_name = strdup(dmaccount->server_id);
961 if (dmaccount->server_pw != NULL) {
962 if(acc_info_s->auth_secret != NULL) {
963 str_free(&(acc_info_s->auth_secret));
965 acc_info_s->auth_secret = strdup(dmaccount->server_pw);
967 if (dmaccount->server_auth_type != NULL) {
968 str_free(&(acc_info_s->auth_type));
969 acc_info_s->auth_type = strdup(dmaccount->server_auth_type);
971 if (dmaccount->server_nextNonce != NULL) {
972 str_free(&(acc_info_s->auth_data));
973 acc_info_s->auth_data = strdup(dmaccount->server_nextNonce);
975 //acc_info_s->auth_level = dmaccount->base64;
976 err_code = sync_agent_update_mo_acc_item(&sync_agent_mo_acc_info_item, acc_info_s);
977 //err_code = sync_agent_set_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_SERVER, acc_info_s);
978 _DEBUG_INFO("set server account result : %d", err_code);
979 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
980 ret = COMMON_ERR_IS_NULL;
984 /*************************************************************************************/
986 err_code = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_COMMIT);
987 _DEBUG_INFO("transanction commit : %d", err_code);
988 sync_agent_close_mo();
990 err_code = sync_agent_free_mo_acc_item(&acc_info_c);
991 _DEBUG_INFO("free mo acc result : %d", err_code);
993 err_code = sync_agent_free_mo_acc_item(&acc_info_s);
994 _DEBUG_INFO("free mo acc result : %d", err_code);
1000 err_code = sync_agent_end_transaction_mo(SYNC_AGENT_DM_MO_TRANSACTION_ROLLBACK);
1001 _DEBUG_INFO("transanction rollback : %d", err_code);
1002 sync_agent_close_mo();
1004 err_code = sync_agent_free_mo_acc_item(&acc_info_c);
1005 _DEBUG_INFO("free mo acc result : %d", err_code);
1007 err_code = sync_agent_free_mo_acc_item(&acc_info_s);
1008 _DEBUG_INFO("free mo acc result : %d", err_code);
1010 _DEBUG_INFO(" end!! error : %d\n", ret);
1015 DM_ERROR get_dmacc_authType(char *pServer_id, AuthType * pAuthType)
1018 DM_ERROR ret = DM_OK;
1020 retvm_if((pServer_id) == NULL, COMMON_ERR_IS_NULL, "pServer_id is NULL!!");
1022 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1023 sync_agent_dm_acc_info_s *acc_info = NULL;
1024 sync_agent_dm_mo_acc_item_info_s sync_agent_mo_acc_info_item;
1026 sync_agent_mo_acc_info_item.acc_type = DEVICE_MANAGE_ACC_TYPE_CLIENT;
1027 sync_agent_mo_acc_info_item.serverid = pServer_id;
1029 err_code = sync_agent_get_mo_acc_item(&sync_agent_mo_acc_info_item, &acc_info);
1030 //acc_info = sync_agent_get_acc_info(pServer_id, DEVICE_MANAGE_ACC_TYPE_CLIENT);
1031 if (err_code != SYNC_AGENT_DM_MO_SUCCESS || acc_info == NULL) {
1032 _DEBUG_INFO(" acc null!!\n");
1033 ret = COMMON_ERR_IS_NULL;
1037 *pAuthType = __get_Session_AuthType_enum(acc_info->auth_type);
1039 _DEBUG_INFO(" end!! auth type : %d\n", *pAuthType);
1041 sync_agent_free_mo_acc_item(&acc_info);
1047 ret = COMMON_ERR_MO_NOT_FOUND_IN_DB;
1052 DM_ERROR get_format(sync_agent_dm_mo_format_e format_enum, char **format)
1055 DM_ERROR ret = DM_OK;
1057 switch (format_enum) {
1058 case SYNC_AGENT_DM_MO_FORMAT_NO_SET:
1059 (*format) = strdup(ELEMENT_NULL);
1061 case SYNC_AGENT_DM_MO_FORMAT_B64:
1062 (*format) = strdup(ELEMENT_B64);
1064 case SYNC_AGENT_DM_MO_FORMAT_BIN:
1065 (*format) = strdup(ELEMENT_BIN);
1067 case SYNC_AGENT_DM_MO_FORMAT_BOOL:
1068 (*format) = strdup(ELEMENT_BOOL);
1070 case SYNC_AGENT_DM_MO_FORMAT_CHR:
1071 (*format) = strdup(ELEMENT_CHR);
1073 case SYNC_AGENT_DM_MO_FORMAT_INT:
1074 (*format) = strdup(ELEMENT_INT);
1076 case SYNC_AGENT_DM_MO_FORMAT_NODE:
1077 (*format) = strdup(ELEMENT_NODE);
1079 case SYNC_AGENT_DM_MO_FORMAT_NULL:
1080 (*format) = strdup(ELEMENT_NULL);
1082 case SYNC_AGENT_DM_MO_FORMAT_XML:
1083 (*format) = strdup(ELEMENT_XML);
1085 case SYNC_AGENT_DM_MO_FORMAT_DATE:
1086 (*format) = strdup(ELEMENT_DATE);
1088 case SYNC_AGENT_DM_MO_FORMAT_TIME:
1089 (*format) = strdup(ELEMENT_TIME);
1091 case SYNC_AGENT_DM_MO_FORMAT_FLOAT:
1092 (*format) = strdup(ELEMENT_FLOAT);
1102 DM_ERROR get_format_enum(char *format, sync_agent_dm_mo_format_e * format_enum)
1105 DM_ERROR ret = DM_OK;
1107 retvm_if((format) == NULL, COMMON_ERR_IS_NULL, "format is NULL!!");
1109 if (!strcmp(format, ELEMENT_NULL)) {
1110 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NO_SET;
1111 } else if (!strcmp(format, ELEMENT_B64)) {
1112 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_B64;
1113 } else if (!strcmp(format, ELEMENT_BIN)) {
1114 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_BIN;
1115 } else if (!strcmp(format, ELEMENT_BOOL)) {
1116 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_BOOL;
1117 } else if (!strcmp(format, ELEMENT_CHR)) {
1118 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_CHR;
1119 } else if (!strcmp(format, ELEMENT_INT)) {
1120 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_INT;
1121 } else if (!strcmp(format, ELEMENT_NODE)) {
1122 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NODE;
1123 } else if (!strcmp(format, ELEMENT_NULL)) {
1124 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NULL;
1125 } else if (!strcmp(format, ELEMENT_XML)) {
1126 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_XML;
1127 } else if (!strcmp(format, ELEMENT_DATE)) {
1128 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_DATE;
1129 } else if (!strcmp(format, ELEMENT_TIME)) {
1130 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_TIME;
1131 } else if (!strcmp(format, ELEMENT_FLOAT)) {
1132 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_FLOAT;
1134 (*format_enum) = SYNC_AGENT_DM_MO_FORMAT_NULL;
1143 DM_ERROR get_contenttype(sync_agent_dm_mo_df_type_e contenttype_enum, char** contenttype)
1145 _DEBUG_INFO( " start!!\n");
1148 switch(contenttype_enum){
1149 case SYNC_AGENT_DM_MO_DF_TYPE_NO_SET:
1150 //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value );
1152 case SYNC_AGENT_DM_MO_DF_TYPE_MIME:
1153 //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value );
1155 case SYNC_AGENT_DM_MO_DF_TYPE_DDFNAME:
1156 //(*contenttype) = strdup( (*mo_node)->runtime_property->type_value );
1162 _DEBUG_INFO( " end!!\n");
1166 void reset_dmacc_mscserver()
1170 sync_agent_open_mo();
1171 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1175 err_code = sync_agent_is_exist_mo(DM_DMACC_MSCSERVER, &is_exist);
1176 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
1177 _DEBUG_INFO("exist mo error : %d", err_code);
1182 if (is_exist != 1) {
1183 _DEBUG_INFO("dm acc not exist");
1188 err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 5, DM_DMACC_MSCSERVER);
1189 _DEBUG_INFO(" end!!: err_code : %d", err_code);
1190 sync_agent_close_mo();
1196 void reset_dmacc_msctestserver()
1200 sync_agent_open_mo();
1201 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1204 err_code = sync_agent_is_exist_mo(DM_DMACC_MSCTESTSERVER, &is_exist);
1205 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
1206 _DEBUG_INFO("exist mo error : %d", err_code);
1211 if (is_exist != 1) {
1212 _DEBUG_INFO("dm acc not exist");
1217 err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 6, DM_DMACC_MSCTESTSERVER);
1218 _DEBUG_INFO(" end!!: err_code : %d", err_code);
1219 sync_agent_close_mo();
1224 void reset_dmacc_gcf()
1228 sync_agent_open_mo();
1229 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1233 err_code = sync_agent_is_exist_mo(DM_DMACC_GCF, &is_exist);
1234 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
1235 _DEBUG_INFO("exist mo error : %d", err_code);
1240 if (is_exist != 1) {
1241 _DEBUG_INFO("dm acc not exist");
1246 err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DMACC, 4, DM_DMACC_GCF);
1247 _DEBUG_INFO(" end!!: err_code : %d", err_code);
1248 sync_agent_close_mo();
1253 void reset_devinfo()
1257 sync_agent_dm_mo_error_e err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DEVINFO, 2, DM_DEVINFO);
1258 _DEBUG_INFO(" end!!: err_code : %d", err_code);
1263 void reset_devdetail()
1267 sync_agent_dm_mo_error_e err_code = sync_agent_uptodate_mo_table(SYNC_AGENT_DM_MO_TYPE_DEVDETAIL, 1, DM_DEVDETAIL);
1268 _DEBUG_INFO(" end!! : err_code : %d", err_code);
1273 DM_ERROR get_mo_root_path(const char *mo_full_path, char **root_path)
1277 DM_ERROR ret = DM_OK;
1278 char *temp_root = NULL;
1279 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1281 retvm_if((mo_full_path) == NULL, COMMON_ERR_IS_NULL, "mo_full_path is NULL!!");
1283 err_code = sync_agent_get_root_path(mo_full_path, &temp_root);
1284 _DEBUG_INFO("get root path : %d", err_code);
1285 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
1287 return COMMON_ERR_IS_NULL;
1290 _DEBUG_INFO("get root path : %s", temp_root);
1292 if (temp_root != NULL) {
1293 (*root_path) = strdup(temp_root);
1294 _DEBUG_INFO(" root : %s\n", (*root_path));
1296 _DEBUG_INFO(" root : %s\n", temp_root);
1297 /*root_size = strlen(temp_root) - 2 ;
1298 memcpy( (*root_path), temp_root + 2, root_size); */
1300 if ((*root_path) == NULL) {
1301 ret = COMMON_ERR_INTERNAL_NOT_DEFINED;
1309 _DEBUG_INFO(" end!! error : %d\n", ret);
1315 SERVICE_SERVER_TYPE get_engine_type_by_serverid(const char *server_id)
1319 retvm_if((server_id) == NULL, COMMON_ERR_IS_NULL, "server_id is NULL!!");
1321 sync_agent_open_mo();
1322 SERVICE_SERVER_TYPE engine_type = NO_ENGINE_TYPE;
1323 SERVICE_SERVER_TYPE service_engine_type = NO_ENGINE_TYPE;
1325 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1326 err_code = sync_agent_get_server_type(server_id, (int *)(&service_engine_type));
1327 _DEBUG_INFO("get server type result : %d", err_code);
1328 _DEBUG_INFO("service engine type : %d", service_engine_type);
1329 if (service_engine_type != NO_ENGINE_TYPE) {
1330 //todo change & operation
1331 if ((service_engine_type & SAMSUNG_FUMO_TYPE) == SAMSUNG_FUMO_TYPE) {
1332 engine_type = SAMSUNG_FUMO_TYPE;
1333 _DEBUG_INFO("FUMO SERVICE");
1334 } else if ((service_engine_type & SAMSUNG_FMM_TYPE) == SAMSUNG_FMM_TYPE) {
1335 engine_type = SAMSUNG_FMM_TYPE;
1336 _DEBUG_INFO("LAWMO SERVICE");
1337 } else if ((service_engine_type & GCF_TYPE) == GCF_TYPE) {
1338 engine_type = GCF_TYPE;
1339 _DEBUG_INFO("GCF_TYPE");
1348 sync_agent_close_mo();
1351 return NO_ENGINE_TYPE;
1354 SERVICE_SERVER_TYPE get_service_type(const char *mo_full_path)
1356 //sync_agent_open_mo();
1359 retvm_if((mo_full_path) == NULL, COMMON_ERR_IS_NULL, "mo_full_path is NULL!!");
1361 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1362 sync_agent_dm_mo_type_e engine_type;
1363 err_code = sync_agent_get_mo_type(mo_full_path, &engine_type);
1364 _DEBUG_INFO("get mo type result : %d", err_code);
1366 //sync_agent_close_mo();
1371 DM_ERROR get_Serverid(SERVICE_SERVER_TYPE mo_type, char **server_id)
1375 sync_agent_open_mo();
1376 char *temp_server_id = 0;
1377 sync_agent_dm_mo_error_e err_code = SYNC_AGENT_DM_MO_SUCCESS;
1378 err_code = sync_agent_get_serverid(mo_type, &temp_server_id);
1379 _DEBUG_INFO("get server id : %d", err_code);
1380 if (err_code != SYNC_AGENT_DM_MO_SUCCESS) {
1382 return COMMON_ERR_IS_NULL;
1385 _DEBUG_INFO("get server id : %s", temp_server_id);
1387 if (temp_server_id != NULL) {
1388 (*server_id) = strdup(temp_server_id);
1389 str_free(&temp_server_id);
1392 return COMMON_ERR_IS_NULL;
1395 //sync_agent_close_mo();
1400 DM_ERROR get_server_type(char *server_id, int *server_type)
1403 retvm_if((server_id) == NULL, COMMON_ERR_IS_NULL, "server id is NULL!!");
1405 DM_ERROR ret = DM_OK;
1406 sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
1407 sync_agent_dm_server_info_s *server_info = NULL;
1408 sync_agent_dm_server_info_s *cursor_ptr = NULL;
1410 err = sync_agent_get_serverinfo(&server_info);
1411 if (err != SYNC_AGENT_DM_MO_SUCCESS) {
1412 _DEBUG_INFO("get server info : %d", err);
1413 return COMMON_ERR_IS_NULL;
1416 *server_type = SYNC_AGENT_DM_MO_TYPE_NO_TYPE;
1417 cursor_ptr = server_info;
1419 _DEBUG_INFO("server_id : %s", server_id);
1421 while (cursor_ptr != NULL) {
1422 _DEBUG_INFO("server_id list : %s", cursor_ptr->server_id);
1423 _DEBUG_INFO("server_type list: %d", cursor_ptr->server_type);
1425 cursor_ptr = cursor_ptr->next;
1428 cursor_ptr = server_info;
1429 while (cursor_ptr != NULL) {
1430 _DEBUG_INFO("server_id : %s", cursor_ptr->server_id);
1431 _DEBUG_INFO("server_type : %d", cursor_ptr->server_type);
1433 if (cursor_ptr->server_id != NULL) {
1434 if (!strncmp(server_id, cursor_ptr->server_id, strlen(server_id))) {
1435 _DEBUG_INFO("server_id : %s", server_id);
1436 _DEBUG_INFO("same server type : %d", cursor_ptr->server_type);
1437 *server_type = cursor_ptr->server_type;
1439 sync_agent_free_serverinfo(server_info);
1443 _DEBUG_INFO("not same server id");
1447 cursor_ptr = cursor_ptr->next;
1450 sync_agent_free_serverinfo(server_info);
1456 DM_ERROR add_dm_acc(SERVICE_SERVER_TYPE server_type)
1460 DM_ERROR ret = DM_OK;
1462 ret = factory_bootstrap(server_type);
1464 _DEBUG_INFO("factory bootstrap fail : %d", ret);
1471 DM_ERROR remove_dm_acc(char *mo_path)
1474 DM_ERROR ret = DM_OK;
1475 sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_FAIL;
1477 err = sync_agent_delete_mo_tree_item(mo_path);
1478 _DEBUG_INFO("delete dmacc mo %d", err);
1479 if (err != SYNC_AGENT_DM_MO_SUCCESS) {
1480 _DEBUG_INFO("delete dmacc mo fail");
1481 ret = DM_ERR_BOOTSTRAP;
1489 DM_ERROR is_exist_dmacc(SERVICE_SERVER_TYPE dmacc_type, int *is_exist)
1492 DM_ERROR ret = DM_OK;
1493 sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_FAIL;
1494 char *mo_path = NULL;
1496 switch (dmacc_type) {
1497 case SAMSUNG_FUMO_TYPE:
1498 mo_path = DM_DMACC_MSCTESTSERVER;
1501 case SAMSUNG_FMM_TYPE:
1502 mo_path = DM_DMACC_MSCSERVER;
1506 mo_path = DM_DMACC_GCF;
1514 err = sync_agent_is_exist_mo(mo_path, is_exist);
1515 if (err != SYNC_AGENT_DM_MO_SUCCESS) {
1516 _DEBUG_INFO("exist dmacc mo fail %d", err);
1517 ret = COMMON_ERR_NOT_FOUND;