summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/gopacket/layers/stp.go
blob: bde7d7c8ef91afc005f84a00246858bdcf8d2bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2017 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.

package layers

import (
	"github.com/google/gopacket"
)

// STP decode spanning tree protocol packets to transport BPDU (bridge protocol data unit) message.
type STP struct {
	BaseLayer
}

// LayerType returns gopacket.LayerTypeSTP.
func (s *STP) LayerType() gopacket.LayerType { return LayerTypeSTP }

func decodeSTP(data []byte, p gopacket.PacketBuilder) error {
	stp := &STP{}
	stp.Contents = data[:]
	// TODO:  parse the STP protocol into actual subfields.
	p.AddLayer(stp)
	return nil
}