RDK Documentation (Open Sourced RDK Components)
xcal-device-main.c
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #include <libgupnp/gupnp.h>
20 //#include <libgssdp/gssdp.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <gmodule.h>
24 #include <stdbool.h>
25 #include <memory.h>
26 #include <libxml/tree.h>
27 #include <libxml/parser.h>
28 
29 #include <string.h>
30 #include "secure_wrapper.h"
31 #include "xdevice.h"
32 #ifdef INCLUDE_BREAKPAD
33 #include "breakpad_wrapper.h"
34 #else
35 #endif
36 #ifdef ENABLE_SD_NOTIFY
37 #include <systemd/sd-daemon.h>
38 #endif
39 #include "rdk_safeclib.h"
40 
41 #define DEVICE_XML_PATH "/etc/xupnp/"
42 #define DEVICE_XML_FILE "BasicDevice.xml"
43 #define CLIENT_DEVICE_XML_FILE "X1Renderer.xml"
44 #define GW_DEVICE_XML_FILE "X1VideoGateway.xml"
45 #define BROADBAND_DEVICE_XML_FILE "X1BroadbandGateway.xml"
46 #define LOG_FILE "/opt/logs/xdevice.log"
47 #define DEVICE_PROTECTION_CONTEXT_PORT 50757
48 
49 #define MAXSIZE 256
50 #define RUIURLSIZE 2048
51 #define URLSIZE 512
52 #ifndef BOOL
53 #define BOOL unsigned char
54 #endif
55 #ifndef BROADBAND
56 int xPKI_check_rfc();
57 #endif
58 static GMainLoop *main_loop;
59 
60 char devBcastIf[MAXSIZE],serial_Num[MAXSIZE], cvpInterface[MAXSIZE], cvPXmlFile[MAXSIZE],playBackUrl[URLSIZE],devXMlPath[MAXSIZE],uUid[MAXSIZE],ruiUrl[RUIURLSIZE];
61 char devXMlFile [MAXSIZE],devBcastIf[MAXSIZE],serial_Num[MAXSIZE],cvpInterface[MAXSIZE],cvPXmlFile[MAXSIZE],ipv6preFix[MAXSIZE],trmUrl[MAXSIZE],urL[MAXSIZE];
62 
63 char gwyIp[MAXSIZE],gwyIpv6[MAXSIZE],gwystbIp[MAXSIZE],hostMacaddress[MAXSIZE],bcastMacaddress[MAXSIZE],recvdevType[MAXSIZE],deviceType[MAXSIZE],modelclass[MAXSIZE],modelNumber[MAXSIZE],deviceid[MAXSIZE],hardwarerevision[MAXSIZE],softwarerevision[MAXSIZE],managementurl[MAXSIZE],Make[MAXSIZE],accountId[MAXSIZE],clientIp[MAXSIZE];
64 char buildVersion[MAXSIZE],dnsConfig[MAXSIZE],systemIds[MAXSIZE],dataGatewayIPAddress[MAXSIZE],dsgtimeZone[MAXSIZE],deviceName[MAXSIZE],etcHosts[RUIURLSIZE],receiverId[MAXSIZE],ipsubnet[MAXSIZE];
65 char devPXmlFile[MAXSIZE], devCertFile[MAXSIZE], devCertPath[MAXSIZE], devKeyFile[MAXSIZE], devKeyPath[MAXSIZE];
66 gint rawoffset, dstoffset, dstsavings, devBcastPort, cvpPort;
67 gboolean usedaylightsavings,allowgwy,requiresTrm;
68 char *caFile="/tmp/UPnP_CA";
69 
70 static int rfc_enabled;
71 #ifdef SAFEC_DUMMY_API
72 //adding strcmp_s defination
73 errno_t strcmp_s(const char * d,int max ,const char * src,int *r)
74 {
75  *r= strcmp(d,src);
76  return EOK;
77 }
78 #endif
79 
80 static xmlNode * get_node_by_name(xmlNode * node, const char *node_name)
81 {
82  errno_t rc = -1;
83  int ind = -1;
84  xmlNode * cur_node = NULL;
85  xmlNode * ret = NULL;
86 
87  for (cur_node = node ; cur_node ; cur_node = cur_node->next)
88  {
89  rc = strcmp_s(cur_node->name, strlen(cur_node->name), node_name, &ind);
90  ERR_CHK(rc);
91  if ((ind ==0) && (rc == EOK))
92  {
93  return cur_node;
94  }
95  ret = get_node_by_name(cur_node->children, node_name);
96  if ( ret != NULL )
97  break;
98  }
99  return ret;
100 }
101 
102 
103 /**
104  * @brief This function is used to set new value to the given node from the xml file.
105  *
106  * @param[in] doc Xml document.
107  * @param[in] node_name The name of the node to be updated.
108  * @param[in] new_value New value to be set for the node.
109  *
110  * @return Returns Integer value '0' if successfully sets the new node value else returns '1'.
111  * @ingroup XUPNP_XCALDEV_FUNC
112  */
113 int set_content(xmlDoc* doc, const char * node_name, const char * new_value)
114 {
115  xmlNode * root_element = NULL;
116  xmlNode * target_node = NULL;
117 
118  root_element = xmlDocGetRootElement(doc);
119  target_node = get_node_by_name(root_element, node_name);
120 
121  if (target_node==NULL)
122  {
123  g_printerr("Couldn't locate the Target node\n");
124  return 1;
125  }
126 
127  xmlNodeSetContent(target_node,new_value);
128 
129  return 0;
130 }
131 
132 
133 
134 /**
135  * @brief This function is used to update the xml node values UDN, serialNumber and friendlyName.
136  *
137  * @param[in] xmlfilename Name of the XML file.
138  * @param[in] struuid Unique device Id .
139  * @param[in] serialno Serial number.
140  * @param[in] friendlyName Friendly name.
141  *
142  * @return Returns TRUE if successfully updated the xml data else returns FALSE.
143  * @ingroup XUPNP_XCALDEV_FUNC
144  */
145 
146 BOOL updatexmldata(const char* xmlfilename, const char* struuid, const char* serialno, const char* friendlyName)
147 {
148  LIBXML_TEST_VERSION
149 
150  xmlDoc * doc = open_document(xmlfilename);
151 
152  if (doc == NULL)
153  {
154  g_printerr ("Error reading the Device XML file\n");
155  return FALSE;
156  }
157  if(rfc_enabled)
158  {
159  if (set_content(doc, "UPC", "10000")!=0)
160  {
161  g_printerr ("Error setting the upc in conf xml\n");
162  return FALSE;
163  }
164  g_message("Added UPC value to %s",xmlfilename);
165  }
166  else
167  {
168  if (set_content(doc, "UPC", "")!=0)
169  {
170  g_printerr ("Error setting the upc in conf xml\n");
171  return FALSE;
172  }
173  g_message("Updated UPC value as empty string in %s",xmlfilename);
174  }
175  if (set_content(doc, "UDN", struuid)!=0)
176  {
177  g_printerr ("Error setting the unique device id in conf xml\n");
178  return FALSE;
179  }
180  if (set_content(doc, "serialNumber", serialno)!=0)
181  {
182  g_printerr ("Error setting the serial number in conf xml\n");
183  return FALSE;
184  }
185  if(NULL != friendlyName)
186  {
187  if (set_content(doc, "friendlyName", friendlyName)!=0)
188  {
189  g_printerr ("Error setting the friendlyName number in conf xml\n");
190  return FALSE;
191  }
192  }
193  else
194  {
195  g_printerr ("friendlyName is NULL\n");
196  }
197 
198  FILE *fp = fopen(xmlfilename, "w");
199 
200  if (fp==NULL)
201  {
202  g_printerr ("Error opening the conf xml file for writing\n");
203  return FALSE;
204  }
205  else if (xmlDocFormatDump(fp, doc, 1) == -1)
206  {
207  g_printerr ("Could not write the conf to xml file\n");
208  /*Coverity Fix CID 125137,28460 RESOURCE_LEAK */
209  fclose(fp);
210  xmlFreeDoc(doc);
211 
212  return FALSE;
213  }
214 
215  fclose(fp);
216 
217  xmlFreeDoc(doc);
218  xmlCleanupParser();
219  return TRUE;
220 }
221 
222 /**
223  * @brief A generic function to notify all the clients whenever there is a change found in the
224  * service variable values.
225  *
226  * @param[in] varname Node name to be notified.
227  * @param[in] strvalue New value to be notified.
228  * @ingroup XUPNP_XCALDEV_FUNC
229  */
230 void notify_value_change(const char* varname, const char* strvalue)
231 {
232  if ((service_ready==FALSE) )
233  {
234  g_warning("Received notificaton before start of Service");
235  }
236  else
237  {
238 // GValue value = {0};
239  GValue value = G_VALUE_INIT;
240  g_value_init(&value, G_TYPE_STRING);
241  g_value_set_static_string(&value, strvalue);
242  g_message("Sending value change notification Name %s - Value: %s", varname, strvalue);
243  gupnp_service_notify_value((GUPnPService *)upnpService, varname, &value);
244  //g_value_unset(&value);
245  }
246  return;
247 }
248 
249 /**
250  * @brief Supporting function for reading the XML file
251  *
252  * @param[in] file_name Name of the xml file
253  *
254  * @return Returns the resulting document tree.
255  * @ingroup XUPNP_XCALDEV_FUNC
256  */
257 xmlDoc * open_document(const char * file_name)
258 {
259  xmlDoc * ret;
260 
261  ret = xmlReadFile(file_name, NULL, 0);
262  if (ret == NULL)
263  {
264  //g_printerr("Failed to parse %s\n", file_name);
265  return NULL;
266  }
267  return ret;
268 }
269 
270 /**
271  * @brief Callback function which is invoked when getBaseURL action is invoked and this sets the
272  * state variable for base url.
273  *
274  * @param[in] service Name of the service.
275  * @param[out] action Action to be invoked.
276  * @param[in] user_data Usually null will be passed.
277  *
278  * @ingroup XUPNP_XCALDEV_FUNC
279  */
280 /* GetBaseUrl */
281 G_MODULE_EXPORT void
282 get_url_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
283 {
284  //static int counter=0;
285  //counter++;
286  //g_print ("Got a call back for url %d\n", counter);
287  getBaseUrl(urL);
288  gupnp_service_action_set (action, "BaseUrl", G_TYPE_STRING, urL, NULL);
289  gupnp_service_action_return (action);
290 }
291 /**
292  * @brief Callback function which is invoked when getBaseTrmUrl action is invoked and this sets the state
293  * variable for base TRM Url.
294  *
295  * @param[in] service Name of the service.
296  * @param[out] action Action to be invoked.
297  * @param[in] user_data Usually null will be passed.
298  *
299  * @ingroup XUPNP_XCALDEV_FUNC
300  */
301 /* GetBaseTrmUrl */
302 G_MODULE_EXPORT void
303 get_trm_url_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
304 {
305  //g_print ("Got a call back for trm url, value is %s\n", trmurl->str); trmUrl
306  getTrmUrl(trmUrl);
307  gupnp_service_action_set (action, "BaseTrmUrl", G_TYPE_STRING, trmUrl, NULL);
308  gupnp_service_action_return (action);
309 }
310 /**
311  * @brief Callback function which is invoked when getPlaybackUrl action is invoked and this sets
312  * the state variable for Playback Url.
313  *
314  * @param[in] service Name of the service.
315  * @param[out] action Action to be invoked.
316  * @param[in] user_data Usually null will be passed.
317  * @ingroup XUPNP_XCALDEV_FUNC
318  */
319 /* GetPlayBackUrl */
320 G_MODULE_EXPORT void
321 get_playback_url_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
322 {
323  //g_message ("Got a call back for playback url, value is %s\n", playbackurl->str);
324  if (getTuneReady())
325  {
326  //g_message ("Got a call back for playback url, value is %s\n", playbackurl->str);
327  getPlaybackUrl(playBackUrl);
328  gupnp_service_action_set (action, "PlaybackUrl", G_TYPE_STRING, playBackUrl ,NULL);
329  }
330  else
331  {
332  //g_message ("Got a call back for playback url, Sending NULL\n", playbackurl->str);
333  gupnp_service_action_set (action, "PlaybackUrl", G_TYPE_STRING, "NULL", NULL);
334  }
335  gupnp_service_action_return (action);
336 }
337 
338 /**
339  * @brief Callback function which is invoked when getGatewayIP action is invoked and this sets
340  * the state variable for Gateway IP.
341  *
342  * @param[in] service Name of the service.
343  * @param[out] action Action to be invoked.
344  * @param[in] user_data Usually null will be passed.
345  * @ingroup XUPNP_XCALDEV_FUNC
346  */
347 /* GetGatewayIP */
348 G_MODULE_EXPORT void
349 get_gwyip_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
350 {
351  //g_print ("Got a call back\n");
352  getGatewayIp(gwyIp);
353  gupnp_service_action_set (action, "GatewayIP", G_TYPE_STRING, gwyIp, NULL);
354  gupnp_service_action_return (action);
355 }
356 /**
357  * @brief Callback function which is invoked when getGatewayIPv6 action is invoked and this sets
358  * the state variable for Gateway IPv6.
359  *
360  * @param[in] service Name of the service.
361  * @param[out] action Action to be invoked.
362  * @param[in] user_data Usually null will be passed.
363  * @ingroup XUPNP_XCALDEV_FUNC
364  */
365 /* GetGatewayIPv6 */
366 G_MODULE_EXPORT void
367 get_gwyipv6_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
368 {
369  //g_print ("Got a call back\n");
370  getGatewayIpv6(gwyIpv6);
371  gupnp_service_action_set (action, "GatewayIPv6", G_TYPE_STRING, gwyIpv6, NULL);
372  gupnp_service_action_return (action);
373 }
374 /**
375  * @brief Callback function which is invoked when getGatewayStbIP action is invoked and this sets
376  * the state variable for Gateway STB IP.
377  *
378  * @param[in] service Name of the service.
379  * @param[out] action Action to be invoked.
380  * @param[in] user_data Usually null will be passed.
381  *
382  * @ingroup XUPNP_XCALDEV_FUNC
383  */
384 /* GetGatewayIP */
385 G_MODULE_EXPORT void
386 get_gwystbip_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
387 {
388  //g_print ("Got a call back\n");
389  getGatewayStbIp(gwystbIp);
390  gupnp_service_action_set (action, "GatewayStbIP", G_TYPE_STRING, gwystbIp, NULL);
391  gupnp_service_action_return (action);
392 }
393 #ifndef BROADBAND
394 /**
395  * @brief Callback function which is invoked when getIpv6Prefix action is invoked and this sets
396  * the state variable for IPv6 Prefix.
397  *
398  * @param[in] service Name of the service.
399  * @param[out] action Action to be invoked.
400  * @param[in] user_data Usually null will be passed.
401  *
402  * @ingroup XUPNP_XCALDEV_FUNC
403  */
404 /* GetIpv6Prefix */
405 G_MODULE_EXPORT void
406 get_ipv6prefix_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
407 {
408  //g_print ("Got a call back\n"); ipv6preFix
409  getIpv6Prefix(ipv6preFix);
410  gupnp_service_action_set (action, "Ipv6Prefix", G_TYPE_STRING, ipv6preFix, NULL);
411  gupnp_service_action_return (action);
412 }
413 #endif
414 /**
415  * @brief Callback function which is invoked when getHostMacAddress action is invoked and this sets
416  * the state variable for Host MAC Address.
417  *
418  * @param[in] service Name of the service.
419  * @param[out] action Action to be invoked.
420  * @param[in] user_data Usually null will be passed.
421  * @ingroup XUPNP_XCALDEV_FUNC
422  */
423 /* GetHostMacAddress */
424 G_MODULE_EXPORT void
425 get_hostmacaddress_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
426 {
427  //g_print ("Got a call back\n");
428  getHostMacAddress(hostMacaddress);
429  gupnp_service_action_set (action, "HostMacAddress", G_TYPE_STRING, hostMacaddress, NULL);
430  gupnp_service_action_return (action);
431 }
432 /**
433  * @brief Callback function which is invoked when getBcastMacAddress action is invoked and this sets
434  * the state variable for Broadcast MAC Address.
435  *
436  * @param[in] service Name of the service.
437  * @param[out] action Action to be invoked.
438  * @param[in] user_data Usually null will be passed.
439  * @ingroup XUPNP_XCALDEV_FUNC
440  */
441 /* GetBcastMacAddress */
442 G_MODULE_EXPORT void
443 get_bcastmacaddress_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
444 {
445  //g_print ("Got a call back\n");
446 // getBcastMacAddress(bcastMacaddress);
447  gupnp_service_action_set (action, "BcastMacAddress", G_TYPE_STRING, bcastMacaddress, NULL);
448  gupnp_service_action_return (action);
449 }
450 /**
451  * @brief Callback function which is invoked when getRecvDevType action is invoked and this sets
452  * the state variable for Receive Device Type.
453  *
454  * @param[in] service Name of the service.
455  * @param[out] action Action to be invoked.
456  * @param[in] user_data Usually null will be passed.
457  * @ingroup XUPNP_XCALDEV_FUNC
458  */
459 /* GetRecvDevType */
460 G_MODULE_EXPORT void
461 get_recvdevtype_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
462 {
463  //g_print ("Got a call back\n");
464  getRecvDevType(recvdevType);
465  gupnp_service_action_set (action, "RecvDevType", G_TYPE_STRING, recvdevType, NULL);
466  gupnp_service_action_return (action);
467 }
468 /* GetDeviceType */
469 G_MODULE_EXPORT void
470 get_devicetype_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
471 {
472  //g_print ("Got a call back\n");
473  getDeviceType(deviceType);
474  gupnp_service_action_set (action, "DeviceType", G_TYPE_STRING, deviceType, NULL);
475  gupnp_service_action_return (action);
476 }
477 
478 /**
479  * @brief Callback function which is invoked when getBuildVersion action is invoked and this sets
480  * the state variable for Build Version.
481  *
482  * @param[in] service Name of the service.
483  * @param[out] action Action to be invoked.
484  * @param[in] user_data Usually null will be passed.
485  * @ingroup XUPNP_XCALDEV_FUNC
486  */
487 /* GetBuildVersion */
488 G_MODULE_EXPORT void
489 get_buildversion_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
490 {
491  //g_print ("Got a call back\n");
492  getBuildVersion(buildVersion);
493  gupnp_service_action_set (action, "BuildVersion", G_TYPE_STRING, buildVersion, NULL);
494  gupnp_service_action_return (action);
495 }
496 #ifndef BROADBAND
497 /**
498  * @brief Callback function which is invoked when getDnsConfig action is invoked and this sets
499  * the state variable for DNS Config.
500  *
501  * @param[in] service Name of the service.
502  * @param[out] action Action to be invoked.
503  * @param[in] user_data Usually null will be passed.
504  * @ingroup XUPNP_XCALDEV_FUNC
505  */
506 /* GetDnsConfig */
507 G_MODULE_EXPORT void
508 get_dnsconfig_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
509 {
510  getDnsConfig(dnsConfig);
511  gupnp_service_action_set (action, "DnsConfig", G_TYPE_STRING, dnsConfig, NULL);
512  gupnp_service_action_return (action);
513 }
514 #endif
515 /**
516  * @brief Callback function which is invoked when getSystemIds action is invoked and this sets
517  * the state variable for System Id.
518  *
519  * @param[in] service Name of the service.
520  * @param[out] action Action to be invoked.
521  * @param[in] user_data Usually null will be passed.
522  * @ingroup XUPNP_XCALDEV_FUNC
523  */
524 /* GetSystemsIds */
525 G_MODULE_EXPORT void
526 get_systemids_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
527 {
528  //g_print ("Got a call back\n");
529  getSystemsIds(systemIds);
530  gupnp_service_action_set (action, "SystemIds", G_TYPE_STRING, systemIds, NULL);
531  gupnp_service_action_return (action);
532 }
533 /**
534  * @brief Callback function which is invoked when getdataGatewayIPaddress action is invoked and this sets
535  * the state variable for DataGatewayIPaddress.
536  *
537  * @param[in] service Name of the service.
538  * @param[out] action Action to be invoked.
539  * @param[in] user_data Usually null will be passed.
540  * @ingroup XUPNP_XCALDEV_FUNC
541  */
542 /* GetDataGatewayIPaddress */
543 G_MODULE_EXPORT void
544 get_dataGatewayIPaddress_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
545 {
546  if ( rfc_enabled )
547  {
548  getGatewayStbIp(dataGatewayIPAddress);
549  }
550  else
551  {
552  getRouteDataGateway(dataGatewayIPAddress);
553  }
554  gupnp_service_action_set (action, "DataGatewayIPaddress", G_TYPE_STRING, dataGatewayIPAddress, NULL);
555  gupnp_service_action_return (action);
556 }
557 
558 /**
559  * @brief Callback function which is invoked when IPSubNet action is invoked and this sets
560  * the state variable for IPSubNet.
561  *
562  * @param[in] service Name of the service.
563  * @param[out] action Action to be invoked.
564  * @param[in] user_data Usually null will be passed.
565  * @ingroup XUPNP_XCALDEV_FUNC
566  */
567 /* GetIPSubNet */
568 G_MODULE_EXPORT void
569 get_ipsubnet_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
570 {
571  getIpSubnet(ipsubnet);
572  gupnp_service_action_set (action, "IPSubNet", G_TYPE_STRING, ipsubnet, NULL);
573  gupnp_service_action_return (action);
574 }
575 
576 /**
577  * @brief Callback function which is invoked when TimeZone action is invoked and this sets
578  * the state variable for Time Zone.
579  *
580  * @param[in] service Name of the service.
581  * @param[out] action Action to be invoked.
582  * @param[in] user_data Usually null will be passed.
583  * @ingroup XUPNP_XCALDEV_FUNC
584  */
585 /* GetTimeZone */
586 G_MODULE_EXPORT void
587 get_timezone_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
588 {
589  //g_print ("Got a call back\n");
590  if(getIsuseGliDiagEnabled()) {
591  getTimeZone(dsgtimeZone);
592  }
593  gupnp_service_action_set (action, "TimeZone", G_TYPE_STRING, dsgtimeZone, NULL);
594  gupnp_service_action_return (action);
595 }
596 /**
597  * @brief Callback function which is invoked when getRawOffSet action is invoked and this sets
598  * the state variable for Raw Offset.
599  *
600  * @param[in] service Name of the service.
601  * @param[out] action Action to be invoked.
602  * @param[in] user_data Usually null will be passed.
603  * @ingroup XUPNP_XCALDEV_FUNC
604  */
605 /* GetRawOffSet */
606 G_MODULE_EXPORT void
607 get_rawoffset_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
608 {
609  getRawOffSet(&rawoffset);
610  gupnp_service_action_set (action,"RawOffSet", G_TYPE_INT, rawoffset, NULL);
611  gupnp_service_action_return (action);
612 }
613 /**
614  * @brief Callback function which is invoked when getDSTSavings action is invoked and this sets
615  * the state variable for DST Savings.
616  *
617  * @param[in] service Name of the service.
618  * @param[out] action Action to be invoked.
619  * @param[in] user_data Usually null will be passed.
620  * @ingroup XUPNP_XCALDEV_FUNC
621  */
622 /* GetDSTSavings */
623 G_MODULE_EXPORT void
624 get_dstsavings_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
625 {
626  getDstSavings(&dstsavings);
627  gupnp_service_action_set (action,"DSTSavings", G_TYPE_INT, dstsavings, NULL);
628  gupnp_service_action_return (action);
629 }
630 /**
631  * @brief Callback function which is invoked when getUsesDaylightTime action is invoked and this sets
632  * the state variable for Uses Daylight Time.
633  *
634  * @param[in] service Name of the service.
635  * @param[out] action Action to be invoked.
636  * @param[in] user_data Usually null will be passed.
637  * @ingroup XUPNP_XCALDEV_FUNC
638  */
639 /* GetUsesDaylightTime */
640 G_MODULE_EXPORT void
641 get_usesdaylighttime_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
642 {
643  getUsesDayLightTime((unsigned char *)&usedaylightsavings);
644  gupnp_service_action_set (action,"UsesDaylightTime", G_TYPE_BOOLEAN, usedaylightsavings, NULL);
645  gupnp_service_action_return (action);
646 }
647 /**
648  * @brief Callback function which is invoked when getDeviceName action is invoked and this sets
649  * the state variable for Uses Service Name.
650  *
651  * @param[in] service Name of the service.
652  * @param[out] action Action to be invoked.
653  * @param[in] user_data Usually null will be passed.
654  * @ingroup XUPNP_XCALDEV_FUNC
655  */
656 /* GetDeviceName */
657 G_MODULE_EXPORT void
658 get_devicename_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
659 {
660  getDeviceName(deviceName);
661  gupnp_service_action_set (action,"DeviceName", G_TYPE_STRING, deviceName, NULL);
662  gupnp_service_action_return (action);
663 }
664 /**
665  * @brief Callback function which is invoked when getDSTOffset action is invoked and this sets
666  * the state variable for DST Offset.
667  *
668  * @param[in] service Name of the service.
669  * @param[out] action Action to be invoked.
670  * @param[in] user_data Usually null will be passed.
671  * @ingroup XUPNP_XCALDEV_FUNC
672  */
673 /* GetDSTOffset */
674 G_MODULE_EXPORT void
675 get_dstoffset_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
676 {
677  getDstOffset(&dstoffset);
678  gupnp_service_action_set (action,"DSTOffset", G_TYPE_INT, dstoffset, NULL);
679  gupnp_service_action_return (action);
680 }
681 /**
682  * @brief Callback function which is invoked when getHosts action is invoked and this sets
683  * the state variable for Hosts.
684  *
685  * @param[in] service Name of the service.
686  * @param[out] action Action to be invoked.
687  * @param[in] user_data Usually null will be passed.
688  * @ingroup XUPNP_XCALDEV_FUNC
689  */
690 /* GetEtcHosts */
691 G_MODULE_EXPORT void
692 get_hosts_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
693 {
694  //g_print ("Got a call back\n");
695  getHosts(etcHosts);
696  gupnp_service_action_set (action, "Hosts", G_TYPE_STRING, etcHosts, NULL);
697  gupnp_service_action_return (action);
698 }
699 /**
700  * @brief Callback function which is invoked when getIsGateway action is invoked and this sets
701  * the state variable for Gatway is active or not.
702  *
703  * @param[in] service Name of the service.
704  * @param[out] action Action to be invoked.
705  * @param[in] user_data Usually null will be passed.
706  * @ingroup XUPNP_XCALDEV_FUNC
707  */
708 /* GetIsGateway */
709 G_MODULE_EXPORT void
710 get_isgateway_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
711 {
712 
713  gchar *clientMacAddr=NULL;
714  gchar *clientIpAddr=NULL;
715  gboolean deviceProtectionEnabled=TRUE;
716  if(rfc_enabled)
717  {
718  if(gupnp_service_action_get_argument_count(action))
719  {
720  gupnp_service_action_get (action, "deviceProtection", G_TYPE_BOOLEAN,&deviceProtectionEnabled, NULL);
721  if(!deviceProtectionEnabled)
722  {
723  gupnp_service_action_get (action, "macAddr", G_TYPE_STRING, &clientMacAddr, NULL);
724  gupnp_service_action_get (action, "ipAddr", G_TYPE_STRING, &clientIpAddr, NULL);
725  if((clientMacAddr) && (clientIpAddr))
726  g_warning("Device Protection Disabled Device : %s,%s",clientMacAddr,clientIpAddr);
727  else
728  g_warning("Device Protection Disabled Device without details");
729  }
730  }
731  else
732  g_warning("Device Protection Not supported legacy Device");
733  }
734  getIsGateway((unsigned char *)&allowgwy);
735  gupnp_service_action_set (action, "IsGateway", G_TYPE_BOOLEAN, allowgwy, NULL);
736  gupnp_service_action_return (action);
737 }
738 /**
739  * @brief Callback function which is invoked when getRequiresTRM action is invoked and this sets
740  * the state variable for Requiring TRM.
741  *
742  * @param[in] service Name of the service.
743  * @param[out] action Action to be invoked.
744  * @param[in] user_data Usually null will be passed.
745  * @ingroup XUPNP_XCALDEV_FUNC
746  */
747 /* IsTrmRequired */
748 G_MODULE_EXPORT void
749 get_requirestrm_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
750 {
751  getRequiresTRM((unsigned char *)&requiresTrm);
752  gupnp_service_action_set (action, "RequiresTRM", G_TYPE_BOOLEAN, requiresTrm, NULL);
753  gupnp_service_action_return (action);
754 }
755 /**
756  * @brief Callback function which is invoked when GetCompatibleUIs action is invoked and this sets
757  * the state variable for InputDeviceProfile, UIFilter and UIListing.
758  *
759  * @param[in] service Name of the service.
760  * @param[out] action Action to be invoked.
761  * @param[in] user_data Usually null will be passed.
762  * @ingroup XUPNP_XCALDEV_FUNC
763  */
764 /* GetRuiBaseUrl */
765 G_MODULE_EXPORT void
766 get_rui_url_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
767 {
768  //must init every callback because it generates a unique
769  //device number for each return value.
770  if(!getRUIUrl(ruiUrl)){
771  g_print("Error in initializing RUI url value\n");
772  //g_print ("Got a call back for Ruiurl, value is %s\n", ruiurl->str);
773  }
774  gupnp_service_action_get (action,"InputDeviceProfile", G_TYPE_STRING, inDevProfile->str, NULL);
775  gupnp_service_action_get (action,"UIFilter", G_TYPE_STRING, uiFilter->str,NULL);
776  gupnp_service_action_set (action, "UIListing", G_TYPE_STRING, ruiUrl, NULL);
777  gupnp_service_action_return (action);
778 }
779 /*Coverity Fix CID: 45236 to 45244 MISSED_RETURN */
780 G_MODULE_EXPORT void
781 get_modelclass_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
782 {
783  //g_print ("Got a call back\n");
784  getDeviceType(modelclass);
785  gupnp_service_action_set (action, "ModelClass", G_TYPE_STRING, modelclass, NULL);
786  gupnp_service_action_return (action);
787 }
788 G_MODULE_EXPORT void
789 get_modelnumber_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
790 {
791  //g_print ("Got a call back\n");
792  getModelNumber(modelNumber);
793  gupnp_service_action_set (action, "ModelNumber", G_TYPE_STRING, modelNumber, NULL);
794  gupnp_service_action_return (action);
795 }
796 G_MODULE_EXPORT void
797 get_deviceid_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
798 {
799  //g_print ("Got a call back\n");
800  gupnp_service_action_set (action, "DeviceId", G_TYPE_STRING, deviceid, NULL);
801  gupnp_service_action_return (action);
802 }
803 G_MODULE_EXPORT void
804 get_hardwarerevision_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
805 {
806  //g_print ("Got a call back\n");
807  gupnp_service_action_set (action, "HardwareRevision", G_TYPE_STRING, hardwarerevision, NULL);
808  gupnp_service_action_return (action);
809 }
810 G_MODULE_EXPORT void
811 get_softwarerevision_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
812 {
813  //g_print ("Got a call back\n");
814  gupnp_service_action_set (action, "SoftwareRevision", G_TYPE_STRING, softwarerevision, NULL);
815  gupnp_service_action_return (action);
816 }
817 G_MODULE_EXPORT void
818 get_managementurl_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
819 {
820  //g_print ("Got a call back\n");
821  gupnp_service_action_set (action, "ManagementURL", G_TYPE_STRING, managementurl, NULL);
822  gupnp_service_action_return (action);
823 }
824 G_MODULE_EXPORT void
825 get_make_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
826 {
827  //g_print ("Got a call back\n");
828  getMake(Make);
829  gupnp_service_action_set (action, "Make", G_TYPE_STRING, Make, NULL);
830  gupnp_service_action_return (action);
831 }
832 G_MODULE_EXPORT void
833 get_recev_id_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
834 {
835  //g_print ("Got a call back\n");
836  gupnp_service_action_set (action, "ReceiverId", G_TYPE_STRING, receiverId, NULL);
837  gupnp_service_action_return (action);
838 }
839 G_MODULE_EXPORT void
840 get_account_id_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
841 {
842  gchar *clientAccountId=NULL;
843  //SoupMessage *msg;
844  gchar *clientMacAddr=NULL;
845  gchar *clientIpAddr=NULL;
846 #ifdef BROADBAND
847  int ret = 0;
848 #endif
849  /* Get the client account Id value */
850  gupnp_service_action_get (action, "SAccountId", G_TYPE_STRING, &clientAccountId, NULL);
851  gupnp_service_action_set (action, "GAccountId", G_TYPE_STRING, accountId, NULL);
852  gupnp_service_action_get (action, "macAddr", G_TYPE_STRING, &clientMacAddr, NULL);
853  gupnp_service_action_get (action, "ipAddr", G_TYPE_STRING, &clientIpAddr, NULL);
854  if ((clientAccountId) && (!strcmp(clientAccountId, accountId)))
855  {
856  g_warning("Client connection account ID same : %s,%s,%s,%s" , accountId,clientAccountId,clientMacAddr,clientIpAddr);
857 #ifdef BROADBAND
858  // add whitelist
859  g_warning("/usr/ccsp/moca/moca_whitelist_ctl.sh add %s",clientIpAddr);
860  ret = v_secure_system("/usr/ccsp/moca/moca_whitelist_ctl.sh add %s", clientIpAddr);
861  if(ret != 0) {
862  g_warning("Failure in executing command via v_secure_system. ret:[%d] ;\n", ret);
863  }
864 #endif
865  gupnp_service_action_return (action);
866  }
867  else
868  {
869  // AccountId is not matching.
870  // Log the message, accountId receivede
871  // Disconnect soup session TBD.
872  g_warning("Client connection account ID mismatch found : %s,%s,%s,%s" , accountId,clientAccountId,clientMacAddr,clientIpAddr);
873 #ifdef BROADBAND
874  g_warning("/usr/ccsp/moca/moca_whitelist_ctl.sh del %s", clientIpAddr);
875  ret = v_secure_system("/usr/ccsp/moca/moca_whitelist_ctl.sh del %s", clientIpAddr);
876  if(ret != 0) {
877  g_warning("Failure in executing command via v_secure_system. ret:[%d] ;\n", ret);
878  }
879 #endif
880  //msg = gupnp_service_action_get_message(action);
881  gupnp_service_action_return (action);
882  //g_warning("service action returning error ");
883  //gupnp_service_action_return_error (action, 402, "Account Id not matching");
884  //g_warning("service action aborting session ");
885  //gupnp_service_action_abort_session(service);
886  }
887  //g_warning("get_account_id_cb exit ");
888 }
889 
890 /**
891  * @brief Callback function which is invoked when getClientIP action is invoked and this sets
892  * the state variable for Client IP.
893  *
894  * @param[in] service Name of the service.
895  * @param[out] action Action to be invoked.
896  * @param[in] user_data Usually null will be passed.
897  * @ingroup XUPNP_XCALDEV_FUNC
898  */
899 /* GetGatewayIP */
900 G_MODULE_EXPORT void
901 get_client_ip_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
902 {
903  //g_print ("Got a call back\n");
904  gupnp_service_action_set (action, "ClientIP", G_TYPE_STRING, clientIp, NULL);
905  gupnp_service_action_return (action);
906 }
907 
908 /*
909  * State Variable query handlers
910  */
911 
912 /**
913  * @brief Callback function which is invoked when getUrl action is invoked.
914  *
915  * @param[in] service Name of the service.
916  * @param[in] variable State(Query)variable.
917  * @param[in] value New value to be assigned.
918  * @param[in] user_data Usually null will be passed.
919  * @ingroup XUPNP_XCALDEV_FUNC
920  */
921 /* BaseUrl */
922 G_MODULE_EXPORT void
923 query_url_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
924 {
925  g_value_init (value, G_TYPE_STRING);
926  g_value_set_string (value, urL);
927 }
928 /**
929  * @brief Callback function which is invoked when TrmUrl action is invoked and this sets
930  * the state variable with a new TRM Url value.
931  *
932  * @param[in] service Name of the service.
933  * @param[in] variable State(Query) variable.
934  * @param[in] value New value to be assigned.
935  * @param[in] user_data Usually null will be passed.
936  * @ingroup XUPNP_XCALDEV_FUNC
937  */
938 /* BaseTrmUrl */
939 G_MODULE_EXPORT void
940 query_trm_url_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
941 {
942  g_value_init (value, G_TYPE_STRING);
943  g_value_set_string (value, trmUrl);
944 }
945 /**
946  * @brief Callback function which is invoked when PlaybackUrl action is invoked and this sets
947  * the state variable with a new playback url.
948  *
949  * @param[in] service Name of the service.
950  * @param[in] variable State(Query) variable.
951  * @param[in] value New value to be assigned.
952  * @param[in] user_data Usually null will be passed.
953  * @ingroup XUPNP_XCALDEV_FUNC
954  */
955 /* PlaybackUrl */
956 G_MODULE_EXPORT void
957 query_playback_url_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
958 {
959  if(getTuneReady())
960  {
961  //g_message ("Got a query for playback url, sending %s\n", playbackurl->str);
962  g_value_init (value, G_TYPE_STRING);
963  g_value_set_string (value, playBackUrl);
964  }
965  else
966  {
967  //g_message ("Got a query for playback url, sending NULL");
968  g_value_init (value, G_TYPE_STRING);
969  g_value_set_string (value, "NULL");
970  }
971 }
972 
973 /**
974  * @brief Callback function which is invoked when DataGatewayIPaddress action is invoked and this sets
975  * the state variable with a new DataGatewayIPaddress.
976  *
977  * @param[in] service Name of the service.
978  * @param[in] variable State(Query) variable.
979  * @param[in] value New value to be assigned.
980  * @param[in] user_data Usually null will be passed.
981  * @ingroup XUPNP_XCALDEV_FUNC
982  */
983 /* DataGatewayIPaddress */
984 G_MODULE_EXPORT void
985 query_dataGatewayIPaddress_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
986 {
987  g_value_init (value, G_TYPE_STRING);
988  g_value_set_string (value, dataGatewayIPAddress);
989 }
990 /**
991  * @brief Callback function which is invoked when DeviceName action is invoked and this sets
992  * the state variable with a new device name.
993  *
994  * @param[in] service Name of the service.
995  * @param[in] variable State(Query) variable.
996  * @param[in] value New value to be assigned.
997  * @param[in] user_data Usually null will be passed.
998  * @ingroup XUPNP_XCALDEV_FUNC
999  */
1000 /* DeviceName */
1001 G_MODULE_EXPORT void
1002 query_devicename_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1003 {
1004  g_value_init (value, G_TYPE_STRING);
1005  g_value_set_string (value, deviceName);
1006 }
1007 /**
1008  * @brief Callback function which is invoked when GatewayIP action is invoked and this sets
1009  * the state variable with a new Gateway IP.
1010  *
1011  * @param[in] service Name of the service.
1012  * @param[in] variable State(Query) variable.
1013  * @param[in] value New value to be assigned.
1014  * @param[in] user_data Usually null will be passed.
1015  * @ingroup XUPNP_XCALDEV_FUNC
1016  */
1017 /* GatewayIP */
1018 G_MODULE_EXPORT void
1019 query_gwyip_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1020 {
1021  g_value_init (value, G_TYPE_STRING);
1022  g_value_set_string (value, gwyIp);
1023 }
1024 /**
1025  * @brief Callback function which is invoked when Ipv6Prefix action is invoked and this sets
1026  * the state variable with a new value.
1027  *
1028  * @param[in] service Name of the service.
1029  * @param[in] variable State(Query) variable.
1030  * @param[in] value New value to be assigned.
1031  * @param[in] user_data Usually null will be passed.
1032  * @ingroup XUPNP_XCALDEV_FUNC
1033  */
1034 /* GatewayIPv6 */
1035 G_MODULE_EXPORT void
1036 query_gwyipv6_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1037 {
1038  g_value_init (value, G_TYPE_STRING);
1039  g_value_set_string (value, gwyIpv6);
1040 }
1041 /**
1042  * @brief Callback function which is invoked when GatewayStbIP action is invoked and this sets
1043  * the state variable with a new value.
1044  *
1045  * @param[in] service Name of the service.
1046  * @param[in] variable State(Query) variable.
1047  * @param[in] value New value to be assigned.
1048  * @param[in] user_data Usually null will be passed.
1049  * @ingroup XUPNP_XCALDEV_FUNC
1050  */
1051 /* GatewayStbIP */
1052 G_MODULE_EXPORT void
1053 query_gwystbip_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1054 {
1055  g_value_init (value, G_TYPE_STRING);
1056  g_value_set_string (value, gwystbIp);
1057 }
1058 #ifndef BROADBAND
1059 /**
1060  * @brief Callback function which is invoked when Ipv6Prefix action is invoked and this sets
1061  * the state variable with a new value.
1062  *
1063  * @param[in] service Name of the service.
1064  * @param[in] variable State(Query) variable.
1065  * @param[in] value New value to be assigned.
1066  * @param[in] user_data Usually null will be passed.
1067  * @ingroup XUPNP_XCALDEV_FUNC
1068  */
1069 /* Ipv6Prefix */
1070 G_MODULE_EXPORT void
1071 query_ipv6prefix_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1072 {
1073  g_value_init (value, G_TYPE_STRING);
1074  g_value_set_string (value, ipv6preFix);
1075 }
1076 #endif
1077 /**
1078  * @brief Callback function which is invoked when HostMacAddress action is invoked and this sets
1079  * the state variable with a new value.
1080  *
1081  * @param[in] service Name of the service.
1082  * @param[in] variable State(Query) variable.
1083  * @param[in] value New value to be assigned.
1084  * @param[in] user_data Usually null will be passed.
1085  * @ingroup XUPNP_XCALDEV_FUNC
1086  */
1087 /* HostMacAddress */
1088 G_MODULE_EXPORT void
1089 query_hostmacaddress_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1090 {
1091  g_value_init (value, G_TYPE_STRING);
1092  g_value_set_string (value, hostMacaddress);
1093 }
1094 /**
1095  * @brief Callback function which is invoked when BcastMacAddress action is invoked and this sets
1096  * the state variable with a new value.
1097  *
1098  * @param[in] service Name of the service.
1099  * @param[in] variable State(Query) variable.
1100  * @param[in] value New value to be assigned.
1101  * @param[in] user_data Usually null will be passed.
1102  * @ingroup XUPNP_XCALDEV_FUNC
1103  */
1104 /* BcastMacAddress */
1105 G_MODULE_EXPORT void
1106 query_bcastmacaddress_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1107 {
1108  g_value_init (value, G_TYPE_STRING);
1109  g_value_set_string (value, bcastMacaddress);
1110 }
1111 /**
1112  * @brief Callback function which is invoked when RecvDevType action is invoked and this sets
1113  * the state variable with a new value.
1114  *
1115  * @param[in] service Name of the service.
1116  * @param[in] variable State(Query) variable.
1117  * @param[in] value New value to be assigned.
1118  * @param[in] user_data Usually null will be passed.
1119  * @ingroup XUPNP_XCALDEV_FUNC
1120  */
1121 /* RecvDevType */
1122 G_MODULE_EXPORT void
1123 query_recvdevtype_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1124 {
1125  g_value_init (value, G_TYPE_STRING);
1126  g_value_set_string (value, recvdevType);
1127 }
1128 /* DeviceType */
1129 G_MODULE_EXPORT void
1130 query_devicetype_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1131 {
1132  g_value_init (value, G_TYPE_STRING);
1133  g_value_set_string (value, deviceType);
1134 }
1135 /**
1136  * @brief Callback function which is invoked when BuildVersion action is invoked and this sets
1137  * the state variable with a new value.
1138  *
1139  * @param[in] service Name of the service.
1140  * @param[in] variable State(Query) variable.
1141  * @param[in] value New value to be assigned.
1142  * @param[in] user_data Usually null will be passed.
1143  * @ingroup XUPNP_XCALDEV_FUNC
1144  */
1145 /* BuildVersion */
1146 G_MODULE_EXPORT void
1147 query_buildversion_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1148 {
1149  g_value_init (value, G_TYPE_STRING);
1150  g_value_set_string (value, buildVersion);
1151 }
1152 #ifndef BROADBAND
1153 /**
1154  * @brief Callback function which is invoked when DnsConfig action is invoked and this sets
1155  * the state variable with a new value.
1156  *
1157  * @param[in] service Name of the service.
1158  * @param[in] variable State(Query) variable.
1159  * @param[in] value New value to be assigned.
1160  * @param[in] user_data Usually null will be passed.
1161  * @ingroup XUPNP_XCALDEV_FUNC
1162  */
1163 /* DnsConfig */
1164 G_MODULE_EXPORT void
1165 query_dnsconfig_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1166 {
1167  g_value_init (value, G_TYPE_STRING);
1168  g_value_set_string (value, dnsConfig);
1169 }
1170 #endif
1171 /**
1172  * @brief Callback function which is invoked when SystemIds action is invoked and this sets
1173  * the state variable with a new value.
1174  *
1175  * @param[in] service Name of the service.
1176  * @param[in] variable State(Query) variable.
1177  * @param[in] value New value to be assigned.
1178  * @param[in] user_data Usually null will be passed.
1179  * @ingroup XUPNP_XCALDEV_FUNC
1180  */
1181 /* SystemIds */
1182 G_MODULE_EXPORT void
1183 query_systemids_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1184 {
1185  g_value_init (value, G_TYPE_STRING);
1186  g_value_set_string (value, systemIds);
1187 }
1188 /**
1189  * @brief Callback function which is invoked when IPSubNet action is invoked and this sets
1190  * the state variable with a new value.
1191  *
1192  * @param[in] service Name of the service.
1193  * @param[in] variable State(Query) variable.
1194  * @param[in] value New value to be assigned.
1195  * @param[in] user_data Usually null will be passed.
1196  * @ingroup XUPNP_XCALDEV_FUNC
1197  */
1198 /* IPSubNet */
1199 G_MODULE_EXPORT void
1200 query_ipsubnet_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1201 {
1202  getIpSubnet(ipsubnet);
1203  g_value_init (value, G_TYPE_STRING);
1204  g_value_set_string (value, ipsubnet);
1205 }
1206 
1207 /**
1208  * @brief Callback function which is invoked when TimeZone action is invoked and this sets
1209  * the state variable with a new value.
1210  *
1211  * @param[in] service Name of the service.
1212  * @param[in] variable State(Query) variable.
1213  * @param[in] value New value to be assigned.
1214  * @param[in] user_data Usually null will be passed.
1215  * @ingroup XUPNP_XCALDEV_FUNC
1216  */
1217 /* TimeZone */
1218 G_MODULE_EXPORT void
1219 query_timezone_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1220 {
1221  if (getIsuseGliDiagEnabled() == FALSE){
1222  getTimeZone(dsgtimeZone);
1223  }
1224  g_value_init (value, G_TYPE_STRING);
1225  g_value_set_string (value, dsgtimeZone);
1226 }
1227 /**
1228  * @brief Callback function which is invoked when Hosts action is invoked and this sets
1229  * the state variable with a new value.
1230  *
1231  * @param[in] service Name of the service.
1232  * @param[in] variable State(Query) variable.
1233  * @param[in] value New value to be assigned.
1234  * @param[in] user_data Usually null will be passed.
1235  * @ingroup XUPNP_XCALDEV_FUNC
1236  */
1237 /* EtcHosts */
1238 G_MODULE_EXPORT void
1239 query_hosts_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1240 {
1241  g_value_init (value, G_TYPE_STRING);
1242  g_value_set_string (value, etcHosts);
1243 }
1244 /**
1245  * @brief Callback function which is invoked when IsGateway action is invoked and this sets
1246  * the state variable with a new value.
1247  *
1248  * @param[in] service Name of the service.
1249  * @param[in] variable State(Query) variable.
1250  * @param[in] value New value to be assigned.
1251  * @param[in] user_data Usually null will be passed.
1252  * @ingroup XUPNP_XCALDEV_FUNC
1253  */
1254 /* IsGateway */
1255 G_MODULE_EXPORT void
1256 query_isgateway_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1257 {
1258  g_value_init (value, G_TYPE_BOOLEAN);
1259  g_value_set_boolean (value, allowgwy);
1260 }
1261 /**
1262  * @brief Callback function which is invoked when RequiresTRM action is invoked and this sets
1263  * the state variable with a new value.
1264  *
1265  * @param[in] service Name of the service.
1266  * @param[in] variable State(Query) variable.
1267  * @param[in] value New value to be assigned.
1268  * @param[in] user_data Usually null will be passed.
1269  * @ingroup XUPNP_XCALDEV_FUNC
1270  */
1271 /* RequiresTRM */
1272 G_MODULE_EXPORT void
1273 query_requirestrm_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1274 {
1275  g_value_init (value, G_TYPE_BOOLEAN);
1276  g_value_set_boolean (value, requiresTrm);
1277 }
1278 /**
1279  * @brief Callback function which is invoked when RuiUrl action is invoked and this sets
1280  * the state variable with a new value.
1281  *
1282  * @param[in] service Name of the service.
1283  * @param[in] variable State(Query) variable.
1284  * @param[in] value New value to be assigned.
1285  * @param[in] user_data Usually null will be passed.
1286  * @ingroup XUPNP_XCALDEV_FUNC
1287  */
1288 /* RuiUrl */
1289 G_MODULE_EXPORT void
1290 query_rui_url_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1291 {
1292  g_value_init (value, G_TYPE_STRING);
1293  g_value_set_string (value, ruiUrl);
1294 }
1295 /**
1296  * @brief Callback function which is invoked when RawOffSet action is invoked and this sets
1297  * the state variable with a new value.
1298  *
1299  * @param[in] service Name of the service.
1300  * @param[in] variable State(Query) variable.
1301  * @param[in] value New value to be assigned.
1302  * @param[in] user_data Usually null will be passed.
1303  * @ingroup XUPNP_XCALDEV_FUNC
1304  */
1305 /* RawOffSet */
1306 G_MODULE_EXPORT void
1307 query_rawoffset_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1308 {
1309  g_value_init (value, G_TYPE_INT);
1310  g_value_set_int (value, rawoffset);
1311 }
1312 /**
1313  * @brief Callback function which is invoked when DSTOffset action is invoked and this sets
1314  * the state variable with a new value.
1315  *
1316  * @param[in] service Name of the service.
1317  * @param[in] variable State(Query) variable.
1318  * @param[in] value New value to be assigned.
1319  * @param[in] user_data Usually null will be passed.
1320  * @ingroup XUPNP_XCALDEV_FUNC
1321  */
1322 /* DSTOffset */
1323 G_MODULE_EXPORT void
1324 query_dstoffset_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1325 {
1326  g_value_init (value, G_TYPE_INT);
1327  g_value_set_int (value, dstoffset);
1328 }
1329 /**
1330  * @brief Callback function which is invoked when DSTSavings action is invoked and this sets
1331  * the state variable with a new value.
1332  *
1333  * @param[in] service Name of the service.
1334  * @param[in] variable State(Query) variable.
1335  * @param[in] value New value to be assigned.
1336  * @param[in] user_data Usually null will be passed.
1337  * @ingroup XUPNP_XCALDEV_FUNC
1338  */
1339 /* DSTSavings */
1340 G_MODULE_EXPORT void
1341 query_dstsavings_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1342 {
1343  g_value_init (value, G_TYPE_INT);
1344  g_value_set_int (value, dstsavings);
1345 }
1346 
1347 /**
1348  * @brief Callback function which is invoked when ClientIP action is invoked and this sets
1349  * the state variable with a new Gateway IP.
1350  *
1351  * @param[in] service Name of the service.
1352  * @param[in] variable State(Query) variable.
1353  * @param[in] value New value to be assigned.
1354  * @param[in] user_data Usually null will be passed.
1355  * @ingroup XUPNP_XCALDEV_FUNC
1356  */
1357 /* ClientIP */
1358 G_MODULE_EXPORT void
1359 query_client_ip_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1360 {
1361  g_value_init (value, G_TYPE_STRING);
1362  g_value_set_string (value, clientIp);
1363 }
1364 
1365 /**
1366  * @brief Callback function which is invoked when UsesDaylightTime action is invoked and this sets
1367  * the state variable with a new value.
1368  *
1369  * @param[in] service Name of the service.
1370  * @param[in] variable State(Query) variable.
1371  * @param[in] value New value to be assigned.
1372  * @param[in] user_data Usually null will be passed.
1373  * @ingroup XUPNP_XCALDEV_FUNC
1374  */
1375 /* UsesDaylightTime */
1376 G_MODULE_EXPORT void
1377 query_usesdaylighttime_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1378 {
1379  g_value_init (value, G_TYPE_BOOLEAN);
1380  g_value_set_boolean (value, usedaylightsavings);
1381 }
1382 
1383 G_MODULE_EXPORT void
1384 query_modelclass_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1385 {
1386  g_value_init (value, G_TYPE_STRING);
1387  g_value_set_string (value, modelclass);
1388 }
1389 G_MODULE_EXPORT void
1390 query_modelnumber_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1391 {
1392  g_value_init (value, G_TYPE_STRING);
1393  g_value_set_string (value, modelNumber);
1394 }
1395 G_MODULE_EXPORT void
1396 query_deviceid_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1397 {
1398  g_value_init (value, G_TYPE_STRING);
1399  g_value_set_string (value, deviceid);
1400 }
1401 G_MODULE_EXPORT void
1402 query_hardwarerevision_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1403 {
1404  g_value_init (value, G_TYPE_STRING);
1405  g_value_set_string (value, hardwarerevision);
1406 }
1407 G_MODULE_EXPORT void
1408 query_softwarerevision_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1409 {
1410  g_value_init (value, G_TYPE_STRING);
1411  g_value_set_string (value, softwarerevision);
1412 }
1413 G_MODULE_EXPORT void
1414 query_managementurl_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1415 {
1416  g_value_init (value, G_TYPE_STRING);
1417  g_value_set_string (value, managementurl);
1418 }
1419 G_MODULE_EXPORT void
1420 query_make_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1421 {
1422  g_value_init (value, G_TYPE_STRING);
1423  g_value_set_string (value, Make);
1424 }
1425 G_MODULE_EXPORT void
1426 query_recev_id_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1427 {
1428  g_value_init (value, G_TYPE_STRING);
1429  g_value_set_string (value, receiverId);
1430 }
1431 G_MODULE_EXPORT void
1432 query_account_id_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
1433 {
1434  g_value_init (value, G_TYPE_STRING);
1435  g_value_set_string (value, accountId);
1436 }
1437 
1438 int registerIdentityConfigurationService(GUPnPServiceInfo *upnpIdService)
1439 {
1440  g_signal_connect (upnpIdService, "action-invoked::GetRecvDevType", G_CALLBACK (get_recvdevtype_cb), NULL);
1441  g_signal_connect (upnpIdService, "action-invoked::GetDeviceType", G_CALLBACK (get_devicetype_cb), NULL);
1442  g_signal_connect (upnpIdService, "action-invoked::GetBuildVersion", G_CALLBACK (get_buildversion_cb), NULL);
1443  g_signal_connect (upnpIdService, "action-invoked::GetDeviceName", G_CALLBACK (get_devicename_cb), NULL);
1444  g_signal_connect (upnpIdService, "action-invoked::GetModelClass", G_CALLBACK (get_modelclass_cb), NULL);
1445  g_signal_connect (upnpIdService, "action-invoked::GetModelNumber", G_CALLBACK (get_modelnumber_cb), NULL);
1446  g_signal_connect (upnpIdService, "action-invoked::GetDeviceId", G_CALLBACK (get_deviceid_cb), NULL);
1447  g_signal_connect (upnpIdService, "action-invoked::GetHardwareRevision", G_CALLBACK (get_hardwarerevision_cb), NULL);
1448  g_signal_connect (upnpIdService, "action-invoked::GetSoftwareRevision", G_CALLBACK (get_softwarerevision_cb), NULL);
1449  g_signal_connect (upnpIdService, "action-invoked::GetManagementUrl", G_CALLBACK (get_managementurl_cb), NULL);
1450  g_signal_connect (upnpIdService, "action-invoked::GetMake", G_CALLBACK (get_make_cb), NULL);
1451  g_signal_connect (upnpIdService, "action-invoked::GetReceiverId", G_CALLBACK (get_recev_id_cb), NULL);
1452  g_signal_connect (upnpIdService, "action-invoked::GetAccountId", G_CALLBACK (get_account_id_cb), NULL);
1453  g_signal_connect (upnpIdService, "action-invoked::GetClientIP", G_CALLBACK (get_client_ip_cb), NULL);
1454  g_signal_connect (upnpIdService, "action-invoked::GetBcastMacAddress", G_CALLBACK (get_bcastmacaddress_cb), NULL);
1455  g_signal_connect (upnpIdService, "query-variable::RecvDevType", G_CALLBACK (query_recvdevtype_cb), NULL);
1456  g_signal_connect (upnpIdService, "query-variable::DeviceType", G_CALLBACK (query_devicetype_cb), NULL);
1457  g_signal_connect (upnpIdService, "query-variable::BuildVersion", G_CALLBACK (query_buildversion_cb), NULL);
1458  g_signal_connect (upnpIdService, "query-variable::DeviceName", G_CALLBACK (query_devicename_cb), NULL);
1459  g_signal_connect (upnpIdService, "query-variable::ModelClass", G_CALLBACK (query_modelclass_cb), NULL);
1460  g_signal_connect (upnpIdService, "query-variable::ModelNumber", G_CALLBACK (query_modelnumber_cb), NULL);
1461  g_signal_connect (upnpIdService, "query-variable::DeviceId", G_CALLBACK (query_deviceid_cb), NULL);
1462  g_signal_connect (upnpIdService, "query-variable::HardwareRevision", G_CALLBACK (query_hardwarerevision_cb), NULL);
1463  g_signal_connect (upnpIdService, "query-variable::SoftwareRevision", G_CALLBACK (query_softwarerevision_cb), NULL);
1464  g_signal_connect (upnpIdService, "query-variable::ManagementUrl", G_CALLBACK (query_managementurl_cb), NULL);
1465  g_signal_connect (upnpIdService, "query-variable::Make", G_CALLBACK (query_make_cb), NULL);
1466  g_signal_connect (upnpIdService, "query-variable::ReceiverId", G_CALLBACK (query_recev_id_cb), NULL);
1467  g_signal_connect (upnpIdService, "query-variable::AccountId", G_CALLBACK (query_account_id_cb), NULL);
1468  g_signal_connect (upnpIdService, "query-variable::BcastMacAddress", G_CALLBACK (query_bcastmacaddress_cb), NULL);
1469  g_signal_connect (upnpIdService, "query-variable::ClientIP", G_CALLBACK (query_client_ip_cb), NULL);
1470  return 0;
1471 }
1472 int registerMediaConfigurationService(GUPnPServiceInfo *upnpMediaConfService)
1473 {
1474  g_signal_connect (upnpMediaConfService, "action-invoked::GetBaseUrl", G_CALLBACK (get_url_cb), NULL);
1475  g_signal_connect (upnpMediaConfService, "action-invoked::GetPlaybackUrl", G_CALLBACK (get_playback_url_cb), NULL);
1476 // g_signal_connect (upnpMediaConfService, "action-invoked::GetFogTsbUrl", G_CALLBACK (get_fogtsb_url_cb), NULL);
1477 // g_signal_connect (upnpMediaConfService, "action-invoked::GetVideoBaseUrl", G_CALLBACK (get_videobase_url_cb), NULL);
1478  g_signal_connect (upnpMediaConfService, "query-variable::Url", G_CALLBACK (query_url_cb), NULL);
1479  g_signal_connect (upnpMediaConfService, "query-variable::PlaybackUrl", G_CALLBACK (query_playback_url_cb), NULL);
1480 // g_signal_connect (upnpMediaConfService, "query-variable::FogTsbUrl", G_CALLBACK (query_fogtsb_url_cb), NULL);
1481 // g_signal_connect (upnpMediaConfService, "query-variable::VideoBaseUrl", G_CALLBACK (query_videobase_url_cb), NULL);
1482  return 0;
1483 }
1484 int registerGatewayConfigurationService(GUPnPServiceInfo *upnpGatewayConf)
1485 {
1486  g_signal_connect (upnpGatewayConf, "action-invoked::GetGatewayIP", G_CALLBACK (get_gwyip_cb), NULL);
1487  g_signal_connect (upnpGatewayConf, "action-invoked::GetGatewayIPv6", G_CALLBACK (get_gwyipv6_cb), NULL);
1488 #ifndef BROADBAND
1489  g_signal_connect (upnpGatewayConf, "action-invoked::GetIpv6Prefix", G_CALLBACK (get_ipv6prefix_cb), NULL);
1490  g_signal_connect (upnpGatewayConf, "action-invoked::GetDnsConfig", G_CALLBACK (get_dnsconfig_cb), NULL);
1491 #endif
1492  g_signal_connect (upnpGatewayConf, "action-invoked::GetGatewayStbIP", G_CALLBACK (get_gwystbip_cb), NULL);
1493  g_signal_connect (upnpGatewayConf, "action-invoked::GetHosts", G_CALLBACK (get_hosts_cb), NULL);
1494  g_signal_connect (upnpGatewayConf, "action-invoked::GetHostMacAddress", G_CALLBACK (get_hostmacaddress_cb), NULL);
1495  g_signal_connect (upnpGatewayConf, "action-invoked::GetDataGatewayIPaddress", G_CALLBACK (get_dataGatewayIPaddress_cb), NULL);
1496  g_signal_connect (upnpGatewayConf, "action-invoked::GetIsGateway", G_CALLBACK (get_isgateway_cb), NULL);
1497  g_signal_connect (upnpGatewayConf, "action-invoked::GetIPSubNet", G_CALLBACK (get_ipsubnet_cb), NULL);
1498  g_signal_connect (upnpGatewayConf, "query-variable::GatewayIP", G_CALLBACK (query_gwyip_cb), NULL);
1499  g_signal_connect (upnpGatewayConf, "query-variable::GatewayIPv6", G_CALLBACK (query_gwyipv6_cb), NULL);
1500 #ifndef BROADBAND
1501  g_signal_connect (upnpGatewayConf, "query-variable::Ipv6Prefix", G_CALLBACK (query_ipv6prefix_cb), NULL);
1502  g_signal_connect (upnpGatewayConf, "query-variable::DnsConfig", G_CALLBACK (query_dnsconfig_cb), NULL);
1503 #endif
1504  g_signal_connect (upnpGatewayConf, "query-variable::GatewayStbIP", G_CALLBACK (query_gwystbip_cb), NULL);
1505  g_signal_connect (upnpGatewayConf, "query-variable::Hosts", G_CALLBACK (query_hosts_cb), NULL);
1506  g_signal_connect (upnpGatewayConf, "query-variable::HostMacAddress", G_CALLBACK (query_hostmacaddress_cb), NULL);
1507  g_signal_connect (upnpGatewayConf, "query-variable::DataGatewayIPaddress", G_CALLBACK (query_dataGatewayIPaddress_cb), NULL);
1508  g_signal_connect (upnpGatewayConf, "query-variable::IsGateway", G_CALLBACK (query_isgateway_cb), NULL);
1509  g_signal_connect (upnpGatewayConf, "query-variable::IPSubNet", G_CALLBACK (query_ipsubnet_cb), NULL);
1510  return 0;
1511 }
1512 int registerQamConfigurationService(GUPnPServiceInfo *upnpQamConf)
1513 {
1514  g_signal_connect (upnpQamConf, "action-invoked::GetBaseTrmUrl", G_CALLBACK (get_trm_url_cb), NULL);
1515  g_signal_connect (upnpQamConf, "action-invoked::GetSystemIds", G_CALLBACK (get_systemids_cb), NULL);
1516  g_signal_connect (upnpQamConf, "action-invoked::GetRequiresTRM", G_CALLBACK (get_requirestrm_cb), NULL);
1517  g_signal_connect (upnpQamConf, "query-variable::TrmUrl", G_CALLBACK (query_trm_url_cb), NULL);
1518  g_signal_connect (upnpQamConf, "query-variable::SystemIds", G_CALLBACK (query_systemids_cb), NULL);
1519  g_signal_connect (upnpQamConf, "query-variable::RequiresTRM", G_CALLBACK (query_requirestrm_cb), NULL);
1520  return 0;
1521 }
1522 int registerTimeConfigurationService(GUPnPServiceInfo *upnpTimeConf)
1523 {
1524  g_signal_connect (upnpTimeConf, "action-invoked::GetTimeZone", G_CALLBACK (get_timezone_cb), NULL);
1525  g_signal_connect (upnpTimeConf, "action-invoked::GetRawOffSet", G_CALLBACK (get_rawoffset_cb), NULL);
1526  g_signal_connect (upnpTimeConf, "action-invoked::GetDSTOffset", G_CALLBACK (get_dstoffset_cb), NULL);
1527  g_signal_connect (upnpTimeConf, "action-invoked::GetDSTSavings", G_CALLBACK (get_dstsavings_cb), NULL);
1528  g_signal_connect (upnpTimeConf, "action-invoked::GetUsesDaylightTime", G_CALLBACK (get_usesdaylighttime_cb), NULL);
1529  g_signal_connect (upnpTimeConf, "query-variable::TimeZone", G_CALLBACK (query_timezone_cb), NULL);
1530  g_signal_connect (upnpTimeConf, "query-variable::RawOffSet", G_CALLBACK (query_rawoffset_cb), NULL);
1531  g_signal_connect (upnpTimeConf, "query-variable::DSTOffset", G_CALLBACK (query_dstoffset_cb), NULL);
1532  g_signal_connect (upnpTimeConf, "query-variable::DSTSavings", G_CALLBACK (query_dstsavings_cb), NULL);
1533  g_signal_connect (upnpTimeConf, "query-variable::UsesDaylightTime", G_CALLBACK (query_usesdaylighttime_cb), NULL);
1534  return 0;
1535 }
1536 
1537 
1538 int
1539 main (int argc, char **argv)
1540 {
1541  GError *error = NULL;
1542  g_thread_init (NULL);
1543  char devConfFile[] = "/etc/xdevice.conf";
1544  char *certFile=NULL, *keyFile=NULL;
1545 
1546  g_type_init ();
1547  g_message("Starting XCAL-DEVICE ");
1548  xupnpEventCallback_register(&notify_value_change);
1549  xdeviceInit(devConfFile,NULL);
1550  getGatewayIp(clientIp);
1551  rfc_enabled = check_rfc();
1552  if(!rfc_enabled)
1553  {
1554  g_message("Running Older Xcal Device");
1555  }
1556  if(!(getDevXmlPath(devXMlPath)&& getDevXmlFile(devXMlFile,0) && getUUID(uUid) && getBcastPort(&devBcastPort) && getSerialNum(serial_Num) && getBcastIf(devBcastIf)))
1557  {
1558  g_message("Failed to update the required gupnp xcal-device variables");
1559  }
1560 
1561  g_message("xmlfilename=%s struuid=%s serial_Num=%s",devXMlFile,uUid,serial_Num);
1562  g_message("devBcastIf=%sdevBcastPort=%d",devBcastIf,devBcastPort);
1563 #ifdef INCLUDE_BREAKPAD
1564  breakpad_ExceptionHandler();
1565 #endif
1566  char* xmlfilename = devXMlFile;
1567  const char* struuid = uUid;
1568  int result = updatexmldata(xmlfilename, struuid, serial_Num, "XFINITY"); // BasicDevice.xml currently does not need multi-tenancy support per RDK-8190. (May come in as part of some other ticket, in which case replace "XFINITY" with getFriendlyName().)
1569  if (!result)
1570  {
1571  fprintf(stderr,"Failed to open the device xml file %s\n", xmlfilename);
1572  exit(1);
1573  }
1574  else
1575  {
1576  g_message("Updated the device xml file:%s uuid: %s", xmlfilename,struuid);
1577  }
1578  if(!getBcastMacAddress(bcastMacaddress))
1579  {
1580  g_message("Unable to get bcastMacaddress");
1581  }
1582 
1583 #ifndef GUPNP_1_2
1584  upnpContext = gupnp_context_new (NULL, devBcastIf, devBcastPort, &error);
1585 #else
1586  upnpContext = gupnp_context_new (devBcastIf, devBcastPort, &error);
1587 #endif
1588  if (error) {
1589  g_message("Error creating the Broadcast context: %s",
1590  error->message);
1591  /* g_clear_error() frees the GError *error memory and reset pointer if set in above operation */
1592  g_clear_error(&error);
1593  return EXIT_FAILURE;
1594  }
1595  gupnp_context_set_subscription_timeout(upnpContext, 0);
1596 #ifndef GUPNP_1_2
1597  baseDev = gupnp_root_device_new (upnpContext, devXMlFile, devXMlPath);
1598 #else
1599  baseDev = gupnp_root_device_new (upnpContext, devXMlFile, devXMlPath, &error);
1600 #endif
1601 #ifndef CLIENT_XCAL_SERVER
1602  if(!getDisableTuneReadyStatus())
1603  {
1604  if(!getTuneReady())
1605  {
1606  g_message("Xupnp: Tune ready status is false");
1607  }
1608  }
1609 #endif
1610  gupnp_root_device_set_available (baseDev, TRUE);
1611  /* Get the discover friendlies service from the root device */
1612  upnpService = gupnp_device_info_get_service
1613  (GUPNP_DEVICE_INFO (baseDev), "urn:schemas-upnp-org:service:DiscoverFriendlies:1");
1614  if (!upnpService)
1615  {
1616  g_printerr ("Cannot get DiscoverFriendlies service\n");
1617  return EXIT_FAILURE;
1618  }
1619  if(rfc_enabled)
1620  {
1621  char devXMlFile_new[MAXSIZE];
1622 
1623  if(!getDevXmlFile(devXMlFile_new, 1))
1624  {
1625  g_message("Unable to get new device xml file");
1626  }
1627  char *xmlfilename_new = devXMlFile_new;
1628 
1629  char uuid_new[48];
1630  if(getAccountId(accountId))
1631  {
1632  g_message("Account Id of the device is %s", accountId);
1633  }
1634  else
1635  {
1636  g_message("Failed to get the Account Id");
1637  }
1638  if(strlen(bcastMacaddress) != 0)
1639  {
1640  /* Coverity Fix CID:46884 DC.STRING_BUFFER */
1641  if (snprintf(uuid_new,sizeof(uuid_new),"uuid:%s",bcastMacaddress) > (int)sizeof(uuid_new)) {
1642  g_message("truncation while copying bcastMacaddress to uuid_new \n");
1643  }
1644  }
1645 #ifndef BROADBAND
1646  if(xPKI_check_rfc() == 1)
1647  {
1648  certFile= g_strdup("/tmp/xpki_cert");
1649  keyFile= g_strdup("/tmp/xpki_key");
1650  g_message("Using xPKI certs for handshaking");
1651  }
1652  else
1653  {
1654  #endif
1655  if ((getDevCertFile(devCertFile)) && (getDevCertPath(devCertPath)) && (getDevKeyFile(devKeyFile)) && (getDevKeyPath(devKeyPath)))
1656  {
1657  if (g_path_is_absolute (devCertFile))
1658  {
1659  certFile = g_strdup (devCertFile);
1660  }
1661  else
1662  {
1663  certFile = g_build_filename (devCertPath, devCertFile, NULL);
1664  }
1665  g_message("certFile loaded");
1666 
1667  if (g_path_is_absolute (devKeyFile))
1668  {
1669  keyFile = g_strdup (devKeyFile);
1670  }
1671  else
1672  {
1673  keyFile = g_build_filename (devKeyPath, devKeyFile, NULL);
1674  }
1675  g_message("keyFile loaded ");
1676  }
1677 #ifndef BROADBAND
1678  }
1679 #endif
1680  if ( (certFile != NULL) && (keyFile != NULL) && (g_file_test(certFile, G_FILE_TEST_EXISTS)) && (g_file_test(keyFile, G_FILE_TEST_EXISTS))
1681  && (g_file_test(caFile, G_FILE_TEST_EXISTS)))
1682  {
1683  result = updatexmldata(xmlfilename_new, uuid_new, serial_Num, "XFINITY");
1684  if (!result)
1685  {
1686  g_message("Failed to open the device xml file %s\n", xmlfilename_new);
1687  exit(1);
1688  }
1689  else
1690  {
1691  g_message("RFC enabled Updated the device xml file:%s uuid: %s", xmlfilename_new,uuid_new);
1692  }
1693 
1694 
1695 #ifndef GUPNP_1_2
1696  upnpContextDeviceProtect = gupnp_context_new_s (NULL, devBcastIf, DEVICE_PROTECTION_CONTEXT_PORT, certFile, keyFile, &error);
1697 #else
1698  upnpContextDeviceProtect = gupnp_context_new_s ( devBcastIf, DEVICE_PROTECTION_CONTEXT_PORT, certFile, keyFile, &error);
1699 #endif
1700  if (error)
1701  {
1702  g_message("Error creating the Device Protection Broadcast context: %s",
1703  error->message);
1704  /* g_clear_error() frees the GError *error memory and reset pointer if set in above operation */
1705  g_clear_error(&error);
1706  }
1707  else
1708  {
1709  gupnp_context_set_subscription_timeout(upnpContextDeviceProtect, 0);
1710  // Set TLS config params here.
1711  gupnp_context_set_tls_params(upnpContextDeviceProtect,caFile,keyFile, NULL);
1712 #ifndef GUPNP_1_2
1713  dev = gupnp_root_device_new (upnpContextDeviceProtect, devXMlFile_new, devXMlPath);
1714 #else
1715  dev = gupnp_root_device_new (upnpContextDeviceProtect, devXMlFile_new, devXMlPath, &error);
1716 #endif
1717  gupnp_root_device_set_available (dev, TRUE);
1718 
1719  upnpIdService = gupnp_device_info_get_service
1720  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1Identity:1");
1721  if (!upnpIdService)
1722  {
1723  g_message("Cannot get X1Identity service\n");
1724  }
1725  else
1726  {
1727  g_message("XUPNP Identity service successfully created");
1728  }
1729  if (strstr(devXMlFile_new,BROADBAND_DEVICE_XML_FILE) || strstr(devXMlFile_new,GW_DEVICE_XML_FILE))
1730  {
1731  g_message("Broadband OR Gateway Device Configuration File");
1732  upnpTimeConf = gupnp_device_info_get_service
1733  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1Time:1");
1734  if (!upnpTimeConf)
1735  {
1736  g_message("Cannot get XfinityTimeConfiguration service\n");
1737  }
1738  else
1739  {
1740  g_message("XUPNP XfinityTimeConfiguration service successfully created");
1741  }
1742  upnpGatewayConf = gupnp_device_info_get_service
1743  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1GatewayConfiguration:1");
1744  if (!upnpGatewayConf)
1745  {
1746  g_message("Cannot get XfinityGatewayConfiguration service\n");
1747  }
1748  else
1749  {
1750  g_message("XUPNP XfinityGatewayConfiguration service successfully created");
1751  }
1752  }
1753  else
1754  {
1755  g_message("Client Device configuration file");
1756  upnpMediaConfService = gupnp_device_info_get_service
1757  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1MediaConfiguration:1");
1758  if (!upnpMediaConfService)
1759  {
1760  g_message("Cannot get XfinityMediaConfiguration service\n");
1761  }
1762  else
1763  {
1764  g_message("XUPNP Media Configuration service successfully created");
1765  }
1766  }
1767  if (strstr(devXMlFile_new,GW_DEVICE_XML_FILE))
1768  {
1769  g_message("Gateway Device Configuration file");
1770  upnpMediaConfService = gupnp_device_info_get_service
1771  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1MediaConfiguration:1");
1772  if (!upnpMediaConfService)
1773  {
1774  g_message("Cannot get XfinityMediaConfiguration service\n");
1775  }
1776  else
1777  {
1778  g_message("XUPNP Media Configuration service successfully created");
1779  }
1780  upnpQamConf = gupnp_device_info_get_service
1781  (GUPNP_DEVICE_INFO (dev), "urn:schemas-upnp-org:service:X1QamConfiguration:1");
1782  if (!upnpQamConf)
1783  {
1784  g_message("Cannot get XfinityQamConfiguration service\n");
1785  }
1786  else
1787  {
1788  g_message("XUPNP XfinityQamConfiguration service successfully created");
1789  }
1790  }
1791 
1792  if (!getReceiverId(receiverId))
1793  {
1794  g_message("Unable to get receiver id");
1795  }
1796  }
1797  }
1798  else
1799  {
1800  g_message("DeviceProtection Error: Cert file, Key file not available, continuing with older xcal");
1801  rfc_enabled=0;
1802  result = updatexmldata(xmlfilename, struuid, serial_Num, "XFINITY"); // BasicDevice.xml currently does not need multi-tenancy support per RDK-8190. (May come in as part of some other ticket, in which case replace "XFINITY" with getFriendlyName().)
1803  if (!result)
1804  {
1805  fprintf(stderr,"Failed to open the device xml file %s\n", xmlfilename);
1806  exit(1);
1807  }
1808  else
1809  {
1810  g_message("Updated the device xml file:%s uuid: %s", xmlfilename,struuid);
1811  }
1812  }
1813  g_free(keyFile);
1814  g_free(certFile);
1815 
1816  } //rfc_enabled
1817 
1818 #ifdef ENABLE_SD_NOTIFY
1819  sd_notifyf(0, "READY=1\n"
1820  "STATUS=xcal-device is Successfully Initialized\n"
1821  "MAINPID=%lu",
1822  (unsigned long) getpid());
1823 #endif
1824  /* Autoconnect the action and state variable handlers. This connects
1825  query_target_cb and query_status_cb to the Target and Status state
1826  variables query callbacks, and set_target_cb, get_target_cb and
1827  get_status_cb to SetTarget, GetTarget and GetStatus actions
1828  respectively. */
1829  /*gupnp_service_signals_autoconnect (GUPNP_SERVICE (service), NULL, &error);
1830  if (error) {
1831  g_printerr ("Failed to autoconnect signals: %s\n", error->message);
1832  g_error_free (error);
1833  return EXIT_FAILURE;
1834  }*/
1835  g_signal_connect (upnpService, "action-invoked::GetBaseUrl", G_CALLBACK (get_url_cb), NULL);
1836  g_signal_connect (upnpService, "action-invoked::GetBaseTrmUrl", G_CALLBACK (get_trm_url_cb), NULL);
1837  g_signal_connect (upnpService, "action-invoked::GetGatewayIP", G_CALLBACK (get_gwyip_cb), NULL);
1838  g_signal_connect (upnpService, "action-invoked::GetGatewayIPv6", G_CALLBACK (get_gwyipv6_cb), NULL);
1839 #ifndef BROADBAND
1840  g_signal_connect (upnpService, "action-invoked::GetIpv6Prefix", G_CALLBACK (get_ipv6prefix_cb), NULL);
1841  g_signal_connect (upnpService, "action-invoked::GetDnsConfig", G_CALLBACK (get_dnsconfig_cb), NULL);
1842 #endif
1843  g_signal_connect (upnpService, "action-invoked::GetGatewayStbIP", G_CALLBACK (get_gwystbip_cb), NULL);
1844  g_signal_connect (upnpService, "action-invoked::GetSystemIds", G_CALLBACK (get_systemids_cb), NULL);
1845  g_signal_connect (upnpService, "action-invoked::GetTimeZone", G_CALLBACK (get_timezone_cb), NULL);
1846  g_signal_connect (upnpService, "action-invoked::GetHosts", G_CALLBACK (get_hosts_cb), NULL);
1847  g_signal_connect (upnpService, "action-invoked::GetRequiresTRM", G_CALLBACK (get_requirestrm_cb), NULL);
1848  g_signal_connect (upnpService, "action-invoked::GetHostMacAddress", G_CALLBACK (get_hostmacaddress_cb), NULL);
1849  g_signal_connect (upnpService, "action-invoked::GetRawOffSet", G_CALLBACK (get_rawoffset_cb), NULL);
1850  g_signal_connect (upnpService, "action-invoked::GetDSTOffset", G_CALLBACK (get_dstoffset_cb), NULL);
1851  g_signal_connect (upnpService, "action-invoked::GetDSTSavings", G_CALLBACK (get_dstsavings_cb), NULL);
1852  g_signal_connect (upnpService, "action-invoked::GetUsesDaylightTime", G_CALLBACK (get_usesdaylighttime_cb), NULL);
1853  g_signal_connect (upnpService, "action-invoked::GetPlaybackUrl", G_CALLBACK (get_playback_url_cb), NULL);
1854  g_signal_connect (upnpService, "action-invoked::GetDataGatewayIPaddress", G_CALLBACK (get_dataGatewayIPaddress_cb), NULL);
1855  g_signal_connect (upnpService, "action-invoked::GetDeviceName", G_CALLBACK (get_devicename_cb), NULL);
1856  g_signal_connect (upnpService, "action-invoked::GetIsGateway", G_CALLBACK (get_isgateway_cb), NULL);
1857  g_signal_connect (upnpService, "action-invoked::GetBcastMacAddress", G_CALLBACK (get_bcastmacaddress_cb), NULL);
1858  g_signal_connect (upnpService, "action-invoked::GetRecvDevType", G_CALLBACK (get_recvdevtype_cb), NULL);
1859  g_signal_connect (upnpService, "action-invoked::GetDeviceType", G_CALLBACK (get_devicetype_cb), NULL);
1860  g_signal_connect (upnpService, "action-invoked::GetBuildVersion", G_CALLBACK (get_buildversion_cb), NULL);
1861  g_signal_connect (upnpService, "action-invoked::GetClientIP", G_CALLBACK (get_client_ip_cb), NULL);
1862  g_signal_connect (upnpService, "query-variable::Url", G_CALLBACK (query_url_cb), NULL);
1863  g_signal_connect (upnpService, "query-variable::TrmUrl", G_CALLBACK (query_trm_url_cb), NULL);
1864  g_signal_connect (upnpService, "query-variable::GatewayIP", G_CALLBACK (query_gwyip_cb), NULL);
1865  g_signal_connect (upnpService, "query-variable::GatewayIPv6", G_CALLBACK (query_gwyipv6_cb), NULL);
1866 #ifndef BROADBAND
1867  g_signal_connect (upnpService, "query-variable::Ipv6Prefix", G_CALLBACK (query_ipv6prefix_cb), NULL);
1868  g_signal_connect (upnpService, "query-variable::DnsConfig", G_CALLBACK (query_dnsconfig_cb), NULL);
1869 #endif
1870  g_signal_connect (upnpService, "query-variable::GatewayStbIP", G_CALLBACK (query_gwystbip_cb), NULL);
1871  g_signal_connect (upnpService, "query-variable::SystemIds", G_CALLBACK (query_systemids_cb), NULL);
1872  g_signal_connect (upnpService, "query-variable::TimeZone", G_CALLBACK (query_timezone_cb), NULL);
1873  g_signal_connect (upnpService, "query-variable::Hosts", G_CALLBACK (query_hosts_cb), NULL);
1874  g_signal_connect (upnpService, "query-variable::RequiresTRM", G_CALLBACK (query_requirestrm_cb), NULL);
1875  g_signal_connect (upnpService, "query-variable::HostMacAddress", G_CALLBACK (query_hostmacaddress_cb), NULL);
1876  g_signal_connect (upnpService, "query-variable::RawOffSet", G_CALLBACK (query_rawoffset_cb), NULL);
1877  g_signal_connect (upnpService, "query-variable::DSTOffset", G_CALLBACK (query_dstoffset_cb), NULL);
1878  g_signal_connect (upnpService, "query-variable::DSTSavings", G_CALLBACK (query_dstsavings_cb), NULL);
1879  g_signal_connect (upnpService, "query-variable::UsesDaylightTime", G_CALLBACK (query_usesdaylighttime_cb), NULL);
1880  g_signal_connect (upnpService, "query-variable::PlaybackUrl", G_CALLBACK (query_playback_url_cb), NULL);
1881  g_signal_connect (upnpService, "query-variable::DataGatewayIPaddress", G_CALLBACK (query_dataGatewayIPaddress_cb), NULL);
1882  g_signal_connect (upnpService, "query-variable::DeviceName", G_CALLBACK (query_devicename_cb), NULL);
1883  g_signal_connect (upnpService, "query-variable::IsGateway", G_CALLBACK (query_isgateway_cb), NULL);
1884  g_signal_connect (upnpService, "query-variable::BcastMacAddress", G_CALLBACK (query_bcastmacaddress_cb), NULL);
1885  g_signal_connect (upnpService, "query-variable::RecvDevType", G_CALLBACK (query_recvdevtype_cb), NULL);
1886  g_signal_connect (upnpService, "query-variable::DeviceType", G_CALLBACK (query_devicetype_cb), NULL);
1887  g_signal_connect (upnpService, "query-variable::BuildVersion", G_CALLBACK (query_buildversion_cb), NULL);
1888  g_signal_connect (upnpService, "query-variable::ClientIP", G_CALLBACK (query_client_ip_cb), NULL);
1889 
1890  if(rfc_enabled)
1891  {
1892 #ifdef BROADBAND
1893  //Broadband services
1894  registerGatewayConfigurationService(upnpGatewayConf);
1895  registerTimeConfigurationService(upnpTimeConf);
1896 #else
1897 #ifndef CLIENT_XCAL_SERVER
1898  //Video Gateway services
1899  registerQamConfigurationService(upnpQamConf);
1900  registerGatewayConfigurationService(upnpGatewayConf);
1901  registerTimeConfigurationService(upnpTimeConf);
1902  registerMediaConfigurationService(upnpMediaConfService);
1903 #else
1904  //Client services
1905  registerMediaConfigurationService(upnpMediaConfService);
1906 #endif
1907 #endif
1908  registerIdentityConfigurationService(upnpIdService);
1909  g_message("Successfully registered all services");
1910  }
1911 
1912  service_ready=TRUE;
1913 #ifndef CLIENT_XCAL_SERVER
1914  /*Code to handle RUI publishing*/
1915  if (checkCVP2Enabled())
1916  {
1917  if(!(getCVPIf(cvpInterface) && getCVPXmlFile(cvPXmlFile) && getCVPPort(&cvpPort)))
1918  {
1919  g_message("Failed to update the CVP variables for xcal-device");
1920  }
1921  char* cvpxmlfilename = g_strconcat(g_strstrip(devXMlPath), "/", g_strstrip(cvPXmlFile),NULL);
1922  g_print("Starting CVP2 Service with %s\n", cvpxmlfilename);
1923  char * struuidcvp = NULL;
1924  GString* mac = get_eSTBMAC();
1925  if(mac)
1926  {
1927  struuidcvp = g_strconcat("uuid:AA5859B7-EFF4-42FD-BB92-", mac->str, NULL);
1928  g_string_free(mac,TRUE);
1929  mac = NULL;
1930  }
1931  g_print("RemoteUIServerDevice UDN value: %s\n",struuidcvp);
1932  if(struuidcvp)
1933  {
1934  result = updatexmldata(cvpxmlfilename, struuidcvp, serial_Num, "XFINITY");
1935  g_free(struuidcvp);
1936  }
1937  if(cvpxmlfilename)
1938  {
1939  g_free( cvpxmlfilename);
1940  }
1941  if (!result)
1942  {
1943  g_printerr("Failed to open the RemoteUIServerDevice xml file\n");
1944  exit(1);
1945  }
1946  else
1947  g_print("Updated the RemoteUIServerDevice xml file\n");
1948 #ifndef GUPNP_1_2
1949  cvpcontext = gupnp_context_new (NULL, cvpInterface, cvpPort, &error);
1950 #else
1951  cvpcontext = gupnp_context_new (cvpInterface, cvpPort, &error);
1952 #endif
1953  if (error) {
1954  g_printerr ("Error creating the CVP context: %s\n", error->message);
1955  /* g_clear_error() frees the GError *error memory and reset pointer if set in above operation */
1956  g_clear_error(&error);
1957  return EXIT_FAILURE;
1958  }
1959  gupnp_context_set_subscription_timeout(cvpcontext, 0);
1960 #ifndef GUPNP_1_2
1961  cvpdev = gupnp_root_device_new (cvpcontext, cvPXmlFile, devXMlPath);
1962 #else
1963  cvpdev = gupnp_root_device_new (cvpcontext, cvPXmlFile, devXMlPath, &error);
1964 #endif
1965  /* Get the CVP service from the root device */
1966  gupnp_root_device_set_available (cvpdev, TRUE);
1967  cvpservice = gupnp_device_info_get_service
1968  (GUPNP_DEVICE_INFO (cvpdev), "urn:schemas-upnp-org:service:RemoteUIServer:1");
1969  if (!cvpservice) {
1970  g_printerr ("Cannot get RemoteUI service\n");
1971  return EXIT_FAILURE;
1972  }
1973  g_signal_connect (cvpservice, "action-invoked::GetCompatibleUIs", G_CALLBACK (get_rui_url_cb), NULL);
1974  fprintf(stderr,"exiting if dev-cvp\n");
1975  }
1976 #endif
1977  //control the announcement frequency and life time
1978  /*
1979  GSSDPResourceGroup *ssdpgrp = gupnp_root_device_get_ssdp_resource_group(dev);
1980  guint msgdelay = gssdp_resource_group_get_message_delay(ssdpgrp);
1981  guint msgage = gssdp_resource_group_get_max_age(ssdpgrp);
1982  g_print("Message delay is %u, Message max age is %u", msgdelay, msgage);
1983  */
1984  /* Run the main loop */
1985  main_loop = g_main_loop_new (NULL, FALSE);
1986  g_main_loop_run (main_loop);
1987  /* Cleanup */
1988  g_main_loop_unref (main_loop);
1989  g_object_unref (upnpService);
1990  g_object_unref (baseDev);
1991  g_object_unref (upnpContext);
1992  if(rfc_enabled)
1993  {
1994  g_object_unref (upnpIdService);
1995  if(upnpMediaConfService)
1996  {
1997  g_object_unref (upnpMediaConfService);
1998  }
1999  if(upnpTimeConf)
2000  {
2001  g_object_unref (upnpTimeConf);
2002  }
2003  if(upnpGatewayConf)
2004  {
2005  g_object_unref (upnpGatewayConf);
2006  }
2007  if(upnpQamConf)
2008  {
2009  g_object_unref (upnpQamConf);
2010  }
2011  g_object_unref (dev);
2012  g_object_unref (upnpContextDeviceProtect);
2013  }
2014  return EXIT_SUCCESS;
2015 }
2016 
get_requirestrm_cb
G_MODULE_EXPORT void get_requirestrm_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getRequiresTRM action is invoked and this sets the state vari...
Definition: xcal-device.c:1107
query_usesdaylighttime_cb
G_MODULE_EXPORT void query_usesdaylighttime_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when UsesDaylightTime action is invoked and this sets the state va...
Definition: xcal-device.c:1595
get_hosts_cb
G_MODULE_EXPORT void get_hosts_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getHosts action is invoked and this sets the state variable f...
Definition: xcal-device.c:1070
get_devicename_cb
G_MODULE_EXPORT void get_devicename_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getDeviceName action is invoked and this sets the state varia...
Definition: xcal-device.c:1035
getBcastMacAddress
unsigned char getBcastMacAddress(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1215
query_systemids_cb
G_MODULE_EXPORT void query_systemids_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when SystemIds action is invoked and this sets the state variable ...
Definition: xcal-device.c:1427
get_gwyipv6_cb
G_MODULE_EXPORT void get_gwyipv6_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getGatewayIPv6 action is invoked and this sets the state vari...
Definition: xcal-device.c:774
query_rui_url_cb
G_MODULE_EXPORT void query_rui_url_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when RuiUrl action is invoked and this sets the state variable wit...
Definition: xcal-device.c:1523
get_trm_url_cb
G_MODULE_EXPORT void get_trm_url_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getBaseTrmUrl action is invoked and this sets the state varia...
Definition: xcal-device.c:710
notify_value_change
void notify_value_change(const char *, const char *)
A generic function to notify all the clients whenever there is a change found in the service variable...
Definition: xcal-device-main.c:230
get_rui_url_cb
G_MODULE_EXPORT void get_rui_url_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when GetCompatibleUIs action is invoked and this sets the state va...
Definition: xcal-device.c:1124
query_hostmacaddress_cb
G_MODULE_EXPORT void query_hostmacaddress_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when HostMacAddress action is invoked and this sets the state vari...
Definition: xcal-device.c:1329
getGatewayIpv6
unsigned char getGatewayIpv6(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1294
query_hosts_cb
G_MODULE_EXPORT void query_hosts_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when Hosts action is invoked and this sets the state variable with...
Definition: xcal-device.c:1466
query_playback_url_cb
G_MODULE_EXPORT void query_playback_url_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when PlaybackUrl action is invoked and this sets the state variabl...
Definition: xcal-device.c:1190
query_gwyip_cb
G_MODULE_EXPORT void query_gwyip_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when GatewayIP action is invoked and this sets the state variable ...
Definition: xcal-device.c:1257
get_eSTBMAC
GString * get_eSTBMAC(void)
This function is used to get the MAC address of the eSTB. It uses global hostmacaddress GString to ge...
Definition: xcal-device-library.c:2519
query_url_cb
G_MODULE_EXPORT void query_url_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when getUrl action is invoked.
Definition: xcal-device.c:1154
query_dataGatewayIPaddress_cb
G_MODULE_EXPORT void query_dataGatewayIPaddress_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when DataGatewayIPaddress action is invoked and this sets the stat...
Definition: xcal-device.c:1219
getDeviceType
unsigned char getDeviceType(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1182
get_playback_url_cb
G_MODULE_EXPORT void get_playback_url_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getPlaybackUrl action is invoked and this sets the state vari...
Definition: xcal-device.c:728
query_bcastmacaddress_cb
G_MODULE_EXPORT void query_bcastmacaddress_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when BcastMacAddress action is invoked and this sets the state var...
Definition: xcal-device.c:1347
getDeviceName
unsigned char getDeviceName(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1149
query_devicename_cb
G_MODULE_EXPORT void query_devicename_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when DeviceName action is invoked and this sets the state variable...
Definition: xcal-device.c:1239
get_ipsubnet_cb
G_MODULE_EXPORT void get_ipsubnet_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when IPSubNet action is invoked and this sets the state variable f...
Definition: xcal-device-main.c:569
getIpv6Prefix
unsigned char getIpv6Prefix(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1094
get_gwystbip_cb
G_MODULE_EXPORT void get_gwystbip_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getGatewayStbIP action is invoked and this sets the state var...
Definition: xcal-device.c:793
get_usesdaylighttime_cb
G_MODULE_EXPORT void get_usesdaylighttime_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getUsesDaylightTime action is invoked and this sets the state...
Definition: xcal-device.c:1018
query_ipsubnet_cb
G_MODULE_EXPORT void query_ipsubnet_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when IPSubNet action is invoked and this sets the state variable w...
Definition: xcal-device-main.c:1200
xdevice.h
The header file provides xcal devices APIs.
query_gwystbip_cb
G_MODULE_EXPORT void query_gwystbip_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when GatewayStbIP action is invoked and this sets the state variab...
Definition: xcal-device.c:1293
query_rawoffset_cb
G_MODULE_EXPORT void query_rawoffset_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when RawOffSet action is invoked and this sets the state variable ...
Definition: xcal-device.c:1541
query_dnsconfig_cb
G_MODULE_EXPORT void query_dnsconfig_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when DnsConfig action is invoked and this sets the state variable ...
Definition: xcal-device.c:1409
query_client_ip_cb
G_MODULE_EXPORT void query_client_ip_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when ClientIP action is invoked and this sets the state variable w...
Definition: xcal-device-main.c:1359
open_document
xmlDoc * open_document(const char *file_name)
Supporting function for reading the XML file.
Definition: xcal-device-main.c:257
query_ipv6prefix_cb
G_MODULE_EXPORT void query_ipv6prefix_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when Ipv6Prefix action is invoked and this sets the state variable...
Definition: xcal-device.c:1311
get_hostmacaddress_cb
G_MODULE_EXPORT void get_hostmacaddress_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getHostMacAddress action is invoked and this sets the state v...
Definition: xcal-device.c:830
get_url_cb
G_MODULE_EXPORT void get_url_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getBaseURL action is invoked and this sets the state variable...
Definition: xcal-device.c:689
updatexmldata
gboolean updatexmldata(const char *xmlfilename, const char *struuid, const char *serialno, const char *friendlyName)
This function is used to update the xml node values UDN, serialNumber and friendlyName.
Definition: xcal-device.c:3260
get_ipv6prefix_cb
G_MODULE_EXPORT void get_ipv6prefix_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getIpv6Prefix action is invoked and this sets the state varia...
Definition: xcal-device.c:812
getGatewayStbIp
unsigned char getGatewayStbIp(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1259
query_recvdevtype_cb
G_MODULE_EXPORT void query_recvdevtype_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when RecvDevType action is invoked and this sets the state variabl...
Definition: xcal-device.c:1365
get_timezone_cb
G_MODULE_EXPORT void get_timezone_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when TimeZone action is invoked and this sets the state variable f...
Definition: xcal-device.c:964
query_buildversion_cb
G_MODULE_EXPORT void query_buildversion_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when BuildVersion action is invoked and this sets the state variab...
Definition: xcal-device.c:1391
query_dstsavings_cb
G_MODULE_EXPORT void query_dstsavings_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when DSTSavings action is invoked and this sets the state variable...
Definition: xcal-device.c:1577
query_gwyipv6_cb
G_MODULE_EXPORT void query_gwyipv6_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when Ipv6Prefix action is invoked and this sets the state variable...
Definition: xcal-device.c:1275
query_dstoffset_cb
G_MODULE_EXPORT void query_dstoffset_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when DSTOffset action is invoked and this sets the state variable ...
Definition: xcal-device.c:1559
get_buildversion_cb
G_MODULE_EXPORT void get_buildversion_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getBuildVersion action is invoked and this sets the state var...
Definition: xcal-device.c:892
get_systemids_cb
G_MODULE_EXPORT void get_systemids_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getSystemIds action is invoked and this sets the state variab...
Definition: xcal-device.c:928
query_isgateway_cb
G_MODULE_EXPORT void query_isgateway_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when IsGateway action is invoked and this sets the state variable ...
Definition: xcal-device.c:1485
set_content
int set_content(xmlDoc *doc, const char *node_name, const char *new_value)
This function is used to set new value to the given node from the xml file.
Definition: xcal-device-main.c:113
query_trm_url_cb
G_MODULE_EXPORT void query_trm_url_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when TrmUrl action is invoked and this sets the state variable wit...
Definition: xcal-device.c:1172
get_dataGatewayIPaddress_cb
G_MODULE_EXPORT void get_dataGatewayIPaddress_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getdataGatewayIPaddress action is invoked and this sets the s...
Definition: xcal-device.c:947
getRecvDevType
unsigned char getRecvDevType(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1362
get_gwyip_cb
G_MODULE_EXPORT void get_gwyip_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getGatewayIP action is invoked and this sets the state variab...
Definition: xcal-device.c:756
get_dstsavings_cb
G_MODULE_EXPORT void get_dstsavings_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getDSTSavings action is invoked and this sets the state varia...
Definition: xcal-device.c:1001
get_recvdevtype_cb
G_MODULE_EXPORT void get_recvdevtype_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getRecvDevType action is invoked and this sets the state vari...
Definition: xcal-device.c:866
get_rawoffset_cb
G_MODULE_EXPORT void get_rawoffset_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getRawOffSet action is invoked and this sets the state variab...
Definition: xcal-device.c:984
get_bcastmacaddress_cb
G_MODULE_EXPORT void get_bcastmacaddress_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getBcastMacAddress action is invoked and this sets the state ...
Definition: xcal-device.c:848
TRUE
#define TRUE
Defines for TRUE/FALSE/ENABLE flags.
Definition: wifi_common_hal.h:199
getBaseUrl
unsigned char getBaseUrl(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1029
get_dstoffset_cb
G_MODULE_EXPORT void get_dstoffset_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getDSTOffset action is invoked and this sets the state variab...
Definition: xcal-device.c:1053
query_requirestrm_cb
G_MODULE_EXPORT void query_requirestrm_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when RequiresTRM action is invoked and this sets the state variabl...
Definition: xcal-device.c:1504
get_client_ip_cb
G_MODULE_EXPORT void get_client_ip_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getClientIP action is invoked and this sets the state variabl...
Definition: xcal-device-main.c:901
get_isgateway_cb
G_MODULE_EXPORT void get_isgateway_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getIsGateway action is invoked and this sets the state variab...
Definition: xcal-device.c:1089
get_dnsconfig_cb
G_MODULE_EXPORT void get_dnsconfig_cb(GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
Callback function which is invoked when getDnsConfig action is invoked and this sets the state variab...
Definition: xcal-device.c:910
query_timezone_cb
G_MODULE_EXPORT void query_timezone_cb(GUPnPService *service, char *variable, GValue *value, gpointer user_data)
Callback function which is invoked when TimeZone action is invoked and this sets the state variable w...
Definition: xcal-device.c:1446
getGatewayIp
unsigned char getGatewayIp(char *outValue)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1329