github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/stn/stn.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/stn.api.json 6 7 // Package stn contains generated bindings for API file stn.api. 8 // 9 // Contents: 10 // - 4 messages 11 package stn 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 = "stn" 28 APIVersion = "2.0.0" 29 VersionCrc = 0x9cfaef64 30 ) 31 32 // Add/del STN rules 33 // - ip_address - STN rule IP address 34 // - sw_if_index - Interface index 35 // - is_add - 1 if add, 0 if delete 36 // 37 // StnAddDelRule defines message 'stn_add_del_rule'. 38 type StnAddDelRule struct { 39 IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` 40 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 41 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 42 } 43 44 func (m *StnAddDelRule) Reset() { *m = StnAddDelRule{} } 45 func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" } 46 func (*StnAddDelRule) GetCrcString() string { return "224c6edd" } 47 func (*StnAddDelRule) GetMessageType() api.MessageType { 48 return api.RequestMessage 49 } 50 51 func (m *StnAddDelRule) Size() (size int) { 52 if m == nil { 53 return 0 54 } 55 size += 1 // m.IPAddress.Af 56 size += 1 * 16 // m.IPAddress.Un 57 size += 4 // m.SwIfIndex 58 size += 1 // m.IsAdd 59 return size 60 } 61 func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) { 62 if b == nil { 63 b = make([]byte, m.Size()) 64 } 65 buf := codec.NewBuffer(b) 66 buf.EncodeUint8(uint8(m.IPAddress.Af)) 67 buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16) 68 buf.EncodeUint32(uint32(m.SwIfIndex)) 69 buf.EncodeBool(m.IsAdd) 70 return buf.Bytes(), nil 71 } 72 func (m *StnAddDelRule) Unmarshal(b []byte) error { 73 buf := codec.NewBuffer(b) 74 m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) 75 copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 76 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 77 m.IsAdd = buf.DecodeBool() 78 return nil 79 } 80 81 // StnAddDelRuleReply defines message 'stn_add_del_rule_reply'. 82 type StnAddDelRuleReply struct { 83 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 84 } 85 86 func (m *StnAddDelRuleReply) Reset() { *m = StnAddDelRuleReply{} } 87 func (*StnAddDelRuleReply) GetMessageName() string { return "stn_add_del_rule_reply" } 88 func (*StnAddDelRuleReply) GetCrcString() string { return "e8d4e804" } 89 func (*StnAddDelRuleReply) GetMessageType() api.MessageType { 90 return api.ReplyMessage 91 } 92 93 func (m *StnAddDelRuleReply) Size() (size int) { 94 if m == nil { 95 return 0 96 } 97 size += 4 // m.Retval 98 return size 99 } 100 func (m *StnAddDelRuleReply) Marshal(b []byte) ([]byte, error) { 101 if b == nil { 102 b = make([]byte, m.Size()) 103 } 104 buf := codec.NewBuffer(b) 105 buf.EncodeInt32(m.Retval) 106 return buf.Bytes(), nil 107 } 108 func (m *StnAddDelRuleReply) Unmarshal(b []byte) error { 109 buf := codec.NewBuffer(b) 110 m.Retval = buf.DecodeInt32() 111 return nil 112 } 113 114 // STN response to rules request 115 // - is_ip4 - 1 if address type is IPv4 116 // - ip_address - IP address 117 // - sw_if_index - Interface index 118 // 119 // StnRulesDetails defines message 'stn_rules_details'. 120 type StnRulesDetails struct { 121 IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` 122 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 123 } 124 125 func (m *StnRulesDetails) Reset() { *m = StnRulesDetails{} } 126 func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" } 127 func (*StnRulesDetails) GetCrcString() string { return "a51935a6" } 128 func (*StnRulesDetails) GetMessageType() api.MessageType { 129 return api.ReplyMessage 130 } 131 132 func (m *StnRulesDetails) Size() (size int) { 133 if m == nil { 134 return 0 135 } 136 size += 1 // m.IPAddress.Af 137 size += 1 * 16 // m.IPAddress.Un 138 size += 4 // m.SwIfIndex 139 return size 140 } 141 func (m *StnRulesDetails) Marshal(b []byte) ([]byte, error) { 142 if b == nil { 143 b = make([]byte, m.Size()) 144 } 145 buf := codec.NewBuffer(b) 146 buf.EncodeUint8(uint8(m.IPAddress.Af)) 147 buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16) 148 buf.EncodeUint32(uint32(m.SwIfIndex)) 149 return buf.Bytes(), nil 150 } 151 func (m *StnRulesDetails) Unmarshal(b []byte) error { 152 buf := codec.NewBuffer(b) 153 m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) 154 copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 155 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 156 return nil 157 } 158 159 // Dump STN rules 160 // StnRulesDump defines message 'stn_rules_dump'. 161 type StnRulesDump struct{} 162 163 func (m *StnRulesDump) Reset() { *m = StnRulesDump{} } 164 func (*StnRulesDump) GetMessageName() string { return "stn_rules_dump" } 165 func (*StnRulesDump) GetCrcString() string { return "51077d14" } 166 func (*StnRulesDump) GetMessageType() api.MessageType { 167 return api.RequestMessage 168 } 169 170 func (m *StnRulesDump) Size() (size int) { 171 if m == nil { 172 return 0 173 } 174 return size 175 } 176 func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) { 177 if b == nil { 178 b = make([]byte, m.Size()) 179 } 180 buf := codec.NewBuffer(b) 181 return buf.Bytes(), nil 182 } 183 func (m *StnRulesDump) Unmarshal(b []byte) error { 184 return nil 185 } 186 187 func init() { file_stn_binapi_init() } 188 func file_stn_binapi_init() { 189 api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_224c6edd") 190 api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804") 191 api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_a51935a6") 192 api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14") 193 } 194 195 // Messages returns list of all messages in this module. 196 func AllMessages() []api.Message { 197 return []api.Message{ 198 (*StnAddDelRule)(nil), 199 (*StnAddDelRuleReply)(nil), 200 (*StnRulesDetails)(nil), 201 (*StnRulesDump)(nil), 202 } 203 }