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.
20 #include <glib/gprintf.h>
23 #include <sync_agent.h>
26 #include "dm-engine/cp/dm_cp_struct.h"
27 #include "dm-engine/cp/dm_cp_parser.h"
28 #include "dm-engine/cp/dm_cp_processor.h"
29 #include "serviceadapter/protocolbinder/syncml_protocol_binder.h"
31 #ifndef OMADM_AGENT_LOG
33 #define LOG_TAG "OMA_DM_CP"
36 static String_Node *___get_Last_String_Node(String_Node * node);
37 static DM_CP_Bootstrap *__parse_Bootstrap(WBXMLTreeNode * wbxml_dom_node);
38 static DM_CP_Napdef *__parse_Napdef(WBXMLTreeNode * wbxml_dom_node);
39 static DM_CP_Application *__parse_Application(WBXMLTreeNode * wbxml_dom_node);
40 static DM_CP_PxLogical *__parse_PxLogical(WBXMLTreeNode * wbxml_dom_node);
41 static void ___set_Param(WBXMLTreeNode * wbxml_dom_node, char **set_value);
42 static sync_agent_pb_error_e _characteristic_start_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * pReverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * pContent);
44 const sync_agent_pb_function_info_s cp_binder_function_info[] = {
45 {TNDS_TAG_CHARACTERISTIC_START, "characteristic", NULL, _characteristic_start_reverse_converter_function, false},
48 DM_CP *parsing_cp_stream(CP_TYPE cp_type, const char *wbxml_stream, unsigned int msgSize)
52 retvm_if((wbxml_stream) == NULL, NULL, "wbxml_stream is NULL!!");
54 sync_agent_pb_protocol_binder_function_set_s *pBinder_function_set = NULL;
55 sync_agent_pb_error_e pb_error = sync_agent_init_binder_function_set(sizeof(cp_binder_function_info) / sizeof(sync_agent_pb_function_info_s),
56 (sync_agent_pb_function_info_s *) cp_binder_function_info, &pBinder_function_set);
58 if (pb_error != SYNC_AGENT_PB_RETURN_OK) {
59 _DEBUG_INFO("Failed to sync_agent_init_binder_function_set()");
65 * reverse protocol binder initialization
67 sync_agent_pb_protocol_e protocol = SYNC_AGENT_PB_PROTOCOL_PROV10;
68 sync_agent_pb_protocol_binder_reverse_info_s *pBinder = 0;
69 DM_CP *dm_cp = (DM_CP *) calloc(1, sizeof(DM_CP));
71 _DEBUG_INFO("alloc fail");
72 free_syncml_binder_function_set(pBinder_function_set);
79 pb_error = sync_agent_init_reverse_protocol_binder((char *)wbxml_stream, msgSize, SYNC_AGENT_PB_DECODING_WBXML, &protocol, pBinder_function_set, dm_cp, &pBinder);
82 pb_error = sync_agent_init_reverse_protocol_binder((char *)wbxml_stream, msgSize, SYNC_AGENT_PB_DECODING_XML, &protocol, pBinder_function_set, dm_cp, &pBinder);
90 if (pb_error != SYNC_AGENT_PB_RETURN_OK) {
91 _DEBUG_INFO("Failed to call sync_agent_init_reverse_protocol_binder() - [%d]", pb_error);
94 Protocol_Element protocol_element;
95 char *protocol_element_name = 0;
96 Content_Ptr content = 0;
99 pb_error = sync_agent_next_element(pBinder, &protocol_element, &protocol_element_name, &content);
101 if (pb_error == SYNC_AGENT_PB_RETURN_HAS_NO_MORE_ELEMENT) {
103 } else if (pb_error != SYNC_AGENT_PB_RETURN_OK) {
114 static sync_agent_pb_error_e _characteristic_start_reverse_converter_function(sync_agent_pb_protocol_binder_reverse_info_s * pReverse_binder, WBXMLTreeNode * wbxml_dom_node, Content_Ptr * pContent)
118 sync_agent_pb_error_e pb_error = SYNC_AGENT_PB_RETURN_OK;
120 retvm_if((pReverse_binder) == NULL, SYNC_AGENT_PB_RETURN_OUT_OF_MEMORY, "pReverse_binder is NULL!!");
121 retvm_if((wbxml_dom_node) == NULL, SYNC_AGENT_PB_RETURN_OUT_OF_MEMORY, "wbxml_dom_node is NULL!!");
123 void *user_data = sync_agent_get_user_data_from_reverse_protocol_binder(pReverse_binder);
124 DM_CP *dm_cp = (DM_CP *) user_data;
126 WBXMLList *attrs = wbxml_dom_node->attrs;
128 WB_ULONG nb_attrs = wbxml_list_len(attrs);
130 while (index < nb_attrs) {
131 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
133 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
134 if (WBXML_STRCMP("APPLICATION", wbxml_attribute_get_xml_value(attr)) == 0) {
135 DM_CP_Application *application = __parse_Application(wbxml_dom_node);
136 if (application == NULL) {
140 if (dm_cp->applications == NULL) {
141 dm_cp->applications = application;
143 DM_CP_Application *cursor_ptr = dm_cp->applications;
144 while (cursor_ptr != 0) {
145 if (cursor_ptr->next == NULL) {
146 cursor_ptr->next = application;
149 cursor_ptr = cursor_ptr->next;
152 } else if (WBXML_STRCMP("BOOTSTRAP", wbxml_attribute_get_xml_value(attr)) == 0) {
153 DM_CP_Bootstrap *bootstrap = __parse_Bootstrap(wbxml_dom_node);
154 if (bootstrap == NULL) {
158 if (dm_cp->bootstraps == NULL) {
159 dm_cp->bootstraps = bootstrap;
161 DM_CP_Bootstrap *cursor_ptr = dm_cp->bootstraps;
162 while (cursor_ptr != NULL) {
163 if (cursor_ptr->next == NULL) {
164 cursor_ptr->next = bootstrap;
167 cursor_ptr = cursor_ptr->next;
170 } else if (WBXML_STRCMP("NAPDEF", wbxml_attribute_get_xml_value(attr)) == 0) {
171 DM_CP_Napdef *napdef = __parse_Napdef(wbxml_dom_node);
172 if (napdef == NULL) {
176 if (dm_cp->napdefs == NULL) {
177 dm_cp->napdefs = napdef;
179 DM_CP_Napdef *cursor_ptr = dm_cp->napdefs;
180 while (cursor_ptr != NULL) {
181 if (cursor_ptr->next == NULL) {
182 cursor_ptr->next = napdef;
185 cursor_ptr = cursor_ptr->next;
188 } else if (WBXML_STRCMP("PXLOGICAL", wbxml_attribute_get_xml_value(attr)) == 0) {
189 DM_CP_PxLogical *pxLogical = __parse_PxLogical(wbxml_dom_node);
190 if (pxLogical == NULL) {
194 if (dm_cp->pxLogical == NULL) {
195 dm_cp->pxLogical = pxLogical;
197 DM_CP_PxLogical *cursor_ptr = dm_cp->pxLogical;
198 while (cursor_ptr != NULL) {
199 if (cursor_ptr->next == NULL) {
200 cursor_ptr->next = pxLogical;
203 cursor_ptr = cursor_ptr->next;
216 static String_Node *___get_Last_String_Node(String_Node * node)
220 String_Node *new_node = (String_Node *) calloc(1, sizeof(String_Node));
221 if (new_node == NULL) {
222 _DEBUG_VERBOSE("alloc fail");
226 new_node->next = NULL;
228 String_Node *cursor_ptr = node;
229 while (cursor_ptr != NULL) {
230 if (cursor_ptr->next == NULL) {
231 cursor_ptr->next = new_node;
235 cursor_ptr = cursor_ptr->next;
243 static DM_CP_Bootstrap *__parse_Bootstrap(WBXMLTreeNode * wbxml_dom_node)
247 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
249 DM_CP_Bootstrap *bootstrap = (DM_CP_Bootstrap *) calloc(1, sizeof(DM_CP_Bootstrap));
250 if (bootstrap == NULL) {
251 _DEBUG_VERBOSE("alloc fail");
256 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
258 while (pCursor != NULL) {
259 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
260 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
261 if (!strcmp((const char *)tag_name, "parm")) {
262 WBXMLList *param_attrs = pCursor->attrs;
263 WB_ULONG param_index = 0;
264 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
265 while (param_index < param_nb_attrs) {
266 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
267 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
268 if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
269 ___set_Param(pCursor, &(bootstrap->name));
270 if(bootstrap->name != NULL) {
271 _DEBUG_VERBOSE("NAME : %s", bootstrap->name);
273 } else if (WBXML_STRCMP("NETWORK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
274 String_Node *target_ptr = ___get_Last_String_Node(bootstrap->network);
275 if (target_ptr == NULL) {
276 _DEBUG_VERBOSE("bootstrap network get null");
280 ___set_Param(pCursor, &(target_ptr->data));
281 if(target_ptr->data != NULL) {
282 _DEBUG_VERBOSE("NETWORK : %s", target_ptr->data);
284 if (bootstrap->network == NULL) {
285 bootstrap->network = target_ptr;
287 _DEBUG_VERBOSE("free network");
288 free_string_node(target_ptr);
290 } else if (WBXML_STRCMP("COUNTRY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
291 ___set_Param(pCursor, &(bootstrap->country));
292 if(bootstrap->country != NULL) {
293 _DEBUG_VERBOSE("COUNTRY : %s", bootstrap->country);
295 } else if (WBXML_STRCMP("PROXY-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
296 String_Node *target_ptr = ___get_Last_String_Node(bootstrap->proxy_id);
297 if (target_ptr == NULL) {
298 _DEBUG_VERBOSE("boot strap PROXY-ID get null");
302 ___set_Param(pCursor, &(target_ptr->data));
303 if(target_ptr->data != NULL) {
304 _DEBUG_VERBOSE("PROXY-ID : %s", target_ptr->data);
306 if (bootstrap->proxy_id == NULL) {
307 bootstrap->proxy_id = target_ptr;
309 _DEBUG_VERBOSE("free proxy id");
310 free_string_node(target_ptr);
312 } else if (WBXML_STRCMP("PROVURL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
313 ___set_Param(pCursor, &(bootstrap->provurl));
314 if(bootstrap->provurl != NULL) {
315 _DEBUG_VERBOSE("PROVURL : %s", bootstrap->provurl);
317 } else if (WBXML_STRCMP("CONTEXT-ALLOW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
318 ___set_Param(pCursor, &(bootstrap->context_allow));
319 if(bootstrap->context_allow != NULL) {
320 _DEBUG_VERBOSE("CONTEXT-ALLOW : %s", bootstrap->context_allow);
328 pCursor = pCursor->next;
335 static DM_CP_Napdef *__parse_Napdef(WBXMLTreeNode * wbxml_dom_node)
339 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
341 DM_CP_Napdef *napdef = (DM_CP_Napdef *) calloc(1, sizeof(DM_CP_Napdef));
342 if (napdef == NULL) {
343 _DEBUG_VERBOSE("alloc fail");
347 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
349 while (pCursor != 0) {
350 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
351 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
352 if (!strcmp((const char *)tag_name, "parm")) {
353 WBXMLList *param_attrs = pCursor->attrs;
354 WB_ULONG param_index = 0;
355 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
356 while (param_index < param_nb_attrs) {
357 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
358 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
359 if (WBXML_STRCMP("NAPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
360 ___set_Param(pCursor, &(napdef->nap_ID));
361 if(napdef->nap_ID != NULL) {
362 _DEBUG_VERBOSE("NAPID : %s", napdef->nap_ID);
364 } else if (WBXML_STRCMP("BEARER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
365 String_Node *target_ptr = ___get_Last_String_Node(napdef->bearer);
366 if(target_ptr == NULL) {
367 _DEBUG_VERBOSE("___get_Last_String_Node fail");
371 ___set_Param(pCursor, &(target_ptr->data));
372 if(target_ptr->data != NULL) {
373 _DEBUG_VERBOSE("BEARER : %s", target_ptr->data);
375 if (napdef->bearer == NULL) {
376 napdef->bearer = target_ptr;
378 _DEBUG_VERBOSE("free BEARER ");
379 free_string_node(target_ptr);
381 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
382 ___set_Param(pCursor, &(napdef->name));
383 if(napdef->name != NULL) {
384 _DEBUG_VERBOSE("NAME : %s", napdef->name);
386 } else if (WBXML_STRCMP("INTERNET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
387 ___set_Param(pCursor, &(napdef->internet));
388 if(napdef->internet != NULL) {
389 _DEBUG_VERBOSE("INTERNET : %s", napdef->internet);
391 } else if (WBXML_STRCMP("NAP-ADDRESS", wbxml_attribute_get_xml_value(param_attr)) == 0) {
392 ___set_Param(pCursor, &(napdef->nap_address));
393 if(napdef->nap_address != NULL) {
394 _DEBUG_VERBOSE("NAP-ADDRESS : %s", napdef->nap_address);
396 } else if (WBXML_STRCMP("NAP-ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
397 ___set_Param(pCursor, &(napdef->nap_addr_type));
398 if(napdef->nap_addr_type != NULL) {
399 _DEBUG_VERBOSE("NAP-ADDRTYPE : %s", napdef->nap_addr_type);
401 } else if (WBXML_STRCMP("DNS-ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
402 String_Node *target_ptr = ___get_Last_String_Node(napdef->dns_addr);
403 if (target_ptr == NULL) {
404 _DEBUG_VERBOSE("DNS-ADDR is NULL");
409 ___set_Param(pCursor, &(target_ptr->data));
410 if(target_ptr->data != NULL) {
411 _DEBUG_VERBOSE("DNS-ADDR : %s", target_ptr->data);
413 if (napdef->dns_addr == NULL) {
414 napdef->dns_addr = target_ptr;
416 _DEBUG_VERBOSE("free DNS-ADDR ");
417 free_string_node(target_ptr);
419 } else if (WBXML_STRCMP("CALLTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
420 ___set_Param(pCursor, &(napdef->call_type));
421 if(napdef->call_type != NULL) {
422 _DEBUG_VERBOSE("CALLTYPE : %s", napdef->call_type);
424 } else if (WBXML_STRCMP("LOCAL-ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
425 ___set_Param(pCursor, &(napdef->local_addr));
426 if(napdef->local_addr != NULL) {
427 _DEBUG_VERBOSE("LOCAL-ADDR : %s", napdef->local_addr);
429 } else if (WBXML_STRCMP("LOCAL-ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
430 ___set_Param(pCursor, &(napdef->local_addr_type));
431 if(napdef->local_addr_type != NULL) {
432 _DEBUG_VERBOSE("LOCAL-ADDRTYPE : %s", napdef->local_addr_type);
434 } else if (WBXML_STRCMP("LINKSPEED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
435 ___set_Param(pCursor, &(napdef->link_speed));
436 if(napdef->link_speed != NULL) {
437 _DEBUG_VERBOSE("LINKSPEED : %s", napdef->link_speed);
439 } else if (WBXML_STRCMP("DNLINKSPEED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
440 ___set_Param(pCursor, &(napdef->dn_link_speed));
441 if(napdef->dn_link_speed != NULL) {
442 _DEBUG_VERBOSE("DNLINKSPEED : %s", napdef->dn_link_speed);
444 } else if (WBXML_STRCMP("LINGER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
445 ___set_Param(pCursor, &(napdef->linger));
446 if(napdef->linger != NULL) {
447 _DEBUG_VERBOSE("LINGER : %s", napdef->linger);
449 } else if (WBXML_STRCMP("DELIVERY-ERR-SDU", wbxml_attribute_get_xml_value(param_attr)) == 0) {
450 ___set_Param(pCursor, &(napdef->delivery_err_sdu));
451 if(napdef->delivery_err_sdu != NULL) {
452 _DEBUG_VERBOSE("DELIVERY-ERR-SDU : %s", napdef->delivery_err_sdu);
454 } else if (WBXML_STRCMP("DELIVERY-ORDER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
455 ___set_Param(pCursor, &(napdef->delivery_order));
456 if(napdef->delivery_order != NULL) {
457 _DEBUG_VERBOSE("DELIVERY-ORDER : %s", napdef->delivery_order);
459 } else if (WBXML_STRCMP("TRAFFIC-CLASS", wbxml_attribute_get_xml_value(param_attr)) == 0) {
460 ___set_Param(pCursor, &(napdef->traffic_class));
461 if(napdef->traffic_class != NULL) {
462 _DEBUG_VERBOSE("TRAFFIC-CLASS : %s", napdef->traffic_class);
464 } else if (WBXML_STRCMP("MAX-SDU-SIZE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
465 ___set_Param(pCursor, &(napdef->max_sdu_size));
466 if(napdef->max_sdu_size != NULL) {
467 _DEBUG_VERBOSE("MAX-SDU-SIZE : %s", napdef->max_sdu_size);
469 } else if (WBXML_STRCMP("MAX-BITRATE-UPLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
470 ___set_Param(pCursor, &(napdef->max_bitrate_uplink));
471 if(napdef->max_bitrate_uplink != NULL) {
472 _DEBUG_VERBOSE("MAX-BITRATE-UPLINK : %s", napdef->max_bitrate_uplink);
474 } else if (WBXML_STRCMP("MAX-BITRATE-DNLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
475 ___set_Param(pCursor, &(napdef->max_bitrate_dnlink));
476 if(napdef->max_bitrate_dnlink != NULL) {
477 _DEBUG_VERBOSE("MAX-BITRATE-DNLINK : %s", napdef->max_bitrate_dnlink);
479 } else if (WBXML_STRCMP("RESIDUAL-BER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
480 ___set_Param(pCursor, &(napdef->residual_ber));
481 if(napdef->residual_ber != NULL) {
482 _DEBUG_VERBOSE("RESIDUAL-BER : %s", napdef->residual_ber);
484 } else if (WBXML_STRCMP("SDU-ERROR-RATIO", wbxml_attribute_get_xml_value(param_attr)) == 0) {
485 ___set_Param(pCursor, &(napdef->sdu_error_ratio));
486 if(napdef->sdu_error_ratio != NULL) {
487 _DEBUG_VERBOSE("SDU-ERROR-RATIO : %s", napdef->sdu_error_ratio);
489 } else if (WBXML_STRCMP("TRAFFIC-HANDL-PRIO", wbxml_attribute_get_xml_value(param_attr)) == 0) {
490 ___set_Param(pCursor, &(napdef->traffic_handl_prio));
491 if(napdef->traffic_handl_prio != NULL) {
492 _DEBUG_VERBOSE("TRAFFIC-HANDL-PRIO : %s", napdef->traffic_handl_prio);
494 } else if (WBXML_STRCMP("TRANSFER-DELAY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
495 ___set_Param(pCursor, &(napdef->transfer_delay));
496 if(napdef->transfer_delay != NULL) {
497 _DEBUG_VERBOSE("TRANSFER-DELAY : %s", napdef->transfer_delay);
499 } else if (WBXML_STRCMP("GUARANTEED-BITRATE-UPLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
500 ___set_Param(pCursor, &(napdef->guaranteed_bitrate_uplink));
501 if(napdef->guaranteed_bitrate_uplink != NULL) {
502 _DEBUG_VERBOSE("GUARANTEED-BITRATE-UPLINK : %s", napdef->guaranteed_bitrate_uplink);
504 } else if (WBXML_STRCMP("GUARANTEED-BITRATE-DNLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
505 ___set_Param(pCursor, &(napdef->guaranteed_bitrate_dnlink));
506 if(napdef->guaranteed_bitrate_dnlink != NULL) {
507 _DEBUG_VERBOSE("GUARANTEED-BITRATE-DNLINK : %s", napdef->guaranteed_bitrate_dnlink);
509 } else if (WBXML_STRCMP("MAX-NUM-RETRY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
510 ___set_Param(pCursor, &(napdef->max_num_retry));
511 if(napdef->max_num_retry != NULL) {
512 _DEBUG_VERBOSE("MAX-NUM-RETRY : %s", napdef->max_num_retry);
514 } else if (WBXML_STRCMP("FIRST-RETRY-TIMEOUT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
515 ___set_Param(pCursor, &(napdef->first_retry_timeout));
516 if(napdef->first_retry_timeout != NULL) {
517 _DEBUG_VERBOSE("FIRST-RETRY-TIMEOUT : %s", napdef->first_retry_timeout);
519 } else if (WBXML_STRCMP("REREG-THRESHOLD", wbxml_attribute_get_xml_value(param_attr)) == 0) {
520 ___set_Param(pCursor, &(napdef->rereg_threshold));
521 if(napdef->rereg_threshold != NULL) {
522 _DEBUG_VERBOSE("REREG-THRESHOLD : %s", napdef->rereg_threshold);
524 } else if (WBXML_STRCMP("T-BIT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
525 ___set_Param(pCursor, &(napdef->t_bit));
526 if(napdef->t_bit != NULL) {
527 _DEBUG_VERBOSE("T-BIT : %s", napdef->t_bit);
533 } else if (!strcmp((const char *)tag_name, "characteristic")) {
534 WBXMLList *attrs = pCursor->attrs;
536 WB_ULONG nb_attrs = wbxml_list_len(attrs);
538 while (index < nb_attrs) {
539 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
540 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
541 if (WBXML_STRCMP("NAPAUTHINFO", wbxml_attribute_get_xml_value(attr)) == 0) {
542 DM_CP_Napdef_AuthInfo *auth_info = (DM_CP_Napdef_AuthInfo *) calloc(1, sizeof(DM_CP_Napdef_AuthInfo));
543 if (auth_info == NULL) {
544 _DEBUG_VERBOSE("alloc fail");
545 free_cp_napdef(napdef);
550 if (napdef->auth_info == NULL) {
551 napdef->auth_info = auth_info;
553 DM_CP_Napdef_AuthInfo *cursor_ptr = napdef->auth_info;
554 while (cursor_ptr != NULL) {
555 if (cursor_ptr->next == NULL) {
556 cursor_ptr->next = auth_info;
559 cursor_ptr = cursor_ptr->next;
562 WBXMLTreeNode *pCursor_AuthInfo = pCursor->children;
563 while (pCursor_AuthInfo != 0) {
564 if (pCursor_AuthInfo->type == WBXML_TREE_ELEMENT_NODE) {
565 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AuthInfo->name);
566 if (strcmp((const char *)tag_name, "parm") == 0) {
567 WBXMLList *param_attrs = pCursor_AuthInfo->attrs;
568 WB_ULONG param_index = 0;
569 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
570 while (param_index < param_nb_attrs) {
571 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
572 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
573 if (WBXML_STRCMP("AUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
574 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_type));
575 if(auth_info->auth_type != NULL) {
576 _DEBUG_VERBOSE("AUTHTYPE : %s", auth_info->auth_type);
578 } else if (WBXML_STRCMP("AUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
579 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_name));
580 if(auth_info->auth_name != NULL) {
581 _DEBUG_VERBOSE("AUTHNAME : %s", auth_info->auth_name);
583 } else if (WBXML_STRCMP("AUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
584 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_secret));
585 if(auth_info->auth_secret != NULL) {
586 _DEBUG_VERBOSE("AUTHSECRET : %s", auth_info->auth_secret);
588 } else if (WBXML_STRCMP("AUTH-ENTITY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
589 String_Node *target_ptr = ___get_Last_String_Node(auth_info->auth_entity);
590 if (target_ptr == NULL) {
591 _DEBUG_VERBOSE("auth entity is NULL");
595 ___set_Param(pCursor_AuthInfo, &(target_ptr->data));
596 if(target_ptr->data != NULL) {
597 _DEBUG_VERBOSE("AUTH-ENTITY : %s", target_ptr->data);
599 if (auth_info->auth_entity == NULL) {
600 auth_info->auth_entity = target_ptr;
602 _DEBUG_VERBOSE("free auth entity");
603 free_string_node(target_ptr);
605 } else if (WBXML_STRCMP("SPI", wbxml_attribute_get_xml_value(param_attr)) == 0) {
606 ___set_Param(pCursor_AuthInfo, &(auth_info->spi));
607 if(auth_info->spi != NULL ) {
608 _DEBUG_VERBOSE("SPI : %s", auth_info->spi);
617 pCursor_AuthInfo = pCursor_AuthInfo->next;
619 } else if (WBXML_STRCMP("VALIDITY", wbxml_attribute_get_xml_value(attr)) == 0) {
620 DM_CP_Napdef_validity *validity = (DM_CP_Napdef_validity *) calloc(1, sizeof(DM_CP_Napdef_validity));
621 if (validity == NULL) {
622 _DEBUG_VERBOSE("alloc fail");
623 free_cp_napdef(napdef);
628 if (napdef->validity == NULL) {
629 napdef->validity = validity;
631 DM_CP_Napdef_validity *cursor_ptr = napdef->validity;
632 while (cursor_ptr != NULL) {
633 if (cursor_ptr->next == NULL) {
634 cursor_ptr->next = validity;
637 cursor_ptr = cursor_ptr->next;
640 WBXMLTreeNode *pCursor_Validity = pCursor->children;
641 while (pCursor_Validity != 0) {
642 if (pCursor_Validity->type == WBXML_TREE_ELEMENT_NODE) {
643 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Validity->name);
644 if (!strcmp((const char *)tag_name, "parm")) {
645 WBXMLList *param_attrs = pCursor_Validity->attrs;
646 WB_ULONG param_index = 0;
647 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
648 while (param_index < param_nb_attrs) {
649 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
650 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
651 if (WBXML_STRCMP("COUNTRY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
652 ___set_Param(pCursor_Validity, &(validity->country));
653 if(validity->country != NULL) {
654 _DEBUG_VERBOSE("COUNTRY : %s", validity->country);
656 } else if (WBXML_STRCMP("NETWORK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
657 ___set_Param(pCursor_Validity, &(validity->network));
658 if(validity->network != NULL) {
659 _DEBUG_VERBOSE("NETWORK : %s", validity->network);
661 } else if (WBXML_STRCMP("SID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
662 ___set_Param(pCursor_Validity, &(validity->sid));
663 if(validity->sid != NULL) {
664 _DEBUG_VERBOSE("SID : %s", validity->sid);
666 } else if (WBXML_STRCMP("SOC", wbxml_attribute_get_xml_value(param_attr)) == 0) {
667 ___set_Param(pCursor_Validity, &(validity->soc));
668 if(validity->soc != NULL) {
669 _DEBUG_VERBOSE("SOC : %s", validity->soc);
671 } else if (WBXML_STRCMP("VALIDUNTIL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
672 ___set_Param(pCursor_Validity, &(validity->validuntil));
673 if(validity->validuntil != NULL) {
674 _DEBUG_VERBOSE("VALIDUNTIL : %s", validity->validuntil);
683 pCursor_Validity = pCursor_Validity->next;
691 pCursor = pCursor->next;
699 static DM_CP_Application *__parse_Application(WBXMLTreeNode * wbxml_dom_node)
703 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
705 DM_CP_Application *application = (DM_CP_Application *) calloc(1, sizeof(DM_CP_Application));
706 if (application == NULL) {
707 _DEBUG_VERBOSE("alloc fail");
711 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
713 while (pCursor != 0) {
714 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
715 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
716 if (strcmp((const char *)tag_name, "parm") == 0) {
717 WBXMLList *param_attrs = pCursor->attrs;
718 WB_ULONG param_index = 0;
719 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
720 while (param_index < param_nb_attrs) {
721 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
722 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
723 if (WBXML_STRCMP("APPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
724 ___set_Param(pCursor, &(application->app_ID));
725 if(application->app_ID != NULL) {
726 _DEBUG_VERBOSE("APPID : %s", application->app_ID);
728 } else if (WBXML_STRCMP("PROVIDER-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
729 ___set_Param(pCursor, &(application->provider_ID));
730 if(application->provider_ID != NULL) {
731 _DEBUG_VERBOSE("PROVIDER-ID : %s", application->provider_ID);
733 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
734 ___set_Param(pCursor, &(application->name));
735 if(application->name != NULL) {
736 _DEBUG_VERBOSE("NAME : %s", application->name);
738 } else if (WBXML_STRCMP("AACCEPT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
739 ___set_Param(pCursor, &(application->accept));
740 if(application->accept != NULL) {
741 _DEBUG_VERBOSE("AACCEPT : %s", application->accept);
743 } else if (WBXML_STRCMP("APROTOCOL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
744 ___set_Param(pCursor, &(application->protocol));
745 if(application->protocol != NULL) {
746 _DEBUG_VERBOSE("APROTOCOL : %s", application->protocol);
748 } else if (WBXML_STRCMP("TO-PROXY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
749 String_Node *target_ptr = ___get_Last_String_Node(application->to_proxy);
750 if (target_ptr == NULL) {
751 _DEBUG_VERBOSE("TO-PROXY is NULL");
756 ___set_Param(pCursor, &(target_ptr->data));
757 if(target_ptr->data != NULL) {
758 _DEBUG_VERBOSE("PROXY : %s", target_ptr->data);
761 if (application->to_proxy == NULL) {
762 application->to_proxy = target_ptr;
764 _DEBUG_VERBOSE("free PROXY ");
765 free_string_node(target_ptr);
767 } else if (WBXML_STRCMP("TO-NAPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
768 String_Node *target_ptr = ___get_Last_String_Node(application->to_napid);
769 if (target_ptr == NULL) {
770 _DEBUG_VERBOSE("TO-NAPID is NULL");
775 ___set_Param(pCursor, &(target_ptr->data));
776 if(target_ptr->data != NULL) {
777 _DEBUG_VERBOSE("NAPID : %s", target_ptr->data);
779 if (application->to_napid == NULL) {
780 application->to_napid = target_ptr;
782 _DEBUG_VERBOSE("free NAPID ");
783 free_string_node(target_ptr);
785 } else if (WBXML_STRCMP("ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
786 String_Node *target_ptr = ___get_Last_String_Node(application->addr);
787 if (target_ptr == NULL) {
788 _DEBUG_VERBOSE("ADDR is NULL");
793 ___set_Param(pCursor, &(target_ptr->data));
794 if(target_ptr->data != NULL) {
795 _DEBUG_VERBOSE("ADDR : %s", target_ptr->data);
797 if (application->addr == NULL) {
798 application->addr = target_ptr;
800 _DEBUG_VERBOSE("free ADDR ");
801 free_string_node(target_ptr);
808 } else if (!strcmp((const char *)tag_name, "characteristic")) {
809 WBXMLList *attrs = pCursor->attrs;
811 WB_ULONG nb_attrs = wbxml_list_len(attrs);
813 while (index < nb_attrs) {
814 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
816 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
818 if (WBXML_STRCMP("APPADDR", wbxml_attribute_get_xml_value(attr)) == 0) {
819 DM_CP_Application_AppAddr *app_addr = (DM_CP_Application_AppAddr *) calloc(1, sizeof(DM_CP_Application_AppAddr));
820 if (app_addr == NULL) {
821 _DEBUG_VERBOSE("alloc fail");
822 free_cp_application(application);
827 if (application->appAddr == NULL) {
828 application->appAddr = app_addr;
830 DM_CP_Application_AppAddr *cursor_ptr = application->appAddr;
831 while (cursor_ptr != NULL) {
832 if (cursor_ptr->next == NULL) {
833 cursor_ptr->next = app_addr;
836 cursor_ptr = cursor_ptr->next;
839 WBXMLTreeNode *pCursor_AppAddr = pCursor->children;
840 while (pCursor_AppAddr != 0) {
841 if (pCursor_AppAddr->type == WBXML_TREE_ELEMENT_NODE) {
842 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AppAddr->name);
843 if (strcmp((const char *)tag_name, "parm") == 0) {
844 WBXMLList *param_attrs = pCursor_AppAddr->attrs;
845 WB_ULONG param_index = 0;
846 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
847 while (param_index < param_nb_attrs) {
848 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
849 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
850 if (WBXML_STRCMP("ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
851 ___set_Param(pCursor_AppAddr, &(app_addr->addr));
852 if(app_addr->addr != NULL) {
853 _DEBUG_VERBOSE("ADDR : %s", app_addr->addr);
855 } else if (WBXML_STRCMP("ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
856 ___set_Param(pCursor_AppAddr, &(app_addr->addr_type));
857 if(app_addr->addr_type != NULL) {
858 _DEBUG_VERBOSE("ADDRTYPE : %s", app_addr->addr_type);
865 } else if (strcmp((const char *)tag_name, "characteristic") == 0) {
866 WBXMLList *addr_attrs = pCursor_AppAddr->attrs;
867 WB_ULONG addr_index = 0;
868 WB_ULONG addr_nb_attrs = wbxml_list_len(addr_attrs);
870 while (addr_index < addr_nb_attrs) {
871 WBXMLAttribute *addr_attr = (WBXMLAttribute *) wbxml_list_get(addr_attrs, addr_index);
872 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(addr_attr)) == 0) {
873 if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(addr_attr)) == 0) {
874 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
876 _DEBUG_VERBOSE("alloc fail");
877 free_cp_application(application);
882 if (app_addr->port == NULL) {
883 app_addr->port = port;
885 DM_CP_Port *cursor_ptr = app_addr->port;
886 while (cursor_ptr != NULL) {
887 if (cursor_ptr->next == NULL) {
888 cursor_ptr->next = port;
891 cursor_ptr = cursor_ptr->next;
894 WBXMLTreeNode *pCursor_Port = pCursor_AppAddr->children;
895 while (pCursor_Port != 0) {
896 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
897 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
898 if (strcmp((const char *)tag_name, "parm") == 0) {
899 WBXMLList *_param_attrs = pCursor_Port->attrs;
900 WB_ULONG _param_index = 0;
901 WB_ULONG _param_nb_attrs = wbxml_list_len(_param_attrs);
902 while (_param_index < _param_nb_attrs) {
903 WBXMLAttribute *_param_attr = (WBXMLAttribute *) wbxml_list_get(_param_attrs, _param_index);
904 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(_param_attr)) == 0) {
905 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
906 ___set_Param(pCursor_Port, &(port->portnbr));
907 if(port->portnbr != NULL) {
908 _DEBUG_VERBOSE("[%d] PORTNBR : %s", _param_index, port->portnbr);
910 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
911 String_Node *target_ptr = ___get_Last_String_Node(port->service);
912 if (target_ptr == NULL) {
913 _DEBUG_VERBOSE("SERVICE is NULL");
918 ___set_Param(pCursor_Port, &(target_ptr->data));
919 if(target_ptr->data != NULL) {
920 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
922 if (port->service == NULL) {
923 port->service = target_ptr;
925 _DEBUG_VERBOSE("free port service");
926 free_string_node(target_ptr);
932 _DEBUG_VERBOSE("param_index : %d", _param_index);
936 pCursor_Port = pCursor_Port->next;
945 pCursor_AppAddr = pCursor_AppAddr->next;
947 } else if (WBXML_STRCMP("APPAUTH", wbxml_attribute_get_xml_value(attr)) == 0) {
948 DM_CP_Application_AppAuth *app_auth = (DM_CP_Application_AppAuth *) calloc(1, sizeof(DM_CP_Application_AppAuth));
949 if (app_auth == NULL) {
950 _DEBUG_VERBOSE("alloc fail");
951 free_cp_application(application);
956 if (application->appAuth == NULL) {
957 application->appAuth = app_auth;
959 DM_CP_Application_AppAuth *cursor_ptr = application->appAuth;
960 while (cursor_ptr != NULL) {
961 if (cursor_ptr->next == NULL) {
962 cursor_ptr->next = app_auth;
965 cursor_ptr = cursor_ptr->next;
968 WBXMLTreeNode *pCursor_AppAuth = pCursor->children;
969 while (pCursor_AppAuth != 0) {
970 if (pCursor_AppAuth->type == WBXML_TREE_ELEMENT_NODE) {
971 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AppAuth->name);
972 if (strcmp((const char *)tag_name, "parm") == 0) {
973 WBXMLList *param_attrs = pCursor_AppAuth->attrs;
974 WB_ULONG param_index = 0;
975 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
976 while (param_index < param_nb_attrs) {
977 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
978 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
979 if (WBXML_STRCMP("AAUTHLEVEL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
980 ___set_Param(pCursor_AppAuth, &(app_auth->auth_level));
981 if(app_auth->auth_level != NULL) {
982 _DEBUG_VERBOSE("AAUTHLEVEL : %s", app_auth->auth_level);
984 } else if (WBXML_STRCMP("AAUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
985 ___set_Param(pCursor_AppAuth, &(app_auth->auth_type));
986 if(app_auth->auth_type != NULL) {
987 _DEBUG_VERBOSE("AAUTHTYPE : %s", app_auth->auth_type);
989 } else if (WBXML_STRCMP("AAUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
990 ___set_Param(pCursor_AppAuth, &(app_auth->auth_name));
991 if(app_auth->auth_name != NULL) {
992 _DEBUG_VERBOSE("AAUTHNAME : %s", app_auth->auth_name);
994 } else if (WBXML_STRCMP("AAUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
995 ___set_Param(pCursor_AppAuth, &(app_auth->auth_secret));
996 if(app_auth->auth_secret != NULL) {
997 _DEBUG_VERBOSE("AAUTHSECRET : %s", app_auth->auth_secret);
999 } else if (WBXML_STRCMP("AAUTHDATA", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1000 ___set_Param(pCursor_AppAuth, &(app_auth->auth_data));
1001 if(app_auth->auth_data != NULL) {
1002 _DEBUG_VERBOSE("AAUTHDATA : %s", app_auth->auth_data);
1011 pCursor_AppAuth = pCursor_AppAuth->next;
1013 } else if (WBXML_STRCMP("RESOURCE", wbxml_attribute_get_xml_value(attr)) == 0) {
1014 DM_CP_Application_Resource *app_resource = (DM_CP_Application_Resource *) calloc(1, sizeof(DM_CP_Application_Resource));
1015 if (app_resource == NULL) {
1016 _DEBUG_VERBOSE("alloc fail");
1017 free_cp_application(application);
1022 if (application->resource == NULL) {
1023 application->resource = app_resource;
1025 DM_CP_Application_Resource *cursor_ptr = application->resource;
1026 while (cursor_ptr != NULL) {
1027 if (cursor_ptr->next == NULL) {
1028 cursor_ptr->next = app_resource;
1031 cursor_ptr = cursor_ptr->next;
1034 WBXMLTreeNode *pCursor_Resource = pCursor->children;
1035 while (pCursor_Resource != 0) {
1036 if (pCursor_Resource->type == WBXML_TREE_ELEMENT_NODE) {
1037 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Resource->name);
1038 if (strcmp((const char *)tag_name, "parm") == 0) {
1039 WBXMLList *param_attrs = pCursor_Resource->attrs;
1040 WB_ULONG param_index = 0;
1041 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1042 while (param_index < param_nb_attrs) {
1043 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1044 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1045 if (WBXML_STRCMP("URI", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1046 ___set_Param(pCursor_Resource, &(app_resource->uri));
1047 if(app_resource->uri != NULL) {
1048 _DEBUG_VERBOSE("URI : %s", app_resource->uri);
1050 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1051 ___set_Param(pCursor_Resource, &(app_resource->name));
1052 if(app_resource->name != NULL) {
1053 _DEBUG_VERBOSE("NAME : %s", app_resource->name);
1055 } else if (WBXML_STRCMP("AACCEPT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1056 ___set_Param(pCursor_Resource, &(app_resource->accept));
1057 if(app_resource->accept != NULL) {
1058 _DEBUG_VERBOSE("AACCEPT : %s", app_resource->accept);
1060 } else if (WBXML_STRCMP("AAUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1061 ___set_Param(pCursor_Resource, &(app_resource->auth_type));
1062 if(app_resource->auth_type != NULL) {
1063 _DEBUG_VERBOSE("AAUTHTYPE : %s", app_resource->auth_type);
1065 } else if (WBXML_STRCMP("AAUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1066 ___set_Param(pCursor_Resource, &(app_resource->auth_name));
1067 if(app_resource->auth_name != NULL) {
1068 _DEBUG_VERBOSE("AAUTHNAME : %s", app_resource->auth_name);
1070 } else if (WBXML_STRCMP("AAUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1071 ___set_Param(pCursor_Resource, &(app_resource->auth_secret));
1072 if(app_resource->auth_secret != NULL) {
1073 _DEBUG_VERBOSE("AAUTHSECRET : %s", app_resource->auth_secret);
1075 } else if (WBXML_STRCMP("AAUTHDATA", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1076 ___set_Param(pCursor_Resource, &(app_resource->auth_data));
1077 if(app_resource->auth_data != NULL) {
1078 _DEBUG_VERBOSE("AAUTHDATA : %s", app_resource->auth_data);
1080 } else if (WBXML_STRCMP("STARTPAGE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1081 ___set_Param(pCursor_Resource, &(app_resource->start_page));
1082 if(app_resource->start_page != NULL) {
1083 _DEBUG_VERBOSE("STARTPAGE : %s", app_resource->start_page);
1092 pCursor_Resource = pCursor_Resource->next;
1102 pCursor = pCursor->next;
1110 static DM_CP_PxLogical *__parse_PxLogical(WBXMLTreeNode * wbxml_dom_node)
1114 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
1116 DM_CP_PxLogical *pxLogical = (DM_CP_PxLogical *) calloc(1, sizeof(DM_CP_PxLogical));
1117 if (pxLogical == NULL) {
1118 _DEBUG_VERBOSE("alloc fail");
1122 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
1124 while (pCursor != 0) {
1125 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
1126 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
1127 if (strcmp((const char *)tag_name, "parm") == 0) {
1128 WBXMLList *param_attrs = pCursor->attrs;
1129 WB_ULONG param_index = 0;
1130 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1131 while (param_index < param_nb_attrs) {
1132 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1133 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1134 if (WBXML_STRCMP("PROXY-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1135 ___set_Param(pCursor, &(pxLogical->proxy_id));
1136 if(pxLogical->proxy_id != NULL) {
1137 _DEBUG_VERBOSE("PROXY-ID : %s", pxLogical->proxy_id);
1139 } else if (WBXML_STRCMP("PROXY-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1140 ___set_Param(pCursor, &(pxLogical->proxy_pw));
1141 if(pxLogical->proxy_pw != NULL) {
1142 _DEBUG_VERBOSE("PROXY-PW : %s", pxLogical->proxy_pw);
1144 } else if (WBXML_STRCMP("PPGAUTH-TYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1145 ___set_Param(pCursor, &(pxLogical->ppg_auth_type));
1146 if(pxLogical->ppg_auth_type != NULL) {
1147 _DEBUG_VERBOSE("PPGAUTH-TYPE : %s", pxLogical->ppg_auth_type);
1149 } else if (WBXML_STRCMP("PROXY-PROVIDER-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1150 ___set_Param(pCursor, &(pxLogical->proxy_provider_id));
1151 if(pxLogical->proxy_provider_id != NULL) {
1152 _DEBUG_VERBOSE("PROXY-PROVIDER-ID : %s", pxLogical->proxy_provider_id);
1154 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1155 ___set_Param(pCursor, &(pxLogical->name));
1156 if(pxLogical->name != NULL) {
1157 _DEBUG_VERBOSE("NAME : %s", pxLogical->name);
1159 } else if (WBXML_STRCMP("DOMAIN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1160 String_Node *target_ptr = ___get_Last_String_Node(pxLogical->domain);
1161 if(target_ptr == NULL) {
1162 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1166 ___set_Param(pCursor, &(target_ptr->data));
1167 if(target_ptr->data != NULL) {
1168 _DEBUG_VERBOSE("DOMAIN : %s", target_ptr->data);
1170 if (pxLogical->domain == 0) {
1171 pxLogical->domain = target_ptr;
1173 _DEBUG_VERBOSE("free DOMAIN ");
1174 free_string_node(target_ptr);
1176 } else if (WBXML_STRCMP("TRUST", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1177 ___set_Param(pCursor, &(pxLogical->trust));
1178 if(pxLogical->trust != NULL) {
1179 _DEBUG_VERBOSE("TRUST : %s", pxLogical->trust);
1181 } else if (WBXML_STRCMP("MASTER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1182 ___set_Param(pCursor, &(pxLogical->master));
1183 if(pxLogical->master != NULL) {
1184 _DEBUG_VERBOSE("MASTER : %s", pxLogical->master);
1186 } else if (WBXML_STRCMP("STARTPAGE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1187 ___set_Param(pCursor, &(pxLogical->start_page));
1188 if(pxLogical->start_page != NULL) {
1189 _DEBUG_VERBOSE("STARTPAGE : %s", pxLogical->start_page);
1191 } else if (WBXML_STRCMP("BASAUTH-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1192 ___set_Param(pCursor, &(pxLogical->bas_auth_id));
1193 if(pxLogical->bas_auth_id != NULL) {
1194 _DEBUG_VERBOSE("BASAUTH-ID : %s", pxLogical->bas_auth_id);
1196 } else if (WBXML_STRCMP("BASAUTH-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1197 ___set_Param(pCursor, &(pxLogical->bas_auth_pw));
1198 if(pxLogical->bas_auth_pw != NULL) {
1199 _DEBUG_VERBOSE("BASAUTH-PW : %s", pxLogical->bas_auth_pw);
1201 } else if (WBXML_STRCMP("WSP-VERSION", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1202 ___set_Param(pCursor, &(pxLogical->wsp_version));
1203 if(pxLogical->wsp_version != NULL) {
1204 _DEBUG_VERBOSE("WSP-VERSION : %s", pxLogical->wsp_version);
1206 } else if (WBXML_STRCMP("PUSHENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1207 ___set_Param(pCursor, &(pxLogical->push_enabled));
1208 if(pxLogical->push_enabled != NULL) {
1209 _DEBUG_VERBOSE("PUSHENABLED : %s", pxLogical->push_enabled);
1211 } else if (WBXML_STRCMP("PULLENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1212 ___set_Param(pCursor, &(pxLogical->pull_enabled));
1213 if(pxLogical->pull_enabled != NULL) {
1214 _DEBUG_VERBOSE("PULLENABLED : %s", pxLogical->pull_enabled);
1221 } else if (!strcmp((const char *)tag_name, "characteristic")) {
1222 WBXMLList *attrs = pCursor->attrs;
1224 WB_ULONG nb_attrs = wbxml_list_len(attrs);
1226 while (index < nb_attrs) {
1227 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
1229 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
1231 if (WBXML_STRCMP("PXAUTHINFO", wbxml_attribute_get_xml_value(attr)) == 0) {
1232 DM_CP_PxLogical_PxAuthInfo *pxAuthInfo = (DM_CP_PxLogical_PxAuthInfo *) calloc(1, sizeof(DM_CP_PxLogical_PxAuthInfo));
1233 if (pxAuthInfo == NULL) {
1234 _DEBUG_VERBOSE("alloc fail");
1235 free_cp_pxlogical(pxLogical);
1240 if (pxLogical->pxAuthInfo == NULL) {
1241 pxLogical->pxAuthInfo = pxAuthInfo;
1243 DM_CP_PxLogical_PxAuthInfo *cursor_ptr = pxLogical->pxAuthInfo;
1244 while (cursor_ptr != NULL) {
1245 if (cursor_ptr->next == NULL) {
1246 cursor_ptr->next = pxAuthInfo;
1249 cursor_ptr = cursor_ptr->next;
1252 WBXMLTreeNode *pCursor_PxAuthInfo = pCursor->children;
1253 while (pCursor_PxAuthInfo != 0) {
1254 if (pCursor_PxAuthInfo->type == WBXML_TREE_ELEMENT_NODE) {
1255 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_PxAuthInfo->name);
1256 if (strcmp((const char *)tag_name, "parm") == 0) {
1257 WBXMLList *param_attrs = pCursor_PxAuthInfo->attrs;
1258 WB_ULONG param_index = 0;
1259 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1260 while (param_index < param_nb_attrs) {
1261 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1262 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1263 if (WBXML_STRCMP("PXAUTH-TYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1264 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_type));
1265 if(pxAuthInfo->pxAuth_type != NULL) {
1266 _DEBUG_VERBOSE("PXAUTH-TYPE : %s", pxAuthInfo->pxAuth_type);
1268 } else if (WBXML_STRCMP("PXAUTH-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1269 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_id));
1270 if(pxAuthInfo->pxAuth_id != NULL) {
1271 _DEBUG_VERBOSE("PXAUTH-ID : %s", pxAuthInfo->pxAuth_id);
1273 } else if (WBXML_STRCMP("PXAUTH-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1274 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_pw));
1275 if(pxAuthInfo->pxAuth_pw != NULL) {
1276 _DEBUG_VERBOSE("PXAUTH-PW : %s", pxAuthInfo->pxAuth_pw);
1285 pCursor_PxAuthInfo = pCursor_PxAuthInfo->next;
1287 } else if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(attr)) == 0) {
1288 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
1290 _DEBUG_VERBOSE("alloc fail");
1291 free_cp_pxlogical(pxLogical);
1296 if (pxLogical->port == NULL) {
1297 pxLogical->port = port;
1299 DM_CP_Port *cursor_ptr = pxLogical->port;
1300 while (cursor_ptr != NULL) {
1301 if (cursor_ptr->next == NULL) {
1302 cursor_ptr->next = port;
1305 cursor_ptr = cursor_ptr->next;
1308 WBXMLTreeNode *pCursor_Port = pCursor->children;
1309 while (pCursor_Port != 0) {
1310 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
1311 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
1312 if (strcmp((const char *)tag_name, "parm") == 0) {
1313 WBXMLList *param_attrs = pCursor_Port->attrs;
1314 WB_ULONG param_index = 0;
1315 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1316 while (param_index < param_nb_attrs) {
1317 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1318 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1319 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1320 ___set_Param(pCursor_Port, &(port->portnbr));
1321 if(port->portnbr != NULL) {
1322 _DEBUG_VERBOSE("AAUTHLEVEL : %s", port->portnbr);
1324 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1325 String_Node *target_ptr = ___get_Last_String_Node(port->service);
1326 ___set_Param(pCursor_Port, &(target_ptr->data));
1327 if(target_ptr->data != NULL) {
1328 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
1330 if (port->service == NULL) {
1331 port->service = target_ptr;
1333 _DEBUG_VERBOSE("free SERVICE ");
1334 free_string_node(target_ptr);
1343 pCursor_Port = pCursor_Port->next;
1345 } else if (WBXML_STRCMP("PXPHYSICAL", wbxml_attribute_get_xml_value(attr)) == 0) {
1346 DM_CP_PxLogical_PxPhysical *pxPhysical = (DM_CP_PxLogical_PxPhysical *) calloc(1, sizeof(DM_CP_PxLogical_PxPhysical));
1347 if (pxPhysical == NULL) {
1348 _DEBUG_VERBOSE("alloc fail");
1349 free_cp_pxlogical(pxLogical);
1354 if (pxLogical->pxPhysical == NULL) {
1355 pxLogical->pxPhysical = pxPhysical;
1357 DM_CP_PxLogical_PxPhysical *cursor_ptr = pxLogical->pxPhysical;
1358 while (cursor_ptr != NULL) {
1359 if (cursor_ptr->next == NULL) {
1360 cursor_ptr->next = pxPhysical;
1363 cursor_ptr = cursor_ptr->next;
1366 WBXMLTreeNode *pCursor_PxPhysical = pCursor->children;
1367 while (pCursor_PxPhysical != 0) {
1368 if (pCursor_PxPhysical->type == WBXML_TREE_ELEMENT_NODE) {
1369 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_PxPhysical->name);
1370 if (strcmp((const char *)tag_name, "parm") == 0) {
1371 WBXMLList *param_attrs = pCursor_PxPhysical->attrs;
1372 WB_ULONG param_index = 0;
1373 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1374 while (param_index < param_nb_attrs) {
1375 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1376 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1377 if (WBXML_STRCMP("PHYSICAL-PROXY-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1378 ___set_Param(pCursor_PxPhysical, &(pxPhysical->physical_proxy_id));
1379 if(pxPhysical->physical_proxy_id != NULL) {
1380 _DEBUG_VERBOSE("PHYSICAL-PROXY-ID : %s", pxPhysical->physical_proxy_id);
1382 } else if (WBXML_STRCMP("DOMAIN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1383 String_Node *target_ptr = ___get_Last_String_Node(pxPhysical->domain);
1384 if(target_ptr == NULL) {
1385 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1389 ___set_Param(pCursor_PxPhysical, &(target_ptr->data));
1390 if(target_ptr->data != NULL) {
1391 _DEBUG_VERBOSE("DOMAIN : %s", target_ptr->data);
1393 if (pxPhysical->domain == NULL) {
1394 pxPhysical->domain = target_ptr;
1396 _DEBUG_VERBOSE("free DOMAIN ");
1397 free_string_node(target_ptr);
1399 } else if (WBXML_STRCMP("PXADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1400 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddr));
1401 if(pxPhysical->pxAddr != NULL) {
1402 _DEBUG_VERBOSE("PXADDR : %s", pxPhysical->pxAddr);
1404 } else if (WBXML_STRCMP("PXADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1405 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddrType));
1406 if(pxPhysical->pxAddrType != NULL) {
1407 _DEBUG_VERBOSE("PXADDRTYPE : %s", pxPhysical->pxAddrType);
1409 } else if (WBXML_STRCMP("PXADDR-FQDN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1410 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddr_FQDN));
1411 if(pxPhysical->pxAddr_FQDN != NULL) {
1412 _DEBUG_VERBOSE("PXADDR-FQDN : %s", pxPhysical->pxAddr_FQDN);
1414 } else if (WBXML_STRCMP("WSP-VERSION", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1415 ___set_Param(pCursor_PxPhysical, &(pxPhysical->wsp_version));
1416 if(pxPhysical->wsp_version != NULL) {
1417 _DEBUG_VERBOSE("WSP-VERSION : %s", pxPhysical->wsp_version);
1419 } else if (WBXML_STRCMP("PUSHENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1420 ___set_Param(pCursor_PxPhysical, &(pxPhysical->push_enabled));
1421 if(pxPhysical->push_enabled != NULL) {
1422 _DEBUG_VERBOSE("PUSHENABLED : %s", pxPhysical->push_enabled);
1424 } else if (WBXML_STRCMP("PULLENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1425 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pull_enabled));
1426 if(pxPhysical->pull_enabled != NULL) {
1427 _DEBUG_VERBOSE("PULLENABLED : %s", pxPhysical->pull_enabled);
1429 } else if (WBXML_STRCMP("TO-NAPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1430 String_Node *target_ptr = ___get_Last_String_Node(pxPhysical->to_napid);
1431 if(target_ptr == NULL) {
1432 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1436 ___set_Param(pCursor_PxPhysical, &(target_ptr->data));
1437 if(target_ptr->data != NULL) {
1438 _DEBUG_VERBOSE("TO-NAPID : %s", target_ptr->data);
1440 if (pxPhysical->to_napid == NULL) {
1441 pxPhysical->to_napid = target_ptr;
1443 _DEBUG_VERBOSE("free TO-NAPID ");
1444 free_string_node(target_ptr);
1451 } else if (strcmp((const char *)tag_name, "characteristic") == 0) {
1452 WBXMLList *addr_attrs = pCursor_PxPhysical->attrs;
1453 WB_ULONG addr_index = 0;
1454 WB_ULONG addr_nb_attrs = wbxml_list_len(addr_attrs);
1456 while (addr_index < addr_nb_attrs) {
1457 WBXMLAttribute *addr_attr = (WBXMLAttribute *) wbxml_list_get(addr_attrs, addr_index);
1458 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(addr_attr)) == 0) {
1459 if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(addr_attr)) == 0) {
1460 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
1462 _DEBUG_VERBOSE("alloc fail");
1463 free_cp_pxlogical(pxLogical);
1468 if (pxPhysical->port == NULL) {
1469 pxPhysical->port = port;
1471 DM_CP_Port *cursor_ptr = pxPhysical->port;
1472 while (cursor_ptr != NULL) {
1473 if (cursor_ptr->next == NULL) {
1474 cursor_ptr->next = port;
1477 cursor_ptr = cursor_ptr->next;
1480 WBXMLTreeNode *pCursor_Port = pCursor_PxPhysical->children;
1481 while (pCursor_Port != 0) {
1482 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
1483 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
1484 if (strcmp((const char *)tag_name, "parm") == 0) {
1485 WBXMLList *_param_attrs = pCursor_Port->attrs;
1486 WB_ULONG _param_index = 0;
1487 WB_ULONG _param_nb_attrs = wbxml_list_len(_param_attrs);
1488 while (_param_index < _param_nb_attrs) {
1489 WBXMLAttribute *_param_attr = (WBXMLAttribute *) wbxml_list_get(_param_attrs, _param_index);
1490 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(_param_attr)) == 0) {
1491 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
1492 ___set_Param(pCursor_Port, &(port->portnbr));
1493 if(port->portnbr != NULL) {
1494 _DEBUG_VERBOSE("[%d] PORTNBR : %s", _param_index, port->portnbr);
1496 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
1497 String_Node *target_ptr = ___get_Last_String_Node(port->service);
1498 if(target_ptr==NULL) {
1499 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1503 ___set_Param(pCursor_Port, &(target_ptr->data));
1504 if(target_ptr->data != NULL) {
1505 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
1507 if (port->service == NULL) {
1508 port->service = target_ptr;
1510 _DEBUG_VERBOSE("free port service");
1511 free_string_node(target_ptr);
1517 _DEBUG_VERBOSE("param_index : %d", _param_index);
1521 pCursor_Port = pCursor_Port->next;
1529 pCursor_PxPhysical = pCursor_PxPhysical->next;
1538 pCursor = pCursor->next;
1546 static void ___set_Param(WBXMLTreeNode * wbxml_dom_node, char **set_value)
1550 retm_if((wbxml_dom_node) == NULL, "wbxml_dom_node is NULL!!");
1552 WBXMLList *attr_list = wbxml_dom_node->attrs;
1554 WB_ULONG nb_attrs = wbxml_list_len(attr_list);
1556 while (index < nb_attrs) {
1557 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attr_list, index);
1558 if (WBXML_STRCMP("value", wbxml_attribute_get_xml_name(attr)) == 0) {
1559 const char *value_str = 0;
1560 value_str = (const char *)wbxml_attribute_get_xml_value(attr);
1562 if (value_str != NULL) {
1563 value_len = strlen(value_str);
1566 *set_value = (char *)calloc(value_len + 1, sizeof(char));
1567 if (*set_value == NULL) {
1571 str_len = g_strlcpy(*set_value, value_str, value_len + 1);
1572 if (str_len >= sizeof(*set_value)) {
1573 _DEBUG_VERBOSE("buffer overflow");