From ec16b9d47cacb0d873ee0ff80c919f49215c0005 Mon Sep 17 00:00:00 2001 From: "Mike J. Chen" Date: Thu, 23 Jun 2011 14:55:28 -0700 Subject: Revert "Revert "Add NETLINK_ROUTE processing to the netlink client code, so that Ethernet"" This reverts commit 1d504eeb50d980c222572629383bb76315f32ca0. Conflicts: libsysutils/src/NetlinkEvent.cpp Bring back the changes from Stan Chesnutt regarding adding NETLINK_ROUTE processing. The original commit message description was: Add NETLINK_ROUTE processing to the netlink client code, so that Ethernet physical-layer up/down events can be tracked. Upper layers will use these events to enable/disable Ethernet connectivity. The original change was reverted due to an incompatiblity with Motorola's ril.so binary. I'll submit a patch to workaround that incompatiblity separately. Change-Id: I4e97ac98833b10543e654c63ecae3b9b8c7db44f Signed-off-by: Mike J. Chen --- include/sysutils/NetlinkEvent.h | 8 +++++++- include/sysutils/NetlinkListener.h | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'include/sysutils') diff --git a/include/sysutils/NetlinkEvent.h b/include/sysutils/NetlinkEvent.h index b329b092..1ee98493 100644 --- a/include/sysutils/NetlinkEvent.h +++ b/include/sysutils/NetlinkEvent.h @@ -30,17 +30,23 @@ public: const static int NlActionAdd; const static int NlActionRemove; const static int NlActionChange; + const static int NlActionLinkDown; + const static int NlActionLinkUp; NetlinkEvent(); virtual ~NetlinkEvent(); - bool decode(char *buffer, int size); + bool decode(char *buffer, int size, int format); const char *findParam(const char *paramName); const char *getSubsystem() { return mSubsystem; } int getAction() { return mAction; } void dump(); + + protected: + bool parseBinaryNetlinkMessage(char *buffer, int size); + bool parseAsciiNetlinkMessage(char *buffer, int size); }; #endif diff --git a/include/sysutils/NetlinkListener.h b/include/sysutils/NetlinkListener.h index 28800460..1cf5f9ff 100644 --- a/include/sysutils/NetlinkListener.h +++ b/include/sysutils/NetlinkListener.h @@ -22,9 +22,13 @@ class NetlinkEvent; class NetlinkListener : public SocketListener { char mBuffer[64 * 1024]; + int mFormat; public: - NetlinkListener(int socket); + static const int NETLINK_FORMAT_ASCII = 0; + static const int NETLINK_FORMAT_BINARY = 1; + + NetlinkListener(int socket, int format); virtual ~NetlinkListener() {} protected: -- cgit v1.2.3