// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Provides an interface for describing TLS-related types. type TlsBackendInterface struct { _ structs.HostLayout GIface uintptr xSupportsTls uintptr xGetCertificateType uintptr xGetClientConnectionType uintptr xGetServerConnectionType uintptr xGetFileDatabaseType uintptr xGetDefaultDatabase uintptr xSupportsDtls uintptr xGetDtlsClientConnectionType uintptr xGetDtlsServerConnectionType uintptr } func (x *TlsBackendInterface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideSupportsTls sets the "supports_tls" callback function. // returns whether the backend supports TLS. func (x *TlsBackendInterface) OverrideSupportsTls(cb func(TlsBackend) bool) { if cb == nil { x.xSupportsTls = 0 } else { x.xSupportsTls = purego.NewCallback(func(BackendVarp uintptr) bool { return cb(&TlsBackendBase{Ptr: BackendVarp}) }) } } // GetSupportsTls gets the "supports_tls" callback function. // returns whether the backend supports TLS. func (x *TlsBackendInterface) GetSupportsTls() func(TlsBackend) bool { if x.xSupportsTls == 0 { return nil } var rawCallback func(BackendVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xSupportsTls) return func(BackendVar TlsBackend) bool { return rawCallback(BackendVar.GoPointer()) } } // OverrideGetCertificateType sets the "get_certificate_type" callback function. // returns the #GTlsCertificate implementation type func (x *TlsBackendInterface) OverrideGetCertificateType(cb func() types.GType) { if cb == nil { x.xGetCertificateType = 0 } else { x.xGetCertificateType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetCertificateType gets the "get_certificate_type" callback function. // returns the #GTlsCertificate implementation type func (x *TlsBackendInterface) GetGetCertificateType() func() types.GType { if x.xGetCertificateType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetCertificateType) return func() types.GType { return rawCallback() } } // OverrideGetClientConnectionType sets the "get_client_connection_type" callback function. // returns the #GTlsClientConnection implementation type func (x *TlsBackendInterface) OverrideGetClientConnectionType(cb func() types.GType) { if cb == nil { x.xGetClientConnectionType = 0 } else { x.xGetClientConnectionType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetClientConnectionType gets the "get_client_connection_type" callback function. // returns the #GTlsClientConnection implementation type func (x *TlsBackendInterface) GetGetClientConnectionType() func() types.GType { if x.xGetClientConnectionType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetClientConnectionType) return func() types.GType { return rawCallback() } } // OverrideGetServerConnectionType sets the "get_server_connection_type" callback function. // returns the #GTlsServerConnection implementation type func (x *TlsBackendInterface) OverrideGetServerConnectionType(cb func() types.GType) { if cb == nil { x.xGetServerConnectionType = 0 } else { x.xGetServerConnectionType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetServerConnectionType gets the "get_server_connection_type" callback function. // returns the #GTlsServerConnection implementation type func (x *TlsBackendInterface) GetGetServerConnectionType() func() types.GType { if x.xGetServerConnectionType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetServerConnectionType) return func() types.GType { return rawCallback() } } // OverrideGetFileDatabaseType sets the "get_file_database_type" callback function. // returns the #GTlsFileDatabase implementation type. func (x *TlsBackendInterface) OverrideGetFileDatabaseType(cb func() types.GType) { if cb == nil { x.xGetFileDatabaseType = 0 } else { x.xGetFileDatabaseType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetFileDatabaseType gets the "get_file_database_type" callback function. // returns the #GTlsFileDatabase implementation type. func (x *TlsBackendInterface) GetGetFileDatabaseType() func() types.GType { if x.xGetFileDatabaseType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetFileDatabaseType) return func() types.GType { return rawCallback() } } // OverrideGetDefaultDatabase sets the "get_default_database" callback function. // returns a default #GTlsDatabase instance. func (x *TlsBackendInterface) OverrideGetDefaultDatabase(cb func(TlsBackend) *TlsDatabase) { if cb == nil { x.xGetDefaultDatabase = 0 } else { x.xGetDefaultDatabase = purego.NewCallback(func(BackendVarp uintptr) uintptr { ret := cb(&TlsBackendBase{Ptr: BackendVarp}) if ret == nil { return 0 } return ret.GoPointer() }) } } // GetGetDefaultDatabase gets the "get_default_database" callback function. // returns a default #GTlsDatabase instance. func (x *TlsBackendInterface) GetGetDefaultDatabase() func(TlsBackend) *TlsDatabase { if x.xGetDefaultDatabase == 0 { return nil } var rawCallback func(BackendVarp uintptr) uintptr purego.RegisterFunc(&rawCallback, x.xGetDefaultDatabase) return func(BackendVar TlsBackend) *TlsDatabase { rawRet := rawCallback(BackendVar.GoPointer()) if rawRet == 0 { return nil } ret := &TlsDatabase{} ret.Ptr = rawRet return ret } } // OverrideSupportsDtls sets the "supports_dtls" callback function. // returns whether the backend supports DTLS func (x *TlsBackendInterface) OverrideSupportsDtls(cb func(TlsBackend) bool) { if cb == nil { x.xSupportsDtls = 0 } else { x.xSupportsDtls = purego.NewCallback(func(BackendVarp uintptr) bool { return cb(&TlsBackendBase{Ptr: BackendVarp}) }) } } // GetSupportsDtls gets the "supports_dtls" callback function. // returns whether the backend supports DTLS func (x *TlsBackendInterface) GetSupportsDtls() func(TlsBackend) bool { if x.xSupportsDtls == 0 { return nil } var rawCallback func(BackendVarp uintptr) bool purego.RegisterFunc(&rawCallback, x.xSupportsDtls) return func(BackendVar TlsBackend) bool { return rawCallback(BackendVar.GoPointer()) } } // OverrideGetDtlsClientConnectionType sets the "get_dtls_client_connection_type" callback function. // returns the #GDtlsClientConnection implementation type func (x *TlsBackendInterface) OverrideGetDtlsClientConnectionType(cb func() types.GType) { if cb == nil { x.xGetDtlsClientConnectionType = 0 } else { x.xGetDtlsClientConnectionType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetDtlsClientConnectionType gets the "get_dtls_client_connection_type" callback function. // returns the #GDtlsClientConnection implementation type func (x *TlsBackendInterface) GetGetDtlsClientConnectionType() func() types.GType { if x.xGetDtlsClientConnectionType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetDtlsClientConnectionType) return func() types.GType { return rawCallback() } } // OverrideGetDtlsServerConnectionType sets the "get_dtls_server_connection_type" callback function. // returns the #GDtlsServerConnection implementation type func (x *TlsBackendInterface) OverrideGetDtlsServerConnectionType(cb func() types.GType) { if cb == nil { x.xGetDtlsServerConnectionType = 0 } else { x.xGetDtlsServerConnectionType = purego.NewCallback(func() types.GType { return cb() }) } } // GetGetDtlsServerConnectionType gets the "get_dtls_server_connection_type" callback function. // returns the #GDtlsServerConnection implementation type func (x *TlsBackendInterface) GetGetDtlsServerConnectionType() func() types.GType { if x.xGetDtlsServerConnectionType == 0 { return nil } var rawCallback func() types.GType purego.RegisterFunc(&rawCallback, x.xGetDtlsServerConnectionType) return func() types.GType { return rawCallback() } } // TLS (Transport Layer Security, aka SSL) and DTLS backend. This is an // internal type used to coordinate the different classes implemented // by a TLS backend. type TlsBackend interface { GoPointer() uintptr SetGoPointer(uintptr) GetCertificateType() types.GType GetClientConnectionType() types.GType GetDefaultDatabase() *TlsDatabase GetDtlsClientConnectionType() types.GType GetDtlsServerConnectionType() types.GType GetFileDatabaseType() types.GType GetServerConnectionType() types.GType SetDefaultDatabase(DatabaseVar *TlsDatabase) SupportsDtls() bool SupportsTls() bool } var xTlsBackendGLibType func() types.GType func TlsBackendGLibType() types.GType { return xTlsBackendGLibType() } type TlsBackendBase struct { Ptr uintptr } func (x *TlsBackendBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *TlsBackendBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Gets the #GType of @backend's #GTlsCertificate implementation. func (x *TlsBackendBase) GetCertificateType() types.GType { cret := XGTlsBackendGetCertificateType(x.GoPointer()) return cret } // Gets the #GType of @backend's #GTlsClientConnection implementation. func (x *TlsBackendBase) GetClientConnectionType() types.GType { cret := XGTlsBackendGetClientConnectionType(x.GoPointer()) return cret } // Gets the default #GTlsDatabase used to verify TLS connections. func (x *TlsBackendBase) GetDefaultDatabase() *TlsDatabase { var cls *TlsDatabase cret := XGTlsBackendGetDefaultDatabase(x.GoPointer()) if cret == 0 { return nil } cls = &TlsDatabase{} cls.Ptr = cret return cls } // Gets the #GType of @backend’s #GDtlsClientConnection implementation. func (x *TlsBackendBase) GetDtlsClientConnectionType() types.GType { cret := XGTlsBackendGetDtlsClientConnectionType(x.GoPointer()) return cret } // Gets the #GType of @backend’s #GDtlsServerConnection implementation. func (x *TlsBackendBase) GetDtlsServerConnectionType() types.GType { cret := XGTlsBackendGetDtlsServerConnectionType(x.GoPointer()) return cret } // Gets the #GType of @backend's #GTlsFileDatabase implementation. func (x *TlsBackendBase) GetFileDatabaseType() types.GType { cret := XGTlsBackendGetFileDatabaseType(x.GoPointer()) return cret } // Gets the #GType of @backend's #GTlsServerConnection implementation. func (x *TlsBackendBase) GetServerConnectionType() types.GType { cret := XGTlsBackendGetServerConnectionType(x.GoPointer()) return cret } // Set the default #GTlsDatabase used to verify TLS connections // // Any subsequent call to g_tls_backend_get_default_database() will return // the database set in this call. Existing databases and connections are not // modified. // // Setting a %NULL default database will reset to using the system default // database as if g_tls_backend_set_default_database() had never been called. func (x *TlsBackendBase) SetDefaultDatabase(DatabaseVar *TlsDatabase) { XGTlsBackendSetDefaultDatabase(x.GoPointer(), DatabaseVar.GoPointer()) } // Checks if DTLS is supported. DTLS support may not be available even if TLS // support is available, and vice-versa. func (x *TlsBackendBase) SupportsDtls() bool { cret := XGTlsBackendSupportsDtls(x.GoPointer()) return cret } // Checks if TLS is supported; if this returns %FALSE for the default // #GTlsBackend, it means no "real" TLS backend is available. func (x *TlsBackendBase) SupportsTls() bool { cret := XGTlsBackendSupportsTls(x.GoPointer()) return cret } var XGTlsBackendGetCertificateType func(uintptr) types.GType var XGTlsBackendGetClientConnectionType func(uintptr) types.GType var XGTlsBackendGetDefaultDatabase func(uintptr) uintptr var XGTlsBackendGetDtlsClientConnectionType func(uintptr) types.GType var XGTlsBackendGetDtlsServerConnectionType func(uintptr) types.GType var XGTlsBackendGetFileDatabaseType func(uintptr) types.GType var XGTlsBackendGetServerConnectionType func(uintptr) types.GType var XGTlsBackendSetDefaultDatabase func(uintptr, uintptr) var XGTlsBackendSupportsDtls func(uintptr) bool var XGTlsBackendSupportsTls func(uintptr) bool const ( // Extension point for TLS functionality via #GTlsBackend. // See [Extending GIO](overview.html#extending-gio). TLS_BACKEND_EXTENSION_POINT_NAME string = "gio-tls-backend" ) var xTlsBackendGetDefault func() uintptr // Gets the default #GTlsBackend for the system. func TlsBackendGetDefault() *TlsBackendBase { var cls *TlsBackendBase cret := xTlsBackendGetDefault() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &TlsBackendBase{} cls.Ptr = cret return cls } 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(&xTlsBackendGetDefault, libs, "g_tls_backend_get_default") core.PuregoSafeRegister(&xTlsBackendGLibType, libs, "g_tls_backend_get_type") core.PuregoSafeRegister(&XGTlsBackendGetCertificateType, libs, "g_tls_backend_get_certificate_type") core.PuregoSafeRegister(&XGTlsBackendGetClientConnectionType, libs, "g_tls_backend_get_client_connection_type") core.PuregoSafeRegister(&XGTlsBackendGetDefaultDatabase, libs, "g_tls_backend_get_default_database") core.PuregoSafeRegister(&XGTlsBackendGetDtlsClientConnectionType, libs, "g_tls_backend_get_dtls_client_connection_type") core.PuregoSafeRegister(&XGTlsBackendGetDtlsServerConnectionType, libs, "g_tls_backend_get_dtls_server_connection_type") core.PuregoSafeRegister(&XGTlsBackendGetFileDatabaseType, libs, "g_tls_backend_get_file_database_type") core.PuregoSafeRegister(&XGTlsBackendGetServerConnectionType, libs, "g_tls_backend_get_server_connection_type") core.PuregoSafeRegister(&XGTlsBackendSetDefaultDatabase, libs, "g_tls_backend_set_default_database") core.PuregoSafeRegister(&XGTlsBackendSupportsDtls, libs, "g_tls_backend_supports_dtls") core.PuregoSafeRegister(&XGTlsBackendSupportsTls, libs, "g_tls_backend_supports_tls") }