rina.flowAllocator.impl
Class FlowAllocatorImpl

java.lang.Object
  extended by rina.flowAllocator.impl.FlowAllocatorImpl
All Implemented Interfaces:
FlowAllocatorAPI

public class FlowAllocatorImpl
extends java.lang.Object
implements FlowAllocatorAPI

This is a component of the IPC Process that responds to allocation Requests from Application Processes(or from upper DIF IPC)

Version:
1.0
Author:
Yuefeng Wang and Flavio Esposito. Computer Science Department, Boston University

Constructor Summary
FlowAllocatorImpl(RIBImpl rib, MessageQueue msgQueue, IRM irm)
           
FlowAllocatorImpl(RIBImpl rib, MessageQueue msgQueue, TCPFlowManager tcpManager)
           
 
Method Summary
 int addIncomingFlow(java.lang.String srcIPCName, java.lang.String dstIPCName, int dstPortID, java.lang.String dstUnderlyingIPCName)
          return a handle to IPC
 int addNewApp(java.lang.String upperIPCName)
           
 Flow allocate(java.lang.String srcIPCName, java.lang.String dstIPCName)
           
 Flow allocateAccept(java.lang.String srcIPCName, java.lang.String dstIPCName, java.lang.String dstUnderlyingIPC, int dstUnderlyingIPCPort)
           
 void allocateReject(java.lang.String srcIPCName, java.lang.String dstIPCName, java.lang.String dstUnderlyingIPC, int dstUnderlyingIPCPort)
           
 void deallocate(int portID)
           
 java.util.LinkedHashMap<java.lang.String,java.lang.String> getAppToIPCMapping()
           
 java.util.LinkedHashMap<java.lang.String,java.lang.Integer> getAppWellKnownPort()
           
 FlowAllocated getFlowAllocated()
           
 MessageQueue getFlowMsgQueue(int portID)
           
 java.util.LinkedHashMap<java.lang.String,java.lang.String> getForwardingTable()
           
 IRM getIrm()
           
 void getOneFlow(java.lang.String IPCName)
          return a flow by giving a dst IPC Name Since there may be multiple flows to the same IPC,so just pick the first one this will be used when do the relaying
 TCPFlowManager getTcpManager()
           
 byte[] receive(int handleID)
           
 java.lang.String resolveApplicationByNMS(java.lang.String appName)
          this is used to revolve an application to the low DIF IPC just like reslove a URL to ip address
 void send(int portID, byte[] payloadMsg)
           
 void setAppToIPCMapping(java.util.LinkedHashMap<java.lang.String,java.lang.String> appToIPCMapping)
           
 void setAppWellKnownPort(java.util.LinkedHashMap<java.lang.String,java.lang.Integer> appWellKnownPort)
           
 void setFlowAllocated(FlowAllocated flowAllocated)
           
 void setForwardingTable(java.util.LinkedHashMap<java.lang.String,java.lang.String> forwardingTable)
           
 void setIrm(IRM irm)
           
 void setTcpManager(TCPFlowManager tcpManager)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowAllocatorImpl

public FlowAllocatorImpl(RIBImpl rib,
                         MessageQueue msgQueue,
                         TCPFlowManager tcpManager)

FlowAllocatorImpl

public FlowAllocatorImpl(RIBImpl rib,
                         MessageQueue msgQueue,
                         IRM irm)
Method Detail

allocate

public Flow allocate(java.lang.String srcIPCName,
                     java.lang.String dstIPCName)
Specified by:
allocate in interface FlowAllocatorAPI
Parameters:
srcIPCName: - upperDIF IPC
dstIPCName: - upperDIF IPC
Returns:
flow if any

allocateAccept

public Flow allocateAccept(java.lang.String srcIPCName,
                           java.lang.String dstIPCName,
                           java.lang.String dstUnderlyingIPC,
                           int dstUnderlyingIPCPort)

allocateReject

public void allocateReject(java.lang.String srcIPCName,
                           java.lang.String dstIPCName,
                           java.lang.String dstUnderlyingIPC,
                           int dstUnderlyingIPCPort)

getFlowMsgQueue

public MessageQueue getFlowMsgQueue(int portID)
Returns:
the flowMsgQueue

resolveApplicationByNMS

public java.lang.String resolveApplicationByNMS(java.lang.String appName)
this is used to revolve an application to the low DIF IPC just like reslove a URL to ip address

Parameters:
dstIPCName -
Returns:
Throws:

getAppWellKnownPort

public java.util.LinkedHashMap<java.lang.String,java.lang.Integer> getAppWellKnownPort()
Returns:
the appWellKnownPort

setAppWellKnownPort

public void setAppWellKnownPort(java.util.LinkedHashMap<java.lang.String,java.lang.Integer> appWellKnownPort)
Parameters:
appWellKnownPort - the appWellKnownPort to set

addIncomingFlow

public int addIncomingFlow(java.lang.String srcIPCName,
                           java.lang.String dstIPCName,
                           int dstPortID,
                           java.lang.String dstUnderlyingIPCName)
return a handle to IPC


deallocate

public void deallocate(int portID)
Specified by:
deallocate in interface FlowAllocatorAPI

send

public void send(int portID,
                 byte[] payloadMsg)
          throws java.lang.Exception
Throws:
java.lang.Exception

receive

public byte[] receive(int handleID)

getOneFlow

public void getOneFlow(java.lang.String IPCName)
return a flow by giving a dst IPC Name Since there may be multiple flows to the same IPC,so just pick the first one this will be used when do the relaying

Parameters:
IPCName -

getFlowAllocated

public FlowAllocated getFlowAllocated()
Returns:
the flowAllocated

setFlowAllocated

public void setFlowAllocated(FlowAllocated flowAllocated)
Parameters:
flowAllocated - the flowAllocated to set

getForwardingTable

public java.util.LinkedHashMap<java.lang.String,java.lang.String> getForwardingTable()
Returns:
the forwardingTable

setForwardingTable

public void setForwardingTable(java.util.LinkedHashMap<java.lang.String,java.lang.String> forwardingTable)
Parameters:
forwardingTable - the forwardingTable to set

getAppToIPCMapping

public java.util.LinkedHashMap<java.lang.String,java.lang.String> getAppToIPCMapping()
Returns:
the appToIPCMapping

setAppToIPCMapping

public void setAppToIPCMapping(java.util.LinkedHashMap<java.lang.String,java.lang.String> appToIPCMapping)
Parameters:
appToIPCMapping - the appToIPCMapping to set

addNewApp

public int addNewApp(java.lang.String upperIPCName)

getTcpManager

public TCPFlowManager getTcpManager()
Returns:
the tcpManager

setTcpManager

public void setTcpManager(TCPFlowManager tcpManager)
Parameters:
tcpManager - the tcpManager to set

getIrm

public IRM getIrm()
Returns:
the irm

setIrm

public void setIrm(IRM irm)
Parameters:
irm - the irm to set