Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame] | 1 | // Copyright 2012 Google, Inc. All rights reserved. |
| 2 | |
| 3 | package 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 | |
| 8 | import ( |
| 9 | "fmt" |
| 10 | |
| 11 | "github.com/google/gopacket" |
| 12 | ) |
| 13 | |
| 14 | func 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. |
| 30 | func (a LinkType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 31 | return LinkTypeMetadata[a].DecodeWith.Decode(data, p) |
| 32 | } |
| 33 | |
| 34 | // String returns LinkTypeMetadata.Name. |
| 35 | func (a LinkType) String() string { |
| 36 | return LinkTypeMetadata[a].Name |
| 37 | } |
| 38 | |
| 39 | // LayerType returns LinkTypeMetadata.LayerType. |
| 40 | func (a LinkType) LayerType() gopacket.LayerType { |
| 41 | return LinkTypeMetadata[a].LayerType |
| 42 | } |
| 43 | |
| 44 | type errorDecoderForLinkType int |
| 45 | |
| 46 | func (a *errorDecoderForLinkType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 47 | return a |
| 48 | } |
| 49 | func (a *errorDecoderForLinkType) Error() string { |
| 50 | return fmt.Sprintf("Unable to decode LinkType %d", int(*a)) |
| 51 | } |
| 52 | |
| 53 | var errorDecodersForLinkType [256]errorDecoderForLinkType |
| 54 | var LinkTypeMetadata [256]EnumMetadata |
| 55 | |
| 56 | func 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. |
| 67 | func (a EthernetType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 68 | return EthernetTypeMetadata[a].DecodeWith.Decode(data, p) |
| 69 | } |
| 70 | |
| 71 | // String returns EthernetTypeMetadata.Name. |
| 72 | func (a EthernetType) String() string { |
| 73 | return EthernetTypeMetadata[a].Name |
| 74 | } |
| 75 | |
| 76 | // LayerType returns EthernetTypeMetadata.LayerType. |
| 77 | func (a EthernetType) LayerType() gopacket.LayerType { |
| 78 | return EthernetTypeMetadata[a].LayerType |
| 79 | } |
| 80 | |
| 81 | type errorDecoderForEthernetType int |
| 82 | |
| 83 | func (a *errorDecoderForEthernetType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 84 | return a |
| 85 | } |
| 86 | func (a *errorDecoderForEthernetType) Error() string { |
| 87 | return fmt.Sprintf("Unable to decode EthernetType %d", int(*a)) |
| 88 | } |
| 89 | |
| 90 | var errorDecodersForEthernetType [65536]errorDecoderForEthernetType |
| 91 | var EthernetTypeMetadata [65536]EnumMetadata |
| 92 | |
| 93 | func 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. |
| 104 | func (a PPPType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 105 | return PPPTypeMetadata[a].DecodeWith.Decode(data, p) |
| 106 | } |
| 107 | |
| 108 | // String returns PPPTypeMetadata.Name. |
| 109 | func (a PPPType) String() string { |
| 110 | return PPPTypeMetadata[a].Name |
| 111 | } |
| 112 | |
| 113 | // LayerType returns PPPTypeMetadata.LayerType. |
| 114 | func (a PPPType) LayerType() gopacket.LayerType { |
| 115 | return PPPTypeMetadata[a].LayerType |
| 116 | } |
| 117 | |
| 118 | type errorDecoderForPPPType int |
| 119 | |
| 120 | func (a *errorDecoderForPPPType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 121 | return a |
| 122 | } |
| 123 | func (a *errorDecoderForPPPType) Error() string { |
| 124 | return fmt.Sprintf("Unable to decode PPPType %d", int(*a)) |
| 125 | } |
| 126 | |
| 127 | var errorDecodersForPPPType [65536]errorDecoderForPPPType |
| 128 | var PPPTypeMetadata [65536]EnumMetadata |
| 129 | |
| 130 | func 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. |
| 141 | func (a IPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 142 | return IPProtocolMetadata[a].DecodeWith.Decode(data, p) |
| 143 | } |
| 144 | |
| 145 | // String returns IPProtocolMetadata.Name. |
| 146 | func (a IPProtocol) String() string { |
| 147 | return IPProtocolMetadata[a].Name |
| 148 | } |
| 149 | |
| 150 | // LayerType returns IPProtocolMetadata.LayerType. |
| 151 | func (a IPProtocol) LayerType() gopacket.LayerType { |
| 152 | return IPProtocolMetadata[a].LayerType |
| 153 | } |
| 154 | |
| 155 | type errorDecoderForIPProtocol int |
| 156 | |
| 157 | func (a *errorDecoderForIPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 158 | return a |
| 159 | } |
| 160 | func (a *errorDecoderForIPProtocol) Error() string { |
| 161 | return fmt.Sprintf("Unable to decode IPProtocol %d", int(*a)) |
| 162 | } |
| 163 | |
| 164 | var errorDecodersForIPProtocol [256]errorDecoderForIPProtocol |
| 165 | var IPProtocolMetadata [256]EnumMetadata |
| 166 | |
| 167 | func 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. |
| 178 | func (a SCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 179 | return SCTPChunkTypeMetadata[a].DecodeWith.Decode(data, p) |
| 180 | } |
| 181 | |
| 182 | // String returns SCTPChunkTypeMetadata.Name. |
| 183 | func (a SCTPChunkType) String() string { |
| 184 | return SCTPChunkTypeMetadata[a].Name |
| 185 | } |
| 186 | |
| 187 | // LayerType returns SCTPChunkTypeMetadata.LayerType. |
| 188 | func (a SCTPChunkType) LayerType() gopacket.LayerType { |
| 189 | return SCTPChunkTypeMetadata[a].LayerType |
| 190 | } |
| 191 | |
| 192 | type errorDecoderForSCTPChunkType int |
| 193 | |
| 194 | func (a *errorDecoderForSCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 195 | return a |
| 196 | } |
| 197 | func (a *errorDecoderForSCTPChunkType) Error() string { |
| 198 | return fmt.Sprintf("Unable to decode SCTPChunkType %d", int(*a)) |
| 199 | } |
| 200 | |
| 201 | var errorDecodersForSCTPChunkType [256]errorDecoderForSCTPChunkType |
| 202 | var SCTPChunkTypeMetadata [256]EnumMetadata |
| 203 | |
| 204 | func 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. |
| 215 | func (a PPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 216 | return PPPoECodeMetadata[a].DecodeWith.Decode(data, p) |
| 217 | } |
| 218 | |
| 219 | // String returns PPPoECodeMetadata.Name. |
| 220 | func (a PPPoECode) String() string { |
| 221 | return PPPoECodeMetadata[a].Name |
| 222 | } |
| 223 | |
| 224 | // LayerType returns PPPoECodeMetadata.LayerType. |
| 225 | func (a PPPoECode) LayerType() gopacket.LayerType { |
| 226 | return PPPoECodeMetadata[a].LayerType |
| 227 | } |
| 228 | |
| 229 | type errorDecoderForPPPoECode int |
| 230 | |
| 231 | func (a *errorDecoderForPPPoECode) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 232 | return a |
| 233 | } |
| 234 | func (a *errorDecoderForPPPoECode) Error() string { |
| 235 | return fmt.Sprintf("Unable to decode PPPoECode %d", int(*a)) |
| 236 | } |
| 237 | |
| 238 | var errorDecodersForPPPoECode [256]errorDecoderForPPPoECode |
| 239 | var PPPoECodeMetadata [256]EnumMetadata |
| 240 | |
| 241 | func 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. |
| 252 | func (a FDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 253 | return FDDIFrameControlMetadata[a].DecodeWith.Decode(data, p) |
| 254 | } |
| 255 | |
| 256 | // String returns FDDIFrameControlMetadata.Name. |
| 257 | func (a FDDIFrameControl) String() string { |
| 258 | return FDDIFrameControlMetadata[a].Name |
| 259 | } |
| 260 | |
| 261 | // LayerType returns FDDIFrameControlMetadata.LayerType. |
| 262 | func (a FDDIFrameControl) LayerType() gopacket.LayerType { |
| 263 | return FDDIFrameControlMetadata[a].LayerType |
| 264 | } |
| 265 | |
| 266 | type errorDecoderForFDDIFrameControl int |
| 267 | |
| 268 | func (a *errorDecoderForFDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 269 | return a |
| 270 | } |
| 271 | func (a *errorDecoderForFDDIFrameControl) Error() string { |
| 272 | return fmt.Sprintf("Unable to decode FDDIFrameControl %d", int(*a)) |
| 273 | } |
| 274 | |
| 275 | var errorDecodersForFDDIFrameControl [256]errorDecoderForFDDIFrameControl |
| 276 | var FDDIFrameControlMetadata [256]EnumMetadata |
| 277 | |
| 278 | func 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. |
| 289 | func (a EAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 290 | return EAPOLTypeMetadata[a].DecodeWith.Decode(data, p) |
| 291 | } |
| 292 | |
| 293 | // String returns EAPOLTypeMetadata.Name. |
| 294 | func (a EAPOLType) String() string { |
| 295 | return EAPOLTypeMetadata[a].Name |
| 296 | } |
| 297 | |
| 298 | // LayerType returns EAPOLTypeMetadata.LayerType. |
| 299 | func (a EAPOLType) LayerType() gopacket.LayerType { |
| 300 | return EAPOLTypeMetadata[a].LayerType |
| 301 | } |
| 302 | |
| 303 | type errorDecoderForEAPOLType int |
| 304 | |
| 305 | func (a *errorDecoderForEAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 306 | return a |
| 307 | } |
| 308 | func (a *errorDecoderForEAPOLType) Error() string { |
| 309 | return fmt.Sprintf("Unable to decode EAPOLType %d", int(*a)) |
| 310 | } |
| 311 | |
| 312 | var errorDecodersForEAPOLType [256]errorDecoderForEAPOLType |
| 313 | var EAPOLTypeMetadata [256]EnumMetadata |
| 314 | |
| 315 | func 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. |
| 326 | func (a ProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 327 | return ProtocolFamilyMetadata[a].DecodeWith.Decode(data, p) |
| 328 | } |
| 329 | |
| 330 | // String returns ProtocolFamilyMetadata.Name. |
| 331 | func (a ProtocolFamily) String() string { |
| 332 | return ProtocolFamilyMetadata[a].Name |
| 333 | } |
| 334 | |
| 335 | // LayerType returns ProtocolFamilyMetadata.LayerType. |
| 336 | func (a ProtocolFamily) LayerType() gopacket.LayerType { |
| 337 | return ProtocolFamilyMetadata[a].LayerType |
| 338 | } |
| 339 | |
| 340 | type errorDecoderForProtocolFamily int |
| 341 | |
| 342 | func (a *errorDecoderForProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 343 | return a |
| 344 | } |
| 345 | func (a *errorDecoderForProtocolFamily) Error() string { |
| 346 | return fmt.Sprintf("Unable to decode ProtocolFamily %d", int(*a)) |
| 347 | } |
| 348 | |
| 349 | var errorDecodersForProtocolFamily [256]errorDecoderForProtocolFamily |
| 350 | var ProtocolFamilyMetadata [256]EnumMetadata |
| 351 | |
| 352 | func 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. |
| 363 | func (a Dot11Type) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 364 | return Dot11TypeMetadata[a].DecodeWith.Decode(data, p) |
| 365 | } |
| 366 | |
| 367 | // String returns Dot11TypeMetadata.Name. |
| 368 | func (a Dot11Type) String() string { |
| 369 | return Dot11TypeMetadata[a].Name |
| 370 | } |
| 371 | |
| 372 | // LayerType returns Dot11TypeMetadata.LayerType. |
| 373 | func (a Dot11Type) LayerType() gopacket.LayerType { |
| 374 | return Dot11TypeMetadata[a].LayerType |
| 375 | } |
| 376 | |
| 377 | type errorDecoderForDot11Type int |
| 378 | |
| 379 | func (a *errorDecoderForDot11Type) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 380 | return a |
| 381 | } |
| 382 | func (a *errorDecoderForDot11Type) Error() string { |
| 383 | return fmt.Sprintf("Unable to decode Dot11Type %d", int(*a)) |
| 384 | } |
| 385 | |
| 386 | var errorDecodersForDot11Type [256]errorDecoderForDot11Type |
| 387 | var Dot11TypeMetadata [256]EnumMetadata |
| 388 | |
| 389 | func 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. |
| 400 | func (a USBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 401 | return USBTransportTypeMetadata[a].DecodeWith.Decode(data, p) |
| 402 | } |
| 403 | |
| 404 | // String returns USBTransportTypeMetadata.Name. |
| 405 | func (a USBTransportType) String() string { |
| 406 | return USBTransportTypeMetadata[a].Name |
| 407 | } |
| 408 | |
| 409 | // LayerType returns USBTransportTypeMetadata.LayerType. |
| 410 | func (a USBTransportType) LayerType() gopacket.LayerType { |
| 411 | return USBTransportTypeMetadata[a].LayerType |
| 412 | } |
| 413 | |
| 414 | type errorDecoderForUSBTransportType int |
| 415 | |
| 416 | func (a *errorDecoderForUSBTransportType) Decode(data []byte, p gopacket.PacketBuilder) error { |
| 417 | return a |
| 418 | } |
| 419 | func (a *errorDecoderForUSBTransportType) Error() string { |
| 420 | return fmt.Sprintf("Unable to decode USBTransportType %d", int(*a)) |
| 421 | } |
| 422 | |
| 423 | var errorDecodersForUSBTransportType [256]errorDecoderForUSBTransportType |
| 424 | var USBTransportTypeMetadata [256]EnumMetadata |
| 425 | |
| 426 | func 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 | } |