Пример #1
0
 public void CallTeardown(NetworkConnection connection, string reason)
 {
     /*
     string src = manager.Get(connection.Source, "Name");
     string trg = manager.Get(connection.Target, "Name");
     Directory[src].Socket.Send(Encoding.ASCII.GetBytes(
         "call_teardown " + connection.Id + " " + reason));
     Directory[trg].Socket.Send(Encoding.ASCII.GetBytes(
         "call_teardown " + connection.Id + " " + reason));
     manager.Disconnect(connection.Id);*/
 }
Пример #2
0
 public bool Establish(NetworkConnection connection)
 {
     if (connection != null)
     {
         ConnectionController.AddConnection(connection);
         ConnectionController.ConnectionRequest(connection.Id);
         return true;
     }
     return false;
 }
Пример #3
0
        public object[] peerCoordinationReceived(string[] ports, string dstName, int dstId, int cap)
        {
            object[] toReturn = new object[2];
            NetworkConnection connection = new NetworkConnection();
            int i = 0;
            int connectionId=0;
            for ( ; i < ports.Length; i++)
            {
                connectionId = ConnectionController.GetFreeId();
                connection = rc.ExternalRequest(ports[i], dstName, dstId, connectionId, cap);
                if (connection != null)
                    break;
            }

            //toReturn[0] = "";
            toReturn[0]=ports[i];
            toReturn[1] = connection;
            ClientsToConnection.Add(ports[i] + "#" + dstName, connectionId);
            return toReturn;
        }
Пример #4
0
        public NetworkConnection PeerCoordinationAck(string srdDstName, string connArgs, string choosedSlot)
        {
            NetworkConnection connection = new NetworkConnection();
            string[] names = srdDstName.Split('#');
            string[] args = connArgs.Split('#');
            string connectionId = "1";

            connection = rc.getPathViaExternalLink(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(connectionId), Convert.ToInt32(args[2]), choosedSlot);

            return connection;
        }
Пример #5
0
        public string PeerCoordination(string srcName, string dstName, int sourceId, int targetId, int cap)
        {
            NetworkConnection connection = new NetworkConnection();

            if (targetId % 1000 == 0)
            {
                //e-nni
                string portsAvailable = rc.getExternalPorts(sourceId, targetId, ConnectionController.GetFreeId(), cap);
                network.sendMessage("NCC" + targetId / 1000 + "@CallControll#PeerCoordination#" + srcName + "#" + dstName + "#" + cap + "#" + portsAvailable);

                //connBuffer.Add("CallCoordination#"+srcName+"#"+dstName, connection);
                return "Waiting for Peer Coordination ok";
            }
            return "";
        }
Пример #6
0
        public object[] intraDomainCall(string srcName, string dstName, int sourceId, int targetId, int cap)
        {
            object[] toReturn = new object[2];
            NetworkConnection connection = new NetworkConnection();

            if (targetId % 1000 == 0)
            {
                //e-nni
                string portsAvailable = rc.getExternalPorts(sourceId, targetId, ConnectionController.GetFreeId(), cap);
                network.sendMessage("NCC"+targetId/1000+"@CallControll#PeerCoordination#"+srcName+"#"+dstName+"#"+cap+"#"+portsAvailable);

                //connBuffer.Add("CallCoordination#"+srcName+"#"+dstName, connection);
                toReturn[0] = "Waiting for Peer Coordination ok";
                toReturn[1] = null;
                return toReturn;
            }

            else
            {
                //i-nni
                int connectionId = ConnectionController.GetFreeId();
                connection = rc.assignRoute(sourceId, targetId, connectionId, cap);
                ClientsToConnection.Add(srcName + "#" + dstName, connectionId);
                Establish(connection);
                toReturn[0] = "Setting up connection";
                toReturn[1] = connection;
                return toReturn;
            }
        }
Пример #7
0
        private NetworkConnection parseToNetworConnection(SetupStore ss)
        {
            NetworkConnection networkConnection = new NetworkConnection(ss.connectN);
            //  List<LinkConnection> links = new List<LinkConnection>();
            LinkConnection link;
            networkConnection.Capacity = ss.requieredCapacity;

            foreach (var e in ss.path)
            {
                link = new LinkConnection();
                link.SourceId = e.Source.tNode.Name;
                link.TargetId = e.Target.tNode.Name;
                link.SourceRouting = e.SourceRouting;
                link.TargetRouting = e.TargetRouting;
                link.Link = e.tLink;
                networkConnection.Path.Add(link);
            }
            return networkConnection;
        }
Пример #8
0
 public void AddConnection(NetworkConnection connection)
 {
     connections.Add(connection.Id, connection);
 }