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 __XDEVICE_LIBRARY_PRIVATE_H__
20 #define __XDEVICE_LIBRARY_PRIVATE_H__
21 #include <glib.h>
22 #define MAX_DEBUG_MESSAGE 50
23 #if defined(USE_XUPNP_IARM_BUS)
24 #include "libIARM.h"
25 #endif
26 typedef struct
27 {
28  gchar *bcastIf, *streamIf, *trmIf, *gwIf, *cvpIf, *ruiPath, *uriOverride, *hostMacIf;
29  gchar *oemFile, *dnsFile, *dsgFile, *diagFile, *hostsFile, *devXmlPath, *devXmlFile, *cvpXmlFile, *logFile, *devPropertyFile,*ipv6FileLocation,*ipv6PrefixFile,*deviceNameFile;
30  gboolean enableCVP2, useIARM, allowGwy, enableTRM, useGliDiag, disableTuneReady,enableHostMacPblsh,rmfCrshSupp,wareHouseMode;
31  gint bcastPort, cvpPort;
32  gchar *devCertPath, *devCertFile, *devKeyFile, *devKeyPath;
33 } ConfSettings;
34 ConfSettings *devConf;
35 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, *modelnumber, *make, *accountid;
36 GString *trmurlCVP2, *playbackurlCVP2, *gwyipCVP2;
37 unsigned long channelmap_id, dac_id, plant_id, vodserver_id;
38 GString *dsgtimezone, *etchosts;
39 gboolean isgateway, tune_ready, service_ready, requirestrm, usesDaylightTime;
40 gint dstOffset, rawOffset, dstSavings;
41 GString *ruiurl, *inDevProfile, *uiFilter;
42 FILE *logoutfile;
43 
44 //typedef enum _IARM_Result_t
45 //{
46 // IARM_RESULT_SUCCESS,
47 // IARM_RESULT_INVALID_PARAM, /*!< Invalid input parameter */
48 // IARM_RESULT_INVALID_STATE, /*!< Invalid state encountered */
49 // IARM_RESULT_IPCCORE_FAIL, /*!< Underlying IPC failure */
50 // IARM_RESULT_OOM, /*!< Memory allocation failure */
51 
52 //} IARM_Result_t;
53 
54 
55 typedef void (*xupnpEventCallback)(const char*,const char*);
56 void xupnpEventCallback_register(xupnpEventCallback callback_proc);
57 
58 typedef struct _STRING_MAP {
59  char *pszKey;
60  char *pszValue;
61 } STRING_MAP;
62 //typedef int IARM_EventId_t;
63 
64 #if defined(USE_XUPNP_IARM_BUS)
65 #define _IARM_XDEVICE_NAME "XDEVICE" /*!< Method to Get the Xdevice Info */
66 static void _sysEventHandler(const char *owner, IARM_EventId_t eventId,
67  void *data, size_t len);
68 IARM_Result_t _SysModeChange(void *arg);
69 static void _routesysEventHandler(const char *owner, IARM_EventId_t eventId,
70  void *data, size_t len);
71 BOOL XUPnP_IARM_Init(void);
72 BOOL getRouteData(void);
73 void getSystemValues(void);
74 BOOL getFogStatus(void);
75 //fog
76 typedef struct _IARM_Bus_FOG_Param_t
77 {
78  BOOL status; // if true, FOG is active
79  int fogVersion;
80  char tsbEndpoint[33]; // i.e. http://169.254.228.194:9080/tsb?
81  BOOL bIPDVRSupported;
83 #define IARM_BUS_FOG_NAME "FOG"
84 #define IARM_BUS_FOG_getCurrentState "getCurrentState"
85 typedef enum
86 {
87  IARM_BUS_FOG_EVENT_STATUS,
88  IARM_BUS_FOG_EVENT_MAX
89 } FOG_EventId_t;
90 //netsrvmgr
91 #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
92 #define IARM_BUS_NETSRVMGR_Route_Event "sendCurrentRouteData"
93 #define IARM_BUS_ROUTE_MGR_API_getCurrentRouteData "getCurrentRouteData"
94 typedef struct _routeEventData_t {
95  char routeIp[46];
96  gboolean ipv4;
97  char routeIf[10];
100  routeEventData_t route;
101  BOOL status;
103 typedef enum _NetworkManager_Route_EventId_t {
104  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_DATA=10,
105  IARM_BUS_NETWORK_MANAGER_EVENT_ROUTE_MAX,
106 } IARM_Bus_NetworkManager_Route_EventId_t;
107 #endif
108 BOOL xdeviceInit(char *devConfFile, char *devLogFile);
109 
110 GString *getID( const gchar *id );
111 BOOL updatesystemids(void);
112 BOOL parsedevicename(void);
113 BOOL parseipv6prefix(void);
114 BOOL readconffile(const char *configfile);
115 BOOL getetchosts(void);
116 BOOL parseserialnum(GString *serial_num);
117 unsigned long getidfromdiagfile(const gchar *diagparam,
118  const gchar *diagfilecontents);
119 BOOL parsednsconfig(void);
120 gchar *getmacaddress(const gchar *ifname);
121 int getipaddress(const char *ifname, char *ipAddressBuffer,gboolean ipv6Enabled);
122 BOOL check_empty(char *str);
123 BOOL check_null(char *str);
124 void mapTimeZoneToJavaFormat(char *payload);
125 static char * getPartnerName();
126 
127 #if 0
128 static char * getFriendlyName();
129 #endif
130 
131 static char * getProductName();
132 static char * getServiceName();
133 static char * getServiceDescription();
134 static char * getGatewayName();
135 #else
136 #error "! __XDEVICE_LIBRARY_PRIVATE_H__"
137 #endif
getetchosts
BOOL getetchosts(void)
This function is used to get the hosts IP information from hosts configuration file "/etc/hosts".
Definition: xcal-device-library.c:2718
parseipv6prefix
BOOL parseipv6prefix(void)
This function is used to retrieve the IPv6 prefix information from dibblers file.
Definition: xcal-device-library.c:2241
parsedevicename
BOOL parsedevicename(void)
This function is used to get the device name from /devicename/devicename file.
Definition: xcal-device-library.c:2192
readconffile
BOOL readconffile(const char *configfile)
This function is used to retrieve the data from the device configuration file.
Definition: xcal-device-library.c:2328
check_empty
BOOL 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:546
parsednsconfig
BOOL parsednsconfig(void)
This function is used to get the DNS value from DNS mask configuration file.
Definition: xcal-device-library.c:2869
_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-library.c:2920
_IARM_Bus_RouteSrvMgr_RouteData_Param_t
Definition: xdevice-library.h:127
updatesystemids
BOOL 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
parseserialnum
BOOL 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:2777
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 *id)
This function is used to get the Receiver Id & Partner Id.
Definition: xcal-device-library.c:2074
_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