michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NetworkActivityMonitor_h___ michael@0: #define NetworkActivityMonitor_h___ michael@0: michael@0: #include michael@0: #include "nscore.h" michael@0: #include "prio.h" michael@0: #include "prinrval.h" michael@0: michael@0: namespace mozilla { namespace net { michael@0: michael@0: class NetworkActivityMonitor michael@0: { michael@0: public: michael@0: enum Direction { michael@0: kUpload = 0, michael@0: kDownload = 1 michael@0: }; michael@0: michael@0: NetworkActivityMonitor(); michael@0: ~NetworkActivityMonitor(); michael@0: michael@0: static nsresult Init(int32_t blipInterval); michael@0: static nsresult Shutdown(); michael@0: michael@0: static nsresult AttachIOLayer(PRFileDesc *fd); michael@0: static nsresult DataInOut(Direction direction); michael@0: michael@0: private: michael@0: nsresult Init_Internal(int32_t blipInterval); michael@0: void PostNotification(Direction direction); michael@0: michael@0: static NetworkActivityMonitor * gInstance; michael@0: PRDescIdentity mLayerIdentity; michael@0: PRIOMethods mLayerMethods; michael@0: PRIntervalTime mBlipInterval; michael@0: PRIntervalTime mLastNotificationTime[2]; michael@0: }; michael@0: michael@0: }} // namespace mozilla::net michael@0: michael@0: #endif /* NetworkActivityMonitor_h___ */