Add various generator improvements
[govpp.git] / examples / binapi / acl / acl.ba.go
similarity index 68%
rename from examples/bin_api/acl/acl.ba.go
rename to examples/binapi/acl/acl.ba.go
index 54fe26d..a00918e 100644 (file)
@@ -1,46 +1,43 @@
 // Code generated by GoVPP binapi-generator. DO NOT EDIT.
-//  source: acl.api.json
+// source: /usr/share/vpp/api/plugins/acl.api.json
 
 /*
- Package acl is a generated from VPP binary API module 'acl'.
+Package acl is a generated from VPP binary API module 'acl'.
 
- It contains following objects:
-        18 services
+ The acl module consists of:
          2 types
         36 messages
+        18 services
 */
 package acl
 
 import api "git.fd.io/govpp.git/api"
-import struc "github.com/lunixbochs/struc"
 import bytes "bytes"
+import context "context"
+import strconv "strconv"
+import struc "github.com/lunixbochs/struc"
 
 // Reference imports to suppress errors if they are not otherwise used.
 var _ = api.RegisterMessage
-var _ = struc.Pack
 var _ = bytes.NewBuffer
+var _ = context.Background
+var _ = strconv.Itoa
+var _ = struc.Pack
 
-// Services represents VPP binary API services:
-type Services interface {
-       DumpACL(*ACLDump) ([]*ACLDetails, error)
-       DumpACLInterfaceEtypeWhitelist(*ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error)
-       DumpACLInterfaceList(*ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error)
-       DumpMacipACL(*MacipACLDump) ([]*MacipACLDetails, error)
-       DumpMacipACLInterfaceList(*MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error)
-       ACLAddReplace(*ACLAddReplace) (*ACLAddReplaceReply, error)
-       ACLDel(*ACLDel) (*ACLDelReply, error)
-       ACLInterfaceAddDel(*ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error)
-       ACLInterfaceSetACLList(*ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error)
-       ACLInterfaceSetEtypeWhitelist(*ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error)
-       ACLPluginControlPing(*ACLPluginControlPing) (*ACLPluginControlPingReply, error)
-       ACLPluginGetConnTableMaxEntries(*ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error)
-       ACLPluginGetVersion(*ACLPluginGetVersion) (*ACLPluginGetVersionReply, error)
-       MacipACLAdd(*MacipACLAdd) (*MacipACLAddReply, error)
-       MacipACLAddReplace(*MacipACLAddReplace) (*MacipACLAddReplaceReply, error)
-       MacipACLDel(*MacipACLDel) (*MacipACLDelReply, error)
-       MacipACLInterfaceAddDel(*MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error)
-       MacipACLInterfaceGet(*MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error)
-}
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the GoVPP api package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// GoVPP api package needs to be updated.
+const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package
+
+const (
+       // ModuleName is the name of this module.
+       ModuleName = "acl"
+       // APIVersion is the API version of this module.
+       APIVersion = "1.0.1"
+       // VersionCrc is the CRC of this module.
+       VersionCrc = 0x8ed22cb9
+)
 
 /* Types */
 
@@ -698,41 +695,276 @@ func init() {
        api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump")
 }
 
-var Messages = []api.Message{
-       (*ACLAddReplace)(nil),
-       (*ACLAddReplaceReply)(nil),
-       (*ACLDel)(nil),
-       (*ACLDelReply)(nil),
-       (*ACLDetails)(nil),
-       (*ACLDump)(nil),
-       (*ACLInterfaceAddDel)(nil),
-       (*ACLInterfaceAddDelReply)(nil),
-       (*ACLInterfaceEtypeWhitelistDetails)(nil),
-       (*ACLInterfaceEtypeWhitelistDump)(nil),
-       (*ACLInterfaceListDetails)(nil),
-       (*ACLInterfaceListDump)(nil),
-       (*ACLInterfaceSetACLList)(nil),
-       (*ACLInterfaceSetACLListReply)(nil),
-       (*ACLInterfaceSetEtypeWhitelist)(nil),
-       (*ACLInterfaceSetEtypeWhitelistReply)(nil),
-       (*ACLPluginControlPing)(nil),
-       (*ACLPluginControlPingReply)(nil),
-       (*ACLPluginGetConnTableMaxEntries)(nil),
-       (*ACLPluginGetConnTableMaxEntriesReply)(nil),
-       (*ACLPluginGetVersion)(nil),
-       (*ACLPluginGetVersionReply)(nil),
-       (*MacipACLAdd)(nil),
-       (*MacipACLAddReplace)(nil),
-       (*MacipACLAddReplaceReply)(nil),
-       (*MacipACLAddReply)(nil),
-       (*MacipACLDel)(nil),
-       (*MacipACLDelReply)(nil),
-       (*MacipACLDetails)(nil),
-       (*MacipACLDump)(nil),
-       (*MacipACLInterfaceAddDel)(nil),
-       (*MacipACLInterfaceAddDelReply)(nil),
-       (*MacipACLInterfaceGet)(nil),
-       (*MacipACLInterfaceGetReply)(nil),
-       (*MacipACLInterfaceListDetails)(nil),
-       (*MacipACLInterfaceListDump)(nil),
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+       return []api.Message{
+               (*ACLAddReplace)(nil),
+               (*ACLAddReplaceReply)(nil),
+               (*ACLDel)(nil),
+               (*ACLDelReply)(nil),
+               (*ACLDetails)(nil),
+               (*ACLDump)(nil),
+               (*ACLInterfaceAddDel)(nil),
+               (*ACLInterfaceAddDelReply)(nil),
+               (*ACLInterfaceEtypeWhitelistDetails)(nil),
+               (*ACLInterfaceEtypeWhitelistDump)(nil),
+               (*ACLInterfaceListDetails)(nil),
+               (*ACLInterfaceListDump)(nil),
+               (*ACLInterfaceSetACLList)(nil),
+               (*ACLInterfaceSetACLListReply)(nil),
+               (*ACLInterfaceSetEtypeWhitelist)(nil),
+               (*ACLInterfaceSetEtypeWhitelistReply)(nil),
+               (*ACLPluginControlPing)(nil),
+               (*ACLPluginControlPingReply)(nil),
+               (*ACLPluginGetConnTableMaxEntries)(nil),
+               (*ACLPluginGetConnTableMaxEntriesReply)(nil),
+               (*ACLPluginGetVersion)(nil),
+               (*ACLPluginGetVersionReply)(nil),
+               (*MacipACLAdd)(nil),
+               (*MacipACLAddReplace)(nil),
+               (*MacipACLAddReplaceReply)(nil),
+               (*MacipACLAddReply)(nil),
+               (*MacipACLDel)(nil),
+               (*MacipACLDelReply)(nil),
+               (*MacipACLDetails)(nil),
+               (*MacipACLDump)(nil),
+               (*MacipACLInterfaceAddDel)(nil),
+               (*MacipACLInterfaceAddDelReply)(nil),
+               (*MacipACLInterfaceGet)(nil),
+               (*MacipACLInterfaceGetReply)(nil),
+               (*MacipACLInterfaceListDetails)(nil),
+               (*MacipACLInterfaceListDump)(nil),
+       }
+}
+
+// Service represents services in VPP binary API.
+type Service interface {
+       DumpACL(ctx context.Context, in *ACLDump) ([]*ACLDetails, error)
+       DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error)
+       DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error)
+       DumpMacipACL(ctx context.Context, in *MacipACLDump) ([]*MacipACLDetails, error)
+       DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error)
+       ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error)
+       ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error)
+       ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error)
+       ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error)
+       ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error)
+       ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error)
+       ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error)
+       ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error)
+       MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error)
+       MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error)
+       MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error)
+       MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error)
+       MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error)
+}
+
+type service struct {
+       ch api.Channel
+}
+
+func NewService(ch api.Channel) Service {
+       return &service{ch}
+}
+
+func (c *service) DumpACL(ctx context.Context, in *ACLDump) ([]*ACLDetails, error) {
+       var dump []*ACLDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(ACLDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) ([]*ACLInterfaceEtypeWhitelistDetails, error) {
+       var dump []*ACLInterfaceEtypeWhitelistDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(ACLInterfaceEtypeWhitelistDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) ([]*ACLInterfaceListDetails, error) {
+       var dump []*ACLInterfaceListDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(ACLInterfaceListDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) DumpMacipACL(ctx context.Context, in *MacipACLDump) ([]*MacipACLDetails, error) {
+       var dump []*MacipACLDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(MacipACLDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) ([]*MacipACLInterfaceListDetails, error) {
+       var dump []*MacipACLInterfaceListDetails
+       req := c.ch.SendMultiRequest(in)
+       for {
+               m := new(MacipACLInterfaceListDetails)
+               stop, err := req.ReceiveReply(m)
+               if stop {
+                       break
+               }
+               if err != nil {
+                       return nil, err
+               }
+               dump = append(dump, m)
+       }
+       return dump, nil
+}
+
+func (c *service) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) {
+       out := new(ACLAddReplaceReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) {
+       out := new(ACLDelReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) {
+       out := new(ACLInterfaceAddDelReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) {
+       out := new(ACLInterfaceSetACLListReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) {
+       out := new(ACLInterfaceSetEtypeWhitelistReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) {
+       out := new(ACLPluginControlPingReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) {
+       out := new(ACLPluginGetConnTableMaxEntriesReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) {
+       out := new(ACLPluginGetVersionReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) {
+       out := new(MacipACLAddReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) {
+       out := new(MacipACLAddReplaceReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) {
+       out := new(MacipACLDelReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) {
+       out := new(MacipACLInterfaceAddDelReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
+}
+
+func (c *service) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) {
+       out := new(MacipACLInterfaceGetReply)
+       err := c.ch.SendRequest(in).ReceiveReply(out)
+       if err != nil {
+               return nil, err
+       }
+       return out, nil
 }