1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2021 Simon Ser
5//
6// Permission is hereby granted, free of charge, to any person obtaining a
7// copy of this software and associated documentation files (the "Software"),
8// to deal in the Software without restriction, including without limitation
9// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10// and/or sell copies of the Software, and to permit persons to whom the
11// Software is furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice (including the next
14// paragraph) shall be included in all copies or substantial portions of the
15// Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25package securitycontext
26
27import (
28 "fmt"
29 "github.com/bnema/purego-libwayland/server"
30)
31
32var WpSecurityContextManagerV1Interface *server.Interface
33var WpSecurityContextV1Interface *server.Interface
34
35func init() {
36 WpSecurityContextManagerV1Interface = &server.Interface{Name: "wp_security_context_manager_v1", Version: 1}
37 WpSecurityContextV1Interface = &server.Interface{Name: "wp_security_context_v1", Version: 1}
38 WpSecurityContextManagerV1Interface.Requests = []server.Message{
39 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
40 {Name: "create_listener", Signature: "nhh", Types: []*server.Interface{WpSecurityContextV1Interface, nil, nil}},
41 }
42 WpSecurityContextManagerV1Interface.Events = []server.Message{}
43 WpSecurityContextV1Interface.Requests = []server.Message{
44 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
45 {Name: "set_sandbox_engine", Signature: "s", Types: []*server.Interface{nil}},
46 {Name: "set_app_id", Signature: "s", Types: []*server.Interface{nil}},
47 {Name: "set_instance_id", Signature: "s", Types: []*server.Interface{nil}},
48 {Name: "commit", Signature: "", Types: []*server.Interface{}},
49 }
50 WpSecurityContextV1Interface.Events = []server.Message{}
51 if err := server.NewInterfaces(WpSecurityContextManagerV1Interface, WpSecurityContextV1Interface); err != nil {
52 panic(err)
53 }
54}
55
56// WpSecurityContextManagerV1 client security context manager.
57type WpSecurityContextManagerV1 struct{ *server.Resource }
58
59func WrapWpSecurityContextManagerV1(r *server.Resource) *WpSecurityContextManagerV1 {
60 if r == nil {
61 return nil
62 }
63 return &WpSecurityContextManagerV1{r}
64}
65
66const WpSecurityContextManagerV1RequestDestroy uint32 = 0
67const WpSecurityContextManagerV1RequestCreateListener uint32 = 1
68
69// WpSecurityContextManagerV1Error .
70type WpSecurityContextManagerV1Error uint32
71
72const (
73 WpSecurityContextManagerV1ErrorInvalidListenFd WpSecurityContextManagerV1Error = 1
74 WpSecurityContextManagerV1ErrorNested WpSecurityContextManagerV1Error = 2
75)
76
77// WpSecurityContextManagerV1Handler handles wp_security_context_manager_v1 requests.
78type WpSecurityContextManagerV1Handler interface {
79 Destroy(self *WpSecurityContextManagerV1)
80 CreateListener(self *WpSecurityContextManagerV1, id uint32, listenFd int, closeFd int)
81}
82
83func NewWpSecurityContextManagerV1(c server.Client, version int32, id uint32, h WpSecurityContextManagerV1Handler) (*WpSecurityContextManagerV1, error) {
84 if h == nil {
85 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_manager_v1")
86 }
87 var self *WpSecurityContextManagerV1
88 r, err := c.CreateResource(WpSecurityContextManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
89 switch opcode {
90 case 0:
91 h.Destroy(self)
92 self.Destroy()
93 case 1:
94 h.CreateListener(self, args[0].NewID(), args[1].Fd(), args[2].Fd())
95 }
96 })
97 if err != nil {
98 return nil, err
99 }
100 self = WrapWpSecurityContextManagerV1(r)
101 r.Data = self
102 return self, nil
103}
104func NewWpSecurityContextManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
105 return d.CreateGlobal(WpSecurityContextManagerV1Interface, version, bind)
106}
107
108// WpSecurityContextV1 client security context.
109type WpSecurityContextV1 struct{ *server.Resource }
110
111func WrapWpSecurityContextV1(r *server.Resource) *WpSecurityContextV1 {
112 if r == nil {
113 return nil
114 }
115 return &WpSecurityContextV1{r}
116}
117
118const WpSecurityContextV1RequestDestroy uint32 = 0
119const WpSecurityContextV1RequestSetSandboxEngine uint32 = 1
120const WpSecurityContextV1RequestSetAppId uint32 = 2
121const WpSecurityContextV1RequestSetInstanceId uint32 = 3
122const WpSecurityContextV1RequestCommit uint32 = 4
123
124// WpSecurityContextV1Error .
125type WpSecurityContextV1Error uint32
126
127const (
128 WpSecurityContextV1ErrorAlreadyUsed WpSecurityContextV1Error = 1
129 WpSecurityContextV1ErrorAlreadySet WpSecurityContextV1Error = 2
130 WpSecurityContextV1ErrorInvalidMetadata WpSecurityContextV1Error = 3
131)
132
133// WpSecurityContextV1Handler handles wp_security_context_v1 requests.
134type WpSecurityContextV1Handler interface {
135 Destroy(self *WpSecurityContextV1)
136 SetSandboxEngine(self *WpSecurityContextV1, name string)
137 SetAppId(self *WpSecurityContextV1, appId string)
138 SetInstanceId(self *WpSecurityContextV1, instanceId string)
139 Commit(self *WpSecurityContextV1)
140}
141
142func NewWpSecurityContextV1(c server.Client, version int32, id uint32, h WpSecurityContextV1Handler) (*WpSecurityContextV1, error) {
143 if h == nil {
144 return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_v1")
145 }
146 var self *WpSecurityContextV1
147 r, err := c.CreateResource(WpSecurityContextV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
148 switch opcode {
149 case 0:
150 h.Destroy(self)
151 self.Destroy()
152 case 1:
153 h.SetSandboxEngine(self, args[0].String())
154 case 2:
155 h.SetAppId(self, args[0].String())
156 case 3:
157 h.SetInstanceId(self, args[0].String())
158 case 4:
159 h.Commit(self)
160 }
161 })
162 if err != nil {
163 return nil, err
164 }
165 self = WrapWpSecurityContextV1(r)
166 r.Data = self
167 return self, nil
168}
169func NewWpSecurityContextV1Global(d *server.Display, version int32, bind server.BindFunc) error {
170 return d.CreateGlobal(WpSecurityContextV1Interface, version, bind)
171}
172func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
173 if v == nil {
174 return nil
175 }
176 return v.GetResource()
177}
178func (self *WpSecurityContextManagerV1) GetResource() *server.Resource {
179 if self == nil {
180 return nil
181 }
182 return self.Resource
183}
184func (self *WpSecurityContextV1) GetResource() *server.Resource {
185 if self == nil {
186 return nil
187 }
188 return self.Resource
189}