blob: bde7d7c8ef91afc005f84a00246858bdcf8d2bfa [file] [log] [blame]
Andrea Campanella7167ebb2020-02-24 09:56:38 +01001// 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
7package layers
8
9import (
10 "github.com/google/gopacket"
11)
12
13// STP decode spanning tree protocol packets to transport BPDU (bridge protocol data unit) message.
14type STP struct {
15 BaseLayer
16}
17
18// LayerType returns gopacket.LayerTypeSTP.
19func (s *STP) LayerType() gopacket.LayerType { return LayerTypeSTP }
20
21func 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}