상속: Brunet.Transport.EdgeListener, IEdgeSendHandler
예제 #1
0
        static public Node AddNode(Simulator sim, NatTypes type0, NatTypes type1, bool relay)
        {
            Node node = sim.AddNode();

            NatFactory.AddNat(node.EdgeListenerList, type0);

            if (relay)
            {
                Relay.IRelayOverlap ito = new Relay.SimpleRelayOverlap();
                EdgeListener        el  = new Relay.RelayEdgeListener(node, ito);
                node.AddEdgeListener(el);
                el.Start();
            }

            if (type1 != NatTypes.Disabled)
            {
                NodeMapping            nm  = sim.Nodes[node.Address];
                int                    id  = nm.ID;
                string                 tas = SimulationTransportAddress.GetString(TransportAddress.TAType.SO, id);
                INat                   nat = GetNat(TransportAddressFactory.CreateInstance(tas), type1);
                SimulationEdgeListener el  = new SimulationEdgeListener(id, 0, null,
                                                                        true, TransportAddress.TAType.SO, nat);
                node.AddEdgeListener(el);
                el.Start();
            }
            return(node);
        }
예제 #2
0
        static public void AddNat(IEnumerable el_list, NatTypes type)
        {
            SimulationEdgeListener simel = null;

            foreach (EdgeListener el in el_list)
            {
                simel = el as SimulationEdgeListener;
                if (simel != null)
                {
                    break;
                }
            }

            if (simel == null)
            {
                throw new Exception("There was no SimulationEdgeListener");
            }

            TransportAddress ta = null;

            foreach (TransportAddress lta in simel.LocalTAs)
            {
                ta = lta;
                break;
            }

            if (ta == null)
            {
                throw new Exception("How did we get a null TA?");
            }

            simel.Nat = GetNat(ta, type);
        }
예제 #3
0
 public SimulationEdge(IEdgeSendHandler s, int local_id, int remote_id,
                       bool is_in, int delay, TransportAddress.TAType type) : base(s, is_in)
 {
     Delay      = delay;
     LocalID    = local_id;
     RemoteID   = remote_id;
     _ta_type   = type;
     _local_ta  = GetTransportAddress(local_id);
     _remote_ta = GetTransportAddress(remote_id);
     SimEL      = s as SimulationEdgeListener;
 }