|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.net.SocketImpl
verinec.netsim.util.net.sockets.SocketImpl
public class SocketImpl
A socket implementation that redirects all traffic into the simulator instead of sending it to the systems network stack. Therefore it needs to know to which Layer (@link verinec.netsim.entities.layers.TransportLayer) the traffic is redirected. SocketImpl is not used directly. It us used by SocketImplFactory (@link java.net.SocketImplFactory) or (@link verinec.netsim.sockets.SimSocketImplFactory) which are used in the constructor of Socket (@link java.net.Socket).
| Field Summary | |
|---|---|
SocketInputStream |
is
the socket's input stream returned by #getInputStream() |
private Logger |
jlogger
|
private TransportLayer |
layer
|
private ILogger |
logger
|
SocketOutputStream |
os
the socket's output stream returned by #getOutputStream() |
private int |
seq
running sequence number of send messages |
private int |
seq_ack
last acknowledged sequence number, last received ack |
private FSMSocketImpl |
state
|
private NetSimThread |
thread
|
| Fields inherited from class java.net.SocketImpl |
|---|
address, fd, localport, port |
| Fields inherited from interface java.net.SocketOptions |
|---|
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY |
| Constructor Summary | |
|---|---|
SocketImpl()
Constructs a new SocketImplementation the TransportLayer to which all the data is redirected |
|
| Method Summary | |
|---|---|
protected void |
accept(SocketImpl s)
|
void |
activate()
|
void |
activate(SimTime st)
|
protected int |
available()
|
protected void |
bind(InetAddress host,
int bport)
|
protected void |
close()
|
protected void |
connect(InetAddress address,
int port)
|
protected void |
connect(SocketAddress address,
int timeout)
|
protected void |
connect(String host,
int port)
|
protected void |
create(boolean stream)
|
TCPPacket |
createTCPPacket()
Creates a TCP Packet that is adressed with the adress of this port. |
InetAddress |
getAddress()
gets the remote address of this Socket |
int |
getBuf()
gets the address of the last part of the buffer that can be acknowledged |
protected InputStream |
getInputStream()
|
int |
getLocalPort()
|
ILogger |
getLogger()
gets this Socket's Logger |
Object |
getOption(int optID)
|
protected OutputStream |
getOutputStream()
|
int |
getPort()
|
int |
getSeq_ack()
gets the last acknowledged sequence number |
int |
getSeq()
gets the sequence number of this socket |
FSMSocketImpl |
getState()
gets the state of this Socket |
NetSimThread |
getThread()
gets the Thread using this socket |
TransportLayer |
getTransportLayer()
gets the TransportLayer |
private TransportLayer |
guessLayer()
|
void |
hold(SimTime time)
|
void |
incrSeq()
increases the sequence number of this socket by one |
boolean |
isConnectionReset()
|
protected void |
listen(int backlog)
|
void |
passivate()
|
void |
proccessUp(Packet packet)
Processes a packet |
private void |
send(TCPPacket packet,
ILogger logger)
sends a TCP Packet |
void |
send(Vector payload,
ILogger logger)
sends a packet down to the next layer |
void |
sendData(TCPPacket packet,
ILogger logger)
sends a TCP Packet |
protected void |
sendUrgentData(int data)
|
void |
setAddress(InetAddress address)
sets the Address of this Socket |
void |
setBacklog(int backlog)
Sets the number of accpeting connections |
void |
setLayer(TransportLayer layer)
sets the layer for this instance |
void |
setLocalPort(int localport)
sets the Local Port of this Socket |
void |
setLogger(ILogger logger)
sets the Logger in the InputStream Associated with this Socket |
void |
setOption(int optID,
Object value)
|
void |
setPort(int port)
sets the Remote Port of this Socket |
void |
setSeq_ack(int seq_ack)
sets the last acknowledged sequence number |
void |
setSeq(int seq)
sets the sequence number of this socket |
void |
setState(FSMSocketImpl state)
Sets the state of this socket |
void |
unbind()
Un-binds this Socket and frees the used port |
| Methods inherited from class java.net.SocketImpl |
|---|
getFileDescriptor, getInetAddress, setPerformancePreferences, shutdownInput, shutdownOutput, supportsUrgentData, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private TransportLayer layer
private NetSimThread thread
public SocketInputStream is
public SocketOutputStream os
private ILogger logger
private Logger jlogger
private FSMSocketImpl state
private int seq
private int seq_ack
| Constructor Detail |
|---|
public SocketImpl()
throws NetSimException
NetSimException - if no layer is associated with this SocketImpl| Method Detail |
|---|
private TransportLayer guessLayer()
protected int available()
throws IOException
available in class SocketImplIOExceptionSocketImpl.available()
protected void close()
throws IOException
close in class SocketImplIOExceptionSocketImpl.close()
protected void listen(int backlog)
throws IOException
listen in class SocketImplIOExceptionSocketImpl.listen(int)
protected void sendUrgentData(int data)
throws IOException
sendUrgentData in class SocketImplIOExceptionSocketImpl.sendUrgentData(int)
protected void create(boolean stream)
throws IOException
create in class SocketImplIOExceptionSocketImpl.create(boolean)
protected InputStream getInputStream()
throws IOException
getInputStream in class SocketImplIOExceptionSocketImpl.getInputStream()
protected OutputStream getOutputStream()
throws IOException
getOutputStream in class SocketImplIOExceptionSocketImpl.getOutputStream()
protected void connect(String host,
int port)
throws IOException
connect in class SocketImplIOExceptionSocketImpl.connect(java.lang.String, int)
protected void bind(InetAddress host,
int bport)
throws IOException
bind in class SocketImplIOExceptionSocketImpl.bind(java.net.InetAddress, int)public int getLocalPort()
getLocalPort in class SocketImplSocketImpl.getLocalPort()public int getPort()
getPort in class SocketImplSocketImpl.getPort()public InetAddress getAddress()
protected void connect(InetAddress address,
int port)
throws IOException
connect in class SocketImplIOExceptionSocketImpl.connect(java.net.InetAddress, int)
protected void connect(SocketAddress address,
int timeout)
throws IOException
connect in class SocketImplIOExceptionSocketImpl.connect(java.net.SocketAddress, int)
protected void accept(SocketImpl s)
throws IOException
accept in class SocketImplIOExceptionSocketImpl.accept(java.net.SocketImpl)public void setPort(int port)
port - the Remote Port of this Socketpublic void setLocalPort(int localport)
localport - the local port of this Socket
public Object getOption(int optID)
throws SocketException
getOption in interface SocketOptionsSocketExceptionSocketOptions.getOption(int)
public void setOption(int optID,
Object value)
throws SocketException
setOption in interface SocketOptionsSocketExceptionSocketOptions.setOption(int, java.lang.Object)public boolean isConnectionReset()
public void send(Vector payload,
ILogger logger)
payload - payload that is used as the tcp packets payloadlogger - a logger
public void sendData(TCPPacket packet,
ILogger logger)
packet - a TCPPacket to be sendlogger - the XML Logger that processes the logged sim events
private void send(TCPPacket packet,
ILogger logger)
packet - a TCPPacket to be sendlogger - the XML Logger that processes the logged sim eventspublic void setLayer(TransportLayer layer)
layer - a TransportLayerpublic void setLogger(ILogger logger)
logger - a Loggerpublic TransportLayer getTransportLayer()
public void setState(FSMSocketImpl state)
state - a SocketImpl (state)public void setBacklog(int backlog)
backlog - the number of accpeting connections
public TCPPacket createTCPPacket()
throws NetSimException
NetSimException - if the Socket doesn't know where to send the packet to. This means to connection (or state to a connection) was etablished.public void proccessUp(Packet packet)
packet - a packet to be processedFSMSocketImpl.proccessUp(verinec.netsim.entities.packets.Packet)public void setAddress(InetAddress address)
address - the Address of this Socketpublic void passivate()
NetSimThread.passivate()public void hold(SimTime time)
time - a Simulation Time interval for which the thread holdsNetSimThread.hold(desmoj.core.simulator.SimTime)public void activate()
NetSimThread.activate()public void activate(SimTime st)
st - simulation interval time until the threads activationNetSimThread.activate(desmoj.core.simulator.SimTime)public int getBuf()
public int getSeq()
public void setSeq(int seq)
seq - the new sequence numberpublic void incrSeq()
public int getSeq_ack()
public void setSeq_ack(int seq_ack)
seq_ack - a sequence numberpublic FSMSocketImpl getState()
public NetSimThread getThread()
public void unbind()
public ILogger getLogger()
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||