enums_generated.go 13 KB

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