// Generated by gmmproc 2.41.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <giomm/tlsclientconnection.h>
#include <giomm/private/tlsclientconnection_p.h>


/* 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, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gio/gio.h>
#include <giomm/socketconnectable.h>

namespace Gio
{

TlsClientConnection::TlsClientConnection(GTlsClientConnection* castitem)
: TlsConnection(G_TLS_CONNECTION(castitem))
{}

} // namespace Gio

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::TlsClientConnection> wrap(GTlsClientConnection* object, bool take_copy)
{
  return Glib::RefPtr<Gio::TlsClientConnection>( dynamic_cast<Gio::TlsClientConnection*> (Glib::wrap_auto_interface<Gio::TlsClientConnection> ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gio
{


/* The *_Class implementation: */

const Glib::Interface_Class& TlsClientConnection_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Interface_Class has to know the interface init function
    // in order to add interfaces to implementing types.
    class_init_func_ = &TlsClientConnection_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = g_tls_client_connection_get_type();
  }

  return *this;
}

void TlsClientConnection_Class::iface_init_function(void* g_iface, void*)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);

  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
  g_assert(klass != 0); 


}


Glib::ObjectBase* TlsClientConnection_Class::wrap_new(GObject* object)
{
  return new TlsClientConnection((GTlsClientConnection*)(object));
}


/* The implementation: */

TlsClientConnection::TlsClientConnection()
:
  Glib::Interface(tlsclientconnection_class_.init())
{}


TlsClientConnection::TlsClientConnection(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

TlsClientConnection::~TlsClientConnection()
{}

// static
void TlsClientConnection::add_interface(GType gtype_implementer)
{
  tlsclientconnection_class_.init().add_interface(gtype_implementer);
}

TlsClientConnection::CppClassType TlsClientConnection::tlsclientconnection_class_; // initialize static member

GType TlsClientConnection::get_type()
{
  return tlsclientconnection_class_.init().get_type();
}


GType TlsClientConnection::get_base_type()
{
  return g_tls_client_connection_get_type();
}


Glib::RefPtr<TlsClientConnection> TlsClientConnection::create(const Glib::RefPtr<IOStream>& base_io_stream, const Glib::RefPtr<const SocketConnectable>& server_identity)
{
  GError* gerror = 0;
  Glib::RefPtr<TlsClientConnection> retvalue = Glib::wrap(G_TLS_CLIENT_CONNECTION(g_tls_client_connection_new(Glib::unwrap(base_io_stream), const_cast<GSocketConnectable*>(Glib::unwrap(server_identity)), &(gerror))));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}


Glib::RefPtr<TlsClientConnection> TlsClientConnection::create(const Glib::RefPtr<IOStream>& base_io_stream)
{
  GError* gerror = 0;
  Glib::RefPtr<TlsClientConnection> retvalue = Glib::wrap(G_TLS_CLIENT_CONNECTION(g_tls_client_connection_new(Glib::unwrap(base_io_stream), 0, &(gerror))));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}


void TlsClientConnection::set_server_identity(const Glib::RefPtr<SocketConnectable>& identity)
{
  g_tls_client_connection_set_server_identity(gobj(), const_cast<GSocketConnectable*>(Glib::unwrap(identity)));
}

Glib::RefPtr<SocketConnectable> TlsClientConnection::get_server_identity()
{
  Glib::RefPtr<SocketConnectable> retvalue = Glib::wrap(g_tls_client_connection_get_server_identity(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const SocketConnectable> TlsClientConnection::get_server_identity() const
{
  return const_cast<TlsClientConnection*>(this)->get_server_identity();
}

void TlsClientConnection::set_validation_flags(TlsCertificateFlags flags)
{
  g_tls_client_connection_set_validation_flags(gobj(), ((GTlsCertificateFlags)(flags)));
}

TlsCertificateFlags TlsClientConnection::get_validation_flags() const
{
  return ((TlsCertificateFlags)(g_tls_client_connection_get_validation_flags(const_cast<GTlsClientConnection*>(gobj()))));
}

void TlsClientConnection::set_use_ssl3(bool use_ssl3)
{
  g_tls_client_connection_set_use_ssl3(gobj(), static_cast<int>(use_ssl3));
}

bool TlsClientConnection::get_use_ssl3() const
{
  return g_tls_client_connection_get_use_ssl3(const_cast<GTlsClientConnection*>(gobj()));
}

std::vector< Glib::RefPtr<Glib::ByteArray> > TlsClientConnection::get_accepted_cas()
{
  return Glib::ListHandler< Glib::RefPtr<Glib::ByteArray> >::list_to_vector(g_tls_client_connection_get_accepted_cas(gobj()), Glib::OWNERSHIP_DEEP);
}

std::vector< Glib::RefPtr<const Glib::ByteArray> > TlsClientConnection::get_accepted_cas() const
{
  return Glib::ListHandler< Glib::RefPtr<const Glib::ByteArray> >::list_to_vector(g_tls_client_connection_get_accepted_cas(const_cast<GTlsClientConnection*>(gobj())), Glib::OWNERSHIP_DEEP);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< std::vector< Glib::RefPtr<Glib::ByteArray> > > TlsClientConnection::property_accepted_cas() const
{
  return Glib::PropertyProxy_ReadOnly< std::vector< Glib::RefPtr<Glib::ByteArray> > >(this, "accepted-cas");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Glib::RefPtr<SocketConnectable> > TlsClientConnection::property_server_identity() 
{
  return Glib::PropertyProxy< Glib::RefPtr<SocketConnectable> >(this, "server-identity");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketConnectable> > TlsClientConnection::property_server_identity() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketConnectable> >(this, "server-identity");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< bool > TlsClientConnection::property_use_ssl3() 
{
  return Glib::PropertyProxy< bool >(this, "use-ssl3");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< bool > TlsClientConnection::property_use_ssl3() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "use-ssl3");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< TlsCertificateFlags > TlsClientConnection::property_validation_flags() 
{
  return Glib::PropertyProxy< TlsCertificateFlags >(this, "validation-flags");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< TlsCertificateFlags > TlsClientConnection::property_validation_flags() const
{
  return Glib::PropertyProxy_ReadOnly< TlsCertificateFlags >(this, "validation-flags");
}
#endif //GLIBMM_PROPERTIES_ENABLED


} // namespace Gio


