|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjist.swans.net.NetIp
public class NetIp
IPv4 implementation based on RFC 791. Performs protocol multiplexing, and prioritized packet queuing, but no RED or packet fragmentation.
Nested Class Summary | |
---|---|
static class |
NetIp.NicInfo
Information about each network interface. |
Nested classes/interfaces inherited from interface jist.swans.net.NetInterface |
---|
NetInterface.NetHandler |
Field Summary | |
---|---|
protected PacketLoss |
incomingLoss
packet loss models. |
protected NetAddress |
localAddr
local network address. |
static org.apache.log4j.Logger |
log
IP logger. |
static byte |
MAX_QUEUE_LENGTH
Maximum packet queue length. |
protected NetIp.NicInfo[] |
nics
network interfaces. |
protected PacketLoss |
outgoingLoss
packet loss models. |
protected NetInterface.NetHandler[] |
protocolHandlers
protocol handlers. |
protected Mapper |
protocolMap
protocol number mapping. |
protected RouteInterface |
routing
routing protocol. |
protected NetInterface |
self
self-referencing proxy entity. |
static int |
THRESHOLD_FRAGMENT
Packet fragmentation threshold. |
Constructor Summary | |
---|---|
NetIp(NetAddress addr,
Mapper protocolMap,
PacketLoss in,
PacketLoss out)
Initialize IP implementation with given address and protocol mapping. |
Method Summary | |
---|---|
byte |
addInterface(MacInterface macEntity)
Add network interface with default queue. |
byte |
addInterface(MacInterface macEntity,
MessageQueue q)
Add network interface. |
NetAddress |
getAddress()
Return local network address. |
private NetInterface.NetHandler |
getProtocolHandler(int protocolId)
Return network protocol handler. |
NetInterface |
getProxy()
Return self-referencing proxy entity. |
private boolean |
isForMe(NetMessage.Ip msg)
Whether packet is for local consumption. |
void |
pump(int interfaceId)
Request next packet to send, if one exists; indicate that interface has completed processing previous request. |
void |
receive(Message msg,
MacAddress lastHop,
byte macId,
boolean promisc)
Receive a message from the link layer. |
void |
send(Message msg,
NetAddress dst,
short protocol,
byte priority,
byte ttl)
Route, if necessary, and send a message (from TRANSPORT). |
void |
send(NetMessage.Ip msg,
int interfaceId,
MacAddress nextHop)
Send a message along given interface (usually from ROUTING). |
private void |
sendIp(NetMessage.Ip msg)
Send an IP packet. |
void |
setAddress(NetAddress addr)
Set local network address. |
void |
setProtocolHandler(int protocolId,
NetInterface.NetHandler handler)
Set network protocol handler. |
void |
setRouting(RouteInterface routingEntity)
Set routing implementation. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger log
public static final int THRESHOLD_FRAGMENT
public static final byte MAX_QUEUE_LENGTH
protected NetInterface self
protected NetAddress localAddr
protected RouteInterface routing
protected Mapper protocolMap
protected NetInterface.NetHandler[] protocolHandlers
protected NetIp.NicInfo[] nics
protected PacketLoss incomingLoss
protected PacketLoss outgoingLoss
Constructor Detail |
---|
public NetIp(NetAddress addr, Mapper protocolMap, PacketLoss in, PacketLoss out)
addr
- local network addressprotocolMap
- protocol number mappingin
- incoming packet loss modelout
- outgoing packet loss modelMethod Detail |
---|
public NetInterface getProxy()
public void setAddress(NetAddress addr)
addr
- local network addressprivate boolean isForMe(NetMessage.Ip msg)
msg
- packet to inspect
public void setRouting(RouteInterface routingEntity)
routingEntity
- routing entitypublic byte addInterface(MacInterface macEntity)
macEntity
- link layer entity
public byte addInterface(MacInterface macEntity, MessageQueue q)
macEntity
- link layer entity
public void setProtocolHandler(int protocolId, NetInterface.NetHandler handler)
protocolId
- protocol identifierhandler
- protocol handlerprivate NetInterface.NetHandler getProtocolHandler(int protocolId)
protocolId
- protocol identifier
public NetAddress getAddress() throws JistAPI.Continuation
getAddress
in interface NetInterface
JistAPI.Continuation
- never (blocking event)public void receive(Message msg, MacAddress lastHop, byte macId, boolean promisc)
receive
in interface NetInterface
msg
- incoming network packetlastHop
- link-level source of incoming packetmacId
- incoming interfacepromisc
- whether network interface is in promisc. modepublic void send(Message msg, NetAddress dst, short protocol, byte priority, byte ttl)
send
in interface NetInterface
msg
- packet payload (usually from transport or routing layers)dst
- packet destination addressprotocol
- packet protocol identifierpriority
- packet priorityttl
- packet time-to-live valuepublic void send(NetMessage.Ip msg, int interfaceId, MacAddress nextHop)
send
in interface NetInterface
msg
- packet (usually from routing layer)interfaceId
- interface along which to send packetnextHop
- packet next hop addressprivate void sendIp(NetMessage.Ip msg)
msg
- ip packetpublic void pump(int interfaceId)
pump
in interface NetInterface
interfaceId
- interface identifierpublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |