RAMP API

A brief list of most important methods provided by RAMP.

top

Core Layer

The it.unibo.deis.lia.ramp.core.e2e.E2EComm class provides the following full-featured methods. Other semplified versions of the same methods are available; see the source code for additional details.
public static GenericPacket receive(int localPort, int protocol, int timeout)
The receive(...) method waits for unicast and broadcast packets at the specified localPort using protocol (either E2EComm.UDP or E2EComm.TCP). The method waits at most timeout ms or until a packet is received if timeout value is set to 0.
public static void sendBroadcast(int TTL, int destPort, int protocol, Object payload)
The sendBroadcast(...) method sends a packet with the desired payload to every node whose distance in hops is equal to or less than TTL from the sender. Every time the packet reaches a node, RAMP forwards it to the specified local destPort using protocol (either E2EComm.UDP or E2EComm.TCP). In order to limit the impact of broadcast communications on network performance, the size of broadcast packets is kept under 60 KB.
public static boolean sendUnicast(String[] dest, String destNodeId, int destPort, int protocol, boolean ack, int timeoutAck, int bufferSize, int packetDeliveryTimeout, Object payload)
The sendUnicast(...) method sends a packet with the desired payload to a given remote node. The dest parameter identifies the destination via the ordered set of intermediary nodes composing the multi-hop path between sender and receiver.
destPort and protocol specify the port and protocol (either E2EComm.UDP or E2EComm.TCP) at which the receiving application is waiting for the packet. The destNodeId parameter identifies the destination via the unique identifier of the receiver.
If ack is false, the method immediately returns true. If ack is true, the sender waits at most timeoutAck ms for an explicit acknowledgment from the receiver; the method returns true if the acknowledgment packet reaches the sender before timeoutAck ms, false otherwise.
bufferSize parameter specifies the fragmentation granularity to be used by RAMP (GenericPacket.UNUSED_FIELD to disable fragmentation, 0 for default value of 50KB).
The packetDeliveryTimeout parameter specifies the expiration deadline of the packet in seconds (0 to disable packet time deadline).
The it.unibo.deis.lia.ramp.core.internode.Dispatcher class provides the following method.
protected void addPacketForwardingListener(PacketForwardingListener pfw);
The addPacketForwardingListener(...) method registers a listener to the local Dispatcher; the listener must implements the following methods:
  • void receivedUDPUnicastPacket(UnicastPacket up);
  • void receivedUDPBroadcastPacket(BroadcastPacket bp);
  • void receivedTCPUnicastPacket(UnicastPacket up);
  • void receivedTCPBroadcastPacket(BroadcastPacket bp);
  • void receivedTCPUnicastHeader(UnicastHeader uh);
  • void receivedTCPPartialPayload(UnicastHeader uh, byte[] payload, int off, int len);
  • void sendingTCPUnicastPacketException(UnicastPacket up, Exception e);
  • void sendingTCPUnicastHeaderException(UnicastHeader uh, Exception e);
top

Service Layer

The it.unibo.deis.lia.ramp.service.management.ServiceManager and it.unibo.deis.lia.ramp.service.management.Discovery classes provide the following full-featured methods. Other semplified versions of the same methods are available; see the source code for additional details.

public void registerService(String serviceName, int servicePort, int protocol)
The registerService(...) method allows to register a local service in a local repository directly handled by the Service Manager. For each service, there is the need to specify service name, local port where the service waits for requests, and protocol.
public static Vector<ServiceResponse> findServices(int TTL, String serviceName, int timeout, int serviceAmount)
The findServices(...) method permits to local applications to discover the location of remote services based on UDP sendBroadcast . The discoverer application has to specify service name, TTL of the discovery process, a timeout to avoid indefinite blocking, and maximum number of service replicas the application is willing to wait for. Note that the method returns either after timeout ms or after that responseAmount services have been found.
Last modified: July 8, 2010