RDK Documentation (Open Sourced RDK Components)
xdevice.h
Go to the documentation of this file.
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 #ifndef BOOL
45 #define BOOL unsigned char
46 #endif
47 
48 typedef struct
49 {
50  gchar *bcastIf, *streamIf, *trmIf, *gwIf, *cvpIf, *ruiPath, *uriOverride, *hostMacIf;
51  gchar *oemFile, *dnsFile, *dsgFile, *diagFile, *hostsFile, *devXmlPath, *devXmlFile, *cvpXmlFile, *logFile, *devPropertyFile,*ipv6FileLocation,*ipv6PrefixFile,*deviceNameFile;
52  gboolean enableCVP2, useIARM, allowGwy, enableTRM, useGliDiag, disableTuneReady,enableHostMacPblsh,rmfCrshSupp,wareHouseMode;
53  gint bcastPort, cvpPort;
54 } ConfSettings;
55 
56 ConfSettings *devConf;
57 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;
58 GString *trmurlCVP2, *playbackurlCVP2, *gwyipCVP2;
59 unsigned long channelmap_id, dac_id, plant_id, vodserver_id;
60 GString *dsgtimezone, *etchosts;
61 GUPnPRootDevice *dev, *cvpdev, *baseDev;
62 GUPnPServiceInfo *upnpService, *cvpservice, *upnpIdService, *upnpMediaConfService, *upnpTimeConf, *upnpGatewayConf, *upnpQamConf;
63 GUPnPContext *upnpContext, *cvpcontext, *upnpContextDeviceProtect;
64 
65 gboolean isgateway, tune_ready, service_ready, requirestrm, usesDaylightTime;
66 gint dstOffset, rawOffset, dstSavings;
67 GString *ruiurl, *inDevProfile, *uiFilter;
68 FILE *logoutfile;
69 
70 
71 
72 xmlDoc * open_document(const char * file_name);
73 int set_content(xmlDoc* doc, const char * node_name, const char * new_value);
74 char * get_content(xmlDoc* doc, const char * node_name);
75 gboolean getdnsconfig(void);
76 unsigned long getidfromdiagfile(const gchar *diagparam, const gchar *diagfilecontents);
77 gboolean updatesystemids(void);
78 gboolean gettimezone(void);
79 gboolean getserialnum(GString* serial_num);
80 gboolean getetchosts(void);
81 gboolean readconfile(const char*);
82 gboolean updateuuid(const char*, const char*, const char*);
83 gboolean getruiurl(void);
84 void notify_value_change(const char*, const char*);
85 void notify_value_change_int(const char*, int);
86 gboolean is_alphanum(const gchar *str);
87 gchar* getmacaddress(const gchar *if_name);
88 gboolean readDevFile(const char* );
89 GString* getID( const gchar* );
90 int getipaddress(const char* ifname, char* ipAddressBuffer, gboolean ipv6Enabled);
91 gboolean getipv6prefix(void);
92 gboolean getdevicename(void);
93 GString* get_eSTBMAC(void);
94 void notify_timezone(void);
95 gboolean getFogStatus(void);
96 void getRouteData(void);
97 
98 BOOL getBaseUrl(char *outValue);
99 BOOL getTrmUrl(char *outValue);
100 BOOL getTuneReady();
101 BOOL getPlaybackUrl(char *outValue);
102 BOOL getGatewayIp(char *outValue);
103 BOOL getGatewayIpv6(char *outValue);
104 BOOL getGatewayStbIp(char *outValue);
105 BOOL getIpv6Prefix(char *outValue);
106 BOOL getHostMacAddress(char *outValue);
107 BOOL getRecvDevType(char *outValue);
108 BOOL getDeviceType(char *outValue);
109 BOOL getBuildVersion(char *outValue);
110 BOOL getDnsConfig(char *outValue);
111 BOOL getSystemsIds(char *outValue);
112 BOOL getRouteDataGateway(char *outValue);
113 BOOL getIpSubnet(char *outValue);
114 BOOL getIsuseGliDiagEnabled();
115 BOOL getTimeZone(char *outValue);
116 BOOL getRawOffSet(int *outValue);
117 BOOL getDstSavings(int *outValue);
118 BOOL getUsesDayLightTime(BOOL *outValue);
119 BOOL getDeviceName(char *outValue);
120 BOOL getDstOffset(int *outValue);
121 BOOL getHosts(char *outValue);
122 BOOL getIsGateway(BOOL *outValue);
123 BOOL getRequiresTRM(BOOL *outValue);
124 BOOL getRUIUrl(char *outValue);
125 BOOL getModelNumber(char *outValue);
126 BOOL getMake(char *outValue);
127 BOOL getDevXmlPath(char *outValue);
128 BOOL getDevXmlFile(char *outValue, int refactor);
129 BOOL getUUID(char *outValue);
130 BOOL getBcastPort(int *outValue);
131 BOOL getSerialNum(char *outValue);
132 BOOL getBcastIf(char *outValue);
133 BOOL getBcastMacAddress(char *outValue);
134 BOOL getAccountId(char *outValue);
135 BOOL getDevCertFile(char *outValue);
136 BOOL getDevCertPath(char *outValue);
137 BOOL getDevKeyFile(char *outValue);
138 BOOL getDevKeyPath(char *outValue);
139 BOOL getReceiverId(char *outValue);
140 typedef void (*xupnpEventCallback)(const char*,const char*);
141 void xupnpEventCallback_register(xupnpEventCallback callback_proc);
142 BOOL xdeviceInit(char *devConfFile, char *devLogFile);
143 int check_rfc();
144 #ifndef CLIENT_XCAL_SERVER
145 BOOL getDisableTuneReadyStatus();
146 BOOL checkCVP2Enabled();
147 BOOL getCVPIf(char *outValue);
148 BOOL getCVPXmlFile(char *outValue);
149 BOOL getCVPPort(int *outValue);
150 #endif
151 
152 //fog
153 
154 typedef struct _IARM_Bus_FOG_Param_t
155 {
156  bool status; // if true, FOG is active
157  int fogVersion;
158  char tsbEndpoint[33]; // i.e. http://169.254.228.194:9080/tsb?
159  bool bIPDVRSupported;
161 
162 #define IARM_BUS_FOG_NAME "FOG"
163 #define IARM_BUS_FOG_getCurrentState "getCurrentState"
164 
165 typedef enum
166 {
167  IARM_BUS_FOG_EVENT_STATUS,
168  IARM_BUS_FOG_EVENT_MAX
169 } FOG_EventId_t;
170 
171 
172 //netsrvmgr
173 
174 #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
175 #define IARM_BUS_NETSRVMGR_Route_Event "sendCurrentRouteData"
176 #define IARM_BUS_ROUTE_MGR_API_getCurrentRouteData "getCurrentRouteData"
177 
178 
179 typedef struct _routeEventData_t {
180  char routeIp[46];
181  gboolean ipv4;
182  char routeIf[10];
184 
186  routeEventData_t route;
187  bool status;
189 
190 typedef enum _NetworkManager_Route_EventId_t {
191  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_DATA=10,
192  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_MAX,
193 } IARM_Bus_NetworkManager_Route_EventId_t;
194 
195 #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
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:701
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.c:3324
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
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:780
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
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:666
_IARM_Bus_FOG_Param_t
Definition: xdevice-library.h:97
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:633
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.c:3640
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
open_document
xmlDoc * open_document(const char *file_name)
Supporting function for reading the XML file.
Definition: idm_server.c:131
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
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:747
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: idm_server.c:164
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
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:848
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.c:3666
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:571
_routeEventData_t
Definition: xdevice-library.h:121
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:813