github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/ping/ping.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.10.0-dev 4 // VPP: 23.10-rc0~170-g6f1548434 5 // source: plugins/ping.api.json 6 7 // Package ping contains generated bindings for API file ping.api. 8 // 9 // Contents: 10 // - 3 messages 11 package ping 12 13 import ( 14 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 15 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 16 api "go.fd.io/govpp/api" 17 codec "go.fd.io/govpp/codec" 18 ) 19 20 // This is a compile-time assertion to ensure that this generated file 21 // is compatible with the GoVPP api package it is being compiled against. 22 // A compilation error at this line likely means your copy of the 23 // GoVPP api package needs to be updated. 24 const _ = api.GoVppAPIPackageIsVersion2 25 26 const ( 27 APIFile = "ping" 28 APIVersion = "0.1.0" 29 VersionCrc = 0x97a62a8b 30 ) 31 32 // PingFinishedEvent defines message 'ping_finished_event'. 33 type PingFinishedEvent struct { 34 RequestCount uint32 `binapi:"u32,name=request_count" json:"request_count,omitempty"` 35 ReplyCount uint32 `binapi:"u32,name=reply_count" json:"reply_count,omitempty"` 36 } 37 38 func (m *PingFinishedEvent) Reset() { *m = PingFinishedEvent{} } 39 func (*PingFinishedEvent) GetMessageName() string { return "ping_finished_event" } 40 func (*PingFinishedEvent) GetCrcString() string { return "397ccf72" } 41 func (*PingFinishedEvent) GetMessageType() api.MessageType { 42 return api.EventMessage 43 } 44 45 func (m *PingFinishedEvent) Size() (size int) { 46 if m == nil { 47 return 0 48 } 49 size += 4 // m.RequestCount 50 size += 4 // m.ReplyCount 51 return size 52 } 53 func (m *PingFinishedEvent) Marshal(b []byte) ([]byte, error) { 54 if b == nil { 55 b = make([]byte, m.Size()) 56 } 57 buf := codec.NewBuffer(b) 58 buf.EncodeUint32(m.RequestCount) 59 buf.EncodeUint32(m.ReplyCount) 60 return buf.Bytes(), nil 61 } 62 func (m *PingFinishedEvent) Unmarshal(b []byte) error { 63 buf := codec.NewBuffer(b) 64 m.RequestCount = buf.DecodeUint32() 65 m.ReplyCount = buf.DecodeUint32() 66 return nil 67 } 68 69 // /* 70 // - Copyright (c) 2023 Cisco and/or its affiliates. 71 // - Licensed under the Apache License, Version 2.0 (the "License"); 72 // - you may not use this file except in compliance with the License. 73 // - You may obtain a copy of the License at: 74 // * 75 // - http://www.apache.org/licenses/LICENSE-2.0 76 // * 77 // - Unless required by applicable law or agreed to in writing, software 78 // - distributed under the License is distributed on an "AS IS" BASIS, 79 // - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 80 // - See the License for the specific language governing permissions and 81 // - limitations under the License. 82 // 83 // WantPingFinishedEvents defines message 'want_ping_finished_events'. 84 type WantPingFinishedEvents struct { 85 Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"` 86 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 87 Repeat uint32 `binapi:"u32,name=repeat,default=1" json:"repeat,omitempty"` 88 Interval float64 `binapi:"f64,name=interval,default=1" json:"interval,omitempty"` 89 } 90 91 func (m *WantPingFinishedEvents) Reset() { *m = WantPingFinishedEvents{} } 92 func (*WantPingFinishedEvents) GetMessageName() string { return "want_ping_finished_events" } 93 func (*WantPingFinishedEvents) GetCrcString() string { return "5ccd10cc" } 94 func (*WantPingFinishedEvents) GetMessageType() api.MessageType { 95 return api.RequestMessage 96 } 97 98 func (m *WantPingFinishedEvents) Size() (size int) { 99 if m == nil { 100 return 0 101 } 102 size += 1 // m.Address.Af 103 size += 1 * 16 // m.Address.Un 104 size += 4 // m.SwIfIndex 105 size += 4 // m.Repeat 106 size += 8 // m.Interval 107 return size 108 } 109 func (m *WantPingFinishedEvents) Marshal(b []byte) ([]byte, error) { 110 if b == nil { 111 b = make([]byte, m.Size()) 112 } 113 buf := codec.NewBuffer(b) 114 buf.EncodeUint8(uint8(m.Address.Af)) 115 buf.EncodeBytes(m.Address.Un.XXX_UnionData[:], 16) 116 buf.EncodeUint32(uint32(m.SwIfIndex)) 117 buf.EncodeUint32(m.Repeat) 118 buf.EncodeFloat64(m.Interval) 119 return buf.Bytes(), nil 120 } 121 func (m *WantPingFinishedEvents) Unmarshal(b []byte) error { 122 buf := codec.NewBuffer(b) 123 m.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 124 copy(m.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 125 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 126 m.Repeat = buf.DecodeUint32() 127 m.Interval = buf.DecodeFloat64() 128 return nil 129 } 130 131 // WantPingFinishedEventsReply defines message 'want_ping_finished_events_reply'. 132 type WantPingFinishedEventsReply struct { 133 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 134 } 135 136 func (m *WantPingFinishedEventsReply) Reset() { *m = WantPingFinishedEventsReply{} } 137 func (*WantPingFinishedEventsReply) GetMessageName() string { return "want_ping_finished_events_reply" } 138 func (*WantPingFinishedEventsReply) GetCrcString() string { return "e8d4e804" } 139 func (*WantPingFinishedEventsReply) GetMessageType() api.MessageType { 140 return api.ReplyMessage 141 } 142 143 func (m *WantPingFinishedEventsReply) Size() (size int) { 144 if m == nil { 145 return 0 146 } 147 size += 4 // m.Retval 148 return size 149 } 150 func (m *WantPingFinishedEventsReply) Marshal(b []byte) ([]byte, error) { 151 if b == nil { 152 b = make([]byte, m.Size()) 153 } 154 buf := codec.NewBuffer(b) 155 buf.EncodeInt32(m.Retval) 156 return buf.Bytes(), nil 157 } 158 func (m *WantPingFinishedEventsReply) Unmarshal(b []byte) error { 159 buf := codec.NewBuffer(b) 160 m.Retval = buf.DecodeInt32() 161 return nil 162 } 163 164 func init() { file_ping_binapi_init() } 165 func file_ping_binapi_init() { 166 api.RegisterMessage((*PingFinishedEvent)(nil), "ping_finished_event_397ccf72") 167 api.RegisterMessage((*WantPingFinishedEvents)(nil), "want_ping_finished_events_5ccd10cc") 168 api.RegisterMessage((*WantPingFinishedEventsReply)(nil), "want_ping_finished_events_reply_e8d4e804") 169 } 170 171 // Messages returns list of all messages in this module. 172 func AllMessages() []api.Message { 173 return []api.Message{ 174 (*PingFinishedEvent)(nil), 175 (*WantPingFinishedEvents)(nil), 176 (*WantPingFinishedEventsReply)(nil), 177 } 178 }