コード例 #1
0
ファイル: NCC.cs プロジェクト: sopel30/tsst2
 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
ファイル: NCC.cs プロジェクト: sopel30/tsst2
 public bool Establish(NetworkConnection connection)
 {
     if (connection != null)
     {
         ConnectionController.AddConnection(connection);
         ConnectionController.ConnectionRequest(connection.Id);
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: NCC.cs プロジェクト: sopel30/tsst2
        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
ファイル: NCC.cs プロジェクト: sopel30/tsst2
        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
ファイル: NCC.cs プロジェクト: sopel30/tsst2
        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
ファイル: NCC.cs プロジェクト: sopel30/tsst2
        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
ファイル: RC.cs プロジェクト: sopel30/tsst2
        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
ファイル: CC.cs プロジェクト: sopel30/tsst2
 public void AddConnection(NetworkConnection connection)
 {
     connections.Add(connection.Id, connection);
 }