Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: src/byte_counter.h

Issue 5180003: cashew: add local byte counters (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SRC_BYTE_COUNTER_H_
6 #define SRC_BYTE_COUNTER_H_
7
8 #include <string>
9
10 #include <base/basictypes.h> // NOLINT
11
12 namespace cashew {
13
14 class ByteCounterDelegate;
15
16 // interface for byte counter
17 class ByteCounter {
18 public:
19 virtual ~ByteCounter() {}
20
21 // to what interface is this counter attached?
22 virtual const std::string& GetInterface() const = 0;
23
24 // received bytes
25 virtual uint64 GetRxBytes() const = 0;
26
27 // transmitted bytes
28 virtual uint64 GetTxBytes() const = 0;
29
30 // set delegate interface that will receive counter updates
31 // it's ok to clear this by setting it to NULL
32 virtual void SetDelegate(ByteCounterDelegate *delegate) = 0;
33
34 // factory
35 // return appropriate concrete impl
36 // caller owns returned ByteCounter and is responsible for deleting it
37 static ByteCounter* NewByteCounter(const std::string& interface);
38 };
39
40 // interface for delegates
41 class ByteCounterDelegate {
42 public:
43 virtual ~ByteCounterDelegate() {}
44
45 // called when byte counter is updated
46 virtual void OnByteCounterUpdate(const ByteCounter *counter,
47 uint64 rx_bytes, uint64 tx_bytes) = 0;
48 };
49
50 } // namespace cashew
51
52 #endif // SRC_BYTE_COUNTER_H_
OLDNEW
« no previous file with comments | « src/Makefile.am ('k') | src/byte_counter.cc » ('j') | src/device.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698