private NetAltingConnectionClient(AltingChannelInput input, ChannelOutput toLink, Link link, ConnectionData connData, NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX) : base(input) { this.toLinkTX = toLink; this.In = input; this.data = connData; this.serverLocation = loc; this.localLocation = new NetConnectionLocation(Node.getInstance().getNodeID(), connData.vconnn); this.outputFilter = filterTX; this.inputFilter = filterRX; if (link != null) { this.linkConnectedTo = link; // TODO: registration stuff this.isLocal = false; this.localConnection = null; } else { this.isLocal = true; this.localConnection = ConnectionManager.getInstance().getConnection(this.serverLocation.getVConnN()); this.linkConnectedTo = null; } }
private NetAltingConnectionServer(AltingChannelInput openChan, AltingChannelInput requestChan, ConnectionData connData, NetworkMessageFilter.FilterRx filterRX, NetworkMessageFilter.FilterTx filterTX) : base(openChan) ////throws JCSPNetworkException { this.openIn = openChan; this.requestIn = requestChan; this.data = connData; this.inputFilter = filterRX; this.outputFilter = filterTX; this.location = new NetConnectionLocation(Node.getInstance().getNodeID(), this.data.vconnn); }
static NetAltingConnectionClient create(NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX) ////throws JCSPNetworkException { // Create the connection data structure ConnectionData data = new ConnectionData(); // Create channel linking this to the Link level. This channel is used to receive response and // acknowledgement messages Any2OneChannel chan = Channel.any2one(new InfiniteBuffer()); data.toConnection = chan.Out(); // Set state of connection data.state = ConnectionDataState.CLIENT_STATE_CLOSED; ConnectionManager.getInstance().create(data); ChannelOutput toLink; if (loc.getNodeID().equals(Node.getInstance().getNodeID())) { toLink = ConnectionManager.getInstance().getConnection(loc.getVConnN()).toConnection; return(new NetAltingConnectionClient(chan.In(), toLink, null, data, loc, filterTX, filterRX)); } Link link = LinkManager.getInstance().requestLink(loc.getNodeID()); if (link == null) { link = LinkFactory.getLink(loc.getNodeID()); } toLink = link.getTxChannel(); return(new NetAltingConnectionClient(chan.In(), toLink, link, data, loc, filterTX, filterRX)); }