1 // Copyright 2014 Google, Inc. All rights reserved.
3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the LICENSE file in the root of the source
7 // See http://standards.ieee.org/findstds/standard/802.11-2012.html for info on
8 // all of the layers in this file.
19 "github.com/google/gopacket"
22 // Dot11Flags contains the set of 8 flags in the IEEE 802.11 frame control
23 // header, all in one place.
27 Dot11FlagsToDS Dot11Flags = 1 << iota
31 Dot11FlagsPowerManagement
37 func (d Dot11Flags) ToDS() bool {
38 return d&Dot11FlagsToDS != 0
40 func (d Dot11Flags) FromDS() bool {
41 return d&Dot11FlagsFromDS != 0
43 func (d Dot11Flags) MF() bool {
44 return d&Dot11FlagsMF != 0
46 func (d Dot11Flags) Retry() bool {
47 return d&Dot11FlagsRetry != 0
49 func (d Dot11Flags) PowerManagement() bool {
50 return d&Dot11FlagsPowerManagement != 0
52 func (d Dot11Flags) MD() bool {
53 return d&Dot11FlagsMD != 0
55 func (d Dot11Flags) WEP() bool {
56 return d&Dot11FlagsWEP != 0
58 func (d Dot11Flags) Order() bool {
59 return d&Dot11FlagsOrder != 0
62 // String provides a human readable string for Dot11Flags.
63 // This string is possibly subject to change over time; if you're storing this
64 // persistently, you should probably store the Dot11Flags value, not its string.
65 func (a Dot11Flags) String() string {
68 out.WriteString("TO-DS,")
71 out.WriteString("FROM-DS,")
74 out.WriteString("MF,")
77 out.WriteString("Retry,")
79 if a.PowerManagement() {
80 out.WriteString("PowerManagement,")
83 out.WriteString("MD,")
86 out.WriteString("WEP,")
89 out.WriteString("Order,")
92 if length := out.Len(); length > 0 {
93 return string(out.Bytes()[:length-1]) // strip final comma
98 type Dot11Reason uint16
100 // TODO: Verify these reasons, and append more reasons if necessary.
103 Dot11ReasonReserved Dot11Reason = 1
104 Dot11ReasonUnspecified Dot11Reason = 2
105 Dot11ReasonAuthExpired Dot11Reason = 3
106 Dot11ReasonDeauthStLeaving Dot11Reason = 4
107 Dot11ReasonInactivity Dot11Reason = 5
108 Dot11ReasonApFull Dot11Reason = 6
109 Dot11ReasonClass2FromNonAuth Dot11Reason = 7
110 Dot11ReasonClass3FromNonAss Dot11Reason = 8
111 Dot11ReasonDisasStLeaving Dot11Reason = 9
112 Dot11ReasonStNotAuth Dot11Reason = 10
115 // String provides a human readable string for Dot11Reason.
116 // This string is possibly subject to change over time; if you're storing this
117 // persistently, you should probably store the Dot11Reason value, not its string.
118 func (a Dot11Reason) String() string {
120 case Dot11ReasonReserved:
122 case Dot11ReasonUnspecified:
124 case Dot11ReasonAuthExpired:
125 return "Auth. expired"
126 case Dot11ReasonDeauthStLeaving:
127 return "Deauth. st. leaving"
128 case Dot11ReasonInactivity:
130 case Dot11ReasonApFull:
132 case Dot11ReasonClass2FromNonAuth:
133 return "Class2 from non auth."
134 case Dot11ReasonClass3FromNonAss:
135 return "Class3 from non ass."
136 case Dot11ReasonDisasStLeaving:
137 return "Disass st. leaving"
138 case Dot11ReasonStNotAuth:
139 return "St. not auth."
141 return "Unknown reason"
145 type Dot11Status uint16
148 Dot11StatusSuccess Dot11Status = 0
149 Dot11StatusFailure Dot11Status = 1 // Unspecified failure
150 Dot11StatusCannotSupportAllCapabilities Dot11Status = 10 // Cannot support all requested capabilities in the Capability Information field
151 Dot11StatusInabilityExistsAssociation Dot11Status = 11 // Reassociation denied due to inability to confirm that association exists
152 Dot11StatusAssociationDenied Dot11Status = 12 // Association denied due to reason outside the scope of this standard
153 Dot11StatusAlgorithmUnsupported Dot11Status = 13 // Responding station does not support the specified authentication algorithm
154 Dot11StatusOufOfExpectedSequence Dot11Status = 14 // Received an Authentication frame with authentication transaction sequence number out of expected sequence
155 Dot11StatusChallengeFailure Dot11Status = 15 // Authentication rejected because of challenge failure
156 Dot11StatusTimeout Dot11Status = 16 // Authentication rejected due to timeout waiting for next frame in sequence
157 Dot11StatusAPUnableToHandle Dot11Status = 17 // Association denied because AP is unable to handle additional associated stations
158 Dot11StatusRateUnsupported Dot11Status = 18 // Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter
161 // String provides a human readable string for Dot11Status.
162 // This string is possibly subject to change over time; if you're storing this
163 // persistently, you should probably store the Dot11Status value, not its string.
164 func (a Dot11Status) String() string {
166 case Dot11StatusSuccess:
168 case Dot11StatusFailure:
170 case Dot11StatusCannotSupportAllCapabilities:
171 return "cannot-support-all-capabilities"
172 case Dot11StatusInabilityExistsAssociation:
173 return "inability-exists-association"
174 case Dot11StatusAssociationDenied:
175 return "association-denied"
176 case Dot11StatusAlgorithmUnsupported:
177 return "algorithm-unsupported"
178 case Dot11StatusOufOfExpectedSequence:
179 return "out-of-expected-sequence"
180 case Dot11StatusChallengeFailure:
181 return "challenge-failure"
182 case Dot11StatusTimeout:
184 case Dot11StatusAPUnableToHandle:
185 return "ap-unable-to-handle"
186 case Dot11StatusRateUnsupported:
187 return "rate-unsupported"
189 return "unknown status"
193 type Dot11AckPolicy uint8
196 Dot11AckPolicyNormal Dot11AckPolicy = 0
197 Dot11AckPolicyNone Dot11AckPolicy = 1
198 Dot11AckPolicyNoExplicit Dot11AckPolicy = 2
199 Dot11AckPolicyBlock Dot11AckPolicy = 3
202 // String provides a human readable string for Dot11AckPolicy.
203 // This string is possibly subject to change over time; if you're storing this
204 // persistently, you should probably store the Dot11AckPolicy value, not its string.
205 func (a Dot11AckPolicy) String() string {
207 case Dot11AckPolicyNormal:
209 case Dot11AckPolicyNone:
211 case Dot11AckPolicyNoExplicit:
212 return "no-explicit-ack"
213 case Dot11AckPolicyBlock:
216 return "unknown-ack-policy"
220 type Dot11Algorithm uint16
223 Dot11AlgorithmOpen Dot11Algorithm = 0
224 Dot11AlgorithmSharedKey Dot11Algorithm = 1
227 // String provides a human readable string for Dot11Algorithm.
228 // This string is possibly subject to change over time; if you're storing this
229 // persistently, you should probably store the Dot11Algorithm value, not its string.
230 func (a Dot11Algorithm) String() string {
232 case Dot11AlgorithmOpen:
234 case Dot11AlgorithmSharedKey:
237 return "unknown-algorithm"
241 type Dot11InformationElementID uint8
243 // TODO: Verify these element ids, and append more ids if more.
246 Dot11InformationElementIDSSID Dot11InformationElementID = 0
247 Dot11InformationElementIDRates Dot11InformationElementID = 1
248 Dot11InformationElementIDFHSet Dot11InformationElementID = 2
249 Dot11InformationElementIDDSSet Dot11InformationElementID = 3
250 Dot11InformationElementIDCFSet Dot11InformationElementID = 4
251 Dot11InformationElementIDTIM Dot11InformationElementID = 5
252 Dot11InformationElementIDIBSSSet Dot11InformationElementID = 6
253 Dot11InformationElementIDChallenge Dot11InformationElementID = 16
254 Dot11InformationElementIDERPInfo Dot11InformationElementID = 42
255 Dot11InformationElementIDQOSCapability Dot11InformationElementID = 46
256 Dot11InformationElementIDERPInfo2 Dot11InformationElementID = 47
257 Dot11InformationElementIDRSNInfo Dot11InformationElementID = 48
258 Dot11InformationElementIDESRates Dot11InformationElementID = 50
259 Dot11InformationElementIDVendor Dot11InformationElementID = 221
260 Dot11InformationElementIDReserved Dot11InformationElementID = 68
263 // String provides a human readable string for Dot11InformationElementID.
264 // This string is possibly subject to change over time; if you're storing this
265 // persistently, you should probably store the Dot11InformationElementID value,
267 func (a Dot11InformationElementID) String() string {
269 case Dot11InformationElementIDSSID:
271 case Dot11InformationElementIDRates:
273 case Dot11InformationElementIDFHSet:
275 case Dot11InformationElementIDDSSet:
277 case Dot11InformationElementIDCFSet:
279 case Dot11InformationElementIDTIM:
281 case Dot11InformationElementIDIBSSSet:
283 case Dot11InformationElementIDChallenge:
285 case Dot11InformationElementIDERPInfo:
287 case Dot11InformationElementIDQOSCapability:
288 return "QOS capability"
289 case Dot11InformationElementIDERPInfo2:
291 case Dot11InformationElementIDRSNInfo:
293 case Dot11InformationElementIDESRates:
295 case Dot11InformationElementIDVendor:
297 case Dot11InformationElementIDReserved:
300 return "Unknown information element id"
304 // Dot11 provides an IEEE 802.11 base packet header.
305 // See http://standards.ieee.org/findstds/standard/802.11-2012.html
306 // for excrutiating detail.
313 Address1 net.HardwareAddr
314 Address2 net.HardwareAddr
315 Address3 net.HardwareAddr
316 Address4 net.HardwareAddr
317 SequenceNumber uint16
318 FragmentNumber uint16
322 func decodeDot11(data []byte, p gopacket.PacketBuilder) error {
324 return decodingLayerDecoder(d, data, p)
327 func (m *Dot11) LayerType() gopacket.LayerType { return LayerTypeDot11 }
328 func (m *Dot11) CanDecode() gopacket.LayerClass { return LayerTypeDot11 }
329 func (m *Dot11) NextLayerType() gopacket.LayerType {
331 return (LayerTypeDot11WEP)
334 return m.Type.LayerType()
337 func (m *Dot11) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
340 return fmt.Errorf("Dot11 length %v too short, %v required", len(data), 10)
342 m.Type = Dot11Type((data[0])&0xFC) >> 2
344 m.Proto = uint8(data[0]) & 0x0003
345 m.Flags = Dot11Flags(data[1])
346 m.DurationID = binary.LittleEndian.Uint16(data[2:4])
347 m.Address1 = net.HardwareAddr(data[4:10])
351 mainType := m.Type.MainType()
356 case Dot11TypeCtrlRTS, Dot11TypeCtrlPowersavePoll, Dot11TypeCtrlCFEnd, Dot11TypeCtrlCFEndAck:
357 if len(data) < offset+6 {
359 return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6)
361 m.Address2 = net.HardwareAddr(data[offset : offset+6])
364 case Dot11TypeMgmt, Dot11TypeData:
365 if len(data) < offset+14 {
367 return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+14)
369 m.Address2 = net.HardwareAddr(data[offset : offset+6])
371 m.Address3 = net.HardwareAddr(data[offset : offset+6])
374 m.SequenceNumber = (binary.LittleEndian.Uint16(data[offset:offset+2]) & 0xFFF0) >> 4
375 m.FragmentNumber = (binary.LittleEndian.Uint16(data[offset:offset+2]) & 0x000F)
379 if mainType == Dot11TypeData && m.Flags.FromDS() && m.Flags.ToDS() {
380 if len(data) < offset+6 {
382 return fmt.Errorf("Dot11 length %v too short, %v required", len(data), offset+6)
384 m.Address4 = net.HardwareAddr(data[offset : offset+6])
388 m.BaseLayer = BaseLayer{Contents: data[0:offset], Payload: data[offset : len(data)-4]}
389 m.Checksum = binary.LittleEndian.Uint32(data[len(data)-4 : len(data)])
393 func (m *Dot11) ChecksumValid() bool {
394 // only for CTRL and MGMT frames
398 return m.Checksum == h.Sum32()
401 func (m Dot11) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
402 buf, err := b.PrependBytes(24)
408 buf[0] = (uint8(m.Type) << 2) | m.Proto
409 buf[1] = uint8(m.Flags)
411 binary.LittleEndian.PutUint16(buf[2:4], m.DurationID)
413 copy(buf[4:10], m.Address1)
417 switch m.Type.MainType() {
420 case Dot11TypeCtrlRTS, Dot11TypeCtrlPowersavePoll, Dot11TypeCtrlCFEnd, Dot11TypeCtrlCFEndAck:
421 copy(buf[offset:offset+6], m.Address2)
424 case Dot11TypeMgmt, Dot11TypeData:
425 copy(buf[offset:offset+6], m.Address2)
427 copy(buf[offset:offset+6], m.Address3)
430 binary.LittleEndian.PutUint16(buf[offset:offset+2], (m.SequenceNumber<<4)|m.FragmentNumber)
434 if m.Type.MainType() == Dot11TypeData && m.Flags.FromDS() && m.Flags.ToDS() {
435 copy(buf[offset:offset+6], m.Address4)
442 // Dot11Mgmt is a base for all IEEE 802.11 management layers.
443 type Dot11Mgmt struct {
447 func (m *Dot11Mgmt) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload }
448 func (m *Dot11Mgmt) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
453 // Dot11Ctrl is a base for all IEEE 802.11 control layers.
454 type Dot11Ctrl struct {
458 func (m *Dot11Ctrl) NextLayerType() gopacket.LayerType { return gopacket.LayerTypePayload }
460 func (m *Dot11Ctrl) LayerType() gopacket.LayerType { return LayerTypeDot11Ctrl }
461 func (m *Dot11Ctrl) CanDecode() gopacket.LayerClass { return LayerTypeDot11Ctrl }
462 func (m *Dot11Ctrl) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
467 func decodeDot11Ctrl(data []byte, p gopacket.PacketBuilder) error {
469 return decodingLayerDecoder(d, data, p)
472 // Dot11WEP contains WEP encrpted IEEE 802.11 data.
473 type Dot11WEP struct {
477 func (m *Dot11WEP) NextLayerType() gopacket.LayerType { return LayerTypeLLC }
479 func (m *Dot11WEP) LayerType() gopacket.LayerType { return LayerTypeDot11WEP }
480 func (m *Dot11WEP) CanDecode() gopacket.LayerClass { return LayerTypeDot11WEP }
481 func (m *Dot11WEP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
486 func decodeDot11WEP(data []byte, p gopacket.PacketBuilder) error {
488 return decodingLayerDecoder(d, data, p)
491 // Dot11Data is a base for all IEEE 802.11 data layers.
492 type Dot11Data struct {
496 func (m *Dot11Data) NextLayerType() gopacket.LayerType { return LayerTypeLLC }
498 func (m *Dot11Data) LayerType() gopacket.LayerType { return LayerTypeDot11Data }
499 func (m *Dot11Data) CanDecode() gopacket.LayerClass { return LayerTypeDot11Data }
500 func (m *Dot11Data) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
505 func decodeDot11Data(data []byte, p gopacket.PacketBuilder) error {
507 return decodingLayerDecoder(d, data, p)
510 type Dot11DataCFAck struct {
514 func decodeDot11DataCFAck(data []byte, p gopacket.PacketBuilder) error {
515 d := &Dot11DataCFAck{}
516 return decodingLayerDecoder(d, data, p)
519 func (m *Dot11DataCFAck) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAck }
520 func (m *Dot11DataCFAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAck }
521 func (m *Dot11DataCFAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
522 return m.Dot11Data.DecodeFromBytes(data, df)
525 type Dot11DataCFPoll struct {
529 func decodeDot11DataCFPoll(data []byte, p gopacket.PacketBuilder) error {
530 d := &Dot11DataCFPoll{}
531 return decodingLayerDecoder(d, data, p)
534 func (m *Dot11DataCFPoll) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFPoll }
535 func (m *Dot11DataCFPoll) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFPoll }
536 func (m *Dot11DataCFPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
537 return m.Dot11Data.DecodeFromBytes(data, df)
540 type Dot11DataCFAckPoll struct {
544 func decodeDot11DataCFAckPoll(data []byte, p gopacket.PacketBuilder) error {
545 d := &Dot11DataCFAckPoll{}
546 return decodingLayerDecoder(d, data, p)
549 func (m *Dot11DataCFAckPoll) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAckPoll }
550 func (m *Dot11DataCFAckPoll) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAckPoll }
551 func (m *Dot11DataCFAckPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
552 return m.Dot11Data.DecodeFromBytes(data, df)
555 type Dot11DataNull struct {
559 func decodeDot11DataNull(data []byte, p gopacket.PacketBuilder) error {
560 d := &Dot11DataNull{}
561 return decodingLayerDecoder(d, data, p)
564 func (m *Dot11DataNull) LayerType() gopacket.LayerType { return LayerTypeDot11DataNull }
565 func (m *Dot11DataNull) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataNull }
566 func (m *Dot11DataNull) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
567 return m.Dot11Data.DecodeFromBytes(data, df)
570 type Dot11DataCFAckNoData struct {
574 func decodeDot11DataCFAckNoData(data []byte, p gopacket.PacketBuilder) error {
575 d := &Dot11DataCFAckNoData{}
576 return decodingLayerDecoder(d, data, p)
579 func (m *Dot11DataCFAckNoData) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFAckNoData }
580 func (m *Dot11DataCFAckNoData) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFAckNoData }
581 func (m *Dot11DataCFAckNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
582 return m.Dot11Data.DecodeFromBytes(data, df)
585 type Dot11DataCFPollNoData struct {
589 func decodeDot11DataCFPollNoData(data []byte, p gopacket.PacketBuilder) error {
590 d := &Dot11DataCFPollNoData{}
591 return decodingLayerDecoder(d, data, p)
594 func (m *Dot11DataCFPollNoData) LayerType() gopacket.LayerType { return LayerTypeDot11DataCFPollNoData }
595 func (m *Dot11DataCFPollNoData) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataCFPollNoData }
596 func (m *Dot11DataCFPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
597 return m.Dot11Data.DecodeFromBytes(data, df)
600 type Dot11DataCFAckPollNoData struct {
604 func decodeDot11DataCFAckPollNoData(data []byte, p gopacket.PacketBuilder) error {
605 d := &Dot11DataCFAckPollNoData{}
606 return decodingLayerDecoder(d, data, p)
609 func (m *Dot11DataCFAckPollNoData) LayerType() gopacket.LayerType {
610 return LayerTypeDot11DataCFAckPollNoData
612 func (m *Dot11DataCFAckPollNoData) CanDecode() gopacket.LayerClass {
613 return LayerTypeDot11DataCFAckPollNoData
615 func (m *Dot11DataCFAckPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
616 return m.Dot11Data.DecodeFromBytes(data, df)
619 type Dot11DataQOS struct {
621 TID uint8 /* Traffic IDentifier */
622 EOSP bool /* End of service period */
623 AckPolicy Dot11AckPolicy
627 func (m *Dot11DataQOS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
630 return fmt.Errorf("Dot11DataQOS length %v too short, %v required", len(data), 4)
632 m.TID = (uint8(data[0]) & 0x0F)
633 m.EOSP = (uint8(data[0]) & 0x10) == 0x10
634 m.AckPolicy = Dot11AckPolicy((uint8(data[0]) & 0x60) >> 5)
635 m.TXOP = uint8(data[1])
636 // TODO: Mesh Control bytes 2:4
637 m.BaseLayer = BaseLayer{Contents: data[0:4], Payload: data[4:]}
641 type Dot11DataQOSData struct {
645 func decodeDot11DataQOSData(data []byte, p gopacket.PacketBuilder) error {
646 d := &Dot11DataQOSData{}
647 return decodingLayerDecoder(d, data, p)
650 func (m *Dot11DataQOSData) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSData }
651 func (m *Dot11DataQOSData) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataQOSData }
653 func (m *Dot11DataQOSData) NextLayerType() gopacket.LayerType {
654 return LayerTypeDot11Data
657 type Dot11DataQOSDataCFAck struct {
661 func decodeDot11DataQOSDataCFAck(data []byte, p gopacket.PacketBuilder) error {
662 d := &Dot11DataQOSDataCFAck{}
663 return decodingLayerDecoder(d, data, p)
666 func (m *Dot11DataQOSDataCFAck) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSDataCFAck }
667 func (m *Dot11DataQOSDataCFAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataQOSDataCFAck }
668 func (m *Dot11DataQOSDataCFAck) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataCFAck }
670 type Dot11DataQOSDataCFPoll struct {
674 func decodeDot11DataQOSDataCFPoll(data []byte, p gopacket.PacketBuilder) error {
675 d := &Dot11DataQOSDataCFPoll{}
676 return decodingLayerDecoder(d, data, p)
679 func (m *Dot11DataQOSDataCFPoll) LayerType() gopacket.LayerType {
680 return LayerTypeDot11DataQOSDataCFPoll
682 func (m *Dot11DataQOSDataCFPoll) CanDecode() gopacket.LayerClass {
683 return LayerTypeDot11DataQOSDataCFPoll
685 func (m *Dot11DataQOSDataCFPoll) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataCFPoll }
687 type Dot11DataQOSDataCFAckPoll struct {
691 func decodeDot11DataQOSDataCFAckPoll(data []byte, p gopacket.PacketBuilder) error {
692 d := &Dot11DataQOSDataCFAckPoll{}
693 return decodingLayerDecoder(d, data, p)
696 func (m *Dot11DataQOSDataCFAckPoll) LayerType() gopacket.LayerType {
697 return LayerTypeDot11DataQOSDataCFAckPoll
699 func (m *Dot11DataQOSDataCFAckPoll) CanDecode() gopacket.LayerClass {
700 return LayerTypeDot11DataQOSDataCFAckPoll
702 func (m *Dot11DataQOSDataCFAckPoll) NextLayerType() gopacket.LayerType {
703 return LayerTypeDot11DataCFAckPoll
706 type Dot11DataQOSNull struct {
710 func decodeDot11DataQOSNull(data []byte, p gopacket.PacketBuilder) error {
711 d := &Dot11DataQOSNull{}
712 return decodingLayerDecoder(d, data, p)
715 func (m *Dot11DataQOSNull) LayerType() gopacket.LayerType { return LayerTypeDot11DataQOSNull }
716 func (m *Dot11DataQOSNull) CanDecode() gopacket.LayerClass { return LayerTypeDot11DataQOSNull }
717 func (m *Dot11DataQOSNull) NextLayerType() gopacket.LayerType { return LayerTypeDot11DataNull }
719 type Dot11DataQOSCFPollNoData struct {
723 func decodeDot11DataQOSCFPollNoData(data []byte, p gopacket.PacketBuilder) error {
724 d := &Dot11DataQOSCFPollNoData{}
725 return decodingLayerDecoder(d, data, p)
728 func (m *Dot11DataQOSCFPollNoData) LayerType() gopacket.LayerType {
729 return LayerTypeDot11DataQOSCFPollNoData
731 func (m *Dot11DataQOSCFPollNoData) CanDecode() gopacket.LayerClass {
732 return LayerTypeDot11DataQOSCFPollNoData
734 func (m *Dot11DataQOSCFPollNoData) NextLayerType() gopacket.LayerType {
735 return LayerTypeDot11DataCFPollNoData
738 type Dot11DataQOSCFAckPollNoData struct {
742 func decodeDot11DataQOSCFAckPollNoData(data []byte, p gopacket.PacketBuilder) error {
743 d := &Dot11DataQOSCFAckPollNoData{}
744 return decodingLayerDecoder(d, data, p)
747 func (m *Dot11DataQOSCFAckPollNoData) LayerType() gopacket.LayerType {
748 return LayerTypeDot11DataQOSCFAckPollNoData
750 func (m *Dot11DataQOSCFAckPollNoData) CanDecode() gopacket.LayerClass {
751 return LayerTypeDot11DataQOSCFAckPollNoData
753 func (m *Dot11DataQOSCFAckPollNoData) NextLayerType() gopacket.LayerType {
754 return LayerTypeDot11DataCFAckPollNoData
757 type Dot11InformationElement struct {
759 ID Dot11InformationElementID
765 func (m *Dot11InformationElement) LayerType() gopacket.LayerType {
766 return LayerTypeDot11InformationElement
768 func (m *Dot11InformationElement) CanDecode() gopacket.LayerClass {
769 return LayerTypeDot11InformationElement
772 func (m *Dot11InformationElement) NextLayerType() gopacket.LayerType {
773 return LayerTypeDot11InformationElement
776 func (m *Dot11InformationElement) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
779 return fmt.Errorf("Dot11InformationElement length %v too short, %v required", len(data), 2)
781 m.ID = Dot11InformationElementID(data[0])
785 if len(data) < offset+int(m.Length) {
787 return fmt.Errorf("Dot11InformationElement length %v too short, %v required", len(data), offset+int(m.Length))
791 m.OUI = data[offset : offset+4]
792 m.Info = data[offset+4 : offset+int(m.Length)]
794 m.Info = data[offset : offset+int(m.Length)]
797 offset += int(m.Length)
799 m.BaseLayer = BaseLayer{Contents: data[:offset], Payload: data[offset:]}
803 func (d *Dot11InformationElement) String() string {
805 return fmt.Sprintf("802.11 Information Element (SSID: %v)", string(d.Info))
806 } else if d.ID == 1 {
808 for i := 0; i < len(d.Info); i++ {
809 if d.Info[i]&0x80 == 0 {
810 rates += fmt.Sprintf("%.1f ", float32(d.Info[i])*0.5)
812 rates += fmt.Sprintf("%.1f* ", float32(d.Info[i]&0x7F)*0.5)
815 return fmt.Sprintf("802.11 Information Element (Rates: %s Mbit)", rates)
816 } else if d.ID == 221 {
817 return fmt.Sprintf("802.11 Information Element (Vendor: ID: %v, Length: %v, OUI: %X, Info: %X)", d.ID, d.Length, d.OUI, d.Info)
819 return fmt.Sprintf("802.11 Information Element (ID: %v, Length: %v, Info: %X)", d.ID, d.Length, d.Info)
823 func (m Dot11InformationElement) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
824 length := len(m.Info) + len(m.OUI)
825 if buf, err := b.PrependBytes(2 + length); err != nil {
829 buf[1] = uint8(length)
831 copy(buf[2+len(m.OUI):], m.Info)
836 func decodeDot11InformationElement(data []byte, p gopacket.PacketBuilder) error {
837 d := &Dot11InformationElement{}
838 return decodingLayerDecoder(d, data, p)
841 type Dot11CtrlCTS struct {
845 func decodeDot11CtrlCTS(data []byte, p gopacket.PacketBuilder) error {
847 return decodingLayerDecoder(d, data, p)
850 func (m *Dot11CtrlCTS) LayerType() gopacket.LayerType {
851 return LayerTypeDot11CtrlCTS
853 func (m *Dot11CtrlCTS) CanDecode() gopacket.LayerClass {
854 return LayerTypeDot11CtrlCTS
856 func (m *Dot11CtrlCTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
857 return m.Dot11Ctrl.DecodeFromBytes(data, df)
860 type Dot11CtrlRTS struct {
864 func decodeDot11CtrlRTS(data []byte, p gopacket.PacketBuilder) error {
866 return decodingLayerDecoder(d, data, p)
869 func (m *Dot11CtrlRTS) LayerType() gopacket.LayerType {
870 return LayerTypeDot11CtrlRTS
872 func (m *Dot11CtrlRTS) CanDecode() gopacket.LayerClass {
873 return LayerTypeDot11CtrlRTS
875 func (m *Dot11CtrlRTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
876 return m.Dot11Ctrl.DecodeFromBytes(data, df)
879 type Dot11CtrlBlockAckReq struct {
883 func decodeDot11CtrlBlockAckReq(data []byte, p gopacket.PacketBuilder) error {
884 d := &Dot11CtrlBlockAckReq{}
885 return decodingLayerDecoder(d, data, p)
888 func (m *Dot11CtrlBlockAckReq) LayerType() gopacket.LayerType {
889 return LayerTypeDot11CtrlBlockAckReq
891 func (m *Dot11CtrlBlockAckReq) CanDecode() gopacket.LayerClass {
892 return LayerTypeDot11CtrlBlockAckReq
894 func (m *Dot11CtrlBlockAckReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
895 return m.Dot11Ctrl.DecodeFromBytes(data, df)
898 type Dot11CtrlBlockAck struct {
902 func decodeDot11CtrlBlockAck(data []byte, p gopacket.PacketBuilder) error {
903 d := &Dot11CtrlBlockAck{}
904 return decodingLayerDecoder(d, data, p)
907 func (m *Dot11CtrlBlockAck) LayerType() gopacket.LayerType { return LayerTypeDot11CtrlBlockAck }
908 func (m *Dot11CtrlBlockAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11CtrlBlockAck }
909 func (m *Dot11CtrlBlockAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
910 return m.Dot11Ctrl.DecodeFromBytes(data, df)
913 type Dot11CtrlPowersavePoll struct {
917 func decodeDot11CtrlPowersavePoll(data []byte, p gopacket.PacketBuilder) error {
918 d := &Dot11CtrlPowersavePoll{}
919 return decodingLayerDecoder(d, data, p)
922 func (m *Dot11CtrlPowersavePoll) LayerType() gopacket.LayerType {
923 return LayerTypeDot11CtrlPowersavePoll
925 func (m *Dot11CtrlPowersavePoll) CanDecode() gopacket.LayerClass {
926 return LayerTypeDot11CtrlPowersavePoll
928 func (m *Dot11CtrlPowersavePoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
929 return m.Dot11Ctrl.DecodeFromBytes(data, df)
932 type Dot11CtrlAck struct {
936 func decodeDot11CtrlAck(data []byte, p gopacket.PacketBuilder) error {
938 return decodingLayerDecoder(d, data, p)
941 func (m *Dot11CtrlAck) LayerType() gopacket.LayerType { return LayerTypeDot11CtrlAck }
942 func (m *Dot11CtrlAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11CtrlAck }
943 func (m *Dot11CtrlAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
944 return m.Dot11Ctrl.DecodeFromBytes(data, df)
947 type Dot11CtrlCFEnd struct {
951 func decodeDot11CtrlCFEnd(data []byte, p gopacket.PacketBuilder) error {
952 d := &Dot11CtrlCFEnd{}
953 return decodingLayerDecoder(d, data, p)
956 func (m *Dot11CtrlCFEnd) LayerType() gopacket.LayerType {
957 return LayerTypeDot11CtrlCFEnd
959 func (m *Dot11CtrlCFEnd) CanDecode() gopacket.LayerClass {
960 return LayerTypeDot11CtrlCFEnd
962 func (m *Dot11CtrlCFEnd) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
963 return m.Dot11Ctrl.DecodeFromBytes(data, df)
966 type Dot11CtrlCFEndAck struct {
970 func decodeDot11CtrlCFEndAck(data []byte, p gopacket.PacketBuilder) error {
971 d := &Dot11CtrlCFEndAck{}
972 return decodingLayerDecoder(d, data, p)
975 func (m *Dot11CtrlCFEndAck) LayerType() gopacket.LayerType {
976 return LayerTypeDot11CtrlCFEndAck
978 func (m *Dot11CtrlCFEndAck) CanDecode() gopacket.LayerClass {
979 return LayerTypeDot11CtrlCFEndAck
981 func (m *Dot11CtrlCFEndAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
982 return m.Dot11Ctrl.DecodeFromBytes(data, df)
985 type Dot11MgmtAssociationReq struct {
987 CapabilityInfo uint16
988 ListenInterval uint16
991 func decodeDot11MgmtAssociationReq(data []byte, p gopacket.PacketBuilder) error {
992 d := &Dot11MgmtAssociationReq{}
993 return decodingLayerDecoder(d, data, p)
996 func (m *Dot11MgmtAssociationReq) LayerType() gopacket.LayerType {
997 return LayerTypeDot11MgmtAssociationReq
999 func (m *Dot11MgmtAssociationReq) CanDecode() gopacket.LayerClass {
1000 return LayerTypeDot11MgmtAssociationReq
1002 func (m *Dot11MgmtAssociationReq) NextLayerType() gopacket.LayerType {
1003 return LayerTypeDot11InformationElement
1005 func (m *Dot11MgmtAssociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1008 return fmt.Errorf("Dot11MgmtAssociationReq length %v too short, %v required", len(data), 4)
1010 m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2])
1011 m.ListenInterval = binary.LittleEndian.Uint16(data[2:4])
1012 m.Payload = data[4:]
1013 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1016 func (m Dot11MgmtAssociationReq) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1017 buf, err := b.PrependBytes(4)
1023 binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo)
1024 binary.LittleEndian.PutUint16(buf[2:4], m.ListenInterval)
1029 type Dot11MgmtAssociationResp struct {
1031 CapabilityInfo uint16
1036 func decodeDot11MgmtAssociationResp(data []byte, p gopacket.PacketBuilder) error {
1037 d := &Dot11MgmtAssociationResp{}
1038 return decodingLayerDecoder(d, data, p)
1041 func (m *Dot11MgmtAssociationResp) CanDecode() gopacket.LayerClass {
1042 return LayerTypeDot11MgmtAssociationResp
1044 func (m *Dot11MgmtAssociationResp) LayerType() gopacket.LayerType {
1045 return LayerTypeDot11MgmtAssociationResp
1047 func (m *Dot11MgmtAssociationResp) NextLayerType() gopacket.LayerType {
1048 return LayerTypeDot11InformationElement
1050 func (m *Dot11MgmtAssociationResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1053 return fmt.Errorf("Dot11MgmtAssociationResp length %v too short, %v required", len(data), 6)
1055 m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2])
1056 m.Status = Dot11Status(binary.LittleEndian.Uint16(data[2:4]))
1057 m.AID = binary.LittleEndian.Uint16(data[4:6])
1058 m.Payload = data[6:]
1059 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1062 func (m Dot11MgmtAssociationResp) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1063 buf, err := b.PrependBytes(6)
1069 binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo)
1070 binary.LittleEndian.PutUint16(buf[2:4], uint16(m.Status))
1071 binary.LittleEndian.PutUint16(buf[4:6], m.AID)
1076 type Dot11MgmtReassociationReq struct {
1078 CapabilityInfo uint16
1079 ListenInterval uint16
1080 CurrentApAddress net.HardwareAddr
1083 func decodeDot11MgmtReassociationReq(data []byte, p gopacket.PacketBuilder) error {
1084 d := &Dot11MgmtReassociationReq{}
1085 return decodingLayerDecoder(d, data, p)
1088 func (m *Dot11MgmtReassociationReq) LayerType() gopacket.LayerType {
1089 return LayerTypeDot11MgmtReassociationReq
1091 func (m *Dot11MgmtReassociationReq) CanDecode() gopacket.LayerClass {
1092 return LayerTypeDot11MgmtReassociationReq
1094 func (m *Dot11MgmtReassociationReq) NextLayerType() gopacket.LayerType {
1095 return LayerTypeDot11InformationElement
1097 func (m *Dot11MgmtReassociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1100 return fmt.Errorf("Dot11MgmtReassociationReq length %v too short, %v required", len(data), 10)
1102 m.CapabilityInfo = binary.LittleEndian.Uint16(data[0:2])
1103 m.ListenInterval = binary.LittleEndian.Uint16(data[2:4])
1104 m.CurrentApAddress = net.HardwareAddr(data[4:10])
1105 m.Payload = data[10:]
1106 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1109 func (m Dot11MgmtReassociationReq) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1110 buf, err := b.PrependBytes(10)
1116 binary.LittleEndian.PutUint16(buf[0:2], m.CapabilityInfo)
1117 binary.LittleEndian.PutUint16(buf[2:4], m.ListenInterval)
1119 copy(buf[4:10], m.CurrentApAddress)
1124 type Dot11MgmtReassociationResp struct {
1128 func decodeDot11MgmtReassociationResp(data []byte, p gopacket.PacketBuilder) error {
1129 d := &Dot11MgmtReassociationResp{}
1130 return decodingLayerDecoder(d, data, p)
1133 func (m *Dot11MgmtReassociationResp) LayerType() gopacket.LayerType {
1134 return LayerTypeDot11MgmtReassociationResp
1136 func (m *Dot11MgmtReassociationResp) CanDecode() gopacket.LayerClass {
1137 return LayerTypeDot11MgmtReassociationResp
1139 func (m *Dot11MgmtReassociationResp) NextLayerType() gopacket.LayerType {
1140 return LayerTypeDot11InformationElement
1143 type Dot11MgmtProbeReq struct {
1147 func decodeDot11MgmtProbeReq(data []byte, p gopacket.PacketBuilder) error {
1148 d := &Dot11MgmtProbeReq{}
1149 return decodingLayerDecoder(d, data, p)
1152 func (m *Dot11MgmtProbeReq) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtProbeReq }
1153 func (m *Dot11MgmtProbeReq) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtProbeReq }
1154 func (m *Dot11MgmtProbeReq) NextLayerType() gopacket.LayerType {
1155 return LayerTypeDot11InformationElement
1158 type Dot11MgmtProbeResp struct {
1165 func decodeDot11MgmtProbeResp(data []byte, p gopacket.PacketBuilder) error {
1166 d := &Dot11MgmtProbeResp{}
1167 return decodingLayerDecoder(d, data, p)
1170 func (m *Dot11MgmtProbeResp) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtProbeResp }
1171 func (m *Dot11MgmtProbeResp) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtProbeResp }
1172 func (m *Dot11MgmtProbeResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1176 return fmt.Errorf("Dot11MgmtProbeResp length %v too short, %v required", len(data), 12)
1179 m.Timestamp = binary.LittleEndian.Uint64(data[0:8])
1180 m.Interval = binary.LittleEndian.Uint16(data[8:10])
1181 m.Flags = binary.LittleEndian.Uint16(data[10:12])
1182 m.Payload = data[12:]
1184 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1187 func (m *Dot11MgmtProbeResp) NextLayerType() gopacket.LayerType {
1188 return LayerTypeDot11InformationElement
1191 func (m Dot11MgmtProbeResp) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1192 buf, err := b.PrependBytes(12)
1198 binary.LittleEndian.PutUint64(buf[0:8], m.Timestamp)
1199 binary.LittleEndian.PutUint16(buf[8:10], m.Interval)
1200 binary.LittleEndian.PutUint16(buf[10:12], m.Flags)
1205 type Dot11MgmtMeasurementPilot struct {
1209 func decodeDot11MgmtMeasurementPilot(data []byte, p gopacket.PacketBuilder) error {
1210 d := &Dot11MgmtMeasurementPilot{}
1211 return decodingLayerDecoder(d, data, p)
1214 func (m *Dot11MgmtMeasurementPilot) LayerType() gopacket.LayerType {
1215 return LayerTypeDot11MgmtMeasurementPilot
1217 func (m *Dot11MgmtMeasurementPilot) CanDecode() gopacket.LayerClass {
1218 return LayerTypeDot11MgmtMeasurementPilot
1221 type Dot11MgmtBeacon struct {
1228 func decodeDot11MgmtBeacon(data []byte, p gopacket.PacketBuilder) error {
1229 d := &Dot11MgmtBeacon{}
1230 return decodingLayerDecoder(d, data, p)
1233 func (m *Dot11MgmtBeacon) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtBeacon }
1234 func (m *Dot11MgmtBeacon) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtBeacon }
1235 func (m *Dot11MgmtBeacon) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1238 return fmt.Errorf("Dot11MgmtBeacon length %v too short, %v required", len(data), 12)
1240 m.Timestamp = binary.LittleEndian.Uint64(data[0:8])
1241 m.Interval = binary.LittleEndian.Uint16(data[8:10])
1242 m.Flags = binary.LittleEndian.Uint16(data[10:12])
1243 m.Payload = data[12:]
1244 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1247 func (m *Dot11MgmtBeacon) NextLayerType() gopacket.LayerType { return LayerTypeDot11InformationElement }
1249 func (m Dot11MgmtBeacon) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1250 buf, err := b.PrependBytes(12)
1256 binary.LittleEndian.PutUint64(buf[0:8], m.Timestamp)
1257 binary.LittleEndian.PutUint16(buf[8:10], m.Interval)
1258 binary.LittleEndian.PutUint16(buf[10:12], m.Flags)
1263 type Dot11MgmtATIM struct {
1267 func decodeDot11MgmtATIM(data []byte, p gopacket.PacketBuilder) error {
1268 d := &Dot11MgmtATIM{}
1269 return decodingLayerDecoder(d, data, p)
1272 func (m *Dot11MgmtATIM) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtATIM }
1273 func (m *Dot11MgmtATIM) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtATIM }
1275 type Dot11MgmtDisassociation struct {
1280 func decodeDot11MgmtDisassociation(data []byte, p gopacket.PacketBuilder) error {
1281 d := &Dot11MgmtDisassociation{}
1282 return decodingLayerDecoder(d, data, p)
1285 func (m *Dot11MgmtDisassociation) LayerType() gopacket.LayerType {
1286 return LayerTypeDot11MgmtDisassociation
1288 func (m *Dot11MgmtDisassociation) CanDecode() gopacket.LayerClass {
1289 return LayerTypeDot11MgmtDisassociation
1291 func (m *Dot11MgmtDisassociation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1294 return fmt.Errorf("Dot11MgmtDisassociation length %v too short, %v required", len(data), 2)
1296 m.Reason = Dot11Reason(binary.LittleEndian.Uint16(data[0:2]))
1297 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1300 func (m Dot11MgmtDisassociation) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1301 buf, err := b.PrependBytes(2)
1307 binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Reason))
1312 type Dot11MgmtAuthentication struct {
1314 Algorithm Dot11Algorithm
1319 func decodeDot11MgmtAuthentication(data []byte, p gopacket.PacketBuilder) error {
1320 d := &Dot11MgmtAuthentication{}
1321 return decodingLayerDecoder(d, data, p)
1324 func (m *Dot11MgmtAuthentication) LayerType() gopacket.LayerType {
1325 return LayerTypeDot11MgmtAuthentication
1327 func (m *Dot11MgmtAuthentication) CanDecode() gopacket.LayerClass {
1328 return LayerTypeDot11MgmtAuthentication
1330 func (m *Dot11MgmtAuthentication) NextLayerType() gopacket.LayerType {
1331 return LayerTypeDot11InformationElement
1333 func (m *Dot11MgmtAuthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1336 return fmt.Errorf("Dot11MgmtAuthentication length %v too short, %v required", len(data), 6)
1338 m.Algorithm = Dot11Algorithm(binary.LittleEndian.Uint16(data[0:2]))
1339 m.Sequence = binary.LittleEndian.Uint16(data[2:4])
1340 m.Status = Dot11Status(binary.LittleEndian.Uint16(data[4:6]))
1341 m.Payload = data[6:]
1342 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1345 func (m Dot11MgmtAuthentication) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1346 buf, err := b.PrependBytes(6)
1352 binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Algorithm))
1353 binary.LittleEndian.PutUint16(buf[2:4], m.Sequence)
1354 binary.LittleEndian.PutUint16(buf[4:6], uint16(m.Status))
1359 type Dot11MgmtDeauthentication struct {
1364 func decodeDot11MgmtDeauthentication(data []byte, p gopacket.PacketBuilder) error {
1365 d := &Dot11MgmtDeauthentication{}
1366 return decodingLayerDecoder(d, data, p)
1369 func (m *Dot11MgmtDeauthentication) LayerType() gopacket.LayerType {
1370 return LayerTypeDot11MgmtDeauthentication
1372 func (m *Dot11MgmtDeauthentication) CanDecode() gopacket.LayerClass {
1373 return LayerTypeDot11MgmtDeauthentication
1375 func (m *Dot11MgmtDeauthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
1378 return fmt.Errorf("Dot11MgmtDeauthentication length %v too short, %v required", len(data), 2)
1380 m.Reason = Dot11Reason(binary.LittleEndian.Uint16(data[0:2]))
1381 return m.Dot11Mgmt.DecodeFromBytes(data, df)
1384 func (m Dot11MgmtDeauthentication) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
1385 buf, err := b.PrependBytes(2)
1391 binary.LittleEndian.PutUint16(buf[0:2], uint16(m.Reason))
1396 type Dot11MgmtAction struct {
1400 func decodeDot11MgmtAction(data []byte, p gopacket.PacketBuilder) error {
1401 d := &Dot11MgmtAction{}
1402 return decodingLayerDecoder(d, data, p)
1405 func (m *Dot11MgmtAction) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtAction }
1406 func (m *Dot11MgmtAction) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtAction }
1408 type Dot11MgmtActionNoAck struct {
1412 func decodeDot11MgmtActionNoAck(data []byte, p gopacket.PacketBuilder) error {
1413 d := &Dot11MgmtActionNoAck{}
1414 return decodingLayerDecoder(d, data, p)
1417 func (m *Dot11MgmtActionNoAck) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtActionNoAck }
1418 func (m *Dot11MgmtActionNoAck) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtActionNoAck }
1420 type Dot11MgmtArubaWLAN struct {
1424 func decodeDot11MgmtArubaWLAN(data []byte, p gopacket.PacketBuilder) error {
1425 d := &Dot11MgmtArubaWLAN{}
1426 return decodingLayerDecoder(d, data, p)
1429 func (m *Dot11MgmtArubaWLAN) LayerType() gopacket.LayerType { return LayerTypeDot11MgmtArubaWLAN }
1430 func (m *Dot11MgmtArubaWLAN) CanDecode() gopacket.LayerClass { return LayerTypeDot11MgmtArubaWLAN }