blob: e43c0c6f333eadd5b349f8527a0af15b50b3e05a [file] [log] [blame]
Adrien Béraud612b55b2023-05-29 10:42:04 -04001/*
2 * Copyright (C) 2004-2023 Savoir-faire Linux Inc.
3 *
Adrien Béraudcb753622023-07-17 22:32:49 -04004 * This program is free software: you can redistribute it and/or modify
Adrien Béraud612b55b2023-05-29 10:42:04 -04005 * it under the terms of the GNU General Public License as published by
Adrien Béraudcb753622023-07-17 22:32:49 -04006 * the Free Software Foundation, either version 3 of the License, or
Adrien Béraud612b55b2023-05-29 10:42:04 -04007 * (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éraudcb753622023-07-17 22:32:49 -040011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Adrien Béraud612b55b2023-05-29 10:42:04 -040012 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
Adrien Béraudcb753622023-07-17 22:32:49 -040015 * along with this program. If not, see <https://www.gnu.org/licenses/>.
Adrien Béraud612b55b2023-05-29 10:42:04 -040016 */
Adrien Béraud612b55b2023-05-29 10:42:04 -040017#include "pmp_igd.h"
18
19#include <algorithm>
20
Adrien Béraud1ae60aa2023-07-07 09:55:09 -040021namespace dhtnet {
Adrien Béraud612b55b2023-05-29 10:42:04 -040022namespace upnp {
23
24PMPIGD::PMPIGD()
25 : IGD(NatProtocolType::NAT_PMP)
26{}
27
28PMPIGD::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
38bool
39PMPIGD::operator==(IGD& other) const
40{
41 return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp();
42}
43
44bool
45PMPIGD::operator==(PMPIGD& other) const
46{
47 return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp();
48}
49
50const std::string
51PMPIGD::toString() const
52{
53 return getLocalIp().toString();
54}
55
56} // namespace upnp
57} // namespace jami