1// Code generated by wlgen; DO NOT EDIT.
2package securitycontext
3
4import (
5 "fmt"
6 "github.com/bnema/purego-libwayland/server"
7)
8
9var WpSecurityContextManagerV1Interface *server.Interface
10var WpSecurityContextV1Interface *server.Interface
11
12func init() {
13 WpSecurityContextManagerV1Interface = &server.Interface{Name: "wp_security_context_manager_v1", Version: 1}
14 WpSecurityContextV1Interface = &server.Interface{Name: "wp_security_context_v1", Version: 1}
15 WpSecurityContextManagerV1Interface.Requests = []server.Message{
16 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
17 {Name: "create_listener", Signature: "nhh", Types: []*server.Interface{WpSecurityContextV1Interface, nil, nil}},
18 }
19 WpSecurityContextManagerV1Interface.Events = []server.Message{}
20 WpSecurityContextV1Interface.Requests = []server.Message{
21 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
22 {Name: "set_sandbox_engine", Signature: "s", Types: []*server.Interface{nil}},
23 {Name: "set_app_id", Signature: "s", Types: []*server.Interface{nil}},
24 {Name: "set_instance_id", Signature: "s", Types: []*server.Interface{nil}},
25 {Name: "commit", Signature: "", Types: []*server.Interface{}},
26 }
27 WpSecurityContextV1Interface.Events = []server.Message{}
28 if err := server.NewInterfaces(WpSecurityContextManagerV1Interface, WpSecurityContextV1Interface); err != nil {
29 panic(err)
30 }
31}
32
33// WpSecurityContextManagerV1 client security context manager.
34type WpSecurityContextManagerV1 struct{ *server.Resource }
35
36func WrapWpSecurityContextManagerV1(r *server.Resource) *WpSecurityContextManagerV1 {
37 if r == nil {
38 return nil
39 }
40 return &WpSecurityContextManagerV1{r}
41}
42
43const WpSecurityContextManagerV1RequestDestroy uint32 = 0
44const WpSecurityContextManagerV1RequestCreateListener uint32 = 1
45
46// WpSecurityContextManagerV1Error .
47type WpSecurityContextManagerV1Error uint32
48
49const (
50 WpSecurityContextManagerV1ErrorInvalidListenFd WpSecurityContextManagerV1Error = 1
51 WpSecurityContextManagerV1ErrorNested WpSecurityContextManagerV1Error = 2
52)
53
54// WpSecurityContextManagerV1Handler handles wp_security_context_manager_v1 requests.
55type WpSecurityContextManagerV1Handler interface {
56 Destroy(self *WpSecurityContextManagerV1)
57 CreateListener(self *WpSecurityContextManagerV1, id uint32, listenFd int, closeFd int)
58}
59
60func NewWpSecurityContextManagerV1(c server.Client, version int32, id uint32, h WpSecurityContextManagerV1Handler) (*WpSecurityContextManagerV1, error) {
61 if h == nil {
62 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_manager_v1")
63 }
64 var self *WpSecurityContextManagerV1
65 r, err := c.CreateResource(WpSecurityContextManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
66 switch opcode {
67 case 0:
68 h.Destroy(self)
69 self.Destroy()
70 case 1:
71 h.CreateListener(self, args[0].NewID(), args[1].Fd(), args[2].Fd())
72 }
73 })
74 if err != nil {
75 return nil, err
76 }
77 self = WrapWpSecurityContextManagerV1(r)
78 r.Data = self
79 return self, nil
80}
81func NewWpSecurityContextManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
82 return d.CreateGlobal(WpSecurityContextManagerV1Interface, version, bind)
83}
84
85// WpSecurityContextV1 client security context.
86type WpSecurityContextV1 struct{ *server.Resource }
87
88func WrapWpSecurityContextV1(r *server.Resource) *WpSecurityContextV1 {
89 if r == nil {
90 return nil
91 }
92 return &WpSecurityContextV1{r}
93}
94
95const WpSecurityContextV1RequestDestroy uint32 = 0
96const WpSecurityContextV1RequestSetSandboxEngine uint32 = 1
97const WpSecurityContextV1RequestSetAppId uint32 = 2
98const WpSecurityContextV1RequestSetInstanceId uint32 = 3
99const WpSecurityContextV1RequestCommit uint32 = 4
100
101// WpSecurityContextV1Error .
102type WpSecurityContextV1Error uint32
103
104const (
105 WpSecurityContextV1ErrorAlreadyUsed WpSecurityContextV1Error = 1
106 WpSecurityContextV1ErrorAlreadySet WpSecurityContextV1Error = 2
107 WpSecurityContextV1ErrorInvalidMetadata WpSecurityContextV1Error = 3
108)
109
110// WpSecurityContextV1Handler handles wp_security_context_v1 requests.
111type WpSecurityContextV1Handler interface {
112 Destroy(self *WpSecurityContextV1)
113 SetSandboxEngine(self *WpSecurityContextV1, name string)
114 SetAppId(self *WpSecurityContextV1, appId string)
115 SetInstanceId(self *WpSecurityContextV1, instanceId string)
116 Commit(self *WpSecurityContextV1)
117}
118
119func NewWpSecurityContextV1(c server.Client, version int32, id uint32, h WpSecurityContextV1Handler) (*WpSecurityContextV1, error) {
120 if h == nil {
121 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_v1")
122 }
123 var self *WpSecurityContextV1
124 r, err := c.CreateResource(WpSecurityContextV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
125 switch opcode {
126 case 0:
127 h.Destroy(self)
128 self.Destroy()
129 case 1:
130 h.SetSandboxEngine(self, args[0].String())
131 case 2:
132 h.SetAppId(self, args[0].String())
133 case 3:
134 h.SetInstanceId(self, args[0].String())
135 case 4:
136 h.Commit(self)
137 }
138 })
139 if err != nil {
140 return nil, err
141 }
142 self = WrapWpSecurityContextV1(r)
143 r.Data = self
144 return self, nil
145}
146func NewWpSecurityContextV1Global(d *server.Display, version int32, bind server.BindFunc) error {
147 return d.CreateGlobal(WpSecurityContextV1Interface, version, bind)
148}
149func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
150 if v == nil {
151 return nil
152 }
153 return v.GetResource()
154}
155func (self *WpSecurityContextManagerV1) GetResource() *server.Resource {
156 if self == nil {
157 return nil
158 }
159 return self.Resource
160}
161func (self *WpSecurityContextV1) GetResource() *server.Resource {
162 if self == nil {
163 return nil
164 }
165 return self.Resource
166}