RDK Documentation (Open Sourced RDK Components)
xcal-device.c File Reference

This source file contains the APIs for xcal device initializer. More...

#include <libgupnp/gupnp.h>
#include <stdio.h>
#include <stdlib.h>
#include <gmodule.h>
#include <stdbool.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <memory.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include "xdevice.h"
#include "rdk_safeclib.h"
Include dependency graph for xcal-device.c:

Go to the source code of this file.

Macros

#define VIDIPATH_FLAG   "/opt/vidiPathEnabled"
 

Functions

void xupnp_logger (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
 This function is used to log the messages of XUPnP applications. Each Log message will be written to a file along with the timestamp formated in ISO8601 format. More...
 
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 for base url. More...
 
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 variable for base TRM Url. More...
 
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 variable for Playback Url. More...
 
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 variable for Gateway IP. More...
 
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 variable for Gateway IPv6. More...
 
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 variable for Gateway STB IP. More...
 
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 variable for IPv6 Prefix. More...
 
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 variable for Host MAC Address. More...
 
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 variable for Broadcast MAC Address. More...
 
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 variable for Receive Device Type. More...
 
G_MODULE_EXPORT void get_devicetype_cb (GUPnPService *service, GUPnPServiceAction *action, gpointer user_data)
 
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 variable for Build Version. More...
 
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 variable for DNS Config. More...
 
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 variable for System Id. More...
 
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 state variable for DataGatewayIPaddress. More...
 
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 for Time Zone. More...
 
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 variable for Raw Offset. More...
 
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 variable for DST Savings. More...
 
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 variable for Uses Daylight Time. More...
 
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 variable for Uses Service Name. More...
 
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 variable for DST Offset. More...
 
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 for Hosts. More...
 
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 variable for Gatway is active or not. More...
 
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 variable for Requiring TRM. More...
 
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 variable for InputDeviceProfile, UIFilter and UIListing. More...
 
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. More...
 
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 with a new TRM Url value. More...
 
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 variable with a new playback url. More...
 
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 state variable with a new DataGatewayIPaddress. More...
 
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 with a new device name. More...
 
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 with a new Gateway IP. More...
 
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 with a new value. More...
 
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 variable with a new value. More...
 
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 with a new value. More...
 
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 variable with a new value. More...
 
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 variable with a new value. More...
 
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 variable with a new value. More...
 
G_MODULE_EXPORT void query_devicetype_cb (GUPnPService *service, char *variable, GValue *value, gpointer user_data)
 
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 variable with a new value. More...
 
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 with a new value. More...
 
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 with a new value. More...
 
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 with a new value. More...
 
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 a new value. More...
 
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 with a new value. More...
 
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 variable with a new value. More...
 
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 with a new value. More...
 
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 with a new value. More...
 
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 with a new value. More...
 
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 with a new value. More...
 
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 variable with a new value. More...
 
void * checkMainLoopRunning ()
 
int main (int argc, char **argv)
 
int getipaddress (const char *ifname, char *ipAddressBuffer, gboolean ipv6Enabled)
 This function is used to get the IP address based on IPv6 or IPv4 is enabled. More...
 
gchar * getmacaddress (const gchar *ifname)
 This function is used to get the mac address of the target device. More...
 
gboolean getdnsconfig (void)
 This function is used to get the DNS value from DNS mask configuration file. More...
 
gboolean updatesystemids (void)
 This function is used to update the system Ids such as channelMapId, controllerId, plantId and vodServerId. More...
 
unsigned long getidfromdiagfile (const gchar *diagparam, const gchar *diagfilecontents)
 This function is used to get the system Id information from the diagnostic file. More...
 
gboolean gettimezone (void)
 This function is used to get the time zone. It gets the time zone information from the device configuration. More...
 
gboolean getserialnum (GString *serial_num)
 This function is used to get the serial number of the device from the vendor specific file. More...
 
gboolean getetchosts (void)
 This function is used to get the hosts IP information from hosts configuration file "/etc/hosts". More...
 
static void uriescape (unsigned char *instr, GString *outstr)
 
static void xmlescape (gchar *instr, GString *outstr)
 
GString * get_eSTBMAC (void)
 This function is used to get the MAC address of the eSTB. It uses global hostmacaddress GString to get the address value. More...
 
static void initIpAddressBufferCVP2 (char *ipAddressBufferCVP2)
 
static GString * get_compatible_uis_icon (int nSize, int nDepth, const char *pszImageType, const char *pszImageExt)
 
static GString * get_compatible_uis_icon_list ()
 
static GString * get_uri_value ()
 
gboolean getruiurl ()
 This function is used to get the RUI(Remote user interface) Url. It uses xdevice.conf file to get the RUI Url. If the xdevice.conf file is not present then create the the RUI url string. More...
 
static xmlNode * get_node_by_name (xmlNode *node, const char *node_name)
 
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. More...
 
char * get_content (xmlDoc *doc, const char *node_name)
 This function is used to get the value of the node from the xml file. More...
 
xmlDoc * open_document (const char *file_name)
 Supporting function for reading the XML file. More...
 
static int isVidiPathEnabled ()
 
gboolean readconffile (const char *configfile)
 This function is used to retrieve the data from the device configuration file. More...
 
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. More...
 
void notify_value_change (const char *varname, const char *strvalue)
 A generic function to notify all the clients whenever there is a change found in the service variable values. More...
 
void notify_value_change_int (const char *varname, int intvalue)
 Generic function to notify the change in the node value which are of integers type from the XML service file. More...
 
gboolean is_alphanum (const gchar *str)
 Supporting function for checking the given string is alphanumeric. More...
 
gboolean is_num (const gchar *str)
 Supporting function for checking the content of given string is numeric or not. More...
 
GString * getID (const gchar *id)
 This function is used to get the Receiver Id & Partner Id. More...
 
gboolean readDevFile (const char *deviceFile)
 This function is used to get partner ID. More...
 
void notify_timezone (void)
 Generic function to notify the change in the time zone.
 
gboolean getipv6prefix (void)
 This function is used to retrieve the IPv6 prefix information from dibblers file. More...
 
gboolean getdevicename (void)
 This function is used to get the device name from /devicename/devicename file. More...
 

yes

This source file contains the APIs for xcal device initializer.

Definition in file xcal-device.c.