package link; /***************************************************************** Interface for a generic link (broadcast or point-to-point). Links connect nodes. @see Node *****************************************************************/ public interface Link { /************************************************************ Transmit a packet on the link. Block until transmission is complete. Does not necessarily block until the packet is received (depending on the latency on the link). @param p the packet to transmit @param n the node transmitting the packet @see LinkPacket ************************************************************/ public void TransmitPacket (LinkPacket p, Node n); /************************************************************ The maximum number of data bytes a packet may contain. Packets with too much data are blindly dropped @return the maximum transmission unit, in bytes ************************************************************/ public int MTU (); /************************************************************ The average bandwidth for the link @return the bandwidth, in Mb/s ************************************************************/ public double Bandwidth (); /************************************************************ The average latency for the link @return the latency, in ms ************************************************************/ public double Latency (); /************************************************************ Get the names of all the other nodes connected to this link (i.e. all the nodes who would receive a packet that was transmitted on the link) @param n the node making the request (so that it can be excluded from the result) @return an array of the names of the other nodes ************************************************************/ public String[] OtherNodeNames (Node n); /************************************************************ Add a node to the link. From this point on, this node will receive any packets sent on this link. @param n the node to add as a receiver ************************************************************/ public void AddNode (Node n); /************************************************************ Remove a node from the link. This node will no longer receive packets sent on this link. No error should occur if the node is not currently receiving packets. @param n the node to remove as a receiver ************************************************************/ public void RemoveNode (Node n); }