// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2021 Simon Ser // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice (including the next // paragraph) shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. package securitycontext import ( "fmt" "github.com/bnema/purego-libwayland/server" ) var WpSecurityContextManagerV1Interface *server.Interface var WpSecurityContextV1Interface *server.Interface func init() { WpSecurityContextManagerV1Interface = &server.Interface{Name: "wp_security_context_manager_v1", Version: 1} WpSecurityContextV1Interface = &server.Interface{Name: "wp_security_context_v1", Version: 1} WpSecurityContextManagerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "create_listener", Signature: "nhh", Types: []*server.Interface{WpSecurityContextV1Interface, nil, nil}}, } WpSecurityContextManagerV1Interface.Events = []server.Message{} WpSecurityContextV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "set_sandbox_engine", Signature: "s", Types: []*server.Interface{nil}}, {Name: "set_app_id", Signature: "s", Types: []*server.Interface{nil}}, {Name: "set_instance_id", Signature: "s", Types: []*server.Interface{nil}}, {Name: "commit", Signature: "", Types: []*server.Interface{}}, } WpSecurityContextV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpSecurityContextManagerV1Interface, WpSecurityContextV1Interface); err != nil { panic(err) } } // WpSecurityContextManagerV1 client security context manager. type WpSecurityContextManagerV1 struct{ *server.Resource } func WrapWpSecurityContextManagerV1(r *server.Resource) *WpSecurityContextManagerV1 { if r == nil { return nil } return &WpSecurityContextManagerV1{r} } const WpSecurityContextManagerV1RequestDestroy uint32 = 0 const WpSecurityContextManagerV1RequestCreateListener uint32 = 1 // WpSecurityContextManagerV1Error . type WpSecurityContextManagerV1Error uint32 const ( WpSecurityContextManagerV1ErrorInvalidListenFd WpSecurityContextManagerV1Error = 1 WpSecurityContextManagerV1ErrorNested WpSecurityContextManagerV1Error = 2 ) // WpSecurityContextManagerV1Handler handles wp_security_context_manager_v1 requests. type WpSecurityContextManagerV1Handler interface { Destroy(self *WpSecurityContextManagerV1) CreateListener(self *WpSecurityContextManagerV1, id uint32, listenFd int, closeFd int) } func NewWpSecurityContextManagerV1(c server.Client, version int32, id uint32, h WpSecurityContextManagerV1Handler) (*WpSecurityContextManagerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_manager_v1") } var self *WpSecurityContextManagerV1 r, err := c.CreateResource(WpSecurityContextManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.CreateListener(self, args[0].NewID(), args[1].Fd(), args[2].Fd()) } }) if err != nil { return nil, err } self = WrapWpSecurityContextManagerV1(r) r.Data = self return self, nil } func NewWpSecurityContextManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpSecurityContextManagerV1Interface, version, bind) } // WpSecurityContextV1 client security context. type WpSecurityContextV1 struct{ *server.Resource } func WrapWpSecurityContextV1(r *server.Resource) *WpSecurityContextV1 { if r == nil { return nil } return &WpSecurityContextV1{r} } const WpSecurityContextV1RequestDestroy uint32 = 0 const WpSecurityContextV1RequestSetSandboxEngine uint32 = 1 const WpSecurityContextV1RequestSetAppId uint32 = 2 const WpSecurityContextV1RequestSetInstanceId uint32 = 3 const WpSecurityContextV1RequestCommit uint32 = 4 // WpSecurityContextV1Error . type WpSecurityContextV1Error uint32 const ( WpSecurityContextV1ErrorAlreadyUsed WpSecurityContextV1Error = 1 WpSecurityContextV1ErrorAlreadySet WpSecurityContextV1Error = 2 WpSecurityContextV1ErrorInvalidMetadata WpSecurityContextV1Error = 3 ) // WpSecurityContextV1Handler handles wp_security_context_v1 requests. type WpSecurityContextV1Handler interface { Destroy(self *WpSecurityContextV1) SetSandboxEngine(self *WpSecurityContextV1, name string) SetAppId(self *WpSecurityContextV1, appId string) SetInstanceId(self *WpSecurityContextV1, instanceId string) Commit(self *WpSecurityContextV1) } func NewWpSecurityContextV1(c server.Client, version int32, id uint32, h WpSecurityContextV1Handler) (*WpSecurityContextV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_security_context_v1") } var self *WpSecurityContextV1 r, err := c.CreateResource(WpSecurityContextV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.SetSandboxEngine(self, args[0].String()) case 2: h.SetAppId(self, args[0].String()) case 3: h.SetInstanceId(self, args[0].String()) case 4: h.Commit(self) } }) if err != nil { return nil, err } self = WrapWpSecurityContextV1(r) r.Data = self return self, nil } func NewWpSecurityContextV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpSecurityContextV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpSecurityContextManagerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *WpSecurityContextV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }