gtlsfiledatabase.go RawHistoryFolder
1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Provides an interface for #GTlsFileDatabase implementations.
17type TlsFileDatabaseInterface struct {
18 _ structs.HostLayout
19
20 GIface uintptr
21
22 Padding [8]uintptr
23}
24
25func (x *TlsFileDatabaseInterface) GoPointer() uintptr {
26 return uintptr(unsafe.Pointer(x))
27}
28
29// `GTlsFileDatabase` is implemented by [class@Gio.TlsDatabase] objects which
30// load their certificate information from a file. It is an interface which
31// TLS library specific subtypes implement.
32type TlsFileDatabase interface {
33 GoPointer() uintptr
34 SetGoPointer(uintptr)
35}
36
37var xTlsFileDatabaseGLibType func() types.GType
38
39func TlsFileDatabaseGLibType() types.GType {
40 return xTlsFileDatabaseGLibType()
41}
42
43type TlsFileDatabaseBase struct {
44 Ptr uintptr
45}
46
47func (x *TlsFileDatabaseBase) GoPointer() uintptr {
48 if x == nil {
49 return 0
50 }
51 return x.Ptr
52}
53
54func (x *TlsFileDatabaseBase) SetGoPointer(ptr uintptr) {
55 x.Ptr = ptr
56}
57
58// SetPropertyAnchors sets the "anchors" property.
59// The path to a file containing PEM encoded certificate authority
60// root anchors. The certificates in this file will be treated as
61// root authorities for the purpose of verifying other certificates
62// via the g_tls_database_verify_chain() operation.
63func (x *TlsFileDatabaseBase) SetPropertyAnchors(value string) {
64 obj := gobject.Object{}
65 obj.Ptr = x.GoPointer()
66 var v gobject.Value
67 v.Init(gobject.TypeStringVal)
68 v.SetString(&value)
69 obj.SetProperty("anchors", &v)
70}
71
72// GetPropertyAnchors gets the "anchors" property.
73// The path to a file containing PEM encoded certificate authority
74// root anchors. The certificates in this file will be treated as
75// root authorities for the purpose of verifying other certificates
76// via the g_tls_database_verify_chain() operation.
77func (x *TlsFileDatabaseBase) GetPropertyAnchors() string {
78 obj := gobject.Object{}
79 obj.Ptr = x.GoPointer()
80 var v gobject.Value
81 obj.GetProperty("anchors", &v)
82 return v.GetString()
83}
84
85var xTlsFileDatabaseNew func(string, **glib.Error) uintptr
86
87// Creates a new #GTlsFileDatabase which uses anchor certificate authorities
88// in @anchors to verify certificate chains.
89//
90// The certificates in @anchors must be PEM encoded.
91func TlsFileDatabaseNew(AnchorsVar string) (*TlsFileDatabaseBase, error) {
92 var cls *TlsFileDatabaseBase
93 var cerr *glib.Error
94
95 cret := xTlsFileDatabaseNew(AnchorsVar, &cerr)
96
97 if cret == 0 {
98 return nil, cerr
99 }
100 cls = &TlsFileDatabaseBase{}
101 cls.Ptr = cret
102 if cerr == nil {
103 return cls, nil
104 }
105 return cls, cerr
106
107}
108
109func init() {
110 core.SetPackageName("GIO", "gio-2.0")
111 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
112 var libs []uintptr
113 for _, libPath := range core.GetPaths("GIO") {
114 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
115 if err != nil {
116 panic(err)
117 }
118 libs = append(libs, lib)
119 }
120
121 core.PuregoSafeRegister(&xTlsFileDatabaseNew, libs, "g_tls_file_database_new")
122
123 core.PuregoSafeRegister(&xTlsFileDatabaseGLibType, libs, "g_tls_file_database_get_type")
124
125}