// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // vtable for a #GDtlsClientConnection implementation. type DtlsClientConnectionInterface struct { _ structs.HostLayout GIface uintptr } func (x *DtlsClientConnectionInterface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // `GDtlsClientConnection` is the client-side subclass of // [iface@Gio.DtlsConnection], representing a client-side DTLS connection. type DtlsClientConnection interface { GoPointer() uintptr SetGoPointer(uintptr) GetAcceptedCas() *glib.List GetServerIdentity() *SocketConnectableBase GetValidationFlags() TlsCertificateFlags SetServerIdentity(IdentityVar SocketConnectable) SetValidationFlags(FlagsVar TlsCertificateFlags) } var xDtlsClientConnectionGLibType func() types.GType func DtlsClientConnectionGLibType() types.GType { return xDtlsClientConnectionGLibType() } type DtlsClientConnectionBase struct { Ptr uintptr } func (x *DtlsClientConnectionBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *DtlsClientConnectionBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Gets the list of distinguished names of the Certificate Authorities // that the server will accept certificates from. This will be set // during the TLS handshake if the server requests a certificate. // Otherwise, it will be %NULL. // // Each item in the list is a #GByteArray which contains the complete // subject DN of the certificate authority. func (x *DtlsClientConnectionBase) GetAcceptedCas() *glib.List { cret := XGDtlsClientConnectionGetAcceptedCas(x.GoPointer()) return cret } // Gets @conn's expected server identity func (x *DtlsClientConnectionBase) GetServerIdentity() *SocketConnectableBase { var cls *SocketConnectableBase cret := XGDtlsClientConnectionGetServerIdentity(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &SocketConnectableBase{} cls.Ptr = cret return cls } // Gets @conn's validation flags // // This function does not work as originally designed and is impossible // to use correctly. See #GDtlsClientConnection:validation-flags for more // information. func (x *DtlsClientConnectionBase) GetValidationFlags() TlsCertificateFlags { cret := XGDtlsClientConnectionGetValidationFlags(x.GoPointer()) return cret } // Sets @conn's expected server identity, which is used both to tell // servers on virtual hosts which certificate to present, and also // to let @conn know what name to look for in the certificate when // performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. func (x *DtlsClientConnectionBase) SetServerIdentity(IdentityVar SocketConnectable) { XGDtlsClientConnectionSetServerIdentity(x.GoPointer(), IdentityVar.GoPointer()) } // Sets @conn's validation flags, to override the default set of // checks performed when validating a server certificate. By default, // %G_TLS_CERTIFICATE_VALIDATE_ALL is used. // // This function does not work as originally designed and is impossible // to use correctly. See #GDtlsClientConnection:validation-flags for more // information. func (x *DtlsClientConnectionBase) SetValidationFlags(FlagsVar TlsCertificateFlags) { XGDtlsClientConnectionSetValidationFlags(x.GoPointer(), FlagsVar) } var XGDtlsClientConnectionGetAcceptedCas func(uintptr) *glib.List var XGDtlsClientConnectionGetServerIdentity func(uintptr) uintptr var XGDtlsClientConnectionGetValidationFlags func(uintptr) TlsCertificateFlags var XGDtlsClientConnectionSetServerIdentity func(uintptr, uintptr) var XGDtlsClientConnectionSetValidationFlags func(uintptr, TlsCertificateFlags) var xDtlsClientConnectionNew func(uintptr, uintptr, **glib.Error) uintptr // Creates a new #GDtlsClientConnection wrapping @base_socket which is // assumed to communicate with the server identified by @server_identity. func DtlsClientConnectionNew(BaseSocketVar DatagramBased, ServerIdentityVar SocketConnectable) (*DtlsClientConnectionBase, error) { var cls *DtlsClientConnectionBase var cerr *glib.Error cret := xDtlsClientConnectionNew(BaseSocketVar.GoPointer(), ServerIdentityVar.GoPointer(), &cerr) if cret == 0 { return nil, cerr } cls = &DtlsClientConnectionBase{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xDtlsClientConnectionNew, libs, "g_dtls_client_connection_new") core.PuregoSafeRegister(&xDtlsClientConnectionGLibType, libs, "g_dtls_client_connection_get_type") core.PuregoSafeRegister(&XGDtlsClientConnectionGetAcceptedCas, libs, "g_dtls_client_connection_get_accepted_cas") core.PuregoSafeRegister(&XGDtlsClientConnectionGetServerIdentity, libs, "g_dtls_client_connection_get_server_identity") core.PuregoSafeRegister(&XGDtlsClientConnectionGetValidationFlags, libs, "g_dtls_client_connection_get_validation_flags") core.PuregoSafeRegister(&XGDtlsClientConnectionSetServerIdentity, libs, "g_dtls_client_connection_set_server_identity") core.PuregoSafeRegister(&XGDtlsClientConnectionSetValidationFlags, libs, "g_dtls_client_connection_set_validation_flags") }