summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusheel Yadagiri <syadagir@codeaurora.org>2010-10-11 14:50:19 -0700
committerSusheel Yadagiri <syadagir@codeaurora.org>2010-10-11 14:50:19 -0700
commit8d0860a47146126fea6395b8fd3a4059b5dc0903 (patch)
tree2a313516183ffde77f16205d18a8137eb6e73386
parentcad4564e137a75c2876e9da9c44345e1f0d6c29b (diff)
downloadandroid_external_connectivity-8d0860a47146126fea6395b8fd3a4059b5dc0903.tar.gz
android_external_connectivity-8d0860a47146126fea6395b8fd3a4059b5dc0903.tar.bz2
android_external_connectivity-8d0860a47146126fea6395b8fd3a4059b5dc0903.zip
external/connectivity: Refactor logging.
Change-Id: I2b81cfa4a08b5e0e2731d46ab30a3d8e9a742cf7
-rw-r--r--cnd/inc/cnd.h18
-rw-r--r--[-rwxr-xr-x]cnd/inc/cnd_iproute2.h0
-rw-r--r--cnd/src/cnd.c4
-rw-r--r--cnd/src/cnd_event.cpp44
-rw-r--r--[-rwxr-xr-x]cnd/src/cnd_iproute2.cpp143
-rw-r--r--[-rwxr-xr-x]cnd/src/cnd_process.cpp114
-rw-r--r--[-rwxr-xr-x]include/cne/cne.h0
7 files changed, 172 insertions, 151 deletions
diff --git a/cnd/inc/cnd.h b/cnd/inc/cnd.h
index abf063f..5c5b60c 100644
--- a/cnd/inc/cnd.h
+++ b/cnd/inc/cnd.h
@@ -19,8 +19,26 @@
#include <stdlib.h>
#include <sys/time.h>
+#include <utils/Log.h>
#include "cne.h"
+#define CNE_DEBUG_LOGGING 0
+
+#define CNE_LOGE(...) LOGE(__VA_ARGS__)
+#define CNE_LOGW(...) LOGW(__VA_ARGS__)
+#define CNE_LOGI(...) \
+ ( (CONDITION(CNE_DEBUG_LOGGING)) \
+ ? LOG(LOG_INFO, LOCAL_TAG, __VA_ARGS__) \
+ : (void)0 )
+#define CNE_LOGD(...) \
+ ( (CONDITION(CNE_DEBUG_LOGGING)) \
+ ? LOG(LOG_DEBUG, LOCAL_TAG, __VA_ARGS__) \
+ : (void)0 )
+#define CNE_LOGV(...) \
+ ( (CONDITION(CNE_DEBUG_LOGGING)) \
+ ? LOG(LOG_VERBOSE, LOCAL_TAG, __VA_ARGS__) \
+ : (void)0 )
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/cnd/inc/cnd_iproute2.h b/cnd/inc/cnd_iproute2.h
index 0c41875..0c41875 100755..100644
--- a/cnd/inc/cnd_iproute2.h
+++ b/cnd/inc/cnd_iproute2.h
diff --git a/cnd/src/cnd.c b/cnd/src/cnd.c
index a42cb9b..9220ae7 100644
--- a/cnd/src/cnd.c
+++ b/cnd/src/cnd.c
@@ -15,6 +15,8 @@
** limitations under the License.
*/
+#define LOG_TAG "CND"
+
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
@@ -22,8 +24,6 @@
#include <cnd.h>
#include "cutils/properties.h"
-#define LOG_TAG "CND"
-
int main (int argc, char **argv)
{
char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
diff --git a/cnd/src/cnd_event.cpp b/cnd/src/cnd_event.cpp
index 519620d..5e52e2e 100644
--- a/cnd/src/cnd_event.cpp
+++ b/cnd/src/cnd_event.cpp
@@ -16,6 +16,7 @@
*/
#define LOG_TAG "CND_EVENT"
+#define LOCAL_TAG "CND_EVENT_DEBUG"
#include <stdlib.h>
#include <unistd.h>
@@ -30,6 +31,7 @@
#include <dlfcn.h>
#include "cutils/properties.h"
#include "cne.h"
+#include "cnd.h"
static pthread_mutex_t listMutex;
#define MUTEX_ACQUIRE() pthread_mutex_lock(&listMutex)
@@ -76,7 +78,7 @@ static void removeFromList(struct cnd_event * ev)
static void removeWatch(struct cnd_event * ev, int index)
{
- LOGD ("removeWatch: fd=%d, index=%d", ev->fd, index);
+ CNE_LOGV("removeWatch: fd=%d, index=%d", ev->fd, index);
watch_table[index] = NULL;
ev->index = -1;
@@ -101,7 +103,7 @@ static void removeWatch(struct cnd_event * ev, int index)
static void processReadReadyEvent(fd_set * rfds, int n)
{
- LOGD ("processReadReadyEvent: n=%d, rfds0=%ld", n, rfds->fds_bits[0]);
+ CNE_LOGV("processReadReadyEvent: n=%d, rfds0=%ld", n, rfds->fds_bits[0]);
MUTEX_ACQUIRE();
for (int i = 0; (i < MAX_FD_EVENTS) && (n > 0); i++) {
@@ -109,13 +111,13 @@ static void processReadReadyEvent(fd_set * rfds, int n)
struct cnd_event * rev = watch_table[i];
if (rev != NULL)
- LOGD ("processReadReadyEvent: i=%d, fd=%d, rfds0=%ld", i, rev->fd, rfds->fds_bits[0]);
+ CNE_LOGV("processReadReadyEvent: i=%d, fd=%d, rfds0=%ld", i, rev->fd, rfds->fds_bits[0]);
else
- LOGD ("processReadReadyEvent: i=%d, rev is NULL", i);
+ CNE_LOGV("processReadReadyEvent: i=%d, rev is NULL", i);
if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
addToList(rev, &pending_list);
- LOGD ("processReadReadyEvent: add to pendingList fd=%d", rev->fd);
+ CNE_LOGV("processReadReadyEvent: add to pendingList fd=%d", rev->fd);
if (rev->persist == 0) {
removeWatch(rev, i);
}
@@ -156,12 +158,12 @@ int cnd_event_init()
prop_value[len] = '\0';
if(strcasecmp(prop_value, "vendor") == 0)
{
- LOGI("loading vendor cne library!!");
+ CNE_LOGV("loading vendor cne library");
cneLibHandle = dlopen("/system/lib/libcne.so",RTLD_NOW);
}
else
{
- LOGI("loading refcne library!!");
+ CNE_LOGV("loading refcne library");
cneLibHandle = dlopen("/system/lib/librefcne.so",RTLD_NOW);
}
@@ -175,15 +177,15 @@ int cnd_event_init()
}
else
{
- LOGE("cne library load failed.!!");
+ CNE_LOGV("cne library load failed.");
}
if(cne_svc_init == NULL || cne_processCommand == NULL ||
cne_regMessageCb == NULL)
{
- LOGE("dlsym ret'd cne_svc_init=%x cne_processCommand=%x cne_regMessageCb=%x",
- cne_svc_init,
- cne_processCommand,
- cne_regMessageCb);
+ CNE_LOGD("dlsym ret'd cne_svc_init=%x cne_processCommand=%x cne_regMessageCb=%x",
+ (unsigned int)cne_svc_init,
+ (unsigned int)cne_processCommand,
+ (unsigned int)cne_regMessageCb);
}
else
{
@@ -218,13 +220,13 @@ void cnd_event_add(struct cnd_event * ev)
if (watch_table[i] == NULL) {
watch_table[i] = ev;
ev->index = i;
- LOGD ("cnd_event_add-before: add at i=%d for fd=%d, readFds0=%ld", i, ev->fd, readFds.fds_bits[0]);
+ CNE_LOGV("cnd_event_add-before: add at i=%d for fd=%d, readFds0=%ld", i, ev->fd, readFds.fds_bits[0]);
FD_SET(ev->fd, &readFds);
if (ev->fd >= nfds)
nfds = ev->fd+1;
- LOGD ("cnd_event_add-after: add at i=%d for fd=%d, readFds0=%ld", i, ev->fd, readFds.fds_bits[0]);
+ CNE_LOGV("cnd_event_add-after: add at i=%d for fd=%d, readFds0=%ld", i, ev->fd, readFds.fds_bits[0]);
break;
}
@@ -240,7 +242,7 @@ void cnd_event_del(struct cnd_event * ev)
{
- LOGD ("cnd_event_del: index=%d", ev->index);
+ CNE_LOGV("cnd_event_del: index=%d", ev->index);
MUTEX_ACQUIRE();
if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) {
@@ -260,7 +262,7 @@ void cnd_dump_watch_table(void)
for (int i = 0; i < MAX_FD_EVENTS; i++) {
if (watch_table[i] != NULL) {
ev = watch_table[i];
- LOGD ("cnd_dump_watch_table: at i=%d , fd=%d", i, ev->fd);
+ CNE_LOGV("cnd_dump_watch_table: at i=%d , fd=%d", i, ev->fd);
}
}
@@ -273,26 +275,26 @@ void cnd_event_loop(void)
fd_set rfds;
int s_fdCommand;
- LOGD ("cnd_event_loop: started, nfds=%d",nfds);
+ CNE_LOGV("cnd_event_loop: started, nfds=%d",nfds);
for (;;) {
// make local copy of read fd_set
memcpy(&rfds, &readFds, sizeof(fd_set));
- LOGD ("cnd_event_loop: waiting for select nfds=%d, rfds0=%ld", nfds, rfds.fds_bits[0]);
+ CNE_LOGV("cnd_event_loop: waiting for select nfds=%d, rfds0=%ld", nfds, rfds.fds_bits[0]);
n = select(nfds, &rfds, NULL, NULL, NULL);
if (n < 0) {
if (errno == EINTR)
continue;
- LOGE("cnd_event_loop: select error (%d)", errno);
+ CNE_LOGD("cnd_event_loop: select error (%d)", errno);
return;
}
if (n == 0)
- LOGD ("cnd_event_loop: select timedout");
+ CNE_LOGV("cnd_event_loop: select timedout");
else if (n > 0)
- LOGD ("cnd_event_loop: select ok,n=%d, rfds0=%ld",n, rfds.fds_bits[0]);
+ CNE_LOGV("cnd_event_loop: select ok,n=%d, rfds0=%ld",n, rfds.fds_bits[0]);
// Check for read-ready events
processReadReadyEvent(&rfds, n);
diff --git a/cnd/src/cnd_iproute2.cpp b/cnd/src/cnd_iproute2.cpp
index 5fa750a..8329647 100755..100644
--- a/cnd/src/cnd_iproute2.cpp
+++ b/cnd/src/cnd_iproute2.cpp
@@ -53,6 +53,7 @@
#include <cstdarg>
#include <map>
#include <set>
+#include <cnd.h>
using namespace std;
@@ -61,7 +62,7 @@ using namespace std;
* -------------------------------------------------------------------------*/
#undef LOG_TAG
#define LOG_TAG "CND_IPROUTE2"
-
+#define LOCAL_TAG "CND_IPROUTE2_DEBUG"
/*----------------------------------------------------------------------------
* Type Declarations
@@ -454,7 +455,7 @@ uint8_t *cmdLineActionEnumToString
return (uint8_t *)ACTIONS_SHOW_STR;
break;
default:
- LOGE("Unsupported conversion of command action to string");
+ CNE_LOGD("Unsupported conversion of command action to string");
return NULL;
}
}
@@ -479,7 +480,7 @@ void flushCache
CACHED_ENTRIES,
NULL))
{
- LOGW("Attempt to flush the routing cache failed.");
+ CNE_LOGD("Attempt to flush the routing cache failed.");
}
}
@@ -502,7 +503,7 @@ uint8_t *storeRoutingInformation
{
if(NULL == parameterPtr)
{
- LOGE("storeRoutingInformation: Parameter is null.");
+ CNE_LOGD("storeRoutingInformation: Parameter is null.");
return NULL;
}
@@ -510,7 +511,7 @@ uint8_t *storeRoutingInformation
if (NULL == memCopyPtr)
{
- LOGE("storeRoutingInformation: unable to allocate memory");
+ CNE_LOGW("storeRoutingInformation: unable to allocate memory");
return NULL;
}
@@ -545,13 +546,13 @@ bool modifyCustomRouteInMainTable
Cmd_line_actions commandAction
)
{
- CustomRouteInfo *currentDevice;
+ CustomRouteInfo *currentDevice = NULL;
map<uint8_t*, RoutingTableInfo*>::iterator routingTableMapIter;
map<uint8_t*, CustomRouteInfo*>::iterator customRouteMapIter;
if (NULL == destinationAddress)
{
- LOGE("Null destination address was passed while modifying a custom route " \
+ CNE_LOGD("Null destination address was passed while modifying a custom route " \
"in the main table");
return false;
}
@@ -560,18 +561,18 @@ bool modifyCustomRouteInMainTable
{
case ACTIONS_ADD_ENUM:
{
- LOGI("Adding a custom route in the main table to destination %s",
+ CNE_LOGV("Adding a custom route in the main table to destination %s",
destinationAddress);
if (NULL == deviceName)
{
- LOGE("Null device name was passed when adding a custom route");
+ CNE_LOGD("Null device name was passed when adding a custom route");
return false;
}
if (NULL == gatewayAddress)
{
- LOGI("A null gateway address was passed when adding the entry to %s",
+ CNE_LOGV("A null gateway address was passed when adding the entry to %s",
destinationAddress);
}
@@ -580,13 +581,13 @@ bool modifyCustomRouteInMainTable
if ((routingTableMapIter != routingTableMap.end()) &&
(NULL == routingTableMapIter->second))
{
- LOGW("Routing table information has been corrupted for %s table",
+ CNE_LOGD("Routing table information has been corrupted for %s table",
deviceName);
}
else if (routingTableMapIter != routingTableMap.end())
{
- LOGI("A separate routing table exists for %s. This table will not be " \
+ CNE_LOGV("A separate routing table exists for %s. This table will not be " \
"updated.", deviceName);
}
@@ -595,7 +596,7 @@ bool modifyCustomRouteInMainTable
if ((customRouteMapIter != customRouteMap.end()) &&
(NULL == customRouteMapIter->second))
{
- LOGW("Custom route in main table information has been corrupted for %s",
+ CNE_LOGD("Custom route in main table information has been corrupted for %s",
destinationAddress);
}
@@ -638,13 +639,13 @@ bool modifyCustomRouteInMainTable
else {
if (NULL == gatewayAddress)
{
- LOGI("Adding duplicate custom route in main table with device %s," \
+ CNE_LOGV("Adding duplicate custom route in main table with device %s," \
"destination address %s.", deviceName, destinationAddress);
return true;
}
else {
- LOGI("Adding duplicate custom route in main table with device %s," \
+ CNE_LOGV("Adding duplicate custom route in main table with device %s," \
"destination %s, gateway %s",
deviceName, destinationAddress, gatewayAddress);
return true;
@@ -652,7 +653,7 @@ bool modifyCustomRouteInMainTable
}
}
else {
- LOGI("Device '%s' not found in a custom entry to main table",
+ CNE_LOGV("Device '%s' not found in a custom entry to main table",
deviceName);
}
@@ -664,7 +665,7 @@ bool modifyCustomRouteInMainTable
(NULL == currentDevice->getDeviceName()) ||
(NULL == currentDevice->getDestinationAddress()))
{
- LOGE("Failed to allocate new device information while adding custom " \
+ CNE_LOGD("Failed to allocate new device information while adding custom " \
"entry over interface %s to main table.", deviceName);
return false;
}
@@ -674,12 +675,12 @@ bool modifyCustomRouteInMainTable
case ACTIONS_DELETE_ENUM:
{
- LOGI("Deleting a custom route in the main table with destination %s",
+ CNE_LOGV("Deleting a custom route in the main table with destination %s",
destinationAddress);
if (customRouteMap.empty())
{
- LOGE("Deleting a custom route in the main table when no route exists.");
+ CNE_LOGD("Deleting a custom route in the main table when no route exists.");
return false;
}
@@ -687,7 +688,7 @@ bool modifyCustomRouteInMainTable
if (customRouteMapIter == customRouteMap.end())
{
- LOGE("Cannot delete custom route over %s that has not been created.",
+ CNE_LOGD("Cannot delete custom route over %s that has not been created.",
destinationAddress);
return false;
}
@@ -695,7 +696,7 @@ bool modifyCustomRouteInMainTable
currentDevice = customRouteMapIter->second;
if (NULL == currentDevice)
{
- LOGE("Deleting custom route over %s with a stored name and null value",
+ CNE_LOGD("Deleting custom route over %s with a stored name and null value",
destinationAddress);
return false;
}
@@ -707,7 +708,7 @@ bool modifyCustomRouteInMainTable
default:
{
- LOGE("Unsupported command action found while modifying a custom route");
+ CNE_LOGD("Unsupported command action found while modifying a custom route");
return false;
}
}
@@ -797,7 +798,7 @@ bool modifyDefaultRoute
{
if (NULL == deviceName)
{
- LOGE("A null device name was passed while replacing the default table");
+ CNE_LOGD("A null device name was passed while replacing the default table");
return false;
}
@@ -806,11 +807,11 @@ bool modifyDefaultRoute
if ((NULL != defaultDevice) &&
(0 == strcmp((char *)defaultDevice, (char *)deviceName)))
{
- LOGI("The new default interface %s is the same as the one known by cnd",
+ CNE_LOGV("The new default interface %s is the same as the one known by cnd",
deviceName);
}
- LOGI("Replacing default routing table with %s", deviceName);
+ CNE_LOGV("Replacing default routing table with %s", deviceName);
bool foundMatchingEntry = false;
map<uint8_t*, RoutingTableInfo*>::iterator routingTableMapIter;
@@ -823,13 +824,13 @@ bool modifyDefaultRoute
{
if (NULL == routingTableMapIter->second)
{
- LOGW("Routing table for new default %s has corrupt stored values",
+ CNE_LOGD("Routing table for new default %s has corrupt stored values",
deviceName);
}
else
{
- LOGI("Routing table for new default %s found", deviceName);
+ CNE_LOGV("Routing table for new default %s found", deviceName);
foundMatchingEntry = true;
gatewayAddress = routingTableMapIter->second->getGatewayAddress();
}
@@ -846,13 +847,13 @@ bool modifyDefaultRoute
if (NULL == destinationAddress)
{
- LOGW("Entry in custom route map is corrupted");
+ CNE_LOGD("Entry in custom route map is corrupted");
continue;
}
if (NULL == currentDevice)
{
- LOGW("Value in custom route map with destination %s is corrupted",
+ CNE_LOGD("Value in custom route map with destination %s is corrupted",
destinationAddress);
continue;
}
@@ -860,7 +861,7 @@ bool modifyDefaultRoute
if (0 == strcmp((char *)currentDevice->getDeviceName(),
(char *)deviceName))
{
- LOGI("Custom route for new default %s found", deviceName);
+ CNE_LOGV("Custom route for new default %s found", deviceName);
foundMatchingEntry = true;
gatewayAddress = currentDevice->getGatewayAddress();
break;
@@ -870,7 +871,7 @@ bool modifyDefaultRoute
if (!foundMatchingEntry)
{
- LOGI("No routing tables or entries found for new default device %s",
+ CNE_LOGV("No routing tables or entries found for new default device %s",
deviceName);
}
@@ -885,18 +886,18 @@ bool modifyDefaultRoute
// being deleted when no tables exist
if (NULL == defaultDevice)
{
- LOGE("No stored default device; use deleteDefaultEntryFromMainTable.");
+ CNE_LOGD("No stored default device; use deleteDefaultEntryFromMainTable.");
return false;
}
- LOGI("Deleting default routing table");
+ CNE_LOGV("Deleting default routing table");
break;
}
default:
{
- LOGE("Unsupported command action found while changing the default table");
+ CNE_LOGD("Unsupported command action found while changing the default table");
return false;
}
}
@@ -969,13 +970,13 @@ bool modifyRoutingTable
int32_t tableNumber;
int32_t priorityNumber;
- RoutingTableInfo *currentDevice;
+ RoutingTableInfo *currentDevice = NULL;
map<uint8_t*, RoutingTableInfo*>::iterator routingTableMapIter;
set<int32_t>::iterator tableNumberSetIter;
if (NULL == deviceName)
{
- LOGE("A null device name was passed while modifying a routing table");
+ CNE_LOGD("A null device name was passed while modifying a routing table");
return false;
}
@@ -983,18 +984,18 @@ bool modifyRoutingTable
{
case ACTIONS_ADD_ENUM:
{
- LOGI("Adding a routing table for interface %s", deviceName);
+ CNE_LOGV("Adding a routing table for interface %s", deviceName);
if (NULL == sourcePrefix)
{
- LOGE("A null source prefix was passed when adding the %s table",
+ CNE_LOGD("A null source prefix was passed when adding the %s table",
deviceName);
return false;
}
if (NULL == gatewayAddress)
{
- LOGI("A null gateway address was passed when adding the %s table",
+ CNE_LOGV("A null gateway address was passed when adding the %s table",
deviceName);
}
@@ -1003,7 +1004,7 @@ bool modifyRoutingTable
if ((routingTableMapIter != routingTableMap.end()) &&
(NULL == routingTableMapIter->second))
{
- LOGW("Adding duplicate routing table with corrupt device information");
+ CNE_LOGD("Adding duplicate routing table with corrupt device information");
routingTableMap.erase(deviceName);
}
@@ -1062,13 +1063,13 @@ bool modifyRoutingTable
else {
if (NULL == gatewayAddress)
{
- LOGI("Adding a duplicate %s table with source %s.",
+ CNE_LOGV("Adding a duplicate %s table with source %s.",
deviceName, sourcePrefix);
return true;
}
else {
- LOGI("Adding a duplicate %s table with gateway %s and source %s.",
+ CNE_LOGV("Adding a duplicate %s table with gateway %s and source %s.",
deviceName, sourcePrefix, gatewayAddress);
return true;
}
@@ -1076,13 +1077,13 @@ bool modifyRoutingTable
}
else {
- LOGI("Device '%s' not found as an active interface", deviceName);
+ CNE_LOGV("Device '%s' not found as an active interface", deviceName);
}
// Instantiating more than 252 tables simultaneously is an error
if (MAX_TABLE_NUMBER - MIN_TABLE_NUMBER < tableNumberSet.size())
{
- LOGE("Too many tables exist to add %s. %d tables are defined",
+ CNE_LOGD("Too many tables exist to add %s. %d tables are defined",
deviceName, tableNumberSet.size());
return false;
}
@@ -1114,7 +1115,7 @@ bool modifyRoutingTable
(NULL == currentDevice->getDeviceName()) ||
(NULL == currentDevice->getSourcePrefix()))
{
- LOGE("Failed to allocate new device information while adding table %s.",
+ CNE_LOGD("Failed to allocate new device information while adding table %s.",
deviceName);
return false;
}
@@ -1124,11 +1125,11 @@ bool modifyRoutingTable
case ACTIONS_DELETE_ENUM:
{
- LOGI("Deleting routing table for interface %s", deviceName);
+ CNE_LOGV("Deleting routing table for interface %s", deviceName);
if (routingTableMap.empty())
{
- LOGE("Deleting a table when no table exists.");
+ CNE_LOGD("Deleting a table when no table exists.");
return false;
}
@@ -1136,14 +1137,14 @@ bool modifyRoutingTable
if (routingTableMapIter == routingTableMap.end())
{
- LOGE("Cannot delete table %s that has not been created.", deviceName);
+ CNE_LOGD("Cannot delete table %s that has not been created.", deviceName);
return false;
}
currentDevice = routingTableMapIter->second;
if (NULL == currentDevice)
{
- LOGE("Deleting table with a stored name and null value");
+ CNE_LOGD("Deleting table with a stored name and null value");
return false;
}
@@ -1154,7 +1155,7 @@ bool modifyRoutingTable
default:
{
- LOGE("Unsupported command action found while modifying a table");
+ CNE_LOGD("Unsupported command action found while modifying a table");
return false;
}
}
@@ -1207,7 +1208,7 @@ bool modifyRoutingTable
// If there is no default entry, the new device should be the default.
if (NULL == defaultDevice)
{
- LOGI("Routing table added when no default exists. Adding new default.");
+ CNE_LOGV("Routing table added when no default exists. Adding new default.");
modifyDefaultRoute(deviceName, ACTIONS_REPLACE_ENUM);
}
@@ -1222,7 +1223,7 @@ bool modifyRoutingTable
// If there are no more tables, then there should be no default device.
if (0 == tableNumberSet.size())
{
- LOGI("Removing default table after no devices are known to be up");
+ CNE_LOGV("Removing default table after no devices are known to be up");
modifyDefaultRoute(NULL, ACTIONS_DELETE_ENUM);
}
@@ -1233,7 +1234,7 @@ bool modifyRoutingTable
{
uint8_t *newDefaultName = routingTableMap.begin()->first;
- LOGI("Replacing old default device with %s", newDefaultName);
+ CNE_LOGV("Replacing old default device with %s", newDefaultName);
modifyDefaultRoute(newDefaultName, ACTIONS_REPLACE_ENUM);
}
@@ -1288,7 +1289,7 @@ bool modifyRule
{
if (NULL == currentDevice)
{
- LOGE("A null device was passed while modifying a rule");
+ CNE_LOGD("A null device was passed while modifying a rule");
return false;
}
@@ -1301,7 +1302,7 @@ bool modifyRule
if ((ACTIONS_ADD_ENUM == commandAction) &&
(routingTableMapIter == routingTableMap.end()))
{
- LOGE("Cannot %s a rule for nonexistant table %s",
+ CNE_LOGD("Cannot %s a rule for nonexistant table %s",
cmdLineActionEnumToString(commandAction),
deviceName);
return false;
@@ -1375,7 +1376,7 @@ bool cmdLineCaller
if (NULL == cmdLineFirstWord)
{
- LOGE("No actual command passed to build a command line.");
+ CNE_LOGD("No actual command passed to build a command line.");
return false;
}
@@ -1398,7 +1399,7 @@ bool cmdLineCaller
if (NULL == cmdLineString)
{
- LOGE("Could not allocate memory to build command line string.");
+ CNE_LOGW("Could not allocate memory to build command line string.");
return false;
}
@@ -1407,7 +1408,7 @@ bool cmdLineCaller
strlen((char *)cmdLineFirstWord) * sizeof(uint8_t) + 1);
if (memLength > strlen((char *)cmdLineFirstWord) * sizeof(uint8_t) + 1)
{
- LOGE("Failure building first word of command line string.");
+ CNE_LOGD("Failure building first word of command line string.");
delete [] cmdLineString;
return false;
}
@@ -1424,7 +1425,7 @@ bool cmdLineCaller
sizeof(uint8_t) + 1);
if (memLength > strlen(cmdLineString) * sizeof(char) + sizeof(uint8_t) + 1)
{
- LOGE("Failure adding whitespace to command line string.");
+ CNE_LOGD("Failure adding whitespace to command line string.");
delete [] cmdLineString;
va_end(cmdLineWordList);
return false;
@@ -1438,7 +1439,7 @@ bool cmdLineCaller
if (memLength > strlen(cmdLineString) * sizeof(char) +
strlen((char *)nextWord) * sizeof(uint8_t) + 1)
{
- LOGE("Failure adding next word to command line string.");
+ CNE_LOGD("Failure adding next word to command line string.");
delete [] cmdLineString;
va_end(cmdLineWordList);
return false;
@@ -1449,7 +1450,7 @@ bool cmdLineCaller
cmdLineString[byteLength + numberOfSpaces] = '\0';
- LOGI("Iproute2 will be called with: %s", cmdLineString);
+ CNE_LOGV("Iproute2 will be called with: %s", cmdLineString);
int cmdLineExitValue = system(cmdLineString);
@@ -1457,12 +1458,12 @@ bool cmdLineCaller
if (0 != cmdLineExitValue)
{
- LOGE("Command line call to iproute2 failed with exitvalue %d.",
+ CNE_LOGD("Command line call to iproute2 failed with exitvalue %d.",
cmdLineExitValue);
return false;
}
- LOGI("Iproute2 successfully called.", cmdLineString);
+ CNE_LOGV("Iproute2 successfully called.");
return true;
}
@@ -1591,16 +1592,16 @@ bool cnd_iproute2::deleteDeviceCustomEntriesInMainTable
{
if (NULL == deviceName)
{
- LOGE("Null device name was passed when adding a custom route");
+ CNE_LOGD("Null device name was passed when adding a custom route");
return false;
}
- LOGI("Deleting custom routes in the main table through interface %s",
+ CNE_LOGV("Deleting custom routes in the main table through interface %s",
deviceName);
if (customRouteMap.empty())
{
- LOGE("Deleting a custom route in the main table when no route exists.");
+ CNE_LOGD("Deleting a custom route in the main table when no route exists.");
return false;
}
@@ -1620,13 +1621,13 @@ bool cnd_iproute2::deleteDeviceCustomEntriesInMainTable
if (NULL == destinationAddress)
{
- LOGW("Entry in currentDevice is corrupted.");
+ CNE_LOGD("Entry in currentDevice is corrupted.");
continue;
}
if (NULL == currentDevice)
{
- LOGW("Entry in currentDevice with destination %s is corrupted",
+ CNE_LOGD("Entry in currentDevice with destination %s is corrupted",
destinationAddress);
continue;
}
@@ -1643,7 +1644,7 @@ bool cnd_iproute2::deleteDeviceCustomEntriesInMainTable
if (!foundMatchingEntry)
{
- LOGE("No entry was found with interface name %s.", deviceName);
+ CNE_LOGD("No entry was found with interface name %s.", deviceName);
return false;
}
@@ -1667,7 +1668,7 @@ bool cnd_iproute2::deleteDefaultEntryInMainTable
uint8_t *deviceName
)
{
- LOGI("Deleting %s interface from main table.", deviceName);
+ CNE_LOGV("Deleting %s interface from main table.", deviceName);
if (!cmdLineCaller(ROUTING_CMD,
cmdLineActionEnumToString(ACTIONS_DELETE_ENUM),
@@ -1754,7 +1755,7 @@ bool cnd_iproute2::showRoutingTable
{
if (NULL == deviceName)
{
- LOGE("A null device name was passed while displaying a table.");
+ CNE_LOGD("A null device name was passed while displaying a table.");
return false;
}
diff --git a/cnd/src/cnd_process.cpp b/cnd/src/cnd_process.cpp
index c93bb53..224d2fb 100755..100644
--- a/cnd/src/cnd_process.cpp
+++ b/cnd/src/cnd_process.cpp
@@ -15,6 +15,7 @@
** limitations under the License.
*/
#define LOG_TAG "CND_PROCESS"
+#define LOCAL_TAG "CND_PROCESS_DEBUG"
#include <cutils/sockets.h>
#include <cutils/jstring.h>
@@ -50,7 +51,6 @@
#include <cnd_iproute2.h>
-
namespace android {
#define SOCKET_NAME_CND "cnd"
@@ -182,7 +182,7 @@ void cnd_sendUnsolicitedMsg(int targetFd, int msgType, int dataLen, void *data)
else
fd = targetFd;
- LOGD ("cnd_sendUnsolicitedMsg: Fd=%d, msgType=%d, datalen=%d\n",
+ CNE_LOGV ("cnd_sendUnsolicitedMsg: Fd=%d, msgType=%d, datalen=%d\n",
targetFd, msgType, dataLen);
unsolicitedMessage(msgType, data, dataLen, fd);
@@ -194,7 +194,7 @@ static void
processCommand (int command, void *data, size_t datalen, CND_Token t)
{
- LOGD ("processCommand: command=%d, datalen=%d", command, datalen);
+ CNE_LOGV ("processCommand: command=%d, datalen=%d", command, datalen);
/* Special handling for iproute2 command to setup iproute2 table */
if ((command == CNE_REQUEST_CONFIG_IPROUTE2_CMD) && (cneServiceEnabled))
@@ -206,7 +206,7 @@ processCommand (int command, void *data, size_t datalen, CND_Token t)
unsigned char *ifName = NULL;
if ((data == NULL) || (datalen ==0)) {
- LOGE ("processCommand: invalid data");
+ CNE_LOGD ("processCommand: invalid data");
return;
}
@@ -215,7 +215,7 @@ processCommand (int command, void *data, size_t datalen, CND_Token t)
ipAddr = ((unsigned char **)data)[2];
gatewayAddr = ((unsigned char **)data)[3];
- LOGD ("processCommand: iproute2cmd=%d, ipAddr=%s, gatewayAddr=%s, "
+ CNE_LOGV ("processCommand: iproute2cmd=%d, ipAddr=%s, gatewayAddr=%s, "
"ifName=%s", cmd, ipAddr, gatewayAddr, ifName);
cnd_iproute2* cnd_iproute2_ptr = cnd_iproute2::getInstance();
@@ -245,7 +245,7 @@ processCommand (int command, void *data, size_t datalen, CND_Token t)
cnd_iproute2::getInstance()->deleteDeviceCustomEntriesInMainTable(ifName);
break;
default:
- LOGE ("processCommand: not iproute2 command=%d", command);
+ CNE_LOGD ("processCommand: not iproute2 command=%d", command);
break;
}
}
@@ -260,7 +260,7 @@ processCommand (int command, void *data, size_t datalen, CND_Token t)
}
else
{
- LOGE("cne_processCommand is NULL");
+ CNE_LOGD("cne_processCommand is NULL");
}
cnd_commandComplete(t, CND_E_SUCCESS, NULL, 0);
return;
@@ -313,7 +313,7 @@ dispatchString (Parcel& p, RequestInfo *pRI)
string8 = strdupReadString(p);
- LOGD ("dispatchString: strlen=%d", strlen(string8));
+ CNE_LOGV ("dispatchString: strlen=%d", strlen(string8));
processCommand(pRI->pCI->commandNumber, string8, strlen(string8), pRI);
@@ -337,7 +337,7 @@ dispatchStrings (Parcel &p, RequestInfo *pRI)
status = p.readInt32 (&countStrings);
if (status != NO_ERROR){
- LOGE ("dispatchStrings: invalid block");
+ CNE_LOGD ("dispatchStrings: invalid block");
return;
}
@@ -389,7 +389,7 @@ dispatchInts (Parcel &p, RequestInfo *pRI)
status = p.readInt32 (&count);
if (status != NO_ERROR || count == 0) {
- LOGE ("dispatchInts: invalid block");
+ CNE_LOGD ("dispatchInts: invalid block");
return;
}
@@ -397,7 +397,7 @@ dispatchInts (Parcel &p, RequestInfo *pRI)
pInts = (int *)alloca(datalen);
if (pInts == NULL) {
- LOGE ("dispatchInts: alloc failed");
+ CNE_LOGW ("dispatchInts: alloc failed");
return;
}
@@ -408,7 +408,7 @@ dispatchInts (Parcel &p, RequestInfo *pRI)
pInts[i] = (int)t;
if (status != NO_ERROR) {
- LOGE ("dispatchInts: invalid block");
+ CNE_LOGD ("dispatchInts: invalid block");
return;
}
}
@@ -445,12 +445,12 @@ dispatchWlanInfo(Parcel &p, RequestInfo *pRI)
args.timeStamp = strdupReadString(p);
if (status != NO_ERROR){
- LOGE ("dispatchWlanInfo: invalid block");
+ CNE_LOGD ("dispatchWlanInfo: invalid block");
return;
}
- LOGD ("dispatchWlanInfo: state=%ld, rssi=%ld, ssid=%s, ipAddr=%s, "
+ CNE_LOGV ("dispatchWlanInfo: state=%d, rssi=%d, ssid=%s, ipAddr=%s, "
"timeStamp=%s",
args.status, args.rssi, args.ssid, args.ipAddr, args.timeStamp);
@@ -470,7 +470,7 @@ dispatchWlanScanResults(Parcel &p, RequestInfo *pRI)
status = p.readInt32 (&t);
if (status != NO_ERROR){
- LOGE ("dispatchWlanScanResults: invalid block");
+ CNE_LOGD ("dispatchWlanScanResults: invalid block");
return;
}
@@ -489,7 +489,7 @@ dispatchWlanScanResults(Parcel &p, RequestInfo *pRI)
args.scanList[i].capabilities = strdupReadString(p);
if (status != NO_ERROR){
- LOGE ("dispatchWlanScanResults: invalid block");
+ CNE_LOGD ("dispatchWlanScanResults: invalid block");
return;
}
}
@@ -521,11 +521,11 @@ dispatchWwanInfo(Parcel &p, RequestInfo *pRI)
args.timeStamp = strdupReadString(p);
if (status != NO_ERROR){
- LOGE ("dispatchWwanInfo: invalid block");
+ CNE_LOGD ("dispatchWwanInfo: invalid block");
return;
}
- LOGD ("dispatchWwanInfo: type=%ld, state=%ld, rssi=%ld, roaming=%ld, "
+ CNE_LOGV ("dispatchWwanInfo: type=%d, state=%d, rssi=%d, roaming=%d, "
"ipAddr=%s, timeStamp=%s", args.type, args.status, args.rssi,
args.roaming, args.ipAddr, args.timeStamp);
@@ -550,11 +550,11 @@ dispatchRatStatus(Parcel &p, RequestInfo *pRI)
args.ipAddr = strdupReadString(p);
if (status != NO_ERROR){
- LOGE ("dispatchRatStatus: invalid block");
+ CNE_LOGD ("dispatchRatStatus: invalid block");
return;
}
- LOGD ("dispatchRatStatus: type=%ld, ratStatus=%ld, ipAddr=%s",
+ CNE_LOGV ("dispatchRatStatus: type=%d, ratStatus=%d, ipAddr=%s",
args.rat, args.ratStatus, args.ipAddr);
@@ -579,12 +579,12 @@ dispatchIproute2Cmd(Parcel &p, RequestInfo *pRI)
args.gatewayAddr = strdupReadString(p);
if ((status != NO_ERROR) || (args.ifName == NULL)) {
- LOGE ("dispatchIproute2Cmd: invalid block");
+ CNE_LOGD ("dispatchIproute2Cmd: invalid block");
return;
}
- LOGD ("dispatchIproute2Cmd: cmd=%ld, ifName=%s, ipAddr=%s, gatewayAddr=%s",
+ CNE_LOGV ("dispatchIproute2Cmd: cmd=%d, ifName=%s, ipAddr=%s, gatewayAddr=%s",
args.cmd, args.ifName, args.ipAddr, args.gatewayAddr);
processCommand(pRI->pCI->commandNumber, &args, sizeof(args), pRI);
@@ -611,7 +611,7 @@ dispatchRaw(Parcel &p, RequestInfo *pRI)
status = p.readInt32(&len);
if (status != NO_ERROR){
- LOGE ("dispatchRaw: invalid block");
+ CNE_LOGD ("dispatchRaw: invalid block");
return;
}
@@ -636,7 +636,7 @@ writeData(int fd, const void *buffer, size_t len)
toWrite = (const uint8_t *)buffer;
- LOGD ("writeData: len=%d",len);
+ CNE_LOGV ("writeData: len=%d",len);
while (writeOffset < len) {
ssize_t written;
do {
@@ -647,7 +647,7 @@ writeData(int fd, const void *buffer, size_t len)
if (written >= 0) {
writeOffset += written;
} else { // written < 0
- LOGE ("writeData: unexpected error on write errno:%d", errno);
+ CNE_LOGD ("writeData: unexpected error on write errno:%d", errno);
close(fd);
return -1;
}
@@ -668,7 +668,7 @@ sendResponseRaw (const void *data, size_t dataSize, int fdCommand)
}
if (dataSize > MAX_COMMAND_BYTES) {
- LOGE("sendResponseRaw: packet larger than %u (%u)",
+ CNE_LOGD("sendResponseRaw: packet larger than %u (%u)",
MAX_COMMAND_BYTES, (unsigned int )dataSize);
return -1;
@@ -711,11 +711,11 @@ responseInts(Parcel &p, void *response, size_t responselen)
int numInts;
if (response == NULL && responselen != 0) {
- LOGE("invalid response: NULL");
+ CNE_LOGD("invalid response: NULL");
return CND_E_INVALID_RESPONSE;
}
if (responselen % sizeof(int) != 0) {
- LOGE("invalid response length %d expected multiple of %d\n",
+ CNE_LOGD("invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(int));
return CND_E_INVALID_RESPONSE;
}
@@ -742,11 +742,11 @@ static int responseStrings(Parcel &p, void *response, size_t responselen)
int numStrings;
if (response == NULL && responselen != 0) {
- LOGE("invalid response: NULL");
+ CNE_LOGD("invalid response: NULL");
return CND_E_INVALID_RESPONSE;
}
if (responselen % sizeof(char *) != 0) {
- LOGE("invalid response length %d expected multiple of %d\n",
+ CNE_LOGD("invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(char *));
return CND_E_INVALID_RESPONSE;
}
@@ -777,7 +777,7 @@ static int responseStrings(Parcel &p, void *response, size_t responselen)
static int responseString(Parcel &p, void *response, size_t responselen)
{
- LOGD ("responseString called");
+ CNE_LOGV("responseString called");
/* one string only */
writeStringToParcel(p, (const char *)response);
@@ -792,7 +792,7 @@ static int responseVoid(Parcel &p, void *response, size_t responselen)
static int responseRaw(Parcel &p, void *response, size_t responselen)
{
if (response == NULL && responselen != 0) {
- LOGE("invalid response: NULL with responselen != 0");
+ CNE_LOGD("invalid response: NULL with responselen != 0");
return CND_E_INVALID_RESPONSE;
}
@@ -812,7 +812,7 @@ static int rspCompatibleNws(Parcel &p, void *response, size_t responselen)
{
if (response == NULL && responselen != 0)
{
- LOGE("invalid response: NULL");
+ CNE_LOGD("invalid response: NULL");
return CND_E_INVALID_RESPONSE;
}
@@ -836,7 +836,7 @@ static int evtMorePrefNw(Parcel &p, void *response, size_t responselen)
{
if (response == NULL && responselen != 0)
{
- LOGE("invalid response: NULL");
+ CNE_LOGD("invalid response: NULL");
return CND_E_INVALID_RESPONSE;
}
@@ -855,7 +855,7 @@ static int eventRatChange(Parcel &p, void *response, size_t responselen)
{
if (response == NULL && responselen != 0)
{
- LOGE("invalid response: NULL");
+ CNE_LOGD("invalid response: NULL");
return CND_E_INVALID_RESPONSE;
}
@@ -926,7 +926,7 @@ static void unsolicitedMessage(int unsolMessage, void *data, size_t datalen, int
int ret;
if (s_registerCalled == 0) {
- LOGW("unsolicitedMessage called before cnd_init ignored");
+ CNE_LOGD("unsolicitedMessage called before cnd_init ignored");
return;
}
@@ -940,7 +940,7 @@ static void unsolicitedMessage(int unsolMessage, void *data, size_t datalen, int
if (ret != 0) {
// Problem with the response. Don't continue;
- LOGE("unsolicitedMessage: problem with response");
+ CNE_LOGD("unsolicitedMessage: problem with response");
return;
}
@@ -967,12 +967,12 @@ processCommandBuffer(void *buffer, size_t buflen, int fd)
status = p.readInt32 (&token);
if (status != NO_ERROR) {
- LOGE("processCommandBuffer: invalid request block");
+ CNE_LOGD("processCommandBuffer: invalid request block");
return -1;
}
if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) {
- LOGE("processCommandBuffer: unsupported request code %d token %d",
+ CNE_LOGD("processCommandBuffer: unsupported request code %d token %d",
request, token);
return -1;
}
@@ -980,7 +980,7 @@ processCommandBuffer(void *buffer, size_t buflen, int fd)
pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo));
if (pRI == NULL) {
- LOGE("processCommandBuffer: calloc failed");
+ CNE_LOGW("processCommandBuffer: calloc failed");
return -1;
}
@@ -1014,9 +1014,9 @@ static void processCommandsCallback(int fd, void *param)
for (;;) {
/* loop until EAGAIN/EINTR, end of stream, or other error */
ret = record_stream_get_next(p_rs, &p_record, &recordlen);
- LOGD ("processCommandsCallback: len=%d, ret=%d", recordlen, ret);
+ CNE_LOGV ("processCommandsCallback: len=%d, ret=%d", recordlen, ret);
if (ret == 0 && p_record == NULL) {
- LOGD ("processCommandsCallback: end of stream");
+ CNE_LOGV ("processCommandsCallback: end of stream");
break;
} else if (ret < 0) {
break;
@@ -1029,9 +1029,9 @@ static void processCommandsCallback(int fd, void *param)
if (ret == 0 || !(errno == EAGAIN || errno == EINTR)) {
/* fatal error or end-of-stream */
if (ret != 0) {
- LOGE("error on reading command socket errno:%d\n", errno);
+ CNE_LOGD("error on reading command socket errno:%d\n", errno);
} else {
- LOGW("EOS. Closing command socket.");
+ CNE_LOGD("EOS. Closing command socket.");
}
close(s_fdCommand);
s_fdCommand = -1;
@@ -1064,7 +1064,7 @@ static void listenCallback (int fd, void *param)
s_fdCommand = accept(s_fdListen, (sockaddr *) &peeraddr, &socklen);
if (s_fdCommand < 0 ) {
- LOGE("Error on accept() errno:%d", errno);
+ CNE_LOGD("Error on accept() errno:%d", errno);
/* start listening for new connections again */
cnd_event_add(&s_listen_event);
return;
@@ -1076,17 +1076,17 @@ static void listenCallback (int fd, void *param)
ret = fcntl(s_fdCommand, F_SETFL, O_NONBLOCK);
if (ret < 0) {
- LOGE ("Error setting O_NONBLOCK errno = %d", errno);
+ CNE_LOGD("Error setting O_NONBLOCK errno = %d", errno);
}
- LOGI("listenCallback: accept new connection, fd=%d", s_fdCommand);
+ CNE_LOGV("listenCallback: accept new connection, fd=%d", s_fdCommand);
p_rs = record_stream_new(s_fdCommand, MAX_COMMAND_BYTES);
// note: persistent = 1, not removed from table
if (command_index >= MAX_FD_EVENTS)
{
- LOGE ("Error: exceeding number of supported connection");
+ CNE_LOGD ("Error: exceeding number of supported connection");
return;
}
cnd_event_set (&s_commands_event[command_index], s_fdCommand, 1,
@@ -1106,7 +1106,7 @@ eventLoop(void *param)
int ret;
int filedes[2];
- LOGD ("eventLoop: s_started=%d", s_started);
+ CNE_LOGV ("eventLoop: s_started=%d", s_started);
pthread_mutex_lock(&s_startupMutex);
@@ -1142,7 +1142,7 @@ cnd_startEventLoop(void)
pthread_mutex_unlock(&s_startupMutex);
if (ret < 0) {
- LOGE("Failed to create dispatch thread errno:%d", errno);
+ CNE_LOGD("Failed to create dispatch thread errno:%d", errno);
return;
}
}
@@ -1153,7 +1153,7 @@ cnd_init (void)
int ret;
if (s_registerCalled > 0) {
- LOGE("cnd_init has been called more than once. "
+ CNE_LOGD("cnd_init has been called more than once. "
"Subsequent call ignored");
return;
}
@@ -1166,19 +1166,19 @@ cnd_init (void)
}
else
{
- LOGE("cne_regMessageCb is NULL");
+ CNE_LOGD("cne_regMessageCb is NULL");
}
s_fdListen = android_get_control_socket(SOCKET_NAME_CND);
if (s_fdListen < 0) {
- LOGE("Failed to get socket '" SOCKET_NAME_CND "'");
+ CNE_LOGD("Failed to get socket '" SOCKET_NAME_CND "'");
exit(-1);
}
ret = listen(s_fdListen, 4);
if (ret < 0) {
- LOGE("Failed to listen on control socket '%d': %s",
+ CNE_LOGD("Failed to listen on control socket '%d': %s",
s_fdListen, strerror(errno));
exit(-1);
}
@@ -1201,7 +1201,7 @@ cnd_commandComplete(CND_Token t, CND_Errno e, void *response, size_t responselen
pRI = (RequestInfo *)t;
if (!checkAndDequeueRequestInfo(pRI)) {
- LOGE ("cnd_commandComplete: invalid Token");
+ CNE_LOGD ("cnd_commandComplete: invalid Token");
return;
}
@@ -1222,11 +1222,11 @@ cnd_commandComplete(CND_Token t, CND_Errno e, void *response, size_t responselen
p.writeInt32 (ret);
}
} else {
- LOGE ("cnd_commandComplete: Error");
+ CNE_LOGD ("cnd_commandComplete: Error");
}
if (pRI->fd < 0) {
- LOGE ("cnd_commandComplete: Command channel closed");
+ CNE_LOGD ("cnd_commandComplete: Command channel closed");
}
sendResponse(p, pRI->fd);
}
diff --git a/include/cne/cne.h b/include/cne/cne.h
index cd63cad..cd63cad 100755..100644
--- a/include/cne/cne.h
+++ b/include/cne/cne.h