RDK Documentation (Open Sourced RDK Components)
xdevice-library.h
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 2016 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 /**
20  * @file xdevice.h
21  * @brief The header file provides xcal devices APIs.
22  */
23 
24  /**
25  * @defgroup XUPNP_XCALDEV XUPnP XCal-Device
26  * The XUPnP XCal-Device moudule is responssible for getting the device discovery information.
27  * - Read the xupnp configuration details from configuration file.
28  * - Getting the input for different gateway to populate all the service veriables.
29  * - It act like a server & whenever requested it will give the services details such as ipv6 ip address,
30  * receiver Id, etc.
31  * - Once the xcal-device receive the services details, it will create a UPnP object and start publishing the UPnP data.
32  * @ingroup XUPNP
33  *
34  * @defgroup XUPNP_XCALDEV_FUNC XUPnP XCal-Device Functions
35  * Describe the details about XCal-Device functional specifications.
36  * @ingroup XUPNP_XCALDEV
37  */
38 #ifndef XDEVICE_H
39 #define XDEVICE_H
40 
41 #define _IARM_XDEVICE_NAME "XDEVICE" /*!< Method to Get the Xdevice Info */
42 #define MAX_DEBUG_MESSAGE 50
43 
44 typedef struct
45 {
46  gchar *bcastIf, *streamIf, *trmIf, *gwIf, *cvpIf, *ruiPath, *uriOverride, *hostMacIf;
47  gchar *oemFile, *dnsFile, *dsgFile, *diagFile, *hostsFile, *devXmlPath, *devXmlFile, *cvpXmlFile, *logFile, *devPropertyFile,*ipv6FileLocation,*ipv6PrefixFile,*deviceNameFile;
48  gboolean enableCVP2, useIARM, allowGwy, enableTRM, useGliDiag, disableTuneReady,enableHostMacPblsh,rmfCrshSupp,wareHouseMode;
49  gint bcastPort, cvpPort;
50 } ConfSettings;
51 
52 ConfSettings *devConf;
53 GString *url, *trmurl, *playbackurl, *gwyip, *gwyipv6, *dnsconfig, *systemids, *serial_num, *lan_ip, *recv_id,*partner_id,*hostmacaddress,*devicetype,*recvdevtype,*buildversion,*ipv6prefix,*gwystbip,*bcastmacaddress,*devicename,*mocaIface,*wifiIface,*dataGatewayIPaddress;
54 GString *trmurlCVP2, *playbackurlCVP2, *gwyipCVP2;
55 unsigned long channelmap_id, dac_id, plant_id, vodserver_id;
56 GString *dsgtimezone, *etchosts;
57 GUPnPRootDevice *dev, *cvpdev;
58 GUPnPServiceInfo *service, *cvpservice;
59 GUPnPContext *context, *cvpcontext;
60 
61 gboolean isgateway, tune_ready, service_ready, requirestrm, usesDaylightTime;
62 gint dstOffset, rawOffset, dstSavings;
63 GString *ruiurl, *inDevProfile, *uiFilter;
64 FILE *logoutfile;
65 
66 
67 
68 xmlDoc * open_document(const char * file_name);
69 int set_content(xmlDoc* doc, const char * node_name, const char * new_value);
70 char * get_content(xmlDoc* doc, const char * node_name);
71 gboolean getdnsconfig(void);
72 unsigned long getidfromdiagfile(const gchar *diagparam, const gchar *diagfilecontents);
73 gboolean updatesystemids(void);
74 gboolean gettimezone(void);
75 gboolean getserialnum(GString* serial_num);
76 gboolean getetchosts(void);
77 gboolean readconfile(const char*);
78 gboolean updateuuid(const char*, const char*, const char*);
79 gboolean getruiurl(void);
80 void notify_value_change(const char*, const char*);
81 void notify_value_change_int(const char*, int);
82 gboolean is_alphanum(const gchar *str);
83 gchar* getmacaddress(const gchar *if_name);
84 gboolean readDevFile(const char* );
85 GString* getID( const gchar* );
86 int getipaddress(const char* ifname, char* ipAddressBuffer, gboolean ipv6Enabled);
87 gboolean getipv6prefix(void);
88 gboolean getdevicename(void);
89 GString* get_eSTBMAC(void);
90 void notify_timezone(void);
91 gboolean getFogStatus(void);
92 void getRouteData(void);
93 
94 
95 //fog
96 
97 typedef struct _IARM_Bus_FOG_Param_t
98 {
99  bool status; // if true, FOG is active
100  int fogVersion;
101  char tsbEndpoint[33]; // i.e. http://169.254.228.194:9080/tsb?
103 
104 #define IARM_BUS_FOG_NAME "FOG"
105 #define IARM_BUS_FOG_getCurrentState "getCurrentState"
106 
107 typedef enum
108 {
109  IARM_BUS_FOG_EVENT_STATUS,
110  IARM_BUS_FOG_EVENT_MAX
111 } FOG_EventId_t;
112 
113 
114 //netsrvmgr
115 
116 #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
117 #define IARM_BUS_NETSRVMGR_Route_Event "sendCurrentRouteData"
118 #define IARM_BUS_ROUTE_MGR_API_getCurrentRouteData "getCurrentRouteData"
119 
120 
121 typedef struct _routeEventData_t {
122  char routeIp[46];
123  gboolean ipv4;
124  char routeIf[10];
126 
128  routeEventData_t route;
129  bool status;
131 
132 typedef enum _NetworkManager_Route_EventId_t {
133  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_DATA=10,
134  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_MAX,
135 } IARM_Bus_NetworkManager_Route_EventId_t;
136 
137 #endif // XDEVICE_H
gettimezone
gboolean gettimezone(void)
This function is used to get the time zone. It gets the time zone information from the device configu...
Definition: xcal-device-library.c:955
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
getdevicename
gboolean getdevicename(void)
This function is used to get the device name from /devicename/devicename file.
Definition: xcal-device.c:3748
getetchosts
gboolean getetchosts(void)
This function is used to get the hosts IP information from hosts configuration file "/etc/hosts".
Definition: xcal-device-library.c:2718
getdnsconfig
gboolean getdnsconfig(void)
This function is used to get the DNS value from DNS mask configuration file.
Definition: xcal-device.c:2287
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
notify_value_change_int
void notify_value_change_int(const char *, int)
Generic function to notify the change in the node value which are of integers type from the XML servi...
Definition: xcal-device.c:3351
_IARM_Bus_FOG_Param_t
Definition: xdevice-library.h:97
readDevFile
gboolean readDevFile(const char *)
This function is used to get partner ID.
Definition: xcal-device-library.c:385
getserialnum
gboolean getserialnum(GString *serial_num)
This function is used to get the serial number of the device from the vendor specific file.
Definition: xcal-device-library.c:227
notify_timezone
void notify_timezone(void)
Generic function to notify the change in the time zone.
Definition: xcal_device_library.c:183
open_document
xmlDoc * open_document(const char *file_name)
Supporting function for reading the XML file.
Definition: xcal-device-main.c:257
ConfSettings
Definition: xdevice-library-private.h:27
_IARM_Bus_RouteSrvMgr_RouteData_Param_t
Definition: xdevice-library.h:127
getmacaddress
gchar * getmacaddress(const gchar *if_name)
This function is used to get the mac address of the target device.
Definition: xcal-device-library.c:2920
updatesystemids
gboolean updatesystemids(void)
This function is used to update the system Ids such as channelMapId, controllerId,...
Definition: xcal-device-library.c:2147
getipaddress
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.
Definition: xcal-device-library.c:2951
getidfromdiagfile
unsigned long getidfromdiagfile(const gchar *diagparam, const gchar *diagfilecontents)
This function is used to get the system Id information from the diagnostic file.
Definition: xcal-device-library.c:2846
getID
GString * getID(const gchar *)
This function is used to get the Receiver Id & Partner Id.
Definition: xcal-device-library.c:2074
getruiurl
gboolean getruiurl(void)
This function is used to get the RUI(Remote user interface) Url. It uses xdevice.conf file to get the...
Definition: xcal-device.c:2942
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
get_content
char * get_content(xmlDoc *doc, const char *node_name)
This function is used to get the value of the node from the xml file.
Definition: xcal-device.c:3054
is_alphanum
gboolean is_alphanum(const gchar *str)
Supporting function for checking the given string is alphanumeric.
Definition: xcal-device-library.c:1177
getipv6prefix
gboolean getipv6prefix(void)
This function is used to retrieve the IPv6 prefix information from dibblers file.
Definition: xcal_device_library.c:2246
_routeEventData_t
Definition: xdevice-library.h:121