-
Notifications
You must be signed in to change notification settings - Fork 0
/
connection_info.cc
96 lines (86 loc) · 3.92 KB
/
connection_info.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "shill/connection_info.h"
#include <netinet/in.h>
namespace shill {
ConnectionInfo::ConnectionInfo()
: protocol_(IPPROTO_MAX),
time_to_expire_seconds_(0),
is_unreplied_(false),
original_source_ip_address_(IPAddress::kFamilyUnknown),
original_source_port_(0),
original_destination_ip_address_(IPAddress::kFamilyUnknown),
original_destination_port_(0),
reply_source_ip_address_(IPAddress::kFamilyUnknown),
reply_source_port_(0),
reply_destination_ip_address_(IPAddress::kFamilyUnknown),
reply_destination_port_(0) {
}
ConnectionInfo::ConnectionInfo(int protocol,
int64_t time_to_expire_seconds,
bool is_unreplied,
IPAddress original_source_ip_address,
uint16_t original_source_port,
IPAddress original_destination_ip_address,
uint16_t original_destination_port,
IPAddress reply_source_ip_address,
uint16_t reply_source_port,
IPAddress reply_destination_ip_address,
uint16_t reply_destination_port)
: protocol_(protocol),
time_to_expire_seconds_(time_to_expire_seconds),
is_unreplied_(is_unreplied),
original_source_ip_address_(original_source_ip_address),
original_source_port_(original_source_port),
original_destination_ip_address_(original_destination_ip_address),
original_destination_port_(original_destination_port),
reply_source_ip_address_(reply_source_ip_address),
reply_source_port_(reply_source_port),
reply_destination_ip_address_(reply_destination_ip_address),
reply_destination_port_(reply_destination_port) {
}
ConnectionInfo::ConnectionInfo(const ConnectionInfo& info)
: protocol_(info.protocol_),
time_to_expire_seconds_(info.time_to_expire_seconds_),
is_unreplied_(info.is_unreplied_),
original_source_ip_address_(info.original_source_ip_address_),
original_source_port_(info.original_source_port_),
original_destination_ip_address_(
info.original_destination_ip_address_),
original_destination_port_(info.original_destination_port_),
reply_source_ip_address_(info.reply_source_ip_address_),
reply_source_port_(info.reply_source_port_),
reply_destination_ip_address_(
info.reply_destination_ip_address_),
reply_destination_port_(info.reply_destination_port_) {
}
ConnectionInfo::~ConnectionInfo() {}
ConnectionInfo& ConnectionInfo::operator=(const ConnectionInfo& info) {
protocol_ = info.protocol_;
time_to_expire_seconds_ = info.time_to_expire_seconds_;
is_unreplied_ = info.is_unreplied_;
original_source_ip_address_ = info.original_source_ip_address_;
original_source_port_ = info.original_source_port_;
original_destination_ip_address_ =
info.original_destination_ip_address_;
original_destination_port_ = info.original_destination_port_;
reply_source_ip_address_ = info.reply_source_ip_address_;
reply_source_port_ = info.reply_source_port_;
reply_destination_ip_address_ = info.reply_destination_ip_address_;
reply_destination_port_ = info.reply_destination_port_;
return *this;
}
} // namespace shill