blob: 41f25dd88cfa9134d00b01131e6ab1f528b667e1 [file] [log] [blame]
Adrien Béraud612b55b2023-05-29 10:42:04 -04001/*
2 * Copyright (C) 2004-2023 Savoir-faire Linux Inc.
3 *
4 * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
5 * Author: Eden Abitbol <eden.abitbol@savoirfairelinux.com>
6 * Author: Mohamed Chibani <mohamed.chibani@savoirfairelinux.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include "pmp_igd.h"
24
25#include <algorithm>
26
Adrien Béraud1ae60aa2023-07-07 09:55:09 -040027namespace dhtnet {
Adrien Béraud612b55b2023-05-29 10:42:04 -040028namespace upnp {
29
30PMPIGD::PMPIGD()
31 : IGD(NatProtocolType::NAT_PMP)
32{}
33
34PMPIGD::PMPIGD(const PMPIGD& other)
35 : PMPIGD()
36{
37 assert(protocol_ == NatProtocolType::NAT_PMP);
38 // protocol_ = other.protocol_;
39 localIp_ = other.localIp_;
40 publicIp_ = other.publicIp_;
41 uid_ = other.uid_;
42}
43
44bool
45PMPIGD::operator==(IGD& other) const
46{
47 return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp();
48}
49
50bool
51PMPIGD::operator==(PMPIGD& other) const
52{
53 return getPublicIp() == other.getPublicIp() and getLocalIp() == other.getLocalIp();
54}
55
56const std::string
57PMPIGD::toString() const
58{
59 return getLocalIp().toString();
60}
61
62} // namespace upnp
63} // namespace jami