RDK Documentation (Open Sourced RDK Components)
NetworkMgrMain.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 #ifndef _NETWORKMGRMAIN_H_
21 #define _NETWORKMGRMAIN_H_
22 
23 
24 #include <stdio.h>
25 #include <sys/types.h>
26 #include <signal.h>
27 #include <unistd.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <malloc.h>
31 #include <errno.h>
32 #include <sys/stat.h>
33 #include <sys/types.h>
34 #include <glib.h>
35 
36 
37 extern "C" {
38 #include "cJSON.h"
39 #ifdef ENABLE_SD_NOTIFY
40 #include <systemd/sd-daemon.h>
41 #endif
42 }
43 
44 #include "logging.h"
45 #include "NetworkMedium.h"
46 #ifdef ENABLE_IARM
47 #include "irMgr.h"
48 #include "comcastIrKeyCodes.h"
49 #include "libIARM.h"
50 #endif
51 
52 /**
53  * @addtogroup NETSRVMGR_TYPES
54  * @{
55  */
56 #define IARM_BUS_NM_SRV_MGR_NAME "NET_SRV_MGR"
57 
58 #define WIFI_CONFIG "WiFiMgr_Config"
59 
60 #define MAX_TIMEOUT_ON_DISCONNECT "MAX_TIMEOUT_ON_DISCONNECT"
61 #define ENABLE_LOST_FOUND_RUN "ENABLE_LOST_FOUND"
62 #define LAF_CONNECT_RETRY_INTERVAL "LAF_CONNECT_RETRY_INTERVAL"
63 #define LAF_CONNECT_START_INTERVAL "LAF_CONNECT_START_INTERVAL"
64 #define AUTHSERVER_URL "AUTHSERVER_URL"
65 #define GET_AUTHTOKEN_URL "GET_AUTHTOKEN_URL"
66 #define GET_LFAT_URL "GET_LFAT_URL"
67 #define SET_LFAT_URL "SET_LFAT_URL"
68 #define DISABLE_WPS_XRE "disableWpsXRE"
69 #define LFAT_VERSION "LFAT_VERSION"
70 #define LFAT_TTL "LFAT_TTL"
71 #define LAF_CONNECTION_RETRY "LAF_CONNECTION_RETRY"
72 
73 #define STUN_CONFIG "Stun_Config"
74 #define STUN_SERVER "STUN_SERVER"
75 #define STUN_PORT "STUN_PORT"
76 #define STUN_INTERFACE "STUN_INTERFACE"
77 #define STUN_IPV6 "STUN_IPV6"
78 #define STUN_BIND_TIMEOUT "STUN_BIND_TIMEOUT"
79 #define STUN_CACHE_TIMEOUT "STUN_CACHE_TIMEOUT"
80 
81 #define WIFI_BCK_PATHNAME "/opt/persistent/wifi"
82 #define WIFI_BCK_FILENAME "/opt/persistent/wifi/wifiConnectionInfo.json"
83 #define WIFI_CONN_DETAILS "wifi_conn_details"
84 #define SSID_STR "ssid"
85 #define PSK_STR "psk"
86 #define CONN_TYPE "conn_type"
87 #define MAX_TIME_OUT_PERIOD 60
88 #define BUFFER_SIZE_128 128
89 
90 /*Telemetery logging file configurations */
91 #define TELEMETRY_LOGGING_PARAM_FILE "/etc/netsrvmgr_Telemetry_LoggingParams.json"
92 #define T_PERIOD_1_INTERVAL "wifi_period1_time"
93 #define T_PERIOD_1_PARAMETER_LIST "wifi_parameter_list_period1"
94 #define T_PERIOD_2_INTERVAL "wifi_period2_time"
95 #define T_PERIOD_2_PARAMETER_LIST "wifi_parameter_list_period2"
96 
97 
98 typedef struct {
99  int timePeriod;
100  GList* paramlist;
102 
103 
104 typedef enum _WiFiResult
105 {
106  WiFiResult_ok= 0,
107  WiFiResult_notFound,
108  WiFiResult_inUse,
109  WiFiResult_readError,
110  WiFiResult_writeError,
111  WiFiResult_invalidParameter,
112  WiFiResult_fail
113 } WiFiResult;
114 
115 typedef struct _wifiMgrConfigProps
116 {
117  unsigned short max_timeout;
118  bool bEnableLostFound;
119  unsigned short lnfRetryInSecs;
120  unsigned short lnfStartInSecs;
121  char authServerURL[BUFFER_SIZE_128];
122  bool disableWpsXRE;
123  char getAuthTokenUrl[BUFFER_SIZE_128];
124  char getLfatUrl[BUFFER_SIZE_128];
125  char setLfatUrl[BUFFER_SIZE_128];
126  char lfatVersion[BUFFER_SIZE_128];
127  unsigned short lnfRetryCount;
128  unsigned int lfatTTL;
130 
131 typedef struct _stunConfigProps
132 {
133  char server[BUFFER_SIZE_128];
134  uint16_t port;
135  bool ipv6;
136  char interface[16];
137  uint16_t bind_timeout;
138  uint16_t cache_timeout;
140 
141 typedef struct _netMgrConfigProps
142 {
143  wifiMgrConfigProps wifiProps;
144  stunConfigProps stunProps;
146 
147 /** @} */ //END OF GROUP NETSRVMGR_TYPES
148 
149 #if !defined(ENABLE_XCAM_SUPPORT) && !defined(XHB1) && !defined(XHC3)
150 bool isInterfaceEnabled(const char* interface, bool& enabled);
151 #endif // if !defined(ENABLE_XCAM_SUPPORT) && !defined(XHB1) && !defined(XHC3)
152 
153 #endif /* _NETWORKMGRMAIN_H_ */
_stunConfigProps
Definition: NetworkMgrMain.h:131
_netMgrConfigProps
Definition: NetworkMgrMain.h:141
_wifiMgrConfigProps
Definition: NetworkMgrMain.h:115
irMgr.h
IARM-Bus IR Manager API.
telemetryParams
Definition: NetworkMgrMain.h:98