Line data Source code
1 : /* 2 : * Copyright (C) 2020-2024 Savoir-faire Linux Inc. 3 : * 4 : * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> 5 : * 6 : * This program is free software; you can redistribute it and/or modify 7 : * it under the terms of the GNU General Public License as published by 8 : * the Free Software Foundation; either version 3 of the License, or 9 : * (at your option) any later version. 10 : * 11 : * This program is distributed in the hope that it will be useful, 12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : * GNU General Public License for more details. 15 : * 16 : * You should have received a copy of the GNU General Public License 17 : * along with this program; if not, write to the Free Software 18 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 : */ 20 : 21 : #pragma once 22 : 23 : #include <dhtnet/ip_utils.h> 24 : #include "connectivity/sip_utils.h" 25 : 26 : #include <pjsip.h> 27 : #include <pj/pool.h> 28 : 29 : namespace jami { 30 : 31 : namespace tls { 32 : 33 : /** 34 : * AbstractSIPTransport 35 : * 36 : * Implements a pjsip_transport on top 37 : */ 38 : class AbstractSIPTransport 39 : { 40 : public: 41 : struct TransportData 42 : { 43 : pjsip_transport base; // do not move, SHOULD be the fist member 44 : AbstractSIPTransport* self {nullptr}; 45 : }; 46 : static_assert(std::is_standard_layout<TransportData>::value, 47 : "TransportData requires standard-layout"); 48 : 49 1208 : virtual ~AbstractSIPTransport() {}; 50 : 51 : virtual pjsip_transport* getTransportBase() = 0; 52 : 53 : virtual dhtnet::IpAddr getLocalAddress() const = 0; 54 : }; 55 : 56 : } // namespace tls 57 : } // namespace jami