RDK Documentation (Open Sourced RDK Components)
xdevice-library-private.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 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 #ifndef BOOL
20 #define BOOL unsigned char
21 #endif
22 #if defined(USE_XUPNP_IARM_BUS)
23 #include "libIARM.h"
24 #endif
25 
26 #define MAX_DEBUG_MESSAGE 50
27 typedef struct
28 {
29  gchar *bcastIf, *streamIf, *trmIf, *gwIf, *cvpIf, *ruiPath, *uriOverride, *hostMacIf, *devCertPath, *devKeyPath;
30  gchar *oemFile, *dnsFile, *dsgFile, *diagFile, *hostsFile, *wbFile, *devXmlPath, *devXmlFile, *cvpXmlFile, *logFile, *devPropertyFile,*ipv6FileLocation,*ipv6PrefixFile,*deviceNameFile;
31  gchar *devCertFile, *devKeyFile;
32  gboolean enableCVP2, useIARM, allowGwy, enableTRM, useGliDiag, disableTuneReady,enableHostMacPblsh,rmfCrshSupp,wareHouseMode;
33  gint bcastPort, cvpPort;
34 } ConfSettings;
35 
36 ConfSettings *devConf;
37 
38 GString *url, *trmurl, *videobaseurl, *playbackurl, *gwyip, *gwyipv6, *dnsconfig, *systemids, *serial_num, *lan_ip, *recv_id,*partner_id,*hostmacaddress,*devicetype,*recvdevtype,*buildversion,*ipv6prefix,*gwystbip,*bcastmacaddress,*devicename,*mocaIface,*wifiIface,*fogtsburl,*dataGatewayIPaddress, *eroutermacaddress, *accountid, *make;
39 GString *trmurlCVP2, *playbackurlCVP2, *gwyipCVP2;
40 unsigned long channelmap_id, dac_id, plant_id, vodserver_id;
41 GString *dsgtimezone, *etchosts;
42 gboolean isgateway, tune_ready, service_ready, requirestrm, usesDaylightTime;
43 gint dstOffset, rawOffset, dstSavings;
44 GString *ruiurl, *inDevProfile, *uiFilter;
45 FILE *logoutfile;
46 
47 typedef struct _STRING_MAP {
48  char *pszKey;
49  char *pszValue;
50 } STRING_MAP;
51 
52 typedef void (*xupnpEventCallback)(const char*,const char*);
53 void xupnpEventCallback_register(xupnpEventCallback callback_proc);
54 
55 #if defined(USE_XUPNP_IARM_BUS)
56 #define _IARM_XDEVICE_NAME "XDEVICE" /*!< Method to Get the Xdevice Info */
57 static void _sysEventHandler(const char *owner, IARM_EventId_t eventId,
58  void *data, size_t len);
59 IARM_Result_t _SysModeChange(void *arg);
60 static void _routesysEventHandler(const char *owner, IARM_EventId_t eventId,
61  void *data, size_t len);
62 gboolean XUPnP_IARM_Init(void);
63 BOOL getRouteData(void);
64 void getSystemValues(void);
65 gboolean getFogStatus(void);
66 //fog
67 typedef struct _IARM_Bus_FOG_Param_t
68 {
69  bool status; // if true, FOG is active
70  int fogVersion;
71  char tsbEndpoint[33]; // i.e. http://169.254.228.194:9080/tsb?
73 #define IARM_BUS_FOG_NAME "FOG"
74 #define IARM_BUS_FOG_getCurrentState "getCurrentState"
75 typedef enum
76 {
77  IARM_BUS_FOG_EVENT_STATUS,
78  IARM_BUS_FOG_EVENT_MAX
79 } FOG_EventId_t;
80 //netsrvmgr
81 #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
82 #define IARM_BUS_NETSRVMGR_Route_Event "sendCurrentRouteData"
83 #define IARM_BUS_ROUTE_MGR_API_getCurrentRouteData "getCurrentRouteData"
84 typedef struct _routeEventData_t {
85  char routeIp[46];
86  gboolean ipv4;
87  char routeIf[10];
90  routeEventData_t route;
91  bool status;
93 typedef enum _NetworkManager_Route_EventId_t {
94  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_DATA=10,
95  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_MAX,
96 } IARM_Bus_NetworkManager_Route_EventId_t;
97 #endif
98 
99 //#####################
100 BOOL check_empty(char *str);
101 BOOL check_null(char *str);
102 //######################
103 
104 BOOL xdeviceInit(char *devConfFile, char *devLogFile);
105 
106 GString *getID( const gchar *id );
107 gboolean updatesystemids(void);
108 gboolean parsedevicename(void);
109 gboolean parseipv6prefix(void);
110 gboolean readconffile(const char *configfile);
111 gboolean getetchosts(void);
112 gboolean parseserialnum(GString *serial_num);
113 unsigned long getidfromdiagfile(const gchar *diagparam,
114  const gchar *diagfilecontents);
115 gboolean parsednsconfig(void);
116 gchar *getmacaddress(const gchar *ifname);
117 int getipaddress(const char *ifname, char *ipAddressBuffer,
118  gboolean ipv6Enabled);
119 //BOOL check_empty(char *str);
120 //BOOL check_null(char *str);
121 //static char *getStrValueFromMap(char *pszKey, int nPairs, STRING_MAP map[]);
getetchosts
gboolean getetchosts(void)
This function is used to get the hosts IP information from hosts configuration file "/etc/hosts".
Definition: xcal-device.c:2573
parseipv6prefix
gboolean parseipv6prefix(void)
This function is used to retrieve the IPv6 prefix information from dibblers file.
Definition: xcal_device_library.c:2848
parsedevicename
gboolean parsedevicename(void)
This function is used to get the device name from /devicename/devicename file.
Definition: xcal_device_library.c:2786
readconffile
gboolean readconffile(const char *configfile)
This function is used to retrieve the data from the device configuration file.
Definition: xcal-device.c:3111
check_empty
unsigned char check_empty(char *str)
This function is used to get the IP address based on IPv6 or IPv4 is enabled.
Definition: xcal_device_library.c:1004
parsednsconfig
gboolean parsednsconfig(void)
This function is used to get the DNS value from DNS mask configuration file.
Definition: xcal_device_library.c:3463
_IARM_Bus_FOG_Param_t
Definition: xdevice-library.h:97
_STRING_MAP
Definition: xdevice-library-private.h:47
ConfSettings
Definition: xdevice-library-private.h:27
getmacaddress
gchar * getmacaddress(const gchar *ifname)
This function is used to get the mac address of the target device.
Definition: xcal-device.c:2253
_IARM_Bus_RouteSrvMgr_RouteData_Param_t
Definition: xdevice-library.h:127
updatesystemids
gboolean updatesystemids(void)
This function is used to update the system Ids such as channelMapId, controllerId,...
Definition: xcal-device.c:2351
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.c:2188
parseserialnum
gboolean parseserialnum(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:3370
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.c:2408
getID
GString * getID(const gchar *id)
This function is used to get the Receiver Id & Partner Id.
Definition: xcal-device.c:3425
_SysModeChange
static IARM_Result_t _SysModeChange(void *arg)
This function is a event handler which returns current system mode using IARM. It returns mode as "NO...
Definition: dsMgr.c:272
_routeEventData_t
Definition: xdevice-library.h:121