コード例 #1
0
ファイル: mach.go プロジェクト: ikravets/ev
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
ファイル: moldudp64.go プロジェクト: ikravets/ev
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
ファイル: reusing_processor.go プロジェクト: ikravets/ev
		}
		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,