summaryrefslogtreecommitdiffstats
path: root/binapi/udp_ping/udp_ping.ba.go
blob: a568fce89df33c356242ee522d46757782fd8f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.4.0
//  VPP:              20.05.1-release
// source: /usr/share/vpp/api/plugins/udp_ping.api.json

// Package udp_ping contains generated bindings for API file udp_ping.api.
//
// Contents:
//   4 messages
//
package udp_ping

import (
	api "git.fd.io/govpp.git/api"
	ip_types "git.fd.io/govpp.git/binapi/ip_types"
	codec "git.fd.io/govpp.git/codec"
)

// 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.GoVppAPIPackageIsVersion2

const (
	APIFile    = "udp_ping"
	APIVersion = "3.0.0"
	VersionCrc = 0x3b2c67de
)

// UDPPingAddDel defines message 'udp_ping_add_del'.
type UDPPingAddDel struct {
	SrcIPAddress ip_types.Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"`
	DstIPAddress ip_types.Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"`
	StartSrcPort uint16           `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"`
	EndSrcPort   uint16           `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"`
	StartDstPort uint16           `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"`
	EndDstPort   uint16           `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"`
	Interval     uint16           `binapi:"u16,name=interval" json:"interval,omitempty"`
	Dis          uint8            `binapi:"u8,name=dis" json:"dis,omitempty"`
	FaultDet     uint8            `binapi:"u8,name=fault_det" json:"fault_det,omitempty"`
	Reserve      []byte           `binapi:"u8[3],name=reserve" json:"reserve,omitempty"`
}

func (m *UDPPingAddDel) Reset()               { *m = UDPPingAddDel{} }
func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" }
func (*UDPPingAddDel) GetCrcString() string   { return "c692b188" }
func (*UDPPingAddDel) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *UDPPingAddDel) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.SrcIPAddress.Af
	size += 1 * 16 // m.SrcIPAddress.Un
	size += 1      // m.DstIPAddress.Af
	size += 1 * 16 // m.DstIPAddress.Un
	size += 2      // m.StartSrcPort
	size += 2      // m.EndSrcPort
	size += 2      // m.StartDstPort
	size += 2      // m.EndDstPort
	size += 2      // m.Interval
	size += 1      // m.Dis
	size += 1      // m.FaultDet
	size += 1 * 3  // m.Reserve
	return size
}
func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint8(uint8(m.SrcIPAddress.Af))
	buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16)
	buf.EncodeUint8(uint8(m.DstIPAddress.Af))
	buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16)
	buf.EncodeUint16(m.StartSrcPort)
	buf.EncodeUint16(m.EndSrcPort)
	buf.EncodeUint16(m.StartDstPort)
	buf.EncodeUint16(m.EndDstPort)
	buf.EncodeUint16(m.Interval)
	buf.EncodeUint8(m.Dis)
	buf.EncodeUint8(m.FaultDet)
	buf.EncodeBytes(m.Reserve, 3)
	return buf.Bytes(), nil
}
func (m *UDPPingAddDel) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.SrcIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.DstIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.StartSrcPort = buf.DecodeUint16()
	m.EndSrcPort = buf.DecodeUint16()
	m.StartDstPort = buf.DecodeUint16()
	m.EndDstPort = buf.DecodeUint16()
	m.Interval = buf.DecodeUint16()
	m.Dis = buf.DecodeUint8()
	m.FaultDet = buf.DecodeUint8()
	m.Reserve = make([]byte, 3)
	copy(m.Reserve, buf.DecodeBytes(len(m.Reserve)))
	return nil
}

// UDPPingAddDelReply defines message 'udp_ping_add_del_reply'.
type UDPPingAddDelReply struct {
	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}

func (m *UDPPingAddDelReply) Reset()               { *m = UDPPingAddDelReply{} }
func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" }
func (*UDPPingAddDelReply) GetCrcString() string   { return "e8d4e804" }
func (*UDPPingAddDelReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *UDPPingAddDelReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	return buf.Bytes(), nil
}
func (m *UDPPingAddDelReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

// UDPPingExport defines message 'udp_ping_export'.
type UDPPingExport struct {
	Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"`
}

func (m *UDPPingExport) Reset()               { *m = UDPPingExport{} }
func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" }
func (*UDPPingExport) GetCrcString() string   { return "b3e225d2" }
func (*UDPPingExport) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *UDPPingExport) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1 // m.Enable
	return size
}
func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeBool(m.Enable)
	return buf.Bytes(), nil
}
func (m *UDPPingExport) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Enable = buf.DecodeBool()
	return nil
}

// UDPPingExportReply defines message 'udp_ping_export_reply'.
type UDPPingExportReply struct {
	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}

func (m *UDPPingExportReply) Reset()               { *m = UDPPingExportReply{} }
func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" }
func (*UDPPingExportReply) GetCrcString() string   { return "e8d4e804" }
func (*UDPPingExportReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *UDPPingExportReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	return buf.Bytes(), nil
}
func (m *UDPPingExportReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

func init() { file_udp_ping_binapi_init() }
func file_udp_ping_binapi_init() {
	api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_c692b188")
	api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804")
	api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2")
	api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*UDPPingAddDel)(nil),
		(*UDPPingAddDelReply)(nil),
		(*UDPPingExport)(nil),
		(*UDPPingExportReply)(nil),
	}
}