本文整理汇总了Golang中github.com/tsg/gopacket.PacketBuilder.NextDecoder方法的典型用法代码示例。如果您正苦于以下问题:Golang PacketBuilder.NextDecoder方法的具体用法?Golang PacketBuilder.NextDecoder怎么用?Golang PacketBuilder.NextDecoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsg/gopacket.PacketBuilder
的用法示例。
在下文中一共展示了PacketBuilder.NextDecoder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: decodeSCTPChunkTypeUnknown
func decodeSCTPChunkTypeUnknown(data []byte, p gopacket.PacketBuilder) error {
sc := &SCTPUnknownChunkType{SCTPChunk: decodeSCTPChunk(data)}
sc.bytes = data[:sc.ActualLength]
p.AddLayer(sc)
p.SetErrorLayer(sc)
return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix))
}
示例2: decodeSCTPEmptyLayer
func decodeSCTPEmptyLayer(data []byte, p gopacket.PacketBuilder) error {
sc := &SCTPEmptyLayer{
SCTPChunk: decodeSCTPChunk(data),
}
p.AddLayer(sc)
return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix))
}
示例3: decodeSCTPShutdown
func decodeSCTPShutdown(data []byte, p gopacket.PacketBuilder) error {
sc := &SCTPShutdown{
SCTPChunk: decodeSCTPChunk(data),
CumulativeTSNAck: binary.BigEndian.Uint32(data[4:8]),
}
p.AddLayer(sc)
return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix))
}
示例4: decodeSCTPCookieEcho
func decodeSCTPCookieEcho(data []byte, p gopacket.PacketBuilder) error {
sc := &SCTPCookieEcho{
SCTPChunk: decodeSCTPChunk(data),
}
sc.Cookie = data[4:sc.Length]
p.AddLayer(sc)
return p.NextDecoder(gopacket.DecodeFunc(decodeWithSCTPChunkTypePrefix))
}
示例5: decodeICMPv4
func decodeICMPv4(data []byte, p gopacket.PacketBuilder) error {
i := &ICMPv4{}
err := i.DecodeFromBytes(data, p)
if err != nil {
return err
}
p.AddLayer(i)
return p.NextDecoder(gopacket.LayerTypePayload)
}
示例6: decodeLinuxSLL
func decodeLinuxSLL(data []byte, p gopacket.PacketBuilder) error {
sll := &LinuxSLL{}
if err := sll.DecodeFromBytes(data, p); err != nil {
return err
}
p.AddLayer(sll)
p.SetLinkLayer(sll)
return p.NextDecoder(sll.EthernetType)
}
示例7: decodeIPv6HopByHop
func decodeIPv6HopByHop(data []byte, p gopacket.PacketBuilder) error {
i := &IPv6HopByHop{}
err := i.DecodeFromBytes(data, p)
p.AddLayer(i)
if err != nil {
return err
}
return p.NextDecoder(i.NextHeader)
}
示例8: decodeTCP
func decodeTCP(data []byte, p gopacket.PacketBuilder) error {
tcp := &TCP{}
err := tcp.DecodeFromBytes(data, p)
p.AddLayer(tcp)
p.SetTransportLayer(tcp)
if err != nil {
return err
}
return p.NextDecoder(gopacket.LayerTypePayload)
}
示例9: decodeEthernet
func decodeEthernet(data []byte, p gopacket.PacketBuilder) error {
eth := &Ethernet{}
err := eth.DecodeFromBytes(data, p)
if err != nil {
return err
}
p.AddLayer(eth)
p.SetLinkLayer(eth)
return p.NextDecoder(eth.EthernetType)
}
示例10: decodeIPv4
func decodeIPv4(data []byte, p gopacket.PacketBuilder) error {
ip := &IPv4{}
err := ip.DecodeFromBytes(data, p)
p.AddLayer(ip)
p.SetNetworkLayer(ip)
if err != nil {
return err
}
return p.NextDecoder(ip.NextLayerType())
}
示例11: decodeUDP
func decodeUDP(data []byte, p gopacket.PacketBuilder) error {
udp := &UDP{}
err := udp.DecodeFromBytes(data, p)
p.AddLayer(udp)
p.SetTransportLayer(udp)
if err != nil {
return err
}
return p.NextDecoder(udp.NextLayerType())
}
示例12: decodeEthernetCTP
func decodeEthernetCTP(data []byte, p gopacket.PacketBuilder) error {
c := &EthernetCTP{
SkipCount: binary.LittleEndian.Uint16(data[:2]),
BaseLayer: BaseLayer{data[:2], data[2:]},
}
if c.SkipCount%2 != 0 {
return fmt.Errorf("EthernetCTP skip count is odd: %d", c.SkipCount)
}
p.AddLayer(c)
return p.NextDecoder(gopacket.DecodeFunc(decodeEthernetCTPFromFunctionType))
}
示例13: decodeIPSecAH
func decodeIPSecAH(data []byte, p gopacket.PacketBuilder) error {
i := &IPSecAH{
ipv6ExtensionBase: decodeIPv6ExtensionBase(data),
Reserved: binary.BigEndian.Uint16(data[2:4]),
SPI: binary.BigEndian.Uint32(data[4:8]),
Seq: binary.BigEndian.Uint32(data[8:12]),
}
i.AuthenticationData = i.Contents[12:]
p.AddLayer(i)
return p.NextDecoder(i.NextHeader)
}
示例14: decodingLayerDecoder
func decodingLayerDecoder(d layerDecodingLayer, data []byte, p gopacket.PacketBuilder) error {
err := d.DecodeFromBytes(data, p)
if err != nil {
return err
}
p.AddLayer(d)
next := d.NextLayerType()
if next == gopacket.LayerTypeZero {
return nil
}
return p.NextDecoder(next)
}
示例15: decodeFDDI
func decodeFDDI(data []byte, p gopacket.PacketBuilder) error {
f := &FDDI{
FrameControl: FDDIFrameControl(data[0] & 0xF8),
Priority: data[0] & 0x07,
SrcMAC: net.HardwareAddr(data[1:7]),
DstMAC: net.HardwareAddr(data[7:13]),
BaseLayer: BaseLayer{data[:13], data[13:]},
}
p.SetLinkLayer(f)
p.AddLayer(f)
return p.NextDecoder(f.FrameControl)
}