summaryrefslogtreecommitdiffstats
path: root/binapi/arping/arping.ba.go
blob: f99b8002b40fcbc3b71fc1da71e9ee5e83c588f7 (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
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.5.0
//  VPP:              22.02-release
// source: /usr/share/vpp/api/plugins/arping.api.json

// Package arping contains generated bindings for API file arping.api.
//
// Contents:
//   2 messages
//
package arping

import (
	api "git.fd.io/govpp.git/api"
	interface_types "git.fd.io/govpp.git/binapi/interface_types"
	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    = "arping"
	APIVersion = "1.0.0"
	VersionCrc = 0x666f91cc
)

// Arping defines message 'arping'.
type Arping struct {
	Address   ip_types.Address               `binapi:"address,name=address" json:"address,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
	IsGarp    bool                           `binapi:"bool,name=is_garp" json:"is_garp,omitempty"`
	Repeat    uint32                         `binapi:"u32,name=repeat,default=1" json:"repeat,omitempty"`
	Interval  float64                        `binapi:"f64,name=interval,default=1" json:"interval,omitempty"`
}

func (m *Arping) Reset()               { *m = Arping{} }
func (*Arping) GetMessageName() string { return "arping" }
func (*Arping) GetCrcString() string   { return "48817482" }
func (*Arping) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *Arping) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.Address.Af
	size += 1 * 16 // m.Address.Un
	size += 4      // m.SwIfIndex
	size += 1      // m.IsGarp
	size += 4      // m.Repeat
	size += 8      // m.Interval
	return size
}
func (m *Arping) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint8(uint8(m.Address.Af))
	buf.EncodeBytes(m.Address.Un.XXX_UnionData[:], 16)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	buf.EncodeBool(m.IsGarp)
	buf.EncodeUint32(m.Repeat)
	buf.EncodeFloat64(m.Interval)
	return buf.Bytes(), nil
}
func (m *Arping) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.IsGarp = buf.DecodeBool()
	m.Repeat = buf.DecodeUint32()
	m.Interval = buf.DecodeFloat64()
	return nil
}

// ArpingReply defines message 'arping_reply'.
type ArpingReply struct {
	Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
	ReplyCount uint32 `binapi:"u32,name=reply_count" json:"reply_count,omitempty"`
}

func (m *ArpingReply) Reset()               { *m = ArpingReply{} }
func (*ArpingReply) GetMessageName() string { return "arping_reply" }
func (*ArpingReply) GetCrcString() string   { return "bb9d1cbd" }
func (*ArpingReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

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

func init() { file_arping_binapi_init() }
func file_arping_binapi_init() {
	api.RegisterMessage((*Arping)(nil), "arping_48817482")
	api.RegisterMessage((*ArpingReply)(nil), "arping_reply_bb9d1cbd")
}

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