26 #include <libgupnp/gupnp-control-point.h>
29 #include <libgssdp/gssdp.h>
31 #include <arpa/inet.h>
32 #include <sys/ioctl.h>
40 #include "secure_wrapper.h"
41 #include <sysevent/sysevent.h>
42 #include <glib/gprintf.h>
44 #include <glib/gstdio.h>
45 #include "rdk_safeclib.h"
51 #include <platform_hal.h>
52 #include <syscfg/syscfg.h>
54 #if defined(CLIENT_XCAL_SERVER) && !defined(BROADBAND)
57 #include <libsoup/soup.h>
59 #define CLIENT_CONTEXT_PORT 50767
60 #define IDM_CLIENT_DEVICE "urn:schemas-upnp-org:device:IDM:1"
61 #define IDM_SERVICE "urn:schemas-upnp-org:service:X1IDM:1"
62 #define IDM_DP_CLIENT_DEVICE "urn:schemas-upnp-org:device:IDM_DP:1"
63 #define IDM_DP_SERVICE "urn:schemas-upnp-org:service:X1IDM_DP:1"
64 #define IDM_CERT_FILE "/tmp/idm_xpki_cert"
65 #define IDM_KEY_FILE "/tmp/idm_xpki_key"
66 #define IDM_CA_FILE "/tmp/idm_UPnP_CA"
68 int idm_upnp_restart_triggered = 0;
69 typedef GTlsInteraction XupnpTlsInteraction;
70 typedef GTlsInteractionClass XupnpTlsInteractionClass;
71 static void xupnp_tls_interaction_init (XupnpTlsInteraction *interaction);
72 static void xupnp_tls_interaction_class_init (XupnpTlsInteractionClass *xupnpClass);
73 int s_sysevent_connect (token_t *out_se_token);
74 int SE_msg_receive(
int fd,
char *replymsg,
unsigned int *replymsg_size, token_t *who);
75 GType xupnp_tls_interaction_get_type (
void);
77 G_DEFINE_TYPE (XupnpTlsInteraction, xupnp_tls_interaction, G_TYPE_TLS_INTERACTION);
82 gint result = g_strcmp0(g_strstrip(gwData1->serial_num->str),g_strstrip(gwData2->serial_num->str));
89 if (g_strcmp0(g_strstrip(gwData->serial_num->str),g_strstrip((gchar *)sno)) == 0)
94 int s_sysevent_connect (token_t *out_se_token)
96 static token_t sysevent_token = 0;
99 unsigned short sysevent_port = SE_SERVER_WELL_KNOWN_PORT;
100 char *sysevent_ip =
"127.0.0.1";
101 char *sysevent_name =
"idm_client";
102 fd = sysevent_open(sysevent_ip, sysevent_port, SE_VERSION, sysevent_name, &sysevent_token);
103 g_message(
"%s: open new sysevent fd %d", __FUNCTION__,fd);
107 g_message(
"Inside %s:%d",__FUNCTION__,__LINE__);
109 *out_se_token = sysevent_token;
112 int EventListen(
void)
120 retval=select(fd+1, &rfds, NULL, NULL, NULL);
124 se_buffer msg_buffer;
125 se_notification_msg *msg_body = (se_notification_msg *)msg_buffer;
126 unsigned int msg_size;
130 msg_size =
sizeof(msg_buffer);
131 msg_type = SE_msg_receive(fd, msg_buffer, &msg_size, &from);
133 if (SE_MSG_NOTIFICATION == msg_type)
142 data_ptr = (
char *)&(msg_body->data);
143 name_str = (
char *)SE_msg_get_string(data_ptr, &name_bytes);
144 data_ptr += name_bytes;
145 value_str = (
char *)SE_msg_get_string(data_ptr, &value_bytes);
146 if(!strcmp(name_str,
"wan-status"))
148 if (!strncmp(value_str,
"started", 7))
150 g_message(
"wan-status returned started");
153 else if (!strncmp(value_str,
"stopped", 7))
155 g_message(
"wan-status returned stopped");
162 g_message(
"Received msg that is not a SE_MSG_NOTIFICATION (%d)\n", msg_type);
167 g_message(
"%s: Received no event retval=%d\n", __FUNCTION__, retval);
171 void* EventHandler(
void* args)
173 char wan_status[8]={
'\0'};
175 async_id_t wan_status_id;
178 fd = s_sysevent_connect(&token);
179 sysevent_set_options(fd, token,
"wan-status", TUPLE_FLAG_EVENT);
180 rc = sysevent_setnotification(fd, token,
"wan-status", &wan_status_id);
183 g_message(
"goto start");
186 if ( 0 == sysevent_get(fd, token,
"wan-status", wan_status,
sizeof(wan_status)) &&
'\0' != wan_status)
188 if (0 == strncmp(wan_status,
"stopped",strlen(
"stopped")))
190 g_message(
"present wan-status stopped");
191 gupnp_set_cert_flags(0x0010);
195 g_message(
"present wan-status started");
196 sysevent_rmnotification(fd, token, wan_status_id);
197 sysevent_close(fd, token);
205 g_message(
"EventListen returned zero");
206 gupnp_set_cert_flags(0x001C);
207 v_secure_system(
"/etc/Xupnp/idm_certs.sh");
212 g_message(
"EventListen returned minus 1");
213 gupnp_set_cert_flags(0x0010);
217 g_message(
"EventListen returned neither 1 or -1");
220 sysevent_rmnotification(fd, token, wan_status_id);
221 sysevent_close(fd, token);
228 xupnp_tls_interaction_init (XupnpTlsInteraction *interaction)
232 static GTlsInteractionResult
233 xupnp_tls_interaction_request_certificate (GTlsInteraction *interaction,
234 GTlsConnection *connection,
235 GTlsCertificateRequestFlags flags,
236 GCancellable *cancellable,
239 GTlsCertificate *cert;
240 GError *xupnp_error = NULL;
242 if ((certFile == NULL) || (keyFile == NULL) ) {
244 g_message(
" Certificate or Key file NULL");
245 return G_TLS_INTERACTION_FAILED;
248 cert = g_tls_certificate_new_from_files (certFile,
251 g_assert_no_error (xupnp_error);
253 g_tls_connection_set_certificate (connection, cert);
254 g_object_unref (cert);
256 return G_TLS_INTERACTION_HANDLED;
260 xupnp_tls_interaction_class_init (XupnpTlsInteractionClass *xupnpClass)
262 GTlsInteractionClass *interaction_class = G_TLS_INTERACTION_CLASS (xupnpClass);
264 interaction_class->request_certificate = xupnp_tls_interaction_request_certificate;
269 gwydata->serial_num = g_string_new(NULL);
270 gwydata->bcastmacaddress = g_string_new(NULL);
271 gwydata->clientip = g_string_new(NULL);
272 gwydata->receiverid = g_string_new(NULL);
273 gwydata->gwyipv6 = g_string_new(NULL);
274 gwydata->sproxy=NULL;
275 gwydata->sproxy_i=NULL;
281 const char * responseFn, gchar ** result, gboolean isInCriticalPath)
283 GError *error = NULL;
285 GUPnPServiceProxyAction *action;
286 action = gupnp_service_proxy_action_new (requestFn, NULL);
287 gupnp_service_proxy_call_action ((GUPnPServiceProxy *)sproxy, action, NULL, &error);
290 gupnp_service_proxy_action_get_result (action,
291 &error, responseFn, G_TYPE_STRING, result, NULL);
292 g_clear_pointer (&action, gupnp_service_proxy_action_unref);
295 gupnp_service_proxy_send_action ((GUPnPServiceProxy *)sproxy, requestFn, &error,NULL, responseFn, G_TYPE_STRING, result ,NULL);
299 g_message (
"%s process gw services Error: %s\n", requestFn, error->message);
300 if ( isInCriticalPath )
302 g_message(
"TELEMETRY_XUPNP_PARTIAL_DISCOVERY:%d,%s",error->code, requestFn);
304 g_clear_error(&error);
312 guint sleepCounter=0;
314 usleep(sleep_seconds);
319 if((sleepCounter > 6) && (sleepCounter < 12))
321 g_message(
"Device Addition %u going in main loop",deviceAddNo);
324 usleep(sleep_seconds);
330 if (gssdp_resource_browser_rescan(GSSDP_RESOURCE_BROWSER(cp))==FALSE)
332 g_message(
"Forced rescan failed");
333 usleep(sleep_seconds);
336 if (gssdp_resource_browser_rescan(GSSDP_RESOURCE_BROWSER(cp_bgw))==FALSE)
338 g_message(
"Forced rescan failed for broadband");
339 usleep(sleep_seconds);
342 usleep(sleep_seconds);
349 GList* lstXdev = g_list_find_custom (xdevlist, serial_num, (GCompareFunc)g_list_find_sno);
355 xdevlist = g_list_remove_link(xdevlist, lstXdev);
359 strcpy(di.Ipv4,gwydata->clientip->str);
360 strcpy(di.mac,gwydata->bcastmacaddress->str);
361 strcpy(di.Ipv6,gwydata->gwyipv6->str);
362 g_message(
"callback=%p",callback);
364 g_string_free(gwydata->serial_num,
TRUE);
365 g_string_free(gwydata->bcastmacaddress,
TRUE);
366 g_string_free(gwydata->gwyipv6,
TRUE);
367 g_string_free(gwydata->clientip,
TRUE);
368 g_string_free(gwydata->receiverid,
TRUE);
371 g_clear_object(&(gwydata->sproxy));
373 if(gwydata->sproxy_i)
375 g_clear_object(&(gwydata->sproxy_i));
379 g_mutex_unlock(mutex);
380 g_message(
"Deleted device %s from the list", serial_num);
381 g_list_free (lstXdev);
386 g_message(
"Device %s to be removed not in the discovered device list", serial_num);
392 device_proxy_unavailable_cb_bgw (GUPnPControlPoint *cp, GUPnPDeviceProxy *dproxy)
394 const gchar* sno = gupnp_device_info_get_serial_number (GUPNP_DEVICE_INFO (dproxy));
395 g_message (
"In unavailable_bgw Device %s went down",sno);
396 if((g_strcmp0(g_strstrip(ownSerialNo->str),sno) == 0))
398 g_message (
"Self Device [%s][%s] not removing",sno,ownSerialNo->str);
399 g_free((gpointer)sno);
404 g_message(
"%s found, but unable to delete it from list", sno);
409 g_message(
"Deleted %s from list", sno);
411 g_free((gpointer)sno);
415 device_proxy_available_cb_bgw (GUPnPControlPoint *cp, GUPnPDeviceProxy *dproxy)
417 g_message(
"In available_bgw found a Broadband device. deviceAddNo = %u ",deviceAddNo);
419 if ((NULL==cp) || (NULL==dproxy))
422 g_message(
"WARNING - Received a null pointer for broadband device device no %u",deviceAddNo);
425 gchar* sno = gupnp_device_info_get_serial_number (GUPNP_DEVICE_INFO (dproxy));
426 GList* xdevlistitem = g_list_find_custom(xdevlist,sno,(GCompareFunc)g_list_find_sno);
427 if(xdevlistitem!=NULL)
430 g_message(
"Existing available_cb_bgw as SNO is present in list so no update of devices %s device no %u",sno,deviceAddNo);
431 g_free((gpointer)sno);
436 gwydata->sproxy_i = gupnp_device_info_get_service(GUPNP_DEVICE_INFO (dproxy), IDM_DP_SERVICE);
439 g_message(
"In available_cb_bgw Broadband device serial number: %s",sno);
440 g_string_assign(gwydata->serial_num, sno);
441 const char* udn = gupnp_device_info_get_udn(GUPNP_DEVICE_INFO (dproxy));
444 if (g_strrstr(udn,
"uuid:"))
446 gchar* receiverid = g_strndup(udn+5, strlen(udn)-5);
449 g_message(
"Gateway device receiver id is %s",receiverid);
451 memset(&di,0,
sizeof(di));
452 g_string_assign(gwydata->receiverid, receiverid);
455 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy_i,
"GetClientIP",
"ClientIP" , &temp, FALSE))
457 g_string_assign(gwydata->clientip, temp);
458 strncpy(di.Ipv4,gwydata->clientip->str,IPv4_ADDR_SIZE);
459 g_message(
"clientIP=%s",di.Ipv4);
462 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy_i,
"GetBcastMacAddress",
"BcastMacAddress" , &temp, FALSE))
464 g_string_assign(gwydata->bcastmacaddress, temp);
465 strncpy(di.mac,gwydata->bcastmacaddress->str,MAC_ADDR_SIZE);
466 g_message(
"BcastMacAddress=%s",di.mac);
469 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy_i,
"GetGatewayIPv6",
"GatewayIPv6" , &temp, FALSE))
471 g_string_assign(gwydata->gwyipv6,temp);
472 strncpy(di.Ipv6,gwydata->gwyipv6->str,IPv6_ADDR_SIZE);
473 g_message(
"GatewayIPv6=%s",di.Ipv6);
476 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy_i,
"GetAccountId",
"AccountId", &temp, FALSE))
478 int valid_account=1,loop=0;
479 g_message(
"Discovered device sent accountId as %s",temp);
480 for(loop=0;loop<(int)(strlen(temp));loop++)
482 if(temp[loop] <
'0' || temp[loop] >
'9')
484 g_message(
"not a valid account due to %c presence",temp[loop]);
491 g_message(
"Discovered device AccountId is valid");
492 if(g_strcmp0(g_strstrip(accountId),temp)==0)
495 xdevlist = g_list_insert_sorted_with_data(xdevlist, gwydata,(GCompareDataFunc)g_list_compare_sno, NULL);
496 g_mutex_unlock(mutex);
497 g_message(
"Inserted new/updated device %s in the list as accountId %s is same", sno,temp);
502 g_message(
"Not adding to the list as accountId %s is different",temp);
507 g_message(
"Its not valid accountID so accountId %s not adding to the list",temp);
514 g_message(
"In available_cb_bgw gateway device receiver id is NULL");
520 g_message(
"Gateway UDN is NULL");
525 g_message(
"Exiting from device_proxy_available_cb_broadband deviceAddNo = %u",deviceAddNo);
528 static void device_proxy_available_cb (GUPnPControlPoint *cp, GUPnPDeviceProxy *dproxy)
530 g_message(
"Found a new device. deviceAddNo = %u ",deviceAddNo);
532 if ((NULL==cp) || (NULL==dproxy))
535 g_message(
"WARNING - Received a null pointer for gateway device device no %u",deviceAddNo);
538 gchar* sno = gupnp_device_info_get_serial_number (GUPNP_DEVICE_INFO (dproxy));
539 GList* xdevlistitem = g_list_find_custom(xdevlist,sno,(GCompareFunc)g_list_find_sno);
540 if(xdevlistitem!=NULL)
543 g_message(
"Existing as SNO is present in list so no update of devices %s device no %u",sno,deviceAddNo);
554 g_critical(
"Could not allocate memory for Gwydata. Exiting...");
557 gwydata->sproxy = gupnp_device_info_get_service(GUPNP_DEVICE_INFO (dproxy), IDM_SERVICE);
561 g_message(
"Unable to get the services, sproxy null. returning");
566 g_message(
"Device serial number is %s",sno);
567 g_string_assign(gwydata->serial_num, sno);
568 const char* udn = gupnp_device_info_get_udn(GUPNP_DEVICE_INFO (dproxy));
571 if (g_strrstr(udn,
"uuid:"))
573 gchar* receiverid = g_strndup(udn+5, strlen(udn)-5);
576 g_message(
"Device receiver id is %s",receiverid);
577 g_string_assign(gwydata->receiverid, receiverid);
581 memset(&di,0,
sizeof(di));
582 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy,
"GetClientIP",
"ClientIP" , &temp, FALSE))
584 g_string_assign(gwydata->clientip, temp);
585 strncpy(di.Ipv4,gwydata->clientip->str,IPv4_ADDR_SIZE);
586 g_message(
"clientIP=%s",di.Ipv4);
589 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy,
"GetBcastMacAddress",
"BcastMacAddress" , &temp, FALSE))
591 g_string_assign(gwydata->bcastmacaddress, temp);
592 strncpy(di.mac,gwydata->bcastmacaddress->str,MAC_ADDR_SIZE);
593 g_message(
"BcastMacAddress=%s",di.mac);
596 if (
processStringRequest((GUPnPServiceProxy *)gwydata->sproxy,
"GetGatewayIPv6",
"GatewayIPv6" , &temp, FALSE))
598 g_string_assign(gwydata->gwyipv6,temp);
599 strncpy(di.Ipv6,gwydata->gwyipv6->str,IPv6_ADDR_SIZE);
600 g_message(
"GatewayIPv6=%s",di.Ipv6);
604 xdevlist = g_list_insert_sorted_with_data(xdevlist, gwydata,(GCompareDataFunc)g_list_compare_sno, NULL);
605 g_mutex_unlock(mutex);
606 g_message(
"Inserted new/updated device %s in the list", sno);
610 g_message(
"Device receiver id is NULL");
614 g_message(
"Device UDN is NULL");
618 g_message(
"Exiting from device_proxy_available_cb deviceAddNo = %u",deviceAddNo);
622 void remove_entries_in_list()
624 g_message(
"%s:%d Entered.",__FUNCTION__,__LINE__);
625 if (g_list_length(xdevlist) > 0)
627 GList *element = NULL;
628 element = g_list_first(xdevlist);
633 xdevlist = g_list_remove_link(xdevlist,element);
634 g_message(
"%s:%d Deleting %s from the list",__FUNCTION__,__LINE__,gwydata->bcastmacaddress->str);
635 g_string_free(gwydata->serial_num,
TRUE);
636 g_string_free(gwydata->bcastmacaddress,
TRUE);
637 g_string_free(gwydata->gwyipv6,
TRUE);
638 g_string_free(gwydata->clientip,
TRUE);
639 g_string_free(gwydata->receiverid,
TRUE);
642 g_clear_object(&(gwydata->sproxy));
644 if(gwydata->sproxy_i)
646 g_clear_object(&(gwydata->sproxy_i));
649 g_mutex_unlock(mutex);
650 element = g_list_next(element);
657 g_message(
"%s:%d Called.",__FUNCTION__,__LINE__);
658 if(g_main_loop_is_running(main_loop))
660 idm_upnp_restart_triggered = 1;
661 g_main_loop_quit(main_loop);
663 g_message(
"%s:%d completed",__FUNCTION__,__LINE__);
669 if(!(dc_obj->interface)||(dc_obj->port)==0||(dc_obj->discovery_interval)==0||(dc_obj->loss_detection_window)==0)
671 g_message(
"some of mandatory values are missing");
672 g_message(
"interface=%s port=%d discovery_interval=%d loss_detection_window=%d\n", dc_obj->interface, dc_obj->port, dc_obj->discovery_interval, dc_obj->loss_detection_window);
675 g_message(
"interface=%s port=%d",dc_obj->interface,dc_obj->port);
676 g_thread_init (NULL);
679 ownSerialNo=g_string_new(NULL);
681 callback=func_callback;
685 memset(accountId,0,ACCOUNTID_SIZE);
688 getAccountId(accountId);
689 g_message(
"%s:AccountId=%s",__FUNCTION__,accountId);
690 rc = strcasecmp_s(
"unknown",strlen(
"unknown"),accountId,&ind);
699 rvalue=idm_server_start(dc_obj->interface, dc_obj->base_mac);
702 g_message(
"id_server_start has facing some issue");
705 mutex = g_mutex_new ();
707 GTlsInteraction *xupnp_tlsinteraction= NULL;
708 char caFile[24]=IDM_CA_FILE;
709 strcpy(certFile,IDM_CERT_FILE);
710 strcpy(keyFile,IDM_KEY_FILE);
711 g_message(
"cert file=%s key file = %s",certFile,keyFile);
712 if((access(certFile,F_OK ) == 0) && (access(keyFile,F_OK ) == 0) && (access(caFile,F_OK ) == 0))
715 upnpContextDeviceProtect = gupnp_context_new_s ( NULL, dc_obj->interface, dc_obj->port,certFile,keyFile, &error);
717 upnpContextDeviceProtect = gupnp_context_new_s (dc_obj->interface, dc_obj->port,certFile,keyFile, &error);
720 g_printerr (
"%s:%d Error creating the Device Protection Broadcast context: %s\n",
721 __FUNCTION__,__LINE__,error->message);
723 g_clear_error(&error);
727 g_message(
"IDM UPnP is running in secure mode");
728 gupnp_context_set_subscription_timeout(upnpContextDeviceProtect, 0);
729 xupnp_tlsinteraction = g_object_new (xupnp_tls_interaction_get_type (), NULL);
730 g_message(
"tls interaction object created");
732 gupnp_context_set_tls_params(upnpContextDeviceProtect,caFile,keyFile, xupnp_tlsinteraction);
733 if(idm_upnp_restart_triggered == 0)
735 pthread_t event_handle_thread;
736 int err = pthread_create(&event_handle_thread, NULL,&EventHandler,NULL);
739 g_message(
"%s: create the event handle thread error!\n", __FUNCTION__);
742 cp_bgw = gupnp_control_point_new(upnpContextDeviceProtect, IDM_DP_CLIENT_DEVICE);
743 g_signal_connect (cp_bgw,
"device-proxy-available", G_CALLBACK (device_proxy_available_cb_bgw), NULL);
744 g_signal_connect (cp_bgw,
"device-proxy-unavailable", G_CALLBACK (device_proxy_unavailable_cb_bgw), NULL);
745 gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp_bgw),
TRUE);
746 g_message(
"X1BroadbandGateway controlpoint created for idm");
751 g_message(
"%s:mandatory files doesn't present",__FUNCTION__);
754 main_loop = g_main_loop_new (NULL, FALSE);
756 main_loop = g_main_loop_new (upnpContextDeviceProtect, FALSE);
759 g_message(
"IDM is running in non secure mode");
762 main_context = g_main_context_new();
763 context = gupnp_context_new (main_context, dc_obj->interface, CLIENT_CONTEXT_PORT, &error);
765 context = gupnp_context_new (NULL, dc_obj->interface, CLIENT_CONTEXT_PORT, &error);
768 context = gupnp_context_new (dc_obj->interface, CLIENT_CONTEXT_PORT, &error);
771 g_message (
"Error creating the GUPnP context: %s", error->message);
772 g_critical(
"%s:Error creating the XUPnP context on %s:%d Error:%s", __FUNCTION__,dc_obj->interface, CLIENT_CONTEXT_PORT, error->message);
773 g_error_free (error);
776 gupnp_context_set_subscription_timeout(context, 0);
777 cp = gupnp_control_point_new(context, IDM_CLIENT_DEVICE);
778 g_signal_connect (cp,
"device-proxy-available", G_CALLBACK (device_proxy_available_cb), NULL);
779 g_signal_connect (cp,
"device-proxy-unavailable", G_CALLBACK (device_proxy_unavailable_cb_bgw), NULL);
780 gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp),
TRUE);
782 main_loop = g_main_loop_new (NULL, FALSE);
784 main_loop = g_main_loop_new (main_context, FALSE);
787 sleep_seconds=((dc_obj->loss_detection_window+8)*1000000);
788 g_message(
"%s %d calling discovery_interval_configuration function %u loss_detection_window=%u",__FUNCTION__,__LINE__,dc_obj->discovery_interval,dc_obj->loss_detection_window);
789 dc_obj->discovery_interval=dc_obj->discovery_interval*1000;
790 discovery_interval_configuration(dc_obj->discovery_interval,dc_obj->loss_detection_window);
791 g_message(
"done timeout source assigning\n");
792 if(idm_upnp_restart_triggered == 0)
794 g_thread_create(verify_devices, NULL,FALSE, NULL);
796 g_main_loop_run (main_loop);
797 g_message(
"%s:%d main loop broken",__FUNCTION__,__LINE__);
800 gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp_bgw), FALSE);
802 gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), FALSE);
804 g_message(
"invoke free_server_memory");
805 free_server_memory();
806 g_message(
"Invoke remove_entries_in_list");
807 remove_entries_in_list();
808 g_main_loop_unref (main_loop);
811 g_object_unref (context);
813 g_object_unref (cp_bgw);
814 g_object_unref (upnpContextDeviceProtect);
815 g_object_unref (xupnp_tlsinteraction);
819 g_message(
"%s:%d Completed.",__FUNCTION__,__LINE__);