1d18304287dbabc7835be771400b85d4ae8b63de6San Mehat/*
2d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Copyright (C) 2008 The Android Open Source Project
3d18304287dbabc7835be771400b85d4ae8b63de6San Mehat *
4d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Licensed under the Apache License, Version 2.0 (the "License");
5d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * you may not use this file except in compliance with the License.
6d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * You may obtain a copy of the License at
7d18304287dbabc7835be771400b85d4ae8b63de6San Mehat *
8d18304287dbabc7835be771400b85d4ae8b63de6San Mehat *      http://www.apache.org/licenses/LICENSE-2.0
9d18304287dbabc7835be771400b85d4ae8b63de6San Mehat *
10d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * Unless required by applicable law or agreed to in writing, software
11d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * distributed under the License is distributed on an "AS IS" BASIS,
12d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * See the License for the specific language governing permissions and
14d18304287dbabc7835be771400b85d4ae8b63de6San Mehat * limitations under the License.
15d18304287dbabc7835be771400b85d4ae8b63de6San Mehat */
16d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
17d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#ifndef _NETLINKHANDLER_H
18d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#define _NETLINKHANDLER_H
19d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
20d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#include <sysutils/NetlinkListener.h>
2167c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt#include "NetlinkManager.h"
22d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
23d18304287dbabc7835be771400b85d4ae8b63de6San Mehatclass NetlinkHandler: public NetlinkListener {
2467c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt    NetlinkManager *mNm;
25d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
26d18304287dbabc7835be771400b85d4ae8b63de6San Mehatpublic:
27564df4efc87f3d04c3570836d38134fd949c4cafMike J. Chen    NetlinkHandler(NetlinkManager *nm, int listenerSocket, int format);
28d18304287dbabc7835be771400b85d4ae8b63de6San Mehat    virtual ~NetlinkHandler();
29d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
30d18304287dbabc7835be771400b85d4ae8b63de6San Mehat    int start(void);
31d18304287dbabc7835be771400b85d4ae8b63de6San Mehat    int stop(void);
32d18304287dbabc7835be771400b85d4ae8b63de6San Mehat
33d18304287dbabc7835be771400b85d4ae8b63de6San Mehatprotected:
34d18304287dbabc7835be771400b85d4ae8b63de6San Mehat    virtual void onEvent(NetlinkEvent *evt);
3567c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt
3667c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt    void notifyInterfaceAdded(const char *name);
3767c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt    void notifyInterfaceRemoved(const char *name);
3867c5753274ee828b56f96b5e9cdae64c8562ad52Robert Greenwalt    void notifyInterfaceChanged(const char *name, bool isUp);
39564df4efc87f3d04c3570836d38134fd949c4cafMike J. Chen    void notifyInterfaceLinkChanged(const char *name, bool isUp);
40e0ebc46c0aa38ce4f35bd3b60c0fcb9204d4c35eJP Abgrall    void notifyQuotaLimitReached(const char *name, const char *iface);
4198f65d32b1530b4da6050e38d52f955710577efbHaoyu Bai    void notifyInterfaceClassActivity(const char *name, bool isActive);
42d18304287dbabc7835be771400b85d4ae8b63de6San Mehat};
43d18304287dbabc7835be771400b85d4ae8b63de6San Mehat#endif
44