net.clackrouter.component.tcp
Class SockBuffer

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.tcp.SockBuffer
All Implemented Interfaces:
Alarm

public class SockBuffer
extends ClackComponent

Buffer to hold application data going to or from an application socket.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int DEFAULT_MAX_OCCUPANCY
           
static int NUM_PORTS
           
static int PORT_HEAD
           
static int PORT_TAIL
           
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT
 
Constructor Summary
SockBuffer(TCB tcb, Router router, java.lang.String name)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          The starting point for packet-processing when packets are "pushed" to this component.
 int getMaxOccupancy()
           
 int getOccupancy()
           
 VertexView getView(JGraph graph, CellMapper mapper)
          Returns the View object used to render this component in the Router Graph.
 VNSPacket handlePullRequest(int port_num)
          Called when a neighboring component wishes to "pull" a packet from this component.
 void setMaxBytesForPull(int max)
           
protected  void setupPorts(int numports)
          Allocates an array of ClackPort objects to be used by this component
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getColor, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getPropertiesView, getRouter, getSerializableProperties, getTime, getTypeName, getUniqueCount, hasError, initializeProperties, isHierarchical, isModifying, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_HEAD

public static int PORT_HEAD

PORT_TAIL

public static int PORT_TAIL

NUM_PORTS

public static int NUM_PORTS

DEFAULT_MAX_OCCUPANCY

public static int DEFAULT_MAX_OCCUPANCY
Constructor Detail

SockBuffer

public SockBuffer(TCB tcb,
                  Router router,
                  java.lang.String name)
Method Detail

setupPorts

protected void setupPorts(int numports)
Description copied from class: ClackComponent
Allocates an array of ClackPort objects to be used by this component

Overrides:
setupPorts in class ClackComponent
Parameters:
numports - the number of ports to create

getView

public VertexView getView(JGraph graph,
                          CellMapper mapper)
Description copied from class: ClackComponent
Returns the View object used to render this component in the Router Graph. By default, we use a ComponentView, which renders the component as a simple colored box with the component type written inside of it. More advanced component sub-classes that wish to be displayed differently should override this method to return a custom VertexView sub-class

Overrides:
getView in class ClackComponent
Parameters:
graph - the Router Graph
mapper - the CellMapper associated with this Router Graph
Returns:
the VertexView for rendering this component

setMaxBytesForPull

public void setMaxBytesForPull(int max)

handlePullRequest

public VNSPacket handlePullRequest(int port_num)
Description copied from class: ClackComponent

Called when a neighboring component wishes to "pull" a packet from this component.

This function should only be valid for port numbers that are defined as pull ports. This is enforced by the ClackPort class. By default, we return nothing.

Overrides:
handlePullRequest in class ClackComponent
Parameters:
port_num - The port that a packet is being requested on
Returns:
A packet if available for pull, or null

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Description copied from class: ClackComponent

The starting point for packet-processing when packets are "pushed" to this component.

The default implementation warns that the packet is being ignored.

Overrides:
acceptPacket in class ClackComponent
Parameters:
packet - The pushed packet
port_number - The number of the port that this packet is arriving on

getOccupancy

public int getOccupancy()

getMaxOccupancy

public int getMaxOccupancy()