RDK Documentation (Open Sourced RDK Components)
Device_WiFi.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 /**
21  * @file Device_WiFi.h
22  * TR-069 Device.WiFi object Public API.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_WIFI TR-069 Object (Device.WiFi)
27  * The WiFi object is based on the WiFi Alliance 802.11 specifications ([802.11-2007]).
28  * It defines interface objects (Radio and SSID), and application objects (AccessPoint and EndPoint).
29  *
30  * @par About TR-069 Object Device.WiFi.AccessPoint.{i}
31  * @n
32  * This object models an 802.11 connection from the perspective of a wireless access point.
33  * Each AccessPoint entry is associated with a particular SSID interface instance via the SSIDReference parameter.
34  * @n @n
35  * For enabled table entries, if SSIDReference is not a valid reference then the table entry is inoperable
36  * and the CPE MUST set Status to Error_Misconfigured.
37  * @n
38  * @note The AccessPoint table includes a unique key parameter that is a strong reference.
39  * If a strongly referenced object is deleted, the CPE will set the referencing parameter to an empty string.
40  * However, doing so under these circumstances might cause the updated AccessPoint row to then violate
41  * the table's unique key constraint; if this occurs, the CPE MUST set Status to Error_Misconfigured
42  * and disable the offending AccessPoint row.
43  * @n @n
44  * At most one entry in this table (regardless of whether or not it is enabled) can exist with a given value
45  * for Alias. On creation of a new table entry, the CPE MUST choose an initial value for Alias such that the
46  * new entry does not conflict with any existing entries.
47  * @n @n
48  * At most one enabled entry in this table can exist with a given value for SSIDReference.
49  *
50  * @par About TR-069 Object Device.WiFi.EndPoint.{i}
51  * @n
52  * This object models an 802.11 connection from the perspective of a wireless end point.
53  * Each EndPoint entry is associated with a particular SSID interface instance via the SSIDReference parameter,
54  * and an associated active Profile instance via the ProfileReference parameter.
55  * The active profile is responsible for specifying the actual SSID and security settings used by the end point.
56  * @n @n
57  * For enabled table entries, if SSIDReference or ProfileReference is not a valid reference then the table entry
58  * is inoperable and the CPE MUST set Status to Error_Misconfigured.
59  * @n @n
60  * Note: The EndPoint table includes a unique key parameter that is a strong reference.
61  * If a strongly referenced object is deleted, the CPE will set the referencing parameter to an empty string.
62  * However, doing so under these circumstances might cause the updated EndPoint row to then violate the table's
63  * unique key constraint;
64  * @n @n
65  * if this occurs, the CPE MUST set Status to Error_Misconfigured and disable the offending EndPoint row.
66  * At most one entry in this table (regardless of whether or not it is enabled) can exist with a given value for Alias.
67  * On creation of a new table entry, the CPE MUST choose an initial value for Alias
68  * such that the new entry does not conflict with any existing entries.
69  * @n @n
70  * At most one enabled entry in this table can exist with a given value for SSIDReference.
71  *
72  * @par About TR-069 Object Device.WiFi.Radio.{i}.
73  * @n
74  * This object models an 802.11 wireless radio on a device (a stackable interface object as described
75  * in [Section 4.2/TR-181i2]).
76  * @n @n
77  * If the device can establish more than one connection simultaneously (e.g. a dual radio device),
78  * a separate Radio instance MUST be used for each physical radio of the device. See [Appendix III.1/TR-181i2]
79  * for additional information.
80  * @n
81  * @note A dual-band single-radio device (e.g. an 802.11a/b/g radio) can be configured to operate at 2.4 or
82  * 5 GHz frequency bands, but only a single frequency band is used to transmit/receive at a given time.
83  * Therefore, a single Radio instance is used even for a dual-band radio.
84  * @n @n
85  * At most one entry in this table can exist with a given value for Alias, or with a given value for Name.
86  *
87  * @par About TR-069 Object Device.WiFi.SSID.{i}.
88  * @n
89  * WiFi SSID table (a stackable interface object as described in [Section 4.2/TR-181i2]), where table
90  * entries model the MAC layer. A WiFi SSID entry is typically stacked on top of a Radio object.
91  * @n
92  * WiFi SSID is also a multiplexing layer, i.e. more than one SSID can be stacked above a single Radio.
93  * @n
94  * At most one entry in this table (regardless of whether or not it is enabled) can exist with a given
95  * value for Alias, or with a given value for Name. On creation of a new table entry, the CPE MUST choose
96  * initial values for Alias and Name such that the new entry does not conflict with any existing entries.
97  * @n
98  * At most one enabled entry in this table can exist with a given value for SSID, or with a given value for BSSID.
99  *
100  * @ingroup TR69_HOSTIF_PROFILE
101  *
102  * @defgroup TR69_HOSTIF_WIFI_API TR-069 Object (Device.WiFi.) Public APIs
103  * The WiFi object is based on the WiFi Alliance 802.11 specifications ([802.11-2007]).
104  * It defines interface objects (Radio and SSID), and application objects (AccessPoint and EndPoint).
105  *
106  * @ingroup TR69_HOSTIF_WIFI
107  */
108 
109 
110 
111 /**
112 * @defgroup tr69hostif
113 * @{
114 * @defgroup hostif
115 * @{
116 **/
117 
118 
119 #ifndef DEVICE_WIFI_H_
120 #define DEVICE_WIFI_H_
121 
122 #ifdef USE_WIFI_PROFILE
123 /*****************************************************************************
124  * TR069-DEVICE-WIFI API SPECIFIC INCLUDE FILES
125  *****************************************************************************/
126 #include "hostIf_main.h"
127 #include "hostIf_tr69ReqHandler.h"
128 #include "hostIf_utils.h"
129 #include "hostIf_updateHandler.h"
130 
131 #define QUERY_INTERVAL 10
132 
133 /** @defgroup TR_069_DEVICE_WIFI_API TR-069 Device.WiFi object API.
134  * @ingroup TR_069_API
135  *
136  * The The WiFi object is based on the WiFi Alliance 802.11 specifications ([802.11-2007]).
137  * It defines interface objects (Radio and SSID), and application objects (AccessPoint and EndPoint).
138  *
139  */
140 
141 /** @addtogroup TR_069_DEVICE_WIFI_GETTER_API TR-069 Device.WiFi Getter API.
142  * @ingroup TR_069_DEVICE_WIFI_API
143  *
144  * \section TR-069 Device.WiFi Getter API
145  *
146  * This is the getter group of API for the <b>Device.WiFi</b> object.
147  *
148  * The interface for all functions is identical and is described here.
149  *
150  * @param[in] HOSTIF_MsgData_t This is the host IF Message Request data
151  *
152  * @return The status of the operation.
153  * @retval OK If parameter requested was successfully fetched. (Same as <b>NO_ERROR</b>).
154  * @retval NOK If parameter requested was successfully fetched. (Same as <b>OK</b>).
155  *
156  *
157  * @{
158  */
159 
160 /**
161  * @brief Get the status of the time client.
162  *
163  * This function provides the status (enabled or disabled) of the NTP or SNTP time
164  * client.
165  *
166  * See @ref dev_time_getter
167  *
168  */
169 
170 class WiFiDevice {
171  void *ctxt = NULL; //CID:103345,102998 - UNINIT_CTOR,UNINIT
172  static GHashTable *devHash;
173 
174  int dev_id;
175 
176  WiFiDevice(int dev_id);
177  ~WiFiDevice() {};
178 public:
179  static class WiFiDevice *getInstance(int dev_id);
180  static void closeInstance(WiFiDevice *);
181  static void closeAllInstances();
182 
183  static int init();
184  static void shutdown();
185 
186  void* getContext();
187 };
188 
189 
190 class hostIf_WiFi {
191 
192  static GHashTable *ifHash;
193 
194  int dev_id;
195  unsigned int uiRadioNumberOfEntries;
196  unsigned int uiSSIDNumberOfEntries;
197  unsigned int uiAccessPointNumberOfEntries;
198  unsigned int uiEndPointNumberOfEntries;
199 
200  hostIf_WiFi(int dev_id);
201  ~hostIf_WiFi() {};
202 
203 public:
204 
205  static hostIf_WiFi* getInstance(int dev_id);
206  static void closeInstance(hostIf_WiFi*);
207  static GList* getAllIntefaces();
208  static void closeAllInstances();
209 
210  /**
211  * @ingroup TR69_HOSTIF_WIFI_API
212  * @{
213  */
214  /**
215  * @brief This function provides the number of entries in the Radio table.
216  */
217  int get_Device_WiFi_RadioNumberOfEntries(HOSTIF_MsgData_t *);
218 
219 
220  /**
221  * @brief This function provides the number of entries in the SSID table.
222  */
223  int get_Device_WiFi_SSIDNumberOfEntries(HOSTIF_MsgData_t *);
224 
225  /**
226  * @brief This function provides the number of entries in the AccessPoint table.
227  */
228  int get_Device_WiFi_AccessPointNumberOfEntries(HOSTIF_MsgData_t *);
229 
230  /**
231  * @brief This function provides the number of entries in the EndPoint table.
232  */
233  int get_Device_WiFi_EndPointNumberOfEntries(HOSTIF_MsgData_t *);
234 
235  /**
236  * @brief Get the wifi enable status.
237  *
238  * This function gets the value of enable or disable wifi.
239  *
240  */
241  int get_Device_WiFi_EnableWiFi(HOSTIF_MsgData_t *);
242  /**
243  * @brief set the wifi enable status.
244  *
245  * This function sets the value for enable or disable wifi.
246  *
247  */
248  int set_Device_WiFi_EnableWiFi(HOSTIF_MsgData_t *);
249 
250  /** @} */ //End of Doxygen tag TR69_HOSTIF_WIFI_API
251  /* End of TR_069_DEVICE_WIFI_GETTER_API doxygen group. */
252  /**
253  * @}
254  */
255 
256 };
257 /* End of TR_069_DEVICE_WIFI_SETTER_API doxygen group. */
258 /**
259  * @}
260  */
261 #endif /*#ifdef USE_WIFI_PROFILE*/
262 #endif /* DEVICE_WIFI_H_ */
263 
264 
265 /** @} */
266 /** @} */
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_main.h
hostIf_main API.