67 #ifndef DEVICE_INTERFACESTACK_H_
68 #define DEVICE_INTERFACESTACK_H_
73 #ifdef USE_INTFSTACK_PROFILE
82 #include "hostIf_tr69ReqHandler.h"
83 #include "hostIf_utils.h"
104 #define MAX_HIGHERLAYER_LEN 256
105 #define MAX_LOWERLAYER_LEN 256
115 typedef enum EDeviceInterfaceStackMembers
119 }EInterfaceStackMembers;
126 std::string higherLayer;
127 std::string lowerLayer;
131 typedef std::multimap<std::string, LayerInfo_t> InterfaceStackMap_t;
132 typedef std::map<std::string, int> IPInterfacesMap_t;
138 class hostif_InterfaceStack {
144 static GHashTable *stIshash;
149 static GHashTable *m_notifyHash;
157 static GHashTable *stBridgeTableHash;
159 static GMutex *stMutex;
161 char higherLayer[MAX_HIGHERLAYER_LEN];
162 char lowerLayer[MAX_LOWERLAYER_LEN];
164 bool bCalledHigherLayer;
165 bool bCalledLowerLayer;
167 char backupHigherLayer[MAX_HIGHERLAYER_LEN];
168 char backupLowerLayer[MAX_LOWERLAYER_LEN];
170 hostif_InterfaceStack(
int dev_id,
char *higherLayer,
char *lowerLayer);
171 ~hostif_InterfaceStack();
172 static int createInstance(
int dev_id,
char *higherLayer,
char *lowerLayer);
173 static int populateBridgeTable();
174 static void deleteBridgeTable();
175 static int insertRowIntoBridgeTable(
char *bridge,
char *bridgeInterfaces);
176 static void bridgeInteface_key_data_free(gpointer key);
177 static void bridgeInteface_value_data_free(gpointer value);
179 template<
typename T>
static int getLowerInterfaceNumberOfEntries();
180 template<
typename T>
static std::string getInterfaceName(T* pIface);
181 template<
typename T>
static std::string getLowerLayerName(
int index);
182 template<
typename T>
static int buildLowerLayerInfo(InterfaceStackMap_t &layerInfo);
183 static int buildBridgeTableLayerInfo(InterfaceStackMap_t &layerInfo);
185 static std::list<std::string> getBridgeElements(
char* elementsCSV);
186 static std::string getDMForBridgePort(
int bridgeNum,
int portNum);
187 static void addBridgeNameLayerInfo(InterfaceStackMap_t &layerInfo, std::string ifname, std::string bridgeLowerLayer);
188 static int addBridgeChildLayerInfo(InterfaceStackMap_t &layerInfo, std::string ifname, std::string bridgeHigherLayer);
189 static void addBridgeUnmanagedLayerInfo(InterfaceStackMap_t &layerInfo, std::string ifname, std::string bridgeHigherLayer, std::string bridgeLowerLayer);
190 static int getIPInterfaces(IPInterfacesMap_t& interfaceList);
191 static std::string getDMForIPLayer(
int portNum);
192 static void fillHigherLayersWithIP(InterfaceStackMap_t &layerInfo, IPInterfacesMap_t& ipInterfaceMap);
193 static void print_map(InterfaceStackMap_t &layerInfo);
196 static hostif_InterfaceStack* getInstance(
int dev_id);
197 static GList* getAllInstances();
198 static void closeInstance(hostif_InterfaceStack *pDev);
199 static void closeAllInstances();
200 static int get_Device_InterfaceStackNumberOfEntries(
HOSTIF_MsgData_t *stMsgData);
201 int get_Device_InterfaceStack_HigherLayer(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged = NULL);
202 int get_Device_InterfaceStack_LowerLayer(
HOSTIF_MsgData_t *stMsgData,
bool* pChanged = NULL);
203 static void getLock();
204 static void releaseLock();
205 static GHashTable* getNotifyHash();