Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2023 Savoir-faire Linux Inc. |
| 3 | * |
Adrien Béraud | cb75362 | 2023-07-17 22:32:49 -0400 | [diff] [blame] | 4 | * This program is free software: you can redistribute it and/or modify |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 5 | * it under the terms of the GNU General Public License as published by |
Adrien Béraud | cb75362 | 2023-07-17 22:32:49 -0400 | [diff] [blame] | 6 | * the Free Software Foundation, either version 3 of the License, or |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Adrien Béraud | cb75362 | 2023-07-17 22:32:49 -0400 | [diff] [blame] | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
Adrien Béraud | cb75362 | 2023-07-17 22:32:49 -0400 | [diff] [blame] | 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 16 | */ |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 17 | #include "pmp_igd.h" |
| 18 | |
| 19 | #include <algorithm> |
| 20 | |
Adrien Béraud | 1ae60aa | 2023-07-07 09:55:09 -0400 | [diff] [blame] | 21 | namespace dhtnet { |
Adrien Béraud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 22 | namespace upnp { |
| 23 | |
| 24 | PMPIGD::PMPIGD() |
| 25 | : IGD(NatProtocolType::NAT_PMP) |
| 26 | {} |
| 27 | |
| 28 | PMPIGD::PMPIGD(const PMPIGD& other) |
| 29 | : PMPIGD() |
| 30 | { |
| 31 | assert(protocol_ == NatProtocolType::NAT_PMP); |
| 32 | // protocol_ = other.protocol_; |
| 33 | localIp_ = other.localIp_; |
| 34 | publicIp_ = other.publicIp_; |
| 35 | uid_ = other.uid_; |
| 36 | } |
| 37 | |
| 38 | bool |
| 39 | PMPIGD::operator==(IGD& other) const |
| 40 | { |
| 41 | return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp(); |
| 42 | } |
| 43 | |
| 44 | bool |
| 45 | PMPIGD::operator==(PMPIGD& other) const |
| 46 | { |
| 47 | return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp(); |
| 48 | } |
| 49 | |
| 50 | const std::string |
| 51 | PMPIGD::toString() const |
| 52 | { |
| 53 | return getLocalIp().toString(); |
| 54 | } |
| 55 | |
| 56 | } // namespace upnp |
Sébastien Blin | 464bdff | 2023-07-19 08:02:53 -0400 | [diff] [blame] | 57 | } // namespace dhtnet |