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");
368 free_cp_napdef(napdef);
373 ___set_Param(pCursor, &(target_ptr->data));
374 if(target_ptr->data != NULL) {
375 _DEBUG_VERBOSE("BEARER : %s", target_ptr->data);
377 if (napdef->bearer == NULL) {
378 napdef->bearer = target_ptr;
380 _DEBUG_VERBOSE("free BEARER ");
381 free_string_node(target_ptr);
383 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
384 ___set_Param(pCursor, &(napdef->name));
385 if(napdef->name != NULL) {
386 _DEBUG_VERBOSE("NAME : %s", napdef->name);
388 } else if (WBXML_STRCMP("INTERNET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
389 ___set_Param(pCursor, &(napdef->internet));
390 if(napdef->internet != NULL) {
391 _DEBUG_VERBOSE("INTERNET : %s", napdef->internet);
393 } else if (WBXML_STRCMP("NAP-ADDRESS", wbxml_attribute_get_xml_value(param_attr)) == 0) {
394 ___set_Param(pCursor, &(napdef->nap_address));
395 if(napdef->nap_address != NULL) {
396 _DEBUG_VERBOSE("NAP-ADDRESS : %s", napdef->nap_address);
398 } else if (WBXML_STRCMP("NAP-ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
399 ___set_Param(pCursor, &(napdef->nap_addr_type));
400 if(napdef->nap_addr_type != NULL) {
401 _DEBUG_VERBOSE("NAP-ADDRTYPE : %s", napdef->nap_addr_type);
403 } else if (WBXML_STRCMP("DNS-ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
404 String_Node *target_ptr = ___get_Last_String_Node(napdef->dns_addr);
405 if (target_ptr == NULL) {
406 _DEBUG_VERBOSE("DNS-ADDR is NULL");
411 ___set_Param(pCursor, &(target_ptr->data));
412 if(target_ptr->data != NULL) {
413 _DEBUG_VERBOSE("DNS-ADDR : %s", target_ptr->data);
415 if (napdef->dns_addr == NULL) {
416 napdef->dns_addr = target_ptr;
418 _DEBUG_VERBOSE("free DNS-ADDR ");
419 free_string_node(target_ptr);
421 } else if (WBXML_STRCMP("CALLTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
422 ___set_Param(pCursor, &(napdef->call_type));
423 if(napdef->call_type != NULL) {
424 _DEBUG_VERBOSE("CALLTYPE : %s", napdef->call_type);
426 } else if (WBXML_STRCMP("LOCAL-ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
427 ___set_Param(pCursor, &(napdef->local_addr));
428 if(napdef->local_addr != NULL) {
429 _DEBUG_VERBOSE("LOCAL-ADDR : %s", napdef->local_addr);
431 } else if (WBXML_STRCMP("LOCAL-ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
432 ___set_Param(pCursor, &(napdef->local_addr_type));
433 if(napdef->local_addr_type != NULL) {
434 _DEBUG_VERBOSE("LOCAL-ADDRTYPE : %s", napdef->local_addr_type);
436 } else if (WBXML_STRCMP("LINKSPEED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
437 ___set_Param(pCursor, &(napdef->link_speed));
438 if(napdef->link_speed != NULL) {
439 _DEBUG_VERBOSE("LINKSPEED : %s", napdef->link_speed);
441 } else if (WBXML_STRCMP("DNLINKSPEED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
442 ___set_Param(pCursor, &(napdef->dn_link_speed));
443 if(napdef->dn_link_speed != NULL) {
444 _DEBUG_VERBOSE("DNLINKSPEED : %s", napdef->dn_link_speed);
446 } else if (WBXML_STRCMP("LINGER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
447 ___set_Param(pCursor, &(napdef->linger));
448 if(napdef->linger != NULL) {
449 _DEBUG_VERBOSE("LINGER : %s", napdef->linger);
451 } else if (WBXML_STRCMP("DELIVERY-ERR-SDU", wbxml_attribute_get_xml_value(param_attr)) == 0) {
452 ___set_Param(pCursor, &(napdef->delivery_err_sdu));
453 if(napdef->delivery_err_sdu != NULL) {
454 _DEBUG_VERBOSE("DELIVERY-ERR-SDU : %s", napdef->delivery_err_sdu);
456 } else if (WBXML_STRCMP("DELIVERY-ORDER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
457 ___set_Param(pCursor, &(napdef->delivery_order));
458 if(napdef->delivery_order != NULL) {
459 _DEBUG_VERBOSE("DELIVERY-ORDER : %s", napdef->delivery_order);
461 } else if (WBXML_STRCMP("TRAFFIC-CLASS", wbxml_attribute_get_xml_value(param_attr)) == 0) {
462 ___set_Param(pCursor, &(napdef->traffic_class));
463 if(napdef->traffic_class != NULL) {
464 _DEBUG_VERBOSE("TRAFFIC-CLASS : %s", napdef->traffic_class);
466 } else if (WBXML_STRCMP("MAX-SDU-SIZE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
467 ___set_Param(pCursor, &(napdef->max_sdu_size));
468 if(napdef->max_sdu_size != NULL) {
469 _DEBUG_VERBOSE("MAX-SDU-SIZE : %s", napdef->max_sdu_size);
471 } else if (WBXML_STRCMP("MAX-BITRATE-UPLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
472 ___set_Param(pCursor, &(napdef->max_bitrate_uplink));
473 if(napdef->max_bitrate_uplink != NULL) {
474 _DEBUG_VERBOSE("MAX-BITRATE-UPLINK : %s", napdef->max_bitrate_uplink);
476 } else if (WBXML_STRCMP("MAX-BITRATE-DNLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
477 ___set_Param(pCursor, &(napdef->max_bitrate_dnlink));
478 if(napdef->max_bitrate_dnlink != NULL) {
479 _DEBUG_VERBOSE("MAX-BITRATE-DNLINK : %s", napdef->max_bitrate_dnlink);
481 } else if (WBXML_STRCMP("RESIDUAL-BER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
482 ___set_Param(pCursor, &(napdef->residual_ber));
483 if(napdef->residual_ber != NULL) {
484 _DEBUG_VERBOSE("RESIDUAL-BER : %s", napdef->residual_ber);
486 } else if (WBXML_STRCMP("SDU-ERROR-RATIO", wbxml_attribute_get_xml_value(param_attr)) == 0) {
487 ___set_Param(pCursor, &(napdef->sdu_error_ratio));
488 if(napdef->sdu_error_ratio != NULL) {
489 _DEBUG_VERBOSE("SDU-ERROR-RATIO : %s", napdef->sdu_error_ratio);
491 } else if (WBXML_STRCMP("TRAFFIC-HANDL-PRIO", wbxml_attribute_get_xml_value(param_attr)) == 0) {
492 ___set_Param(pCursor, &(napdef->traffic_handl_prio));
493 if(napdef->traffic_handl_prio != NULL) {
494 _DEBUG_VERBOSE("TRAFFIC-HANDL-PRIO : %s", napdef->traffic_handl_prio);
496 } else if (WBXML_STRCMP("TRANSFER-DELAY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
497 ___set_Param(pCursor, &(napdef->transfer_delay));
498 if(napdef->transfer_delay != NULL) {
499 _DEBUG_VERBOSE("TRANSFER-DELAY : %s", napdef->transfer_delay);
501 } else if (WBXML_STRCMP("GUARANTEED-BITRATE-UPLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
502 ___set_Param(pCursor, &(napdef->guaranteed_bitrate_uplink));
503 if(napdef->guaranteed_bitrate_uplink != NULL) {
504 _DEBUG_VERBOSE("GUARANTEED-BITRATE-UPLINK : %s", napdef->guaranteed_bitrate_uplink);
506 } else if (WBXML_STRCMP("GUARANTEED-BITRATE-DNLINK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
507 ___set_Param(pCursor, &(napdef->guaranteed_bitrate_dnlink));
508 if(napdef->guaranteed_bitrate_dnlink != NULL) {
509 _DEBUG_VERBOSE("GUARANTEED-BITRATE-DNLINK : %s", napdef->guaranteed_bitrate_dnlink);
511 } else if (WBXML_STRCMP("MAX-NUM-RETRY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
512 ___set_Param(pCursor, &(napdef->max_num_retry));
513 if(napdef->max_num_retry != NULL) {
514 _DEBUG_VERBOSE("MAX-NUM-RETRY : %s", napdef->max_num_retry);
516 } else if (WBXML_STRCMP("FIRST-RETRY-TIMEOUT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
517 ___set_Param(pCursor, &(napdef->first_retry_timeout));
518 if(napdef->first_retry_timeout != NULL) {
519 _DEBUG_VERBOSE("FIRST-RETRY-TIMEOUT : %s", napdef->first_retry_timeout);
521 } else if (WBXML_STRCMP("REREG-THRESHOLD", wbxml_attribute_get_xml_value(param_attr)) == 0) {
522 ___set_Param(pCursor, &(napdef->rereg_threshold));
523 if(napdef->rereg_threshold != NULL) {
524 _DEBUG_VERBOSE("REREG-THRESHOLD : %s", napdef->rereg_threshold);
526 } else if (WBXML_STRCMP("T-BIT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
527 ___set_Param(pCursor, &(napdef->t_bit));
528 if(napdef->t_bit != NULL) {
529 _DEBUG_VERBOSE("T-BIT : %s", napdef->t_bit);
535 } else if (!strcmp((const char *)tag_name, "characteristic")) {
536 WBXMLList *attrs = pCursor->attrs;
538 WB_ULONG nb_attrs = wbxml_list_len(attrs);
540 while (index < nb_attrs) {
541 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
542 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
543 if (WBXML_STRCMP("NAPAUTHINFO", wbxml_attribute_get_xml_value(attr)) == 0) {
544 DM_CP_Napdef_AuthInfo *auth_info = (DM_CP_Napdef_AuthInfo *) calloc(1, sizeof(DM_CP_Napdef_AuthInfo));
545 if (auth_info == NULL) {
546 _DEBUG_VERBOSE("alloc fail");
547 free_cp_napdef(napdef);
552 if (napdef->auth_info == NULL) {
553 napdef->auth_info = auth_info;
555 DM_CP_Napdef_AuthInfo *cursor_ptr = napdef->auth_info;
556 while (cursor_ptr != NULL) {
557 if (cursor_ptr->next == NULL) {
558 cursor_ptr->next = auth_info;
561 cursor_ptr = cursor_ptr->next;
564 WBXMLTreeNode *pCursor_AuthInfo = pCursor->children;
565 while (pCursor_AuthInfo != 0) {
566 if (pCursor_AuthInfo->type == WBXML_TREE_ELEMENT_NODE) {
567 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AuthInfo->name);
568 if (strcmp((const char *)tag_name, "parm") == 0) {
569 WBXMLList *param_attrs = pCursor_AuthInfo->attrs;
570 WB_ULONG param_index = 0;
571 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
572 while (param_index < param_nb_attrs) {
573 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
574 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
575 if (WBXML_STRCMP("AUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
576 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_type));
577 if(auth_info->auth_type != NULL) {
578 _DEBUG_VERBOSE("AUTHTYPE : %s", auth_info->auth_type);
580 } else if (WBXML_STRCMP("AUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
581 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_name));
582 if(auth_info->auth_name != NULL) {
583 _DEBUG_VERBOSE("AUTHNAME : %s", auth_info->auth_name);
585 } else if (WBXML_STRCMP("AUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
586 ___set_Param(pCursor_AuthInfo, &(auth_info->auth_secret));
587 if(auth_info->auth_secret != NULL) {
588 _DEBUG_VERBOSE("AUTHSECRET : %s", auth_info->auth_secret);
590 } else if (WBXML_STRCMP("AUTH-ENTITY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
591 String_Node *target_ptr = ___get_Last_String_Node(auth_info->auth_entity);
592 if (target_ptr == NULL) {
593 _DEBUG_VERBOSE("auth entity is NULL");
597 ___set_Param(pCursor_AuthInfo, &(target_ptr->data));
598 if(target_ptr->data != NULL) {
599 _DEBUG_VERBOSE("AUTH-ENTITY : %s", target_ptr->data);
601 if (auth_info->auth_entity == NULL) {
602 auth_info->auth_entity = target_ptr;
604 _DEBUG_VERBOSE("free auth entity");
605 free_string_node(target_ptr);
607 } else if (WBXML_STRCMP("SPI", wbxml_attribute_get_xml_value(param_attr)) == 0) {
608 ___set_Param(pCursor_AuthInfo, &(auth_info->spi));
609 if(auth_info->spi != NULL ) {
610 _DEBUG_VERBOSE("SPI : %s", auth_info->spi);
619 pCursor_AuthInfo = pCursor_AuthInfo->next;
621 } else if (WBXML_STRCMP("VALIDITY", wbxml_attribute_get_xml_value(attr)) == 0) {
622 DM_CP_Napdef_validity *validity = (DM_CP_Napdef_validity *) calloc(1, sizeof(DM_CP_Napdef_validity));
623 if (validity == NULL) {
624 _DEBUG_VERBOSE("alloc fail");
625 free_cp_napdef(napdef);
630 if (napdef->validity == NULL) {
631 napdef->validity = validity;
633 DM_CP_Napdef_validity *cursor_ptr = napdef->validity;
634 while (cursor_ptr != NULL) {
635 if (cursor_ptr->next == NULL) {
636 cursor_ptr->next = validity;
639 cursor_ptr = cursor_ptr->next;
642 WBXMLTreeNode *pCursor_Validity = pCursor->children;
643 while (pCursor_Validity != 0) {
644 if (pCursor_Validity->type == WBXML_TREE_ELEMENT_NODE) {
645 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Validity->name);
646 if (!strcmp((const char *)tag_name, "parm")) {
647 WBXMLList *param_attrs = pCursor_Validity->attrs;
648 WB_ULONG param_index = 0;
649 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
650 while (param_index < param_nb_attrs) {
651 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
652 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
653 if (WBXML_STRCMP("COUNTRY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
654 ___set_Param(pCursor_Validity, &(validity->country));
655 if(validity->country != NULL) {
656 _DEBUG_VERBOSE("COUNTRY : %s", validity->country);
658 } else if (WBXML_STRCMP("NETWORK", wbxml_attribute_get_xml_value(param_attr)) == 0) {
659 ___set_Param(pCursor_Validity, &(validity->network));
660 if(validity->network != NULL) {
661 _DEBUG_VERBOSE("NETWORK : %s", validity->network);
663 } else if (WBXML_STRCMP("SID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
664 ___set_Param(pCursor_Validity, &(validity->sid));
665 if(validity->sid != NULL) {
666 _DEBUG_VERBOSE("SID : %s", validity->sid);
668 } else if (WBXML_STRCMP("SOC", wbxml_attribute_get_xml_value(param_attr)) == 0) {
669 ___set_Param(pCursor_Validity, &(validity->soc));
670 if(validity->soc != NULL) {
671 _DEBUG_VERBOSE("SOC : %s", validity->soc);
673 } else if (WBXML_STRCMP("VALIDUNTIL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
674 ___set_Param(pCursor_Validity, &(validity->validuntil));
675 if(validity->validuntil != NULL) {
676 _DEBUG_VERBOSE("VALIDUNTIL : %s", validity->validuntil);
685 pCursor_Validity = pCursor_Validity->next;
693 pCursor = pCursor->next;
701 static DM_CP_Application *__parse_Application(WBXMLTreeNode * wbxml_dom_node)
705 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
707 DM_CP_Application *application = (DM_CP_Application *) calloc(1, sizeof(DM_CP_Application));
708 if (application == NULL) {
709 _DEBUG_VERBOSE("alloc fail");
713 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
715 while (pCursor != 0) {
716 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
717 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
718 if (strcmp((const char *)tag_name, "parm") == 0) {
719 WBXMLList *param_attrs = pCursor->attrs;
720 WB_ULONG param_index = 0;
721 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
722 while (param_index < param_nb_attrs) {
723 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
724 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
725 if (WBXML_STRCMP("APPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
726 ___set_Param(pCursor, &(application->app_ID));
727 if(application->app_ID != NULL) {
728 _DEBUG_VERBOSE("APPID : %s", application->app_ID);
730 } else if (WBXML_STRCMP("PROVIDER-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
731 ___set_Param(pCursor, &(application->provider_ID));
732 if(application->provider_ID != NULL) {
733 _DEBUG_VERBOSE("PROVIDER-ID : %s", application->provider_ID);
735 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
736 ___set_Param(pCursor, &(application->name));
737 if(application->name != NULL) {
738 _DEBUG_VERBOSE("NAME : %s", application->name);
740 } else if (WBXML_STRCMP("AACCEPT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
741 ___set_Param(pCursor, &(application->accept));
742 if(application->accept != NULL) {
743 _DEBUG_VERBOSE("AACCEPT : %s", application->accept);
745 } else if (WBXML_STRCMP("APROTOCOL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
746 ___set_Param(pCursor, &(application->protocol));
747 if(application->protocol != NULL) {
748 _DEBUG_VERBOSE("APROTOCOL : %s", application->protocol);
750 } else if (WBXML_STRCMP("TO-PROXY", wbxml_attribute_get_xml_value(param_attr)) == 0) {
751 String_Node *target_ptr = ___get_Last_String_Node(application->to_proxy);
752 if (target_ptr == NULL) {
753 _DEBUG_VERBOSE("TO-PROXY is NULL");
758 ___set_Param(pCursor, &(target_ptr->data));
759 if(target_ptr->data != NULL) {
760 _DEBUG_VERBOSE("PROXY : %s", target_ptr->data);
763 if (application->to_proxy == NULL) {
764 application->to_proxy = target_ptr;
766 _DEBUG_VERBOSE("free PROXY ");
767 free_string_node(target_ptr);
769 } else if (WBXML_STRCMP("TO-NAPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
770 String_Node *target_ptr = ___get_Last_String_Node(application->to_napid);
771 if (target_ptr == NULL) {
772 _DEBUG_VERBOSE("TO-NAPID is NULL");
777 ___set_Param(pCursor, &(target_ptr->data));
778 if(target_ptr->data != NULL) {
779 _DEBUG_VERBOSE("NAPID : %s", target_ptr->data);
781 if (application->to_napid == NULL) {
782 application->to_napid = target_ptr;
784 _DEBUG_VERBOSE("free NAPID ");
785 free_string_node(target_ptr);
787 } else if (WBXML_STRCMP("ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
788 String_Node *target_ptr = ___get_Last_String_Node(application->addr);
789 if (target_ptr == NULL) {
790 _DEBUG_VERBOSE("ADDR is NULL");
795 ___set_Param(pCursor, &(target_ptr->data));
796 if(target_ptr->data != NULL) {
797 _DEBUG_VERBOSE("ADDR : %s", target_ptr->data);
799 if (application->addr == NULL) {
800 application->addr = target_ptr;
802 _DEBUG_VERBOSE("free ADDR ");
803 free_string_node(target_ptr);
810 } else if (!strcmp((const char *)tag_name, "characteristic")) {
811 WBXMLList *attrs = pCursor->attrs;
813 WB_ULONG nb_attrs = wbxml_list_len(attrs);
815 while (index < nb_attrs) {
816 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
818 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
820 if (WBXML_STRCMP("APPADDR", wbxml_attribute_get_xml_value(attr)) == 0) {
821 DM_CP_Application_AppAddr *app_addr = (DM_CP_Application_AppAddr *) calloc(1, sizeof(DM_CP_Application_AppAddr));
822 if (app_addr == NULL) {
823 _DEBUG_VERBOSE("alloc fail");
824 free_cp_application(application);
829 if (application->appAddr == NULL) {
830 application->appAddr = app_addr;
832 DM_CP_Application_AppAddr *cursor_ptr = application->appAddr;
833 while (cursor_ptr != NULL) {
834 if (cursor_ptr->next == NULL) {
835 cursor_ptr->next = app_addr;
838 cursor_ptr = cursor_ptr->next;
841 WBXMLTreeNode *pCursor_AppAddr = pCursor->children;
842 while (pCursor_AppAddr != 0) {
843 if (pCursor_AppAddr->type == WBXML_TREE_ELEMENT_NODE) {
844 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AppAddr->name);
845 if (strcmp((const char *)tag_name, "parm") == 0) {
846 WBXMLList *param_attrs = pCursor_AppAddr->attrs;
847 WB_ULONG param_index = 0;
848 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
849 while (param_index < param_nb_attrs) {
850 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
851 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
852 if (WBXML_STRCMP("ADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
853 ___set_Param(pCursor_AppAddr, &(app_addr->addr));
854 if(app_addr->addr != NULL) {
855 _DEBUG_VERBOSE("ADDR : %s", app_addr->addr);
857 } else if (WBXML_STRCMP("ADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
858 ___set_Param(pCursor_AppAddr, &(app_addr->addr_type));
859 if(app_addr->addr_type != NULL) {
860 _DEBUG_VERBOSE("ADDRTYPE : %s", app_addr->addr_type);
867 } else if (strcmp((const char *)tag_name, "characteristic") == 0) {
868 WBXMLList *addr_attrs = pCursor_AppAddr->attrs;
869 WB_ULONG addr_index = 0;
870 WB_ULONG addr_nb_attrs = wbxml_list_len(addr_attrs);
872 while (addr_index < addr_nb_attrs) {
873 WBXMLAttribute *addr_attr = (WBXMLAttribute *) wbxml_list_get(addr_attrs, addr_index);
874 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(addr_attr)) == 0) {
875 if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(addr_attr)) == 0) {
876 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
878 _DEBUG_VERBOSE("alloc fail");
879 free_cp_application(application);
884 if (app_addr->port == NULL) {
885 app_addr->port = port;
887 DM_CP_Port *cursor_ptr = app_addr->port;
888 while (cursor_ptr != NULL) {
889 if (cursor_ptr->next == NULL) {
890 cursor_ptr->next = port;
893 cursor_ptr = cursor_ptr->next;
896 WBXMLTreeNode *pCursor_Port = pCursor_AppAddr->children;
897 while (pCursor_Port != 0) {
898 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
899 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
900 if (strcmp((const char *)tag_name, "parm") == 0) {
901 WBXMLList *_param_attrs = pCursor_Port->attrs;
902 WB_ULONG _param_index = 0;
903 WB_ULONG _param_nb_attrs = wbxml_list_len(_param_attrs);
904 while (_param_index < _param_nb_attrs) {
905 WBXMLAttribute *_param_attr = (WBXMLAttribute *) wbxml_list_get(_param_attrs, _param_index);
906 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(_param_attr)) == 0) {
907 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
908 ___set_Param(pCursor_Port, &(port->portnbr));
909 if(port->portnbr != NULL) {
910 _DEBUG_VERBOSE("[%d] PORTNBR : %s", _param_index, port->portnbr);
912 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
913 String_Node *target_ptr = ___get_Last_String_Node(port->service);
914 if (target_ptr == NULL) {
915 _DEBUG_VERBOSE("SERVICE is NULL");
920 ___set_Param(pCursor_Port, &(target_ptr->data));
921 if(target_ptr->data != NULL) {
922 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
924 if (port->service == NULL) {
925 port->service = target_ptr;
927 _DEBUG_VERBOSE("free port service");
928 free_string_node(target_ptr);
934 _DEBUG_VERBOSE("param_index : %d", _param_index);
938 pCursor_Port = pCursor_Port->next;
947 pCursor_AppAddr = pCursor_AppAddr->next;
949 } else if (WBXML_STRCMP("APPAUTH", wbxml_attribute_get_xml_value(attr)) == 0) {
950 DM_CP_Application_AppAuth *app_auth = (DM_CP_Application_AppAuth *) calloc(1, sizeof(DM_CP_Application_AppAuth));
951 if (app_auth == NULL) {
952 _DEBUG_VERBOSE("alloc fail");
953 free_cp_application(application);
958 if (application->appAuth == NULL) {
959 application->appAuth = app_auth;
961 DM_CP_Application_AppAuth *cursor_ptr = application->appAuth;
962 while (cursor_ptr != NULL) {
963 if (cursor_ptr->next == NULL) {
964 cursor_ptr->next = app_auth;
967 cursor_ptr = cursor_ptr->next;
970 WBXMLTreeNode *pCursor_AppAuth = pCursor->children;
971 while (pCursor_AppAuth != 0) {
972 if (pCursor_AppAuth->type == WBXML_TREE_ELEMENT_NODE) {
973 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_AppAuth->name);
974 if (strcmp((const char *)tag_name, "parm") == 0) {
975 WBXMLList *param_attrs = pCursor_AppAuth->attrs;
976 WB_ULONG param_index = 0;
977 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
978 while (param_index < param_nb_attrs) {
979 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
980 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
981 if (WBXML_STRCMP("AAUTHLEVEL", wbxml_attribute_get_xml_value(param_attr)) == 0) {
982 ___set_Param(pCursor_AppAuth, &(app_auth->auth_level));
983 if(app_auth->auth_level != NULL) {
984 _DEBUG_VERBOSE("AAUTHLEVEL : %s", app_auth->auth_level);
986 } else if (WBXML_STRCMP("AAUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
987 ___set_Param(pCursor_AppAuth, &(app_auth->auth_type));
988 if(app_auth->auth_type != NULL) {
989 _DEBUG_VERBOSE("AAUTHTYPE : %s", app_auth->auth_type);
991 } else if (WBXML_STRCMP("AAUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
992 ___set_Param(pCursor_AppAuth, &(app_auth->auth_name));
993 if(app_auth->auth_name != NULL) {
994 _DEBUG_VERBOSE("AAUTHNAME : %s", app_auth->auth_name);
996 } else if (WBXML_STRCMP("AAUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
997 ___set_Param(pCursor_AppAuth, &(app_auth->auth_secret));
998 if(app_auth->auth_secret != NULL) {
999 _DEBUG_VERBOSE("AAUTHSECRET : %s", app_auth->auth_secret);
1001 } else if (WBXML_STRCMP("AAUTHDATA", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1002 ___set_Param(pCursor_AppAuth, &(app_auth->auth_data));
1003 if(app_auth->auth_data != NULL) {
1004 _DEBUG_VERBOSE("AAUTHDATA : %s", app_auth->auth_data);
1013 pCursor_AppAuth = pCursor_AppAuth->next;
1015 } else if (WBXML_STRCMP("RESOURCE", wbxml_attribute_get_xml_value(attr)) == 0) {
1016 DM_CP_Application_Resource *app_resource = (DM_CP_Application_Resource *) calloc(1, sizeof(DM_CP_Application_Resource));
1017 if (app_resource == NULL) {
1018 _DEBUG_VERBOSE("alloc fail");
1019 free_cp_application(application);
1024 if (application->resource == NULL) {
1025 application->resource = app_resource;
1027 DM_CP_Application_Resource *cursor_ptr = application->resource;
1028 while (cursor_ptr != NULL) {
1029 if (cursor_ptr->next == NULL) {
1030 cursor_ptr->next = app_resource;
1033 cursor_ptr = cursor_ptr->next;
1036 WBXMLTreeNode *pCursor_Resource = pCursor->children;
1037 while (pCursor_Resource != 0) {
1038 if (pCursor_Resource->type == WBXML_TREE_ELEMENT_NODE) {
1039 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Resource->name);
1040 if (strcmp((const char *)tag_name, "parm") == 0) {
1041 WBXMLList *param_attrs = pCursor_Resource->attrs;
1042 WB_ULONG param_index = 0;
1043 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1044 while (param_index < param_nb_attrs) {
1045 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1046 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1047 if (WBXML_STRCMP("URI", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1048 ___set_Param(pCursor_Resource, &(app_resource->uri));
1049 if(app_resource->uri != NULL) {
1050 _DEBUG_VERBOSE("URI : %s", app_resource->uri);
1052 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1053 ___set_Param(pCursor_Resource, &(app_resource->name));
1054 if(app_resource->name != NULL) {
1055 _DEBUG_VERBOSE("NAME : %s", app_resource->name);
1057 } else if (WBXML_STRCMP("AACCEPT", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1058 ___set_Param(pCursor_Resource, &(app_resource->accept));
1059 if(app_resource->accept != NULL) {
1060 _DEBUG_VERBOSE("AACCEPT : %s", app_resource->accept);
1062 } else if (WBXML_STRCMP("AAUTHTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1063 ___set_Param(pCursor_Resource, &(app_resource->auth_type));
1064 if(app_resource->auth_type != NULL) {
1065 _DEBUG_VERBOSE("AAUTHTYPE : %s", app_resource->auth_type);
1067 } else if (WBXML_STRCMP("AAUTHNAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1068 ___set_Param(pCursor_Resource, &(app_resource->auth_name));
1069 if(app_resource->auth_name != NULL) {
1070 _DEBUG_VERBOSE("AAUTHNAME : %s", app_resource->auth_name);
1072 } else if (WBXML_STRCMP("AAUTHSECRET", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1073 ___set_Param(pCursor_Resource, &(app_resource->auth_secret));
1074 if(app_resource->auth_secret != NULL) {
1075 _DEBUG_VERBOSE("AAUTHSECRET : %s", app_resource->auth_secret);
1077 } else if (WBXML_STRCMP("AAUTHDATA", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1078 ___set_Param(pCursor_Resource, &(app_resource->auth_data));
1079 if(app_resource->auth_data != NULL) {
1080 _DEBUG_VERBOSE("AAUTHDATA : %s", app_resource->auth_data);
1082 } else if (WBXML_STRCMP("STARTPAGE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1083 ___set_Param(pCursor_Resource, &(app_resource->start_page));
1084 if(app_resource->start_page != NULL) {
1085 _DEBUG_VERBOSE("STARTPAGE : %s", app_resource->start_page);
1094 pCursor_Resource = pCursor_Resource->next;
1104 pCursor = pCursor->next;
1112 static DM_CP_PxLogical *__parse_PxLogical(WBXMLTreeNode * wbxml_dom_node)
1116 retvm_if((wbxml_dom_node) == NULL, NULL, "wbxml_dom_node is NULL!!");
1118 DM_CP_PxLogical *pxLogical = (DM_CP_PxLogical *) calloc(1, sizeof(DM_CP_PxLogical));
1119 if (pxLogical == NULL) {
1120 _DEBUG_VERBOSE("alloc fail");
1124 WBXMLTreeNode *pCursor = wbxml_dom_node->children;
1126 while (pCursor != 0) {
1127 if (pCursor->type == WBXML_TREE_ELEMENT_NODE) {
1128 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor->name);
1129 if (strcmp((const char *)tag_name, "parm") == 0) {
1130 WBXMLList *param_attrs = pCursor->attrs;
1131 WB_ULONG param_index = 0;
1132 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1133 while (param_index < param_nb_attrs) {
1134 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1135 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1136 if (WBXML_STRCMP("PROXY-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1137 ___set_Param(pCursor, &(pxLogical->proxy_id));
1138 if(pxLogical->proxy_id != NULL) {
1139 _DEBUG_VERBOSE("PROXY-ID : %s", pxLogical->proxy_id);
1141 } else if (WBXML_STRCMP("PROXY-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1142 ___set_Param(pCursor, &(pxLogical->proxy_pw));
1143 if(pxLogical->proxy_pw != NULL) {
1144 _DEBUG_VERBOSE("PROXY-PW : %s", pxLogical->proxy_pw);
1146 } else if (WBXML_STRCMP("PPGAUTH-TYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1147 ___set_Param(pCursor, &(pxLogical->ppg_auth_type));
1148 if(pxLogical->ppg_auth_type != NULL) {
1149 _DEBUG_VERBOSE("PPGAUTH-TYPE : %s", pxLogical->ppg_auth_type);
1151 } else if (WBXML_STRCMP("PROXY-PROVIDER-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1152 ___set_Param(pCursor, &(pxLogical->proxy_provider_id));
1153 if(pxLogical->proxy_provider_id != NULL) {
1154 _DEBUG_VERBOSE("PROXY-PROVIDER-ID : %s", pxLogical->proxy_provider_id);
1156 } else if (WBXML_STRCMP("NAME", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1157 ___set_Param(pCursor, &(pxLogical->name));
1158 if(pxLogical->name != NULL) {
1159 _DEBUG_VERBOSE("NAME : %s", pxLogical->name);
1161 } else if (WBXML_STRCMP("DOMAIN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1162 String_Node *target_ptr = ___get_Last_String_Node(pxLogical->domain);
1163 if(target_ptr == NULL) {
1164 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1165 free_cp_pxlogical(pxLogical);
1170 ___set_Param(pCursor, &(target_ptr->data));
1171 if(target_ptr->data != NULL) {
1172 _DEBUG_VERBOSE("DOMAIN : %s", target_ptr->data);
1174 if (pxLogical->domain == 0) {
1175 pxLogical->domain = target_ptr;
1177 _DEBUG_VERBOSE("free DOMAIN ");
1178 free_string_node(target_ptr);
1180 } else if (WBXML_STRCMP("TRUST", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1181 ___set_Param(pCursor, &(pxLogical->trust));
1182 if(pxLogical->trust != NULL) {
1183 _DEBUG_VERBOSE("TRUST : %s", pxLogical->trust);
1185 } else if (WBXML_STRCMP("MASTER", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1186 ___set_Param(pCursor, &(pxLogical->master));
1187 if(pxLogical->master != NULL) {
1188 _DEBUG_VERBOSE("MASTER : %s", pxLogical->master);
1190 } else if (WBXML_STRCMP("STARTPAGE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1191 ___set_Param(pCursor, &(pxLogical->start_page));
1192 if(pxLogical->start_page != NULL) {
1193 _DEBUG_VERBOSE("STARTPAGE : %s", pxLogical->start_page);
1195 } else if (WBXML_STRCMP("BASAUTH-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1196 ___set_Param(pCursor, &(pxLogical->bas_auth_id));
1197 if(pxLogical->bas_auth_id != NULL) {
1198 _DEBUG_VERBOSE("BASAUTH-ID : %s", pxLogical->bas_auth_id);
1200 } else if (WBXML_STRCMP("BASAUTH-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1201 ___set_Param(pCursor, &(pxLogical->bas_auth_pw));
1202 if(pxLogical->bas_auth_pw != NULL) {
1203 _DEBUG_VERBOSE("BASAUTH-PW : %s", pxLogical->bas_auth_pw);
1205 } else if (WBXML_STRCMP("WSP-VERSION", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1206 ___set_Param(pCursor, &(pxLogical->wsp_version));
1207 if(pxLogical->wsp_version != NULL) {
1208 _DEBUG_VERBOSE("WSP-VERSION : %s", pxLogical->wsp_version);
1210 } else if (WBXML_STRCMP("PUSHENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1211 ___set_Param(pCursor, &(pxLogical->push_enabled));
1212 if(pxLogical->push_enabled != NULL) {
1213 _DEBUG_VERBOSE("PUSHENABLED : %s", pxLogical->push_enabled);
1215 } else if (WBXML_STRCMP("PULLENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1216 ___set_Param(pCursor, &(pxLogical->pull_enabled));
1217 if(pxLogical->pull_enabled != NULL) {
1218 _DEBUG_VERBOSE("PULLENABLED : %s", pxLogical->pull_enabled);
1225 } else if (!strcmp((const char *)tag_name, "characteristic")) {
1226 WBXMLList *attrs = pCursor->attrs;
1228 WB_ULONG nb_attrs = wbxml_list_len(attrs);
1230 while (index < nb_attrs) {
1231 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attrs, index);
1233 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(attr)) == 0) {
1235 if (WBXML_STRCMP("PXAUTHINFO", wbxml_attribute_get_xml_value(attr)) == 0) {
1236 DM_CP_PxLogical_PxAuthInfo *pxAuthInfo = (DM_CP_PxLogical_PxAuthInfo *) calloc(1, sizeof(DM_CP_PxLogical_PxAuthInfo));
1237 if (pxAuthInfo == NULL) {
1238 _DEBUG_VERBOSE("alloc fail");
1239 free_cp_pxlogical(pxLogical);
1244 if (pxLogical->pxAuthInfo == NULL) {
1245 pxLogical->pxAuthInfo = pxAuthInfo;
1247 DM_CP_PxLogical_PxAuthInfo *cursor_ptr = pxLogical->pxAuthInfo;
1248 while (cursor_ptr != NULL) {
1249 if (cursor_ptr->next == NULL) {
1250 cursor_ptr->next = pxAuthInfo;
1253 cursor_ptr = cursor_ptr->next;
1256 WBXMLTreeNode *pCursor_PxAuthInfo = pCursor->children;
1257 while (pCursor_PxAuthInfo != 0) {
1258 if (pCursor_PxAuthInfo->type == WBXML_TREE_ELEMENT_NODE) {
1259 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_PxAuthInfo->name);
1260 if (strcmp((const char *)tag_name, "parm") == 0) {
1261 WBXMLList *param_attrs = pCursor_PxAuthInfo->attrs;
1262 WB_ULONG param_index = 0;
1263 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1264 while (param_index < param_nb_attrs) {
1265 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1266 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1267 if (WBXML_STRCMP("PXAUTH-TYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1268 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_type));
1269 if(pxAuthInfo->pxAuth_type != NULL) {
1270 _DEBUG_VERBOSE("PXAUTH-TYPE : %s", pxAuthInfo->pxAuth_type);
1272 } else if (WBXML_STRCMP("PXAUTH-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1273 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_id));
1274 if(pxAuthInfo->pxAuth_id != NULL) {
1275 _DEBUG_VERBOSE("PXAUTH-ID : %s", pxAuthInfo->pxAuth_id);
1277 } else if (WBXML_STRCMP("PXAUTH-PW", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1278 ___set_Param(pCursor_PxAuthInfo, &(pxAuthInfo->pxAuth_pw));
1279 if(pxAuthInfo->pxAuth_pw != NULL) {
1280 _DEBUG_VERBOSE("PXAUTH-PW : %s", pxAuthInfo->pxAuth_pw);
1289 pCursor_PxAuthInfo = pCursor_PxAuthInfo->next;
1291 } else if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(attr)) == 0) {
1292 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
1294 _DEBUG_VERBOSE("alloc fail");
1295 free_cp_pxlogical(pxLogical);
1300 if (pxLogical->port == NULL) {
1301 pxLogical->port = port;
1303 DM_CP_Port *cursor_ptr = pxLogical->port;
1304 while (cursor_ptr != NULL) {
1305 if (cursor_ptr->next == NULL) {
1306 cursor_ptr->next = port;
1309 cursor_ptr = cursor_ptr->next;
1312 WBXMLTreeNode *pCursor_Port = pCursor->children;
1313 while (pCursor_Port != 0) {
1314 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
1315 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
1316 if (strcmp((const char *)tag_name, "parm") == 0) {
1317 WBXMLList *param_attrs = pCursor_Port->attrs;
1318 WB_ULONG param_index = 0;
1319 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1320 while (param_index < param_nb_attrs) {
1321 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1322 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1323 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1324 ___set_Param(pCursor_Port, &(port->portnbr));
1325 if(port->portnbr != NULL) {
1326 _DEBUG_VERBOSE("AAUTHLEVEL : %s", port->portnbr);
1328 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1329 String_Node *target_ptr = ___get_Last_String_Node(port->service);
1330 ___set_Param(pCursor_Port, &(target_ptr->data));
1331 if(target_ptr->data != NULL) {
1332 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
1334 if (port->service == NULL) {
1335 port->service = target_ptr;
1337 _DEBUG_VERBOSE("free SERVICE ");
1338 free_string_node(target_ptr);
1347 pCursor_Port = pCursor_Port->next;
1349 } else if (WBXML_STRCMP("PXPHYSICAL", wbxml_attribute_get_xml_value(attr)) == 0) {
1350 DM_CP_PxLogical_PxPhysical *pxPhysical = (DM_CP_PxLogical_PxPhysical *) calloc(1, sizeof(DM_CP_PxLogical_PxPhysical));
1351 if (pxPhysical == NULL) {
1352 _DEBUG_VERBOSE("alloc fail");
1353 free_cp_pxlogical(pxLogical);
1358 if (pxLogical->pxPhysical == NULL) {
1359 pxLogical->pxPhysical = pxPhysical;
1361 DM_CP_PxLogical_PxPhysical *cursor_ptr = pxLogical->pxPhysical;
1362 while (cursor_ptr != NULL) {
1363 if (cursor_ptr->next == NULL) {
1364 cursor_ptr->next = pxPhysical;
1367 cursor_ptr = cursor_ptr->next;
1370 WBXMLTreeNode *pCursor_PxPhysical = pCursor->children;
1371 while (pCursor_PxPhysical != 0) {
1372 if (pCursor_PxPhysical->type == WBXML_TREE_ELEMENT_NODE) {
1373 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_PxPhysical->name);
1374 if (strcmp((const char *)tag_name, "parm") == 0) {
1375 WBXMLList *param_attrs = pCursor_PxPhysical->attrs;
1376 WB_ULONG param_index = 0;
1377 WB_ULONG param_nb_attrs = wbxml_list_len(param_attrs);
1378 while (param_index < param_nb_attrs) {
1379 WBXMLAttribute *param_attr = (WBXMLAttribute *) wbxml_list_get(param_attrs, param_index);
1380 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(param_attr)) == 0) {
1381 if (WBXML_STRCMP("PHYSICAL-PROXY-ID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1382 ___set_Param(pCursor_PxPhysical, &(pxPhysical->physical_proxy_id));
1383 if(pxPhysical->physical_proxy_id != NULL) {
1384 _DEBUG_VERBOSE("PHYSICAL-PROXY-ID : %s", pxPhysical->physical_proxy_id);
1386 } else if (WBXML_STRCMP("DOMAIN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1387 String_Node *target_ptr = ___get_Last_String_Node(pxPhysical->domain);
1388 if(target_ptr == NULL) {
1389 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1390 free_cp_pxlogical(pxLogical);
1395 ___set_Param(pCursor_PxPhysical, &(target_ptr->data));
1396 if(target_ptr->data != NULL) {
1397 _DEBUG_VERBOSE("DOMAIN : %s", target_ptr->data);
1399 if (pxPhysical->domain == NULL) {
1400 pxPhysical->domain = target_ptr;
1402 _DEBUG_VERBOSE("free DOMAIN ");
1403 free_string_node(target_ptr);
1405 } else if (WBXML_STRCMP("PXADDR", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1406 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddr));
1407 if(pxPhysical->pxAddr != NULL) {
1408 _DEBUG_VERBOSE("PXADDR : %s", pxPhysical->pxAddr);
1410 } else if (WBXML_STRCMP("PXADDRTYPE", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1411 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddrType));
1412 if(pxPhysical->pxAddrType != NULL) {
1413 _DEBUG_VERBOSE("PXADDRTYPE : %s", pxPhysical->pxAddrType);
1415 } else if (WBXML_STRCMP("PXADDR-FQDN", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1416 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pxAddr_FQDN));
1417 if(pxPhysical->pxAddr_FQDN != NULL) {
1418 _DEBUG_VERBOSE("PXADDR-FQDN : %s", pxPhysical->pxAddr_FQDN);
1420 } else if (WBXML_STRCMP("WSP-VERSION", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1421 ___set_Param(pCursor_PxPhysical, &(pxPhysical->wsp_version));
1422 if(pxPhysical->wsp_version != NULL) {
1423 _DEBUG_VERBOSE("WSP-VERSION : %s", pxPhysical->wsp_version);
1425 } else if (WBXML_STRCMP("PUSHENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1426 ___set_Param(pCursor_PxPhysical, &(pxPhysical->push_enabled));
1427 if(pxPhysical->push_enabled != NULL) {
1428 _DEBUG_VERBOSE("PUSHENABLED : %s", pxPhysical->push_enabled);
1430 } else if (WBXML_STRCMP("PULLENABLED", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1431 ___set_Param(pCursor_PxPhysical, &(pxPhysical->pull_enabled));
1432 if(pxPhysical->pull_enabled != NULL) {
1433 _DEBUG_VERBOSE("PULLENABLED : %s", pxPhysical->pull_enabled);
1435 } else if (WBXML_STRCMP("TO-NAPID", wbxml_attribute_get_xml_value(param_attr)) == 0) {
1436 String_Node *target_ptr = ___get_Last_String_Node(pxPhysical->to_napid);
1437 if(target_ptr == NULL) {
1438 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1439 free_cp_pxlogical(pxLogical);
1444 ___set_Param(pCursor_PxPhysical, &(target_ptr->data));
1445 if(target_ptr->data != NULL) {
1446 _DEBUG_VERBOSE("TO-NAPID : %s", target_ptr->data);
1448 if (pxPhysical->to_napid == NULL) {
1449 pxPhysical->to_napid = target_ptr;
1451 _DEBUG_VERBOSE("free TO-NAPID ");
1452 free_string_node(target_ptr);
1459 } else if (strcmp((const char *)tag_name, "characteristic") == 0) {
1460 WBXMLList *addr_attrs = pCursor_PxPhysical->attrs;
1461 WB_ULONG addr_index = 0;
1462 WB_ULONG addr_nb_attrs = wbxml_list_len(addr_attrs);
1464 while (addr_index < addr_nb_attrs) {
1465 WBXMLAttribute *addr_attr = (WBXMLAttribute *) wbxml_list_get(addr_attrs, addr_index);
1466 if (WBXML_STRCMP("type", wbxml_attribute_get_xml_name(addr_attr)) == 0) {
1467 if (WBXML_STRCMP("PORT", wbxml_attribute_get_xml_value(addr_attr)) == 0) {
1468 DM_CP_Port *port = (DM_CP_Port *) calloc(1, sizeof(DM_CP_Port));
1470 _DEBUG_VERBOSE("alloc fail");
1471 free_cp_pxlogical(pxLogical);
1476 if (pxPhysical->port == NULL) {
1477 pxPhysical->port = port;
1479 DM_CP_Port *cursor_ptr = pxPhysical->port;
1480 while (cursor_ptr != NULL) {
1481 if (cursor_ptr->next == NULL) {
1482 cursor_ptr->next = port;
1485 cursor_ptr = cursor_ptr->next;
1488 WBXMLTreeNode *pCursor_Port = pCursor_PxPhysical->children;
1489 while (pCursor_Port != 0) {
1490 if (pCursor_Port->type == WBXML_TREE_ELEMENT_NODE) {
1491 const WB_UTINY *tag_name = wbxml_tag_get_xml_name(pCursor_Port->name);
1492 if (strcmp((const char *)tag_name, "parm") == 0) {
1493 WBXMLList *_param_attrs = pCursor_Port->attrs;
1494 WB_ULONG _param_index = 0;
1495 WB_ULONG _param_nb_attrs = wbxml_list_len(_param_attrs);
1496 while (_param_index < _param_nb_attrs) {
1497 WBXMLAttribute *_param_attr = (WBXMLAttribute *) wbxml_list_get(_param_attrs, _param_index);
1498 if (WBXML_STRCMP("name", wbxml_attribute_get_xml_name(_param_attr)) == 0) {
1499 if (WBXML_STRCMP("PORTNBR", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
1500 ___set_Param(pCursor_Port, &(port->portnbr));
1501 if(port->portnbr != NULL) {
1502 _DEBUG_VERBOSE("[%d] PORTNBR : %s", _param_index, port->portnbr);
1504 } else if (WBXML_STRCMP("SERVICE", wbxml_attribute_get_xml_value(_param_attr)) == 0) {
1505 String_Node *target_ptr = ___get_Last_String_Node(port->service);
1506 if(target_ptr==NULL) {
1507 _DEBUG_VERBOSE("___get_Last_String_Node fail");
1508 free_cp_pxlogical(pxLogical);
1513 ___set_Param(pCursor_Port, &(target_ptr->data));
1514 if(target_ptr->data != NULL) {
1515 _DEBUG_VERBOSE("SERVICE : %s", target_ptr->data);
1517 if (port->service == NULL) {
1518 port->service = target_ptr;
1520 _DEBUG_VERBOSE("free port service");
1521 free_string_node(target_ptr);
1527 _DEBUG_VERBOSE("param_index : %d", _param_index);
1531 pCursor_Port = pCursor_Port->next;
1539 pCursor_PxPhysical = pCursor_PxPhysical->next;
1548 pCursor = pCursor->next;
1556 static void ___set_Param(WBXMLTreeNode * wbxml_dom_node, char **set_value)
1560 retm_if((wbxml_dom_node) == NULL, "wbxml_dom_node is NULL!!");
1562 WBXMLList *attr_list = wbxml_dom_node->attrs;
1564 WB_ULONG nb_attrs = wbxml_list_len(attr_list);
1566 while (index < nb_attrs) {
1567 WBXMLAttribute *attr = (WBXMLAttribute *) wbxml_list_get(attr_list, index);
1568 if (WBXML_STRCMP("value", wbxml_attribute_get_xml_name(attr)) == 0) {
1569 const char *value_str = 0;
1570 value_str = (const char *)wbxml_attribute_get_xml_value(attr);
1572 if (value_str != NULL) {
1573 value_len = strlen(value_str);
1576 *set_value = (char *)calloc(value_len + 1, sizeof(char));
1577 if (*set_value == NULL) {
1581 str_len = g_strlcpy(*set_value, value_str, value_len + 1);
1582 if (str_len >= sizeof(*set_value)) {
1583 _DEBUG_VERBOSE("buffer overflow");