func traceNewNetDevice(data []byte, m *base.Monitor) {
	var eventRaw model.DeviceEventRaw
	if err := binary.Read(bytes.NewBuffer(data), utils.GetHostByteOrder(), &eventRaw); err != nil {
		netLogger.Errorf("failed to decode received data (DeviceEventRaw): %s\n", err)
		return
	}
	// Prepare event
	event := model.DeviceEvent{
		EventBase: model.EventBase{
			EventMonitorName: m.Name,
			EventType:        model.NewNetDeviceType,
			Timestamp:        m.Nsp.GetBootTime().Add(time.Duration(eventRaw.Metadata.TimestampRaw) * time.Nanosecond),
			TTYName:          C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Metadata.TTYNameRaw))),
		},
		DeviceEventRaw: &eventRaw,
		DeviceName:     C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Device.NameRaw))),
		PeerName:       C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Peer.NameRaw))),
	}
	switch event.EventFlag {
	case model.DeviceRegistration:
		// Create a new Classifier for the new interface.
		m.Nsp.SetupDeviceMonitor(&event)
	case model.DeviceUnregistration:
		// Delete monitor
		m.Nsp.StopDeviceMonitor(&event)
	}
	// Dispatch event
	m.Nsp.DispatchEvent(&event)
}
// traceNewNetDevice - Traces new network device registration
Traces new network device registration
// traceNewNetDevice - Traces new network device registration
func traceNewNetDevice(data []byte, m *base.Monitor) {
	var eventRaw model.DeviceEventRaw
	if err := binary.Read(bytes.NewBuffer(data), utils.GetHostByteOrder(), &eventRaw); err != nil {
		netLogger.Errorf("failed to decode received data (DeviceEventRaw): %s\n", err)
		return
	}
	event := model.DeviceEvent{
		EventBase: model.EventBase{
			EventMonitorName: m.Name,
			EventType:        model.NewNetDeviceType,
			Timestamp:        m.Nsp.GetBootTime().Add(time.Duration(eventRaw.Metadata.TimestampRaw) * time.Nanosecond),
			TTYName:          C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Metadata.TTYNameRaw))),
		},
		DeviceEventRaw: &eventRaw,
		DeviceName:     C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Device.NameRaw))),
		PeerName:       C.GoString((*C.char)(unsafe.Pointer(&eventRaw.Peer.NameRaw))),
	}
	switch event.EventFlag {
	case model.DeviceRegistration:
		m.Nsp.SetupDeviceMonitor(&event)
	case model.DeviceUnregistration:
		m.Nsp.StopDeviceMonitor(&event)
	}
	m.Nsp.DispatchEvent(&event)
}
func traceNewNetDevice ( data [ ] byte , m * base . Monitor ) { var eventRaw model . DeviceEventRaw if err := binary . Read ( bytes . NewBuffer ( data ) , utils . GetHostByteOrder ( ) , & eventRaw ) ; err != nil { netLogger . Errorf ( " \n " , err ) return } event := model . DeviceEvent { EventBase : model . EventBase { EventMonitorName : m . Name , EventType : model . NewNetDeviceType , Timestamp : m . Nsp . GetBootTime ( ) . Add ( time . Duration ( eventRaw . Metadata . TimestampRaw ) * time . Nanosecond ) , TTYName : C . GoString ( ( * C . char ) ( unsafe . Pointer ( & eventRaw . Metadata . TTYNameRaw ) ) ) , } , DeviceEventRaw : & eventRaw , DeviceName : C . GoString ( ( * C . char ) ( unsafe . Pointer ( & eventRaw . Device . NameRaw ) ) ) , PeerName : C . GoString ( ( * C . char ) ( unsafe . Pointer ( & eventRaw . Peer . NameRaw ) ) ) , } switch event . EventFlag { case model . DeviceRegistration : m . Nsp . SetupDeviceMonitor ( & event ) case model . DeviceUnregistration : m . Nsp . StopDeviceMonitor ( & event ) } m . Nsp . DispatchEvent ( & event ) }
Traces new network device registration
Traces new network device registration
// Prepare event // Create a new Classifier for the new interface. // Delete monitor // Dispatch event