blob: bf77aac5013865b9011101b521a8f6fed635a9d4 [file] [log] [blame]
Naveen Sampath04696f72022-06-13 15:19:14 +05301// Copyright 2012 Google, Inc. All rights reserved.
2
3package layers
4
5// Created by gen2.go, don't edit manually
6// Generated at 2017-10-23 10:20:24.458771856 -0600 MDT m=+0.001159033
7
8import (
9 "fmt"
10
11 "github.com/google/gopacket"
12)
13
14func init() {
15 initUnknownTypesForLinkType()
16 initUnknownTypesForEthernetType()
17 initUnknownTypesForPPPType()
18 initUnknownTypesForIPProtocol()
19 initUnknownTypesForSCTPChunkType()
20 initUnknownTypesForPPPoECode()
21 initUnknownTypesForFDDIFrameControl()
22 initUnknownTypesForEAPOLType()
23 initUnknownTypesForProtocolFamily()
24 initUnknownTypesForDot11Type()
25 initUnknownTypesForUSBTransportType()
26 initActualTypeData()
27}
28
29// Decoder calls LinkTypeMetadata.DecodeWith's decoder.
30func (a LinkType) Decode(data []byte, p gopacket.PacketBuilder) error {
31 return LinkTypeMetadata[a].DecodeWith.Decode(data, p)
32}
33
34// String returns LinkTypeMetadata.Name.
35func (a LinkType) String() string {
36 return LinkTypeMetadata[a].Name
37}
38
39// LayerType returns LinkTypeMetadata.LayerType.
40func (a LinkType) LayerType() gopacket.LayerType {
41 return LinkTypeMetadata[a].LayerType
42}
43
44type errorDecoderForLinkType int
45
46func (a *errorDecoderForLinkType) Decode(data []byte, p gopacket.PacketBuilder) error {
47 return a
48}
49func (a *errorDecoderForLinkType) Error() string {
50 return fmt.Sprintf("Unable to decode LinkType %d", int(*a))
51}
52
53var errorDecodersForLinkType [256]errorDecoderForLinkType
54var LinkTypeMetadata [256]EnumMetadata
55
56func initUnknownTypesForLinkType() {
57 for i := 0; i < 256; i++ {
58 errorDecodersForLinkType[i] = errorDecoderForLinkType(i)
59 LinkTypeMetadata[i] = EnumMetadata{
60 DecodeWith: &errorDecodersForLinkType[i],
61 Name: "UnknownLinkType",
62 }
63 }
64}
65
66// Decoder calls EthernetTypeMetadata.DecodeWith's decoder.
67func (a EthernetType) Decode(data []byte, p gopacket.PacketBuilder) error {
68 return EthernetTypeMetadata[a].DecodeWith.Decode(data, p)
69}
70
71// String returns EthernetTypeMetadata.Name.
72func (a EthernetType) String() string {
73 return EthernetTypeMetadata[a].Name
74}
75
76// LayerType returns EthernetTypeMetadata.LayerType.
77func (a EthernetType) LayerType() gopacket.LayerType {
78 return EthernetTypeMetadata[a].LayerType
79}
80
81type errorDecoderForEthernetType int
82
83func (a *errorDecoderForEthernetType) Decode(data []byte, p gopacket.PacketBuilder) error {
84 return a
85}
86func (a *errorDecoderForEthernetType) Error() string {
87 return fmt.Sprintf("Unable to decode EthernetType %d", int(*a))
88}
89
90var errorDecodersForEthernetType [65536]errorDecoderForEthernetType
91var EthernetTypeMetadata [65536]EnumMetadata
92
93func initUnknownTypesForEthernetType() {
94 for i := 0; i < 65536; i++ {
95 errorDecodersForEthernetType[i] = errorDecoderForEthernetType(i)
96 EthernetTypeMetadata[i] = EnumMetadata{
97 DecodeWith: &errorDecodersForEthernetType[i],
98 Name: "UnknownEthernetType",
99 }
100 }
101}
102
103// Decoder calls PPPTypeMetadata.DecodeWith's decoder.
104func (a PPPType) Decode(data []byte, p gopacket.PacketBuilder) error {
105 return PPPTypeMetadata[a].DecodeWith.Decode(data, p)
106}
107
108// String returns PPPTypeMetadata.Name.
109func (a PPPType) String() string {
110 return PPPTypeMetadata[a].Name
111}
112
113// LayerType returns PPPTypeMetadata.LayerType.
114func (a PPPType) LayerType() gopacket.LayerType {
115 return PPPTypeMetadata[a].LayerType
116}
117
118type errorDecoderForPPPType int
119
120func (a *errorDecoderForPPPType) Decode(data []byte, p gopacket.PacketBuilder) error {
121 return a
122}
123func (a *errorDecoderForPPPType) Error() string {
124 return fmt.Sprintf("Unable to decode PPPType %d", int(*a))
125}
126
127var errorDecodersForPPPType [65536]errorDecoderForPPPType
128var PPPTypeMetadata [65536]EnumMetadata
129
130func initUnknownTypesForPPPType() {
131 for i := 0; i < 65536; i++ {
132 errorDecodersForPPPType[i] = errorDecoderForPPPType(i)
133 PPPTypeMetadata[i] = EnumMetadata{
134 DecodeWith: &errorDecodersForPPPType[i],
135 Name: "UnknownPPPType",
136 }
137 }
138}
139
140// Decoder calls IPProtocolMetadata.DecodeWith's decoder.
141func (a IPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error {
142 return IPProtocolMetadata[a].DecodeWith.Decode(data, p)
143}
144
145// String returns IPProtocolMetadata.Name.
146func (a IPProtocol) String() string {
147 return IPProtocolMetadata[a].Name
148}
149
150// LayerType returns IPProtocolMetadata.LayerType.
151func (a IPProtocol) LayerType() gopacket.LayerType {
152 return IPProtocolMetadata[a].LayerType
153}
154
155type errorDecoderForIPProtocol int
156
157func (a *errorDecoderForIPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error {
158 return a
159}
160func (a *errorDecoderForIPProtocol) Error() string {
161 return fmt.Sprintf("Unable to decode IPProtocol %d", int(*a))
162}
163
164var errorDecodersForIPProtocol [256]errorDecoderForIPProtocol
165var IPProtocolMetadata [256]EnumMetadata
166
167func initUnknownTypesForIPProtocol() {
168 for i := 0; i < 256; i++ {
169 errorDecodersForIPProtocol[i] = errorDecoderForIPProtocol(i)
170 IPProtocolMetadata[i] = EnumMetadata{
171 DecodeWith: &errorDecodersForIPProtocol[i],
172 Name: "UnknownIPProtocol",
173 }
174 }
175}
176
177// Decoder calls SCTPChunkTypeMetadata.DecodeWith's decoder.
178func (a SCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error {
179 return SCTPChunkTypeMetadata[a].DecodeWith.Decode(data, p)
180}
181
182// String returns SCTPChunkTypeMetadata.Name.
183func (a SCTPChunkType) String() string {
184 return SCTPChunkTypeMetadata[a].Name
185}
186
187// LayerType returns SCTPChunkTypeMetadata.LayerType.
188func (a SCTPChunkType) LayerType() gopacket.LayerType {
189 return SCTPChunkTypeMetadata[a].LayerType
190}
191
192type errorDecoderForSCTPChunkType int
193
194func (a *errorDecoderForSCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error {
195 return a
196}
197func (a *errorDecoderForSCTPChunkType) Error() string {
198 return fmt.Sprintf("Unable to decode SCTPChunkType %d", int(*a))
199}
200
201var errorDecodersForSCTPChunkType [256]errorDecoderForSCTPChunkType
202var SCTPChunkTypeMetadata [256]EnumMetadata
203
204func initUnknownTypesForSCTPChunkType() {
205 for i := 0; i < 256; i++ {
206 errorDecodersForSCTPChunkType[i] = errorDecoderForSCTPChunkType(i)
207 SCTPChunkTypeMetadata[i] = EnumMetadata{
208 DecodeWith: &errorDecodersForSCTPChunkType[i],
209 Name: "UnknownSCTPChunkType",
210 }
211 }
212}
213
214// Decoder calls PPPoECodeMetadata.DecodeWith's decoder.
215func (a PPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error {
216 return PPPoECodeMetadata[a].DecodeWith.Decode(data, p)
217}
218
219// String returns PPPoECodeMetadata.Name.
220func (a PPPoECode) String() string {
221 return PPPoECodeMetadata[a].Name
222}
223
224// LayerType returns PPPoECodeMetadata.LayerType.
225func (a PPPoECode) LayerType() gopacket.LayerType {
226 return PPPoECodeMetadata[a].LayerType
227}
228
229type errorDecoderForPPPoECode int
230
231func (a *errorDecoderForPPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error {
232 return a
233}
234func (a *errorDecoderForPPPoECode) Error() string {
235 return fmt.Sprintf("Unable to decode PPPoECode %d", int(*a))
236}
237
238var errorDecodersForPPPoECode [256]errorDecoderForPPPoECode
239var PPPoECodeMetadata [256]EnumMetadata
240
241func initUnknownTypesForPPPoECode() {
242 for i := 0; i < 256; i++ {
243 errorDecodersForPPPoECode[i] = errorDecoderForPPPoECode(i)
244 PPPoECodeMetadata[i] = EnumMetadata{
245 DecodeWith: &errorDecodersForPPPoECode[i],
246 Name: "UnknownPPPoECode",
247 }
248 }
249}
250
251// Decoder calls FDDIFrameControlMetadata.DecodeWith's decoder.
252func (a FDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error {
253 return FDDIFrameControlMetadata[a].DecodeWith.Decode(data, p)
254}
255
256// String returns FDDIFrameControlMetadata.Name.
257func (a FDDIFrameControl) String() string {
258 return FDDIFrameControlMetadata[a].Name
259}
260
261// LayerType returns FDDIFrameControlMetadata.LayerType.
262func (a FDDIFrameControl) LayerType() gopacket.LayerType {
263 return FDDIFrameControlMetadata[a].LayerType
264}
265
266type errorDecoderForFDDIFrameControl int
267
268func (a *errorDecoderForFDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error {
269 return a
270}
271func (a *errorDecoderForFDDIFrameControl) Error() string {
272 return fmt.Sprintf("Unable to decode FDDIFrameControl %d", int(*a))
273}
274
275var errorDecodersForFDDIFrameControl [256]errorDecoderForFDDIFrameControl
276var FDDIFrameControlMetadata [256]EnumMetadata
277
278func initUnknownTypesForFDDIFrameControl() {
279 for i := 0; i < 256; i++ {
280 errorDecodersForFDDIFrameControl[i] = errorDecoderForFDDIFrameControl(i)
281 FDDIFrameControlMetadata[i] = EnumMetadata{
282 DecodeWith: &errorDecodersForFDDIFrameControl[i],
283 Name: "UnknownFDDIFrameControl",
284 }
285 }
286}
287
288// Decoder calls EAPOLTypeMetadata.DecodeWith's decoder.
289func (a EAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error {
290 return EAPOLTypeMetadata[a].DecodeWith.Decode(data, p)
291}
292
293// String returns EAPOLTypeMetadata.Name.
294func (a EAPOLType) String() string {
295 return EAPOLTypeMetadata[a].Name
296}
297
298// LayerType returns EAPOLTypeMetadata.LayerType.
299func (a EAPOLType) LayerType() gopacket.LayerType {
300 return EAPOLTypeMetadata[a].LayerType
301}
302
303type errorDecoderForEAPOLType int
304
305func (a *errorDecoderForEAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error {
306 return a
307}
308func (a *errorDecoderForEAPOLType) Error() string {
309 return fmt.Sprintf("Unable to decode EAPOLType %d", int(*a))
310}
311
312var errorDecodersForEAPOLType [256]errorDecoderForEAPOLType
313var EAPOLTypeMetadata [256]EnumMetadata
314
315func initUnknownTypesForEAPOLType() {
316 for i := 0; i < 256; i++ {
317 errorDecodersForEAPOLType[i] = errorDecoderForEAPOLType(i)
318 EAPOLTypeMetadata[i] = EnumMetadata{
319 DecodeWith: &errorDecodersForEAPOLType[i],
320 Name: "UnknownEAPOLType",
321 }
322 }
323}
324
325// Decoder calls ProtocolFamilyMetadata.DecodeWith's decoder.
326func (a ProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error {
327 return ProtocolFamilyMetadata[a].DecodeWith.Decode(data, p)
328}
329
330// String returns ProtocolFamilyMetadata.Name.
331func (a ProtocolFamily) String() string {
332 return ProtocolFamilyMetadata[a].Name
333}
334
335// LayerType returns ProtocolFamilyMetadata.LayerType.
336func (a ProtocolFamily) LayerType() gopacket.LayerType {
337 return ProtocolFamilyMetadata[a].LayerType
338}
339
340type errorDecoderForProtocolFamily int
341
342func (a *errorDecoderForProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error {
343 return a
344}
345func (a *errorDecoderForProtocolFamily) Error() string {
346 return fmt.Sprintf("Unable to decode ProtocolFamily %d", int(*a))
347}
348
349var errorDecodersForProtocolFamily [256]errorDecoderForProtocolFamily
350var ProtocolFamilyMetadata [256]EnumMetadata
351
352func initUnknownTypesForProtocolFamily() {
353 for i := 0; i < 256; i++ {
354 errorDecodersForProtocolFamily[i] = errorDecoderForProtocolFamily(i)
355 ProtocolFamilyMetadata[i] = EnumMetadata{
356 DecodeWith: &errorDecodersForProtocolFamily[i],
357 Name: "UnknownProtocolFamily",
358 }
359 }
360}
361
362// Decoder calls Dot11TypeMetadata.DecodeWith's decoder.
363func (a Dot11Type) Decode(data []byte, p gopacket.PacketBuilder) error {
364 return Dot11TypeMetadata[a].DecodeWith.Decode(data, p)
365}
366
367// String returns Dot11TypeMetadata.Name.
368func (a Dot11Type) String() string {
369 return Dot11TypeMetadata[a].Name
370}
371
372// LayerType returns Dot11TypeMetadata.LayerType.
373func (a Dot11Type) LayerType() gopacket.LayerType {
374 return Dot11TypeMetadata[a].LayerType
375}
376
377type errorDecoderForDot11Type int
378
379func (a *errorDecoderForDot11Type) Decode(data []byte, p gopacket.PacketBuilder) error {
380 return a
381}
382func (a *errorDecoderForDot11Type) Error() string {
383 return fmt.Sprintf("Unable to decode Dot11Type %d", int(*a))
384}
385
386var errorDecodersForDot11Type [256]errorDecoderForDot11Type
387var Dot11TypeMetadata [256]EnumMetadata
388
389func initUnknownTypesForDot11Type() {
390 for i := 0; i < 256; i++ {
391 errorDecodersForDot11Type[i] = errorDecoderForDot11Type(i)
392 Dot11TypeMetadata[i] = EnumMetadata{
393 DecodeWith: &errorDecodersForDot11Type[i],
394 Name: "UnknownDot11Type",
395 }
396 }
397}
398
399// Decoder calls USBTransportTypeMetadata.DecodeWith's decoder.
400func (a USBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error {
401 return USBTransportTypeMetadata[a].DecodeWith.Decode(data, p)
402}
403
404// String returns USBTransportTypeMetadata.Name.
405func (a USBTransportType) String() string {
406 return USBTransportTypeMetadata[a].Name
407}
408
409// LayerType returns USBTransportTypeMetadata.LayerType.
410func (a USBTransportType) LayerType() gopacket.LayerType {
411 return USBTransportTypeMetadata[a].LayerType
412}
413
414type errorDecoderForUSBTransportType int
415
416func (a *errorDecoderForUSBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error {
417 return a
418}
419func (a *errorDecoderForUSBTransportType) Error() string {
420 return fmt.Sprintf("Unable to decode USBTransportType %d", int(*a))
421}
422
423var errorDecodersForUSBTransportType [256]errorDecoderForUSBTransportType
424var USBTransportTypeMetadata [256]EnumMetadata
425
426func initUnknownTypesForUSBTransportType() {
427 for i := 0; i < 256; i++ {
428 errorDecodersForUSBTransportType[i] = errorDecoderForUSBTransportType(i)
429 USBTransportTypeMetadata[i] = EnumMetadata{
430 DecodeWith: &errorDecodersForUSBTransportType[i],
431 Name: "UnknownUSBTransportType",
432 }
433 }
434}