google永远的神

This commit is contained in:
impact-eintr
2021-09-03 21:50:49 +08:00
parent b208476302
commit 0a08ba8692
7 changed files with 431 additions and 1 deletions

11
tcpip/stack/nic.go Normal file
View File

@@ -0,0 +1,11 @@
package stack
type referencedNetworkEndpoint struct {
//ilist.Entry
//refs int32
//ep NetworkEndpoint
//nic *NIC
//protocol tcpip.NetworkProtocolNumber
//linkCache LinkAddressCache
//holdsInserRef bool
}

View File

@@ -1,6 +1,9 @@
package stack
import "github.com/impact-eintr/netstack/tcpip"
import (
"github.com/impact-eintr/netstack/tcpip"
"github.com/impact-eintr/netstack/tcpip/buffer"
)
// LinkEndpoint是由数据链路层协议(以太 环回 原始)实现的接口
// 并由网络层协议用于实施者的数据链路端点发送数据包
@@ -40,3 +43,6 @@ const (
CapabilityDisconnectOk
CapabilityLoopback
)
type NetworkDispatcher interface {
}

26
tcpip/stack/route.go Normal file
View File

@@ -0,0 +1,26 @@
package stack
import "github.com/impact-eintr/netstack/tcpip"
// 贯穿整个协议栈的路由,也就是在链路层和网络层都可以路由
// 如果目标地址是链路层地址,那么在链路层路由
// 如果目标地址是网络层地址,那么在网络层路由
type Route struct {
// 远端网络层地址 ipv4 or ipv6
RemoteAddress tcpip.Address
// 远端网卡MAC地址
RemoteLinkAddress tcpip.LinkAddress
// 本地网络层地址
LocalAddress tcpip.Address
// 下一跳网络层地址
NextHop tcpip.Address
// 网络层协议号
NextProto tcpip.NetworkProtocolNumber
// 相关的网络终端
ref *referencedNetworkEndpoint
}