Пример #1
0
func init() {
	LayerTypeMachTop = gopacket.RegisterLayerType(11000, gopacket.LayerTypeMetadata{"MachTop", gopacket.DecodeFunc(decodeMach)})
	LayerTypeMach = gopacket.RegisterLayerType(11001, gopacket.LayerTypeMetadata{"Mach", gopacket.DecodeFunc(decodeMach)})

	MachTopLayerFactory = packet.NewSingleDecodingLayerFactory(
		LayerTypeMachTop,
		func() gopacket.DecodingLayer { return &MachTop{} },
	)
	MachLayerFactory = packet.NewSingleDecodingLayerFactory(
		LayerTypeMach,
		func() gopacket.DecodingLayer { return &Mach{} },
	)
}
Пример #2
0
func init() {
	LayerTypeMoldUDP64MessageBlock = gopacket.RegisterLayerType(10001, gopacket.LayerTypeMetadata{"MoldUDP64MessageBlock", gopacket.DecodeFunc(decodeMoldUDP64MessageBlock)})

	LayerTypeMoldUDP64MessageBlockChained = gopacket.RegisterLayerType(10003, gopacket.LayerTypeMetadata{"MoldUDP64MessageBlockChained", gopacket.DecodeFunc(decodeMoldUDP64MessageBlockChained)})

	MoldUDP64LayerFactory = packet.NewSingleDecodingLayerFactory(
		LayerTypeMoldUDP64,
		func() gopacket.DecodingLayer { return &MoldUDP64{} },
	)

	MoldUDP64MessageBlockLayerFactory = packet.NewSingleDecodingLayerFactory(
		LayerTypeMoldUDP64MessageBlock,
		func() gopacket.DecodingLayer { return &MoldUDP64MessageBlock{} },
	)
}
Пример #3
0
Файл: bsu.go Проект: ikravets/ev
		Unit:      uint8(data[3]),
		Sequence:  binary.LittleEndian.Uint32(data[4:8]),
		BaseLayer: layers.BaseLayer{data[:8], data[8:]},
		tps:       m.tps[:0], // reuse the slice storage
	}
	data = m.Payload
	for i := 0; i < int(m.Count); i++ {
		length := int(data[0])
		m.tps = append(m.tps, packet.TypedPayload{
			Type:    PitchMessageType(data[1]).LayerType(),
			Payload: data[:length],
		})
		data = data[length:]
	}
	return
}
func (m *BSU) CanDecode() gopacket.LayerClass {
	return LayerTypeBSU
}
func (m *BSU) NextLayers() []packet.TypedPayload {
	return m.tps
}
func (m *BSU) NextLayerType() gopacket.LayerType {
	return gopacket.LayerTypeZero // TODO can support chained Pitch messages
}

var BSULayerFactory = packet.NewSingleDecodingLayerFactory(
	LayerTypeBSU,
	func() gopacket.DecodingLayer { return &BSU{} },
)
Пример #4
0
		}
		errs.CheckE(err)
	}
	return b.String()
}
func (rp *reusingPacket) Data() []byte {
	return rp.data
}
func (rp *reusingPacket) Timestamp() time.Time {
	return rp.ci.Timestamp
}

/************************************************************************/
var (
	EthernetLayerFactory = packet.NewSingleDecodingLayerFactory(
		layers.LayerTypeEthernet,
		func() gopacket.DecodingLayer { return &layers.Ethernet{} },
	)
	Dot1QLayerFactory = packet.NewSingleDecodingLayerFactory(
		layers.LayerTypeDot1Q,
		func() gopacket.DecodingLayer { return &layers.Dot1Q{} },
	)
	IPv4LayerFactory = packet.NewSingleDecodingLayerFactory(
		layers.LayerTypeIPv4,
		func() gopacket.DecodingLayer { return &layers.IPv4{} },
	)
	UDPLayerFactory = packet.NewSingleDecodingLayerFactory(
		layers.LayerTypeUDP,
		func() gopacket.DecodingLayer { return &layers.UDP{} },
	)
	TcpIgnoreLayerFactory = packet.NewSingleDecodingLayerFactory(
		layers.LayerTypeTCP,