ppforge/devices/devices_windows.go

37 lines
906 B
Go

package devices
// [implwin dsn~low-level-abstraction~0]
import "golang.org/x/sys/windows"
// TransmitterWindows is the Windows implementation of the Transmitter interface
type TransmitterWindows struct {
socket int
}
// Send implements sending packets for Windows
func (tl TransmitterWindows) Send(data []byte) error {
return nil
}
// Close implements closing the socket for Windows
func (tl TransmitterWindows) Close() error {
return windows.Close(tl.socket)
}
// CreateTransmitter creates a Transmitter socket
func CreateTransmitter(device string) (Transmitter, error) {
ret := TransmitterWindows{}
var err error
ret.socket, err = windows.Socket(windows.AF_PACKET, windows.SOCK_RAW, windows.ETH_P_ALL)
if err != nil {
panic(err)
}
return ret, err
}
// CreateReceiver creates and starts the Receiver instance
func CreateReceiver(device string) (Receiver, error) {
return nil, nil
}