RDK Documentation (Open Sourced RDK Components)
snmpAdapter.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 2017 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 snmpAdapter.h
22  * @brief The header file provides TR181 SNMP device RDK Central APIs.
23  */
24 
25 /**
26  * @defgroup TR181_HOSTIF_SNMPRDKCENTRAL TR-181 Object (Device.X_RDKCENTRAL)
27  *
28  *
29  */
30 
31 /**
32  * @file snmpAdapter.h
33  *
34  * @brief Device.X_RDKCENTRAL API.
35  *
36  * Description of SNMP Adapter module.
37  *
38  *
39  * @par Document
40  * Document reference.
41  *
42  *
43  * @par Open Issues (in no particular order)
44  * -# Issue 1
45  * -# Issue 2
46  *
47  *
48  * @par Assumptions
49  * -# Assumption
50  * -# Assumption
51  *
52  *
53  * @par Abbreviations
54  * - ACK: Acknowledge.
55  * - BE: Big-Endian.
56  * - cb: Callback function (suffix).
57  * - config: Configuration.
58  * - desc: Descriptor.
59  * - dword: Double word quantity, i.e., four bytes or 32 bits in size.
60  * - intfc: Interface.
61  * - LE: Little-Endian.
62  * - LS: Least Significant.
63  * - MBZ: Must be zero.
64  * - MS: Most Significant.
65  * - _t: Type (suffix).
66  * - word: Two byte quantity, i.e. 16 bits in size.
67  * - xfer: Transfer.
68  *
69  *
70  * @par Implementation Notes
71  * -# Note
72  * -# Note
73  *
74  */
75 
76 
77 #include <string>
78 #ifndef SNMP_ADAPTER_H_
79 #define SNMP_ADAPTER_H_
80 
81 /*****************************************************************************
82  * TR181-SNMP SPECIFIC INCLUDE FILES
83  *****************************************************************************/
84 #include "hostIf_main.h"
85 #include "hostIf_tr69ReqHandler.h"
86 #include "hostIf_utils.h"
87 #include "hostIf_updateHandler.h"
88 #include <map>
89 
90 /**
91  * @brief This class provides the interface for getting device information.
92  * @ingroup TR181_HOSTIF_SNMPADAPTER_CLASSES
93  */
95 
96  static GHashTable *ifHash;
97 
98  static GMutex *m_mutex;
99 
100  static GHashTable *m_notifyHash;
101 
102  int dev_id;
103  static map<string, vector<pair <string, string>>> tr181Map;
104 
105  hostIf_snmpAdapter(int dev_id);
106 
108 
109 public:
110  static void init(void);
111  static void unInit(void);
112  static hostIf_snmpAdapter *getInstance(int dev_id);
113 
114  static void closeInstance(hostIf_snmpAdapter *);
115 
116  static GList* getAllInstances();
117 
118  static void closeAllInstances();
119 
120  static void getLock();
121 
122  static void releaseLock();
123 
124  GHashTable* getNotifyHash();
125 
126  /**
127  * Description. This is the getter api for SNMP API for
128  * Device.X_RDKCENTRAL-COM_DocsIf Profile.
129  *
130  * @param[in] name Complete path name of the parameter.
131  * @param[in] type It is a user data type of ParameterType.
132  * @param[out] value It is the value of the parameter.
133  *
134  * @retval OK if successful.
135  * @retval XXX_ERR_BADPARAM if a bad parameter was supplied.
136  *
137  * @execution Synchronous.
138  * @sideeffect None.
139  *
140  * @note This function must not suspend and must not invoke any blocking system
141  * calls. It should probably just a device inventory message from the platform.
142  *
143  * @see XXX_SomeOtherFunction.
144  */
145 
146 
149 };
150 /* End of doxygen group */
151 /**
152  * @}
153  */
154 
155 #endif /* SNMP_ADAPTER_H_ */
156 
157 
158 /** @} */
159 /** @} */
hostIf_snmpAdapter
This class provides the interface for getting device information.
Definition: snmpAdapter.h:94
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_snmpAdapter::get_ValueFromSNMPAdapter
int get_ValueFromSNMPAdapter(HOSTIF_MsgData_t *)
This function fetch the SNMP OID for the corresponding TR181 param, and run the snmpget command with ...
Definition: snmpAdapter.cpp:235
hostIf_main.h
hostIf_main API.
hostIf_snmpAdapter::init
static void init(void)
This function opens the RF_DocsIf_tr181_snmp map file, parse the TR181 parameter and its correspoindi...
Definition: snmpAdapter.cpp:102
hostIf_snmpAdapter::set_ValueToSNMPAdapter
int set_ValueToSNMPAdapter(HOSTIF_MsgData_t *)
This function fetch the SNMP OID for the corresponding TR181 param, and run the snmpset command with ...
Definition: snmpAdapter.cpp:309
hostIf_snmpAdapter::hostIf_snmpAdapter
hostIf_snmpAdapter(int dev_id)
Class Constructor of the class hostIf_snmpAdapter.
Definition: snmpAdapter.cpp:79
hostIf_snmpAdapter::unInit
static void unInit(void)
This function clear the TR181 OID map container.
Definition: snmpAdapter.cpp:150
hostIf_snmpAdapter::~hostIf_snmpAdapter
~hostIf_snmpAdapter()
Class Destructor of the class hostIf_snmpAdapter.
Definition: snmpAdapter.cpp:89