add EthLinkPoller;

This commit is contained in:
soypat
2023-12-18 15:56:35 -08:00
parent 731362a0cf
commit 60cdb7fd50
+12 -2
View File
@@ -6,8 +6,8 @@ import (
"time" "time"
) )
//go:linkname UseNetdev net.useNetdev //go:linkname UseStack net.useNetdev
func UseNetdev(dev Stack) func UseStack(stack Stack)
// GethostByName() errors // GethostByName() errors
var ( var (
@@ -61,6 +61,16 @@ type Link interface {
LinkStatus() LinkStatus LinkStatus() LinkStatus
} }
type EthLinkPoller interface {
Link
// SendEth sends an Ethernet packet
SendEth(pkt []byte) error
// RecvEthHandle sets recieve Ethernet packet callback function
RecvEthHandle(func(pkt []byte) error)
// PollOne tries to receive one Ethernet packet and returns true if one was
PollOne() (bool, error)
}
type LinkWifi interface { type LinkWifi interface {
Link Link
// Connect device to network // Connect device to network