2.2 VLN 操作
VLN 接口定义了七个操作,供每台主机上的 VLN 客户端使用。VLN 接口的实现在向客户端呈现这些操作时有很大的自由度;例如,这些操作可以返回错误码,也可以不返回。
VLN 实现可以将这些操作定义为相对于客户端计算同步或异步地发生。我们预期 ResetVLNInterface、MyVLNAddress、SendVLNDatagram、PurgeMAddresses、AttendMAddress 和 IgnoreMAddress 操作通常相对于客户端是同步的,而 ReceiveVLNDatagram 通常是异步的,即客户端可以发起该操作,继续进行计算,并在稍后被通知有数据报可用。(异步 ReceiveVLNDatagram 的替代方案是:A)阻塞式接收操作;B)非阻塞但同步的接收操作,在没有数据报可用时立即返回失败码。任何一种替代方案都可能满足特定需求,但异步接收涵盖了这两者,用途也更广泛。)客户端至少必须能够完全同步地访问每个操作;VLN 实现可以自行选择提供更复杂的机制。
VLN 操作
ResetVLNInterface
The VLN layer for this host is reset (e.g., for the
Ethernet VLN implementation the operation ClearVPMap is
performed, and a frame of type "Cronus VLN" and subtype
"Mapping Update" is broadcast; see Section 4.2). This
operation does not affect the set of attended VLN
multicast addresses.
function MyVLNAddress()
Returns the specific VLN address of this host; this can
always be done without communication with any other host.
SendVLNDatagram(Datagram)
When this operation completes, the VLN layer has copied
the Datagram and it is either "in transmission" or
"delivered", i.e., the transmitting process cannot assume
that the message has been delivered when SendVLNDatagram
completes.
ReceiveVLNDatagram(Datagram)
When this operation completes, Datagram is a
representation of a VLN datagram sent by a VLN client and
not previously received by the client invoking
ReceiveVLNDatagram.
PurgeMAddresses()
When this operation completes, no VLN multicast addresses
are registered with the local VLN component.
function AttendMAddress(MAddress)
If this operation returns True then MAddress, which must
be a VLN multicast address, is registered as an "alias"
for this host, and messages addressed to MAddress by VLN
clients will be delivered to the client on this host.
IgnoreMAddress(MAddress)
When this operation completes, MAddress is not registered
as a multicast address for the client on this host.
每当 Cronus 主机启动时,VLN 层会先隐式执行 ResetVLNInterface 和 PurgeMAddresses,然后才接受来自客户端的请求或来自 PLN 的进入流量。客户端也可以在正常运行期间调用它们。如下文第 4.2 节所述,VLN 组件可能依赖从其他主机动态获得的状态信息,不正确的信息有可能进入组件的状态表。(例如,如果某台 Cronus 主机的 PLN 地址被更改但其 VLN 地址保持不变,其他主机所持有的旧的 VLN 到 PLN 地址映射就会不正确。)谨慎的 VLN 客户端可以每隔一段时间(例如每小时)调用 ResetVLNInterface,迫使 VLN 组件重建其动态表。
VLN 组件会对其同时“关注”(attend)的多播地址数量设置上限;如果客户端试图注册超过该上限的地址,AttendMAddress 将返回 False,且没有其他效果。实际的上限因 VLN 组件而异,但通常在 10 到 100 个多播地址之间。组件可以把上限设得大到整个多播地址空间(64,511 个地址)。
VLN 层不保证在发送主机或接收主机上提供任何最小的数据报缓冲量。然而,它确实保证 VLN 客户端调用的 SendVLNDatagram 操作最终会完成;这意味着如果缓冲不足而接收客户端又太慢,数据报可能丢失。VLN 层会尽力使因此而丢弃数据包的情况非常少见。