OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "net/base/address_tracker_linux.h" | 6 #include "net/base/address_tracker_linux.h" |
7 | 7 |
8 #include <linux/if.h> | 8 #include <linux/if.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 attr.nla_type = type; | 115 attr.nla_type = type; |
116 Append(&attr, sizeof(attr)); | 116 Append(&attr, sizeof(attr)); |
117 Align(); | 117 Align(); |
118 Append(data, length); | 118 Append(data, length); |
119 Align(); | 119 Align(); |
120 } | 120 } |
121 | 121 |
122 void AppendTo(Buffer* output) const { | 122 void AppendTo(Buffer* output) const { |
123 CHECK_EQ(NLMSG_ALIGN(output->size()), output->size()); | 123 CHECK_EQ(NLMSG_ALIGN(output->size()), output->size()); |
124 output->reserve(output->size() + NLMSG_LENGTH(buffer_.size())); | 124 output->reserve(output->size() + NLMSG_LENGTH(buffer_.size())); |
125 output->insert(output->end(), buffer_.begin(), buffer_.end()); | 125 // TODO: fix this |
| 126 //output->insert(output->end(), buffer_.begin(), buffer_.end()); |
126 } | 127 } |
127 | 128 |
128 private: | 129 private: |
129 void Append(const void* data, size_t length) { | 130 void Append(const void* data, size_t length) { |
130 const char* chardata = reinterpret_cast<const char*>(data); | 131 const char* chardata = reinterpret_cast<const char*>(data); |
131 buffer_.insert(buffer_.end(), chardata, chardata + length); | 132 buffer_.insert(buffer_.end(), chardata, chardata + length); |
132 } | 133 } |
133 | 134 |
134 void Align() { | 135 void Align() { |
135 header()->nlmsg_len = buffer_.size(); | 136 header()->nlmsg_len = buffer_.size(); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 548 |
548 TEST_F(AddressTrackerLinuxTest, NonTrackingModeInit) { | 549 TEST_F(AddressTrackerLinuxTest, NonTrackingModeInit) { |
549 AddressTrackerLinux tracker; | 550 AddressTrackerLinux tracker; |
550 tracker.Init(); | 551 tracker.Init(); |
551 } | 552 } |
552 | 553 |
553 } // namespace | 554 } // namespace |
554 | 555 |
555 } // namespace internal | 556 } // namespace internal |
556 } // namespace net | 557 } // namespace net |
OLD | NEW |