net.clackrouter.component.extension
Class UDP

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

public class UDP
extends ClackComponent

Simplified implementation of the User Datagram Protocol (UDP).

Takes care of UDP's main functions of performing a checksum and demultiplexing packets by port


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int NUM_PORTS
           
static int PORT_FROM_NET
           
static int PORT_TO_NET
           
static int PORT_UNREACH
           
 
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, view
 
Constructor Summary
UDP(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.
 void addMapping(java.net.InetAddress addr, int port, UDPSocket sock)
          Adds a local address / port binding to the UDP stack
 void sendPacket(VNSUDPPacket packet)
          Interface for packets to be send by UDP sockets.
 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, getView, handlePullRequest, 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_FROM_NET

public static final int PORT_FROM_NET
See Also:
Constant Field Values

PORT_TO_NET

public static final int PORT_TO_NET
See Also:
Constant Field Values

PORT_UNREACH

public static final int PORT_UNREACH
See Also:
Constant Field Values

NUM_PORTS

public static final int NUM_PORTS
See Also:
Constant Field Values
Constructor Detail

UDP

public UDP(Router router,
           java.lang.String name)
Method Detail

setupPorts

public 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

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

sendPacket

public void sendPacket(VNSUDPPacket packet)
Interface for packets to be send by UDP sockets.

Parameters:
packet -

addMapping

public void addMapping(java.net.InetAddress addr,
                       int port,
                       UDPSocket sock)
                throws java.lang.Exception
Adds a local address / port binding to the UDP stack

Parameters:
addr -
port -
sock -
Throws:
java.lang.Exception - if another socket is already bound to this IP / UDP port pair