/* Copyright (C) 2013 The giomm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ _CONFIGINCLUDE(giommconfig.h) #include #include #include _DEFS(giomm,gio) _PINCLUDE(giomm/private/iostream_p.h) namespace Gio { _WRAP_ENUM(TlsProtocolVersion, GTlsProtocolVersion, decl_prefix GIOMM_API) class GIOMM_API Cancellable; class GIOMM_API TlsDatabase; class GIOMM_API TlsInteraction; /** TLS connection type. * %TlsConnection is the base TLS connection class type, which wraps an IOStream * and provides TLS encryption on top of it. Its subclasses that implement * TlsClientConnection and TlsServerConnection, implement client-side and * server-side TLS, respectively. * @newin{2,36} */ class GIOMM_API TlsConnection : public IOStream { _CLASS_GOBJECT(TlsConnection, GTlsConnection, G_TLS_CONNECTION, IOStream, GIOStream, , , GIOMM_API) _CUSTOM_WRAP_NEW protected: _CTOR_DEFAULT public: _WRAP_METHOD(void set_certificate(const Glib::RefPtr& certificate), g_tls_connection_set_certificate) _WRAP_METHOD(Glib::RefPtr get_certificate(), g_tls_connection_get_certificate, refreturn) _WRAP_METHOD(Glib::RefPtr get_certificate() const, g_tls_connection_get_certificate, constversion) _WRAP_METHOD(Glib::RefPtr get_peer_certificate(), g_tls_connection_get_peer_certificate, refreturn) _WRAP_METHOD(Glib::RefPtr get_peer_certificate() const, g_tls_connection_get_peer_certificate, constversion) _WRAP_METHOD(TlsCertificateFlags get_peer_certificate_errors() const, g_tls_connection_get_peer_certificate_errors) _WRAP_METHOD(void set_require_close_notify(bool require_close_notify = true), g_tls_connection_set_require_close_notify) _WRAP_METHOD(bool get_require_close_notify() const, g_tls_connection_get_require_close_notify) _IGNORE(g_tls_connection_set_use_system_certdb, g_tls_connection_get_use_system_certdb)dnl // deprecated _IGNORE(g_tls_connection_set_rehandshake_mode, g_tls_connection_get_rehandshake_mode)dnl // deprecated _WRAP_METHOD(Glib::RefPtr get_database(), g_tls_connection_get_database) _WRAP_METHOD(Glib::RefPtr get_database() const, g_tls_connection_get_database, constversion) _WRAP_METHOD(void set_database(const Glib::RefPtr& database), g_tls_connection_set_database) _WRAP_METHOD(Glib::RefPtr get_interaction(), g_tls_connection_get_interaction) _WRAP_METHOD(Glib::RefPtr get_interaction() const, g_tls_connection_get_interaction, constversion) _WRAP_METHOD(void set_interaction(const Glib::RefPtr& interaction), g_tls_connection_set_interaction) _WRAP_METHOD(bool handshake(const Glib::RefPtr& cancellable{?}), g_tls_connection_handshake, errthrow) _WRAP_METHOD(void handshake_async(const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, int io_priority{.} = Glib::PRIORITY_DEFAULT), g_tls_connection_handshake_async, slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_METHOD(bool handshake_finish(const Glib::RefPtr& result), g_tls_connection_handshake_finish, errthrow) _WRAP_METHOD(TlsProtocolVersion get_protocol_version() const, g_tls_connection_get_protocol_version) _WRAP_METHOD(Glib::ustring get_ciphersuite_name() const, g_tls_connection_get_ciphersuite_name) _WRAP_METHOD(bool emit_accept_certificate(const Glib::RefPtr& peer_cert, TlsCertificateFlags errors), g_tls_connection_emit_accept_certificate) _WRAP_PROPERTY("base-io-stream", Glib::RefPtr) _WRAP_PROPERTY("certificate", Glib::RefPtr) _WRAP_PROPERTY("database", Glib::RefPtr) _WRAP_PROPERTY("interaction", Glib::RefPtr) _WRAP_PROPERTY("peer-certificate", Glib::RefPtr) _WRAP_PROPERTY("peer-certificate-errors", TlsCertificateFlags) _WRAP_PROPERTY("require-close-notify", bool) _WRAP_PROPERTY("protocol-version", TlsProtocolVersion) _WRAP_PROPERTY("ciphersuite-name", Glib::ustring) _IGNORE_PROPERTY("use-system-certdb", "rehandshake-mode")dnl // deprecated #m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(bool accept_certificate(const Glib::RefPtr& peer_cert, TlsCertificateFlags errors), "accept_certificate") protected: _WRAP_VFUNC(bool handshake(const Glib::RefPtr& cancellable), "handshake", errthrow) _WRAP_VFUNC(void handshake_async(const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.}, int io_priority{.} = Glib::PRIORITY_DEFAULT), "handshake_async", slot_name slot, slot_callback SignalProxy_async_callback) #m4 _CONVERSION(`GAsyncResult*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_VFUNC(bool handshake_finish(const Glib::RefPtr& result), "handshake_finish", errthrow) }; } // namespace Gio