IPACM: add structure of two message queues
Add the structure of two messsage queues in IPACM, one for external
events, one for internal events. Internal event queue always has
priority over external event queue.
Change-Id: I99878b0ce1f112cc72acde3e38d716cb2542303c
diff --git a/ipacm/inc/IPACM_CmdQueue.h b/ipacm/inc/IPACM_CmdQueue.h
index 2f7709a..27d7c8b 100644
--- a/ipacm/inc/IPACM_CmdQueue.h
+++ b/ipacm/inc/IPACM_CmdQueue.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -85,7 +85,8 @@
Message *Head;
Message *Tail;
Message* dequeue(void);
- static MessageQueue *inst;
+ static MessageQueue *inst_internal;
+ static MessageQueue *inst_external;
MessageQueue()
{
@@ -99,7 +100,8 @@
void enqueue(Message *item);
static void* Process(void *);
- static MessageQueue* getInstance();
+ static MessageQueue* getInstanceInternal();
+ static MessageQueue* getInstanceExternal();
};
diff --git a/ipacm/inc/IPACM_Config.h b/ipacm/inc/IPACM_Config.h
index 665b844..0f58018 100644
--- a/ipacm/inc/IPACM_Config.h
+++ b/ipacm/inc/IPACM_Config.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -149,6 +149,8 @@
/* To return the instance */
static IPACM_Config* GetInstance();
+ const char* getEventName(ipa_cm_event_id event_id);
+
inline void increaseFltRuleCount(int index, ipa_ip_type iptype, int increment)
{
if((index >= IPA_CLIENT_CONS - IPA_CLIENT_PROD) || (index < 0))
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index 7e6af22..ab11a47 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -143,64 +143,67 @@
===========================================================================*/
typedef enum
{
- IPA_CFG_CHANGE_EVENT = 1, /* 1 NULL */
- IPA_LINK_UP_EVENT, /* 2 ipacm_event_data_fid */
- IPA_LINK_DOWN_EVENT, /* 3 ipacm_event_data_fid */
- IPA_ADDR_ADD_EVENT, /* 4 ipacm_event_data_addr */
- IPA_ADDR_DEL_EVENT, /* 5 no use */
- IPA_ROUTE_ADD_EVENT, /* 6 ipacm_event_data_addr */
- IPA_ROUTE_DEL_EVENT, /* 7 ipacm_event_data_addr */
- IPA_FIREWALL_CHANGE_EVENT, /* 8 NULL */
- IPA_WLAN_AP_LINK_UP_EVENT, /* 9 ipacm_event_data_mac */
- IPA_WLAN_STA_LINK_UP_EVENT, /* 10 ipacm_event_data_mac */
- IPA_WLAN_CLIENT_ADD_EVENT, /* 11 ipacm_event_data_mac */
- IPA_WLAN_CLIENT_DEL_EVENT, /* 12 ipacm_event_data_mac */
- IPA_WLAN_CLIENT_POWER_SAVE_EVENT, /* 13 ipacm_event_data_mac */
- IPA_WLAN_CLIENT_RECOVER_EVENT, /* 14 ipacm_event_data_mac */
- IPA_NEW_NEIGH_EVENT, /* 15 ipacm_event_data_all */
- IPA_DEL_NEIGH_EVENT, /* 16 ipacm_event_data_all */
- IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT, /* 17 ipacm_event_data_all */
- IPA_NEIGH_CLIENT_IP_ADDR_DEL_EVENT, /* 18 ipacm_event_data_all */
- IPA_SW_ROUTING_ENABLE, /* 19 NULL */
- IPA_SW_ROUTING_DISABLE, /* 20 NULL */
- IPA_PROCESS_CT_MESSAGE, /* 21 ipacm_ct_evt_data */
- IPA_HANDLE_WAN_UP, /* 22 ipacm_event_iface_up */
- IPA_HANDLE_WAN_DOWN, /* 23 ipacm_event_iface_up */
- IPA_HANDLE_WLAN_UP, /* 24 ipacm_event_iface_up */
- IPA_HANDLE_LAN_UP, /* 25 ipacm_event_iface_up */
- IPA_WLAN_CLIENT_ADD_EVENT_EX, /* 26 ipacm_event_data_wlan_ex */
- IPA_HANDLE_WAN_UP_V6, /* 27 NULL */
- IPA_HANDLE_WAN_DOWN_V6, /* 28 NULL */
- IPA_LAN_CLIENT_ACTIVE, /* 29 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_INACTIVE, /* 30 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_DISCONNECT, /* 31 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_POWER_SAVE, /* 32 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_POWER_RECOVER, /* 33 ipacm_event_lan_client*/
- IPA_LAN_TO_LAN_NEW_CONNECTION, /* 34 ipacm_event_connection */
- IPA_LAN_TO_LAN_DEL_CONNECTION, /* 35 ipacm_event_connection */
- IPA_LAN_DELETE_SELF, /* 36 ipacm_event_data_fid */
- IPA_WLAN_LINK_DOWN_EVENT, /* 37 ipacm_event_data_mac */
- IPA_USB_LINK_UP_EVENT, /* 38 ipacm_event_data_fid */
- IPA_PROCESS_CT_MESSAGE_V6, /* 39 ipacm_ct_evt_data */
- IPA_PRIVATE_SUBNET_CHANGE_EVENT, /* 40 ipacm_event_data_fid */
- IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT, /* 41 ipacm_event_data_fid */
- IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT, /* 42 ipacm_event_data_fid */
- IPA_WAN_EMBMS_LINK_UP_EVENT, /* 43 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_CLIENT_ADD_EVENT, /* 44 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_CLIENT_DEL_EVENT, /* 45 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, /* 46 ipacm_event_data_if_cat */
- IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, /* 47 ipacm_event_data_if_cat */
- IPA_WLAN_SWITCH_TO_SCC, /* 48 No Data */
- IPA_WLAN_SWITCH_TO_MCC, /* 49 No Data */
- IPA_CRADLE_WAN_MODE_SWITCH, /* 50 ipacm_event_cradle_wan_mode */
- IPA_WAN_XLAT_CONNECT_EVENT, /* 51 ipacm_event_data_fid */
- IPA_TETHERING_STATS_UPDATE_EVENT, /* 52 ipacm_event_data_fid */
- IPA_NETWORK_STATS_UPDATE_EVENT, /* 53 ipacm_event_data_fid */
- IPA_HANDLE_WAN_UP_TETHER, /* 54 ipacm_event_iface_up_tehter */
- IPA_HANDLE_WAN_DOWN_TETHER, /* 55 ipacm_event_iface_up_tehter */
- IPA_HANDLE_WAN_UP_V6_TETHER, /* 56 ipacm_event_iface_up_tehter */
- IPA_HANDLE_WAN_DOWN_V6_TETHER, /* 57 ipacm_event_iface_up_tehter */
- IPA_BRIDGE_LINK_UP_EVENT, /* 58 ipacm_event_data_all */
+ IPA_CFG_CHANGE_EVENT = 1, /* NULL */
+ IPA_PRIVATE_SUBNET_CHANGE_EVENT, /* ipacm_event_data_fid */
+ IPA_FIREWALL_CHANGE_EVENT, /* NULL */
+ IPA_LINK_UP_EVENT, /* ipacm_event_data_fid */
+ IPA_LINK_DOWN_EVENT, /* ipacm_event_data_fid */
+ IPA_USB_LINK_UP_EVENT, /* ipacm_event_data_fid */
+ IPA_BRIDGE_LINK_UP_EVENT, /* ipacm_event_data_all */
+ IPA_WAN_EMBMS_LINK_UP_EVENT, /* ipacm_event_data_mac */
+ IPA_ADDR_ADD_EVENT, /* ipacm_event_data_addr */
+ IPA_ADDR_DEL_EVENT, /* no use */
+ IPA_ROUTE_ADD_EVENT, /* ipacm_event_data_addr */
+ IPA_ROUTE_DEL_EVENT, /* ipacm_event_data_addr */
+ IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT, /* ipacm_event_data_fid */
+ IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT, /* ipacm_event_data_fid */
+ IPA_WLAN_AP_LINK_UP_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_STA_LINK_UP_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_LINK_DOWN_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_CLIENT_ADD_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_CLIENT_ADD_EVENT_EX, /* ipacm_event_data_wlan_ex */
+ IPA_WLAN_CLIENT_DEL_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_CLIENT_POWER_SAVE_EVENT, /* ipacm_event_data_mac */
+ IPA_WLAN_CLIENT_RECOVER_EVENT, /* ipacm_event_data_mac */
+ IPA_NEW_NEIGH_EVENT, /* ipacm_event_data_all */
+ IPA_DEL_NEIGH_EVENT, /* ipacm_event_data_all */
+ IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT, /* ipacm_event_data_all */
+ IPA_NEIGH_CLIENT_IP_ADDR_DEL_EVENT, /* ipacm_event_data_all */
+ IPA_SW_ROUTING_ENABLE, /* NULL */
+ IPA_SW_ROUTING_DISABLE, /* NULL */
+ IPA_PROCESS_CT_MESSAGE, /* ipacm_ct_evt_data */
+ IPA_PROCESS_CT_MESSAGE_V6, /* ipacm_ct_evt_data */
+ IPA_LAN_TO_LAN_NEW_CONNECTION, /* ipacm_event_connection */
+ IPA_LAN_TO_LAN_DEL_CONNECTION, /* ipacm_event_connection */
+ IPA_WLAN_SWITCH_TO_SCC, /* No Data */
+ IPA_WLAN_SWITCH_TO_MCC, /* No Data */
+ IPA_CRADLE_WAN_MODE_SWITCH, /* ipacm_event_cradle_wan_mode */
+ IPA_WAN_XLAT_CONNECT_EVENT, /* ipacm_event_data_fid */
+ IPA_TETHERING_STATS_UPDATE_EVENT, /* ipacm_event_data_fid */
+ IPA_NETWORK_STATS_UPDATE_EVENT, /* ipacm_event_data_fid */
+
+ IPA_EXTERNAL_EVENT_MAX = 500,
+
+ IPA_HANDLE_WAN_UP, /* ipacm_event_iface_up */
+ IPA_HANDLE_WAN_DOWN, /* ipacm_event_iface_up */
+ IPA_HANDLE_WAN_UP_V6, /* NULL */
+ IPA_HANDLE_WAN_DOWN_V6, /* NULL */
+ IPA_HANDLE_WAN_UP_TETHER, /* ipacm_event_iface_up_tehter */
+ IPA_HANDLE_WAN_DOWN_TETHER, /* ipacm_event_iface_up_tehter */
+ IPA_HANDLE_WAN_UP_V6_TETHER, /* ipacm_event_iface_up_tehter */
+ IPA_HANDLE_WAN_DOWN_V6_TETHER, /* ipacm_event_iface_up_tehter */
+ IPA_HANDLE_WLAN_UP, /* ipacm_event_iface_up */
+ IPA_HANDLE_LAN_UP, /* ipacm_event_iface_up */
+ IPA_LAN_CLIENT_ACTIVE, /* ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_INACTIVE, /* ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_DISCONNECT, /* ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_POWER_SAVE, /* ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_POWER_RECOVER, /* ipacm_event_lan_client*/
+ IPA_LAN_DELETE_SELF, /* ipacm_event_data_fid */
+ IPA_ETH_BRIDGE_CLIENT_ADD_EVENT, /* ipacm_event_data_mac */
+ IPA_ETH_BRIDGE_CLIENT_DEL_EVENT, /* ipacm_event_data_mac */
+ IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, /* ipacm_event_data_if_cat */
+ IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, /* ipacm_event_data_if_cat */
IPACM_EVENT_MAX
} ipa_cm_event_id;
diff --git a/ipacm/inc/IPACM_IfaceManager.h b/ipacm/inc/IPACM_IfaceManager.h
index e65c5d5..c7184f2 100644
--- a/ipacm/inc/IPACM_IfaceManager.h
+++ b/ipacm/inc/IPACM_IfaceManager.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -48,7 +48,6 @@
#include "IPACM_Listener.h"
#include "IPACM_Iface.h"
-#define IPA_MAX_NUM_NEIGHBOR_CLIENTS 17
#define IPA_INSTANCE_NOT_FOUND 0
#define IPA_INSTANCE_FOUND 1
diff --git a/ipacm/src/IPACM_CmdQueue.cpp b/ipacm/src/IPACM_CmdQueue.cpp
index 7e48546..a17fb08 100644
--- a/ipacm/src/IPACM_CmdQueue.cpp
+++ b/ipacm/src/IPACM_CmdQueue.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -40,24 +40,42 @@
#include <string.h>
#include "IPACM_CmdQueue.h"
#include "IPACM_Log.h"
+#include "IPACM_Iface.h"
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond_var = PTHREAD_COND_INITIALIZER;
-MessageQueue* MessageQueue::inst = NULL;
-MessageQueue* MessageQueue::getInstance()
+MessageQueue* MessageQueue::inst_internal = NULL;
+MessageQueue* MessageQueue::inst_external = NULL;
+
+MessageQueue* MessageQueue::getInstanceInternal()
{
- if(inst == NULL)
+ if(inst_internal == NULL)
{
- inst = new MessageQueue();
- if(inst == NULL)
+ inst_internal = new MessageQueue();
+ if(inst_internal == NULL)
{
- IPACMERR("unable to create Message Queue instance\n");
+ IPACMERR("unable to create internal Message Queue instance\n");
return NULL;
}
}
- return inst;
+ return inst_internal;
+}
+
+MessageQueue* MessageQueue::getInstanceExternal()
+{
+ if(inst_external == NULL)
+ {
+ inst_external = new MessageQueue();
+ if(inst_external == NULL)
+ {
+ IPACMERR("unable to create external Message Queue instance\n");
+ return NULL;
+ }
+ }
+
+ return inst_external;
}
void MessageQueue::enqueue(Message *item)
@@ -101,14 +119,22 @@
void* MessageQueue::Process(void *param)
{
- MessageQueue *MsgQueue = NULL;
+ MessageQueue *MsgQueueInternal = NULL;
+ MessageQueue *MsgQueueExternal = NULL;
Message *item = NULL;
IPACMDBG("MessageQueue::Process()\n");
- MsgQueue = MessageQueue::getInstance();
- if(MsgQueue == NULL)
+ MsgQueueInternal = MessageQueue::getInstanceInternal();
+ if(MsgQueueInternal == NULL)
{
- IPACMERR("unable to start cmd queue process\n");
+ IPACMERR("unable to start internal cmd queue process\n");
+ return NULL;
+ }
+
+ MsgQueueExternal = MessageQueue::getInstanceExternal();
+ if(MsgQueueExternal == NULL)
+ {
+ IPACMERR("unable to start external cmd queue process\n");
return NULL;
}
@@ -120,7 +146,21 @@
return NULL;
}
- item = MsgQueue->dequeue();
+ item = MsgQueueInternal->dequeue();
+ if(item == NULL)
+ {
+ item = MsgQueueExternal->dequeue();
+ if(item)
+ {
+ IPACMDBG("Get event %s from external queue.\n",
+ IPACM_Iface::ipacmcfg->getEventName(item->evt.data.event));
+ }
+ }
+ else
+ {
+ IPACMDBG("Get event %s from internal queue.\n",
+ IPACM_Iface::ipacmcfg->getEventName(item->evt.data.event));
+ }
if(item == NULL)
{
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index c718603..5371202 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -47,6 +47,71 @@
const char *IPACM_Config::DEVICE_NAME = "/dev/ipa";
const char *IPACM_Config::DEVICE_NAME_ODU = "/dev/odu_ipa_bridge";
+#define __stringify(x...) #x
+
+const char *ipacm_event_name[] = {
+ __stringify(IPA_CFG_CHANGE_EVENT), /* NULL */
+ __stringify(IPA_PRIVATE_SUBNET_CHANGE_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_FIREWALL_CHANGE_EVENT), /* NULL */
+ __stringify(IPA_LINK_UP_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_LINK_DOWN_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_USB_LINK_UP_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_BRIDGE_LINK_UP_EVENT), /* ipacm_event_data_all */
+ __stringify(IPA_WAN_EMBMS_LINK_UP_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_ADDR_ADD_EVENT), /* ipacm_event_data_addr */
+ __stringify(IPA_ADDR_DEL_EVENT), /* no use */
+ __stringify(IPA_ROUTE_ADD_EVENT), /* ipacm_event_data_addr */
+ __stringify(IPA_ROUTE_DEL_EVENT), /* ipacm_event_data_addr */
+ __stringify(IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_WLAN_AP_LINK_UP_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_STA_LINK_UP_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_LINK_DOWN_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_CLIENT_ADD_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_CLIENT_ADD_EVENT_EX), /* ipacm_event_data_wlan_ex */
+ __stringify(IPA_WLAN_CLIENT_DEL_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_CLIENT_POWER_SAVE_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_WLAN_CLIENT_RECOVER_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_NEW_NEIGH_EVENT), /* ipacm_event_data_all */
+ __stringify(IPA_DEL_NEIGH_EVENT), /* ipacm_event_data_all */
+ __stringify(IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT), /* ipacm_event_data_all */
+ __stringify(IPA_NEIGH_CLIENT_IP_ADDR_DEL_EVENT), /* ipacm_event_data_all */
+ __stringify(IPA_SW_ROUTING_ENABLE), /* NULL */
+ __stringify(IPA_SW_ROUTING_DISABLE), /* NULL */
+ __stringify(IPA_PROCESS_CT_MESSAGE), /* ipacm_ct_evt_data */
+ __stringify(IPA_PROCESS_CT_MESSAGE_V6), /* ipacm_ct_evt_data */
+ __stringify(IPA_LAN_TO_LAN_NEW_CONNECTION), /* ipacm_event_connection */
+ __stringify(IPA_LAN_TO_LAN_DEL_CONNECTION), /* ipacm_event_connection */
+ __stringify(IPA_WLAN_SWITCH_TO_SCC), /* No Data */
+ __stringify(IPA_WLAN_SWITCH_TO_MCC), /* No Data */
+ __stringify(IPA_CRADLE_WAN_MODE_SWITCH), /* ipacm_event_cradle_wan_mode */
+ __stringify(IPA_WAN_XLAT_CONNECT_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_TETHERING_STATS_UPDATE_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_NETWORK_STATS_UPDATE_EVENT), /* ipacm_event_data_fid */
+ __stringify(IPA_EXTERNAL_EVENT_MAX),
+ __stringify(IPA_HANDLE_WAN_UP), /* ipacm_event_iface_up */
+ __stringify(IPA_HANDLE_WAN_DOWN), /* ipacm_event_iface_up */
+ __stringify(IPA_HANDLE_WAN_UP_V6), /* NULL */
+ __stringify(IPA_HANDLE_WAN_DOWN_V6), /* NULL */
+ __stringify(IPA_HANDLE_WAN_UP_TETHER), /* ipacm_event_iface_up_tehter */
+ __stringify(IPA_HANDLE_WAN_DOWN_TETHER), /* ipacm_event_iface_up_tehter */
+ __stringify(IPA_HANDLE_WAN_UP_V6_TETHER), /* ipacm_event_iface_up_tehter */
+ __stringify(IPA_HANDLE_WAN_DOWN_V6_TETHER), /* ipacm_event_iface_up_tehter */
+ __stringify(IPA_HANDLE_WLAN_UP), /* ipacm_event_iface_up */
+ __stringify(IPA_HANDLE_LAN_UP), /* ipacm_event_iface_up */
+ __stringify(IPA_LAN_CLIENT_ACTIVE), /* ipacm_event_lan_client*/
+ __stringify(IPA_LAN_CLIENT_INACTIVE), /* ipacm_event_lan_client*/
+ __stringify(IPA_LAN_CLIENT_DISCONNECT), /* ipacm_event_lan_client*/
+ __stringify(IPA_LAN_CLIENT_POWER_SAVE), /* ipacm_event_lan_client*/
+ __stringify(IPA_LAN_CLIENT_POWER_RECOVER), /* ipacm_event_lan_client*/
+ __stringify(IPA_LAN_DELETE_SELF), /* ipacm_event_data_fid */
+ __stringify(IPA_ETH_BRIDGE_CLIENT_ADD_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_ETH_BRIDGE_CLIENT_DEL_EVENT), /* ipacm_event_data_mac */
+ __stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT), /* ipacm_event_data_if_cat */
+ __stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT), /* ipacm_event_data_if_cat */
+ __stringify(IPACM_EVENT_MAX),
+};
+
IPACM_Config::IPACM_Config()
{
iface_table = NULL;
@@ -774,3 +839,14 @@
return IPACM_SUCCESS;
}
+
+const char* IPACM_Config::getEventName(ipa_cm_event_id event_id)
+{
+ if(event_id >= sizeof(ipacm_event_name)/sizeof(ipacm_event_name[0]))
+ {
+ IPACMDBG_DMESG("ERROR: Event name array is not consistent with event array!\n");
+ return NULL;
+ }
+
+ return ipacm_event_name[event_id];
+}
diff --git a/ipacm/src/IPACM_EvtDispatcher.cpp b/ipacm/src/IPACM_EvtDispatcher.cpp
index 11782df..edb5901 100644
--- a/ipacm/src/IPACM_EvtDispatcher.cpp
+++ b/ipacm/src/IPACM_EvtDispatcher.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -58,7 +58,16 @@
Message *item = NULL;
MessageQueue *MsgQueue = NULL;
- MsgQueue = MessageQueue::getInstance();
+ if(data->event < IPA_EXTERNAL_EVENT_MAX)
+ {
+ IPACMDBG("Insert event into external queue.\n");
+ MsgQueue = MessageQueue::getInstanceExternal();
+ }
+ else
+ {
+ IPACMDBG("Insert event into internal queue.\n");
+ MsgQueue = MessageQueue::getInstanceInternal();
+ }
if(MsgQueue == NULL)
{
IPACMERR("unable to retrieve MsgQueue instance\n");
@@ -72,7 +81,6 @@
return IPACM_FAILURE;
}
- IPACMDBG("Populating item to post to queue\n");
item->evt.callback_ptr = IPACM_EvtDispatcher::ProcessEvt;
memcpy(&item->evt.data, data, sizeof(ipacm_cmd_q_data));
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index 8ecbbe6..a725649 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -57,9 +57,6 @@
#include <signal.h>
#include "linux/ipa_qmi_service_v01.h"
-#define __stringify_1(x...) #x
-#define __stringify(x...) __stringify_1(x)
-
#include "IPACM_CmdQueue.h"
#include "IPACM_EvtDispatcher.h"
#include "IPACM_Defs.h"
@@ -76,68 +73,6 @@
#include "IPACM_LanToLan.h"
#endif
-
-const char *ipacm_event_name[] = {
- __stringify(IPA_CFG_CHANGE_EVENT), /* 1 NULL */
- __stringify(IPA_LINK_UP_EVENT), /* 2 ipacm_event_data_fid */
- __stringify(IPA_LINK_DOWN_EVENT), /* 3 ipacm_event_data_fid */
- __stringify(IPA_ADDR_ADD_EVENT), /* 4 ipacm_event_data_addr */
- __stringify(IPA_ADDR_DEL_EVENT), /* 5 no use */
- __stringify(IPA_ROUTE_ADD_EVENT), /* 6 ipacm_event_data_addr */
- __stringify(IPA_ROUTE_DEL_EVENT), /* 7 ipacm_event_data_addr */
- __stringify(IPA_FIREWALL_CHANGE_EVENT), /* 8 NULL */
- __stringify(IPA_WLAN_AP_LINK_UP_EVENT), /* 9 ipacm_event_data_mac */
- __stringify(IPA_WLAN_STA_LINK_UP_EVENT), /* 10 ipacm_event_data_mac */
- __stringify(IPA_WLAN_CLIENT_ADD_EVENT), /* 11 ipacm_event_data_mac */
- __stringify(IPA_WLAN_CLIENT_DEL_EVENT), /* 12 ipacm_event_data_mac */
- __stringify(IPA_WLAN_CLIENT_POWER_SAVE_EVENT), /* 13 ipacm_event_data_mac */
- __stringify(IPA_WLAN_CLIENT_RECOVER_EVENT), /* 14 ipacm_event_data_mac */
- __stringify(IPA_NEW_NEIGH_EVENT), /* 15 ipacm_event_data_all */
- __stringify(IPA_DEL_NEIGH_EVENT), /* 16 ipacm_event_data_all */
- __stringify(IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT), /* 17 ipacm_event_data_all */
- __stringify(IPA_NEIGH_CLIENT_IP_ADDR_DEL_EVENT), /* 18 ipacm_event_data_all */
- __stringify(IPA_SW_ROUTING_ENABLE), /* 19 NULL */
- __stringify(IPA_SW_ROUTING_DISABLE), /* 20 NULL */
- __stringify(IPA_PROCESS_CT_MESSAGE), /* 21 ipacm_ct_evt_data */
- __stringify(IPA_HANDLE_WAN_UP), /* 22 ipacm_event_iface_up */
- __stringify(IPA_HANDLE_WAN_DOWN), /* 23 ipacm_event_iface_up */
- __stringify(IPA_HANDLE_WLAN_UP), /* 24 ipacm_event_iface_up */
- __stringify(IPA_HANDLE_LAN_UP), /* 25 ipacm_event_iface_up */
- __stringify(IPA_WLAN_CLIENT_ADD_EVENT_EX), /* 26 ipacm_event_data_wlan_ex */
- __stringify(IPA_HANDLE_WAN_UP_V6), /* 27 NULL */
- __stringify(IPA_HANDLE_WAN_DOWN_V6), /* 28 NULL */
- __stringify(IPA_LAN_CLIENT_ACTIVE), /* 29 ipacm_event_lan_client*/
- __stringify(IPA_LAN_CLIENT_INACTIVE), /* 30 ipacm_event_lan_client*/
- __stringify(IPA_LAN_CLIENT_DISCONNECT), /* 31 ipacm_event_lan_client*/
- __stringify(IPA_LAN_CLIENT_POWER_SAVE), /* 32 ipacm_event_lan_client*/
- __stringify(IPA_LAN_CLIENT_POWER_RECOVER), /* 33 ipacm_event_lan_client*/
- __stringify(IPA_LAN_TO_LAN_NEW_CONNECTION), /* 34 ipacm_event_connection */
- __stringify(IPA_LAN_TO_LAN_DEL_CONNECTION), /* 35 ipacm_event_connection */
- __stringify(IPA_LAN_DELETE_SELF), /* 36 ipacm_event_data_fid */
- __stringify(IPA_WLAN_LINK_DOWN_EVENT), /* 37 ipacm_event_data_mac */
- __stringify(IPA_USB_LINK_UP_EVENT), /* 38 ipacm_event_data_fid */
- __stringify(IPA_PROCESS_CT_MESSAGE_V6), /* 39 ipacm_ct_evt_data */
- __stringify(IPA_PRIVATE_SUBNET_CHANGE_EVENT), /* 40 ipacm_event_data_fid */
- __stringify(IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT), /* 41 ipacm_event_data_fid */
- __stringify(IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT), /* 42 ipacm_event_data_fid */
- __stringify(IPA_WAN_EMBMS_LINK_UP_EVENT), /* 43 ipacm_event_data_mac */
- __stringify(IPA_ETH_BRIDGE_CLIENT_ADD_EVENT), /* 44 ipacm_event_data_mac */
- __stringify(IPA_ETH_BRIDGE_CLIENT_DEL_EVENT), /* 45 ipacm_event_data_mac */
- __stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT), /* 46 ipacm_event_data_if_cat */
- __stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT), /* 47 ipacm_event_data_if_cat */
- __stringify(IPA_WLAN_SWITCH_TO_SCC), /* 48 No Data */
- __stringify(IPA_WLAN_SWITCH_TO_MCC), /* 49 No Data */
- __stringify(IPA_CRADLE_WAN_MODE_SWITCH), /* 50 ipacm_event_cradle_wan_mode */
- __stringify(IPA_WAN_XLAT_CONNECT_EVENT), /* 51 ipacm_event_data_fid */
- __stringify(IPA_TETHERING_STATS_UPDATE_EVENT), /* 52 ipacm_event_data_fid */
- __stringify(IPA_NETWORK_STATS_UPDATE_EVENT), /* 53 ipacm_event_data_fid */
- __stringify(IPA_HANDLE_WAN_UP_TETHER), /* 54 ipacm_event_iface_up_tehter */
- __stringify(IPA_HANDLE_WAN_DOWN_TETHER), /* 55 ipacm_event_iface_up_tehter */
- __stringify(IPA_HANDLE_WAN_UP_V6_TETHER), /* 56 ipacm_event_iface_up_tehter */
- __stringify(IPA_HANDLE_WAN_DOWN_V6_TETHER), /* 57 ipacm_event_iface_up_tehter */
- __stringify(IPA_BRIDGE_LINK_UP_EVENT), /* 58 ipacm_event_data_all */
-};
-
#define IPA_DRIVER "/dev/ipa"
#define IPACM_FIREWALL_FILE_NAME "mobileap_firewall.xml"