Andrea Campanella | 7167ebb | 2020-02-24 09:56:38 +0100 | [diff] [blame^] | 1 | // Copyright 2017 Google, Inc. All rights reserved. |
| 2 | // |
| 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 |
| 5 | // tree. |
| 6 | |
| 7 | package layers |
| 8 | |
| 9 | import ( |
| 10 | "github.com/google/gopacket" |
| 11 | ) |
| 12 | |
| 13 | // STP decode spanning tree protocol packets to transport BPDU (bridge protocol data unit) message. |
| 14 | type STP struct { |
| 15 | BaseLayer |
| 16 | } |
| 17 | |
| 18 | // LayerType returns gopacket.LayerTypeSTP. |
| 19 | func (s *STP) LayerType() gopacket.LayerType { return LayerTypeSTP } |
| 20 | |
| 21 | func decodeSTP(data []byte, p gopacket.PacketBuilder) error { |
| 22 | stp := &STP{} |
| 23 | stp.Contents = data[:] |
| 24 | // TODO: parse the STP protocol into actual subfields. |
| 25 | p.AddLayer(stp) |
| 26 | return nil |
| 27 | } |