Ben Chan | 0364fb6 | 2013-04-12 13:04:24 -0700 | [diff] [blame] | 1 | // Copyright (c) 2013 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 | #include "shill/connection_info.h" |
| 6 | |
| 7 | #include <netinet/in.h> |
| 8 | |
| 9 | namespace shill { |
| 10 | |
| 11 | ConnectionInfo::ConnectionInfo() |
| 12 | : protocol_(IPPROTO_MAX), |
| 13 | time_to_expire_seconds_(0), |
| 14 | is_unreplied_(false), |
| 15 | original_source_ip_address_(IPAddress::kFamilyUnknown), |
| 16 | original_source_port_(0), |
| 17 | original_destination_ip_address_(IPAddress::kFamilyUnknown), |
| 18 | original_destination_port_(0), |
| 19 | reply_source_ip_address_(IPAddress::kFamilyUnknown), |
| 20 | reply_source_port_(0), |
| 21 | reply_destination_ip_address_(IPAddress::kFamilyUnknown), |
| 22 | reply_destination_port_(0) { |
| 23 | } |
| 24 | |
| 25 | ConnectionInfo::ConnectionInfo(int protocol, |
| 26 | int64 time_to_expire_seconds, |
| 27 | bool is_unreplied, |
| 28 | IPAddress original_source_ip_address, |
| 29 | uint16 original_source_port, |
| 30 | IPAddress original_destination_ip_address, |
| 31 | uint16 original_destination_port, |
| 32 | IPAddress reply_source_ip_address, |
| 33 | uint16 reply_source_port, |
| 34 | IPAddress reply_destination_ip_address, |
| 35 | uint16 reply_destination_port) |
| 36 | : protocol_(protocol), |
| 37 | time_to_expire_seconds_(time_to_expire_seconds), |
| 38 | is_unreplied_(is_unreplied), |
| 39 | original_source_ip_address_(original_source_ip_address), |
| 40 | original_source_port_(original_source_port), |
| 41 | original_destination_ip_address_(original_destination_ip_address), |
| 42 | original_destination_port_(original_destination_port), |
| 43 | reply_source_ip_address_(reply_source_ip_address), |
| 44 | reply_source_port_(reply_source_port), |
| 45 | reply_destination_ip_address_(reply_destination_ip_address), |
| 46 | reply_destination_port_(reply_destination_port) { |
| 47 | } |
| 48 | |
| 49 | ConnectionInfo::ConnectionInfo(const ConnectionInfo &info) |
| 50 | : protocol_(info.protocol_), |
| 51 | time_to_expire_seconds_(info.time_to_expire_seconds_), |
| 52 | is_unreplied_(info.is_unreplied_), |
| 53 | original_source_ip_address_(info.original_source_ip_address_), |
| 54 | original_source_port_(info.original_source_port_), |
| 55 | original_destination_ip_address_( |
| 56 | info.original_destination_ip_address_), |
| 57 | original_destination_port_(info.original_destination_port_), |
| 58 | reply_source_ip_address_(info.reply_source_ip_address_), |
| 59 | reply_source_port_(info.reply_source_port_), |
| 60 | reply_destination_ip_address_( |
| 61 | info.reply_destination_ip_address_), |
| 62 | reply_destination_port_(info.reply_destination_port_) { |
| 63 | } |
| 64 | |
| 65 | ConnectionInfo::~ConnectionInfo() {} |
| 66 | |
| 67 | ConnectionInfo &ConnectionInfo::operator=(const ConnectionInfo &info) { |
| 68 | protocol_ = info.protocol_; |
| 69 | time_to_expire_seconds_ = info.time_to_expire_seconds_; |
| 70 | is_unreplied_ = info.is_unreplied_; |
| 71 | original_source_ip_address_ = info.original_source_ip_address_; |
| 72 | original_source_port_ = info.original_source_port_; |
| 73 | original_destination_ip_address_ = |
| 74 | info.original_destination_ip_address_; |
| 75 | original_destination_port_ = info.original_destination_port_; |
| 76 | reply_source_ip_address_ = info.reply_source_ip_address_; |
| 77 | reply_source_port_ = info.reply_source_port_; |
| 78 | reply_destination_ip_address_ = info.reply_destination_ip_address_; |
| 79 | reply_destination_port_ = info.reply_destination_port_; |
| 80 | |
| 81 | return *this; |
| 82 | } |
| 83 | |
| 84 | } // namespace shill |