亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dynamicschedulerimpl.java

?? 網絡模擬器
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package jns.dynamic;

/**
 * dynamic.DynamicSchedulerImpl.java
 *
 * This class allows for simple creation of a network of interconnected JNS nodes
 * with duplex links between them. It also allows for scheduling events dynamically
 * with the JNS simulator, through RMI calls. The main purpose of this class is to
 * be an RMI gateway for the fake.net.MulticastSocket classes used to test java implementations
 * of network protocols.
 *
 * @author Einar Vollset <einar.vollset@ncl.ac.uk>
 *
 */

import jns.Simulator;
import jns.agent.Agent;
import jns.command.StopCommand;
import jns.element.*;
import jns.trace.JavisTrace;
import jns.trace.Trace;
import jns.util.IPAddr;
import jns.util.Protocols;
import jns.util.Queue;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Enumeration;
import java.util.Set;

/**
 * This is the main class used to dynamically schedule events to the JNS
 * network simulator.
 * It will start the *modified* simulator, and then any event that gets
 * passed to it will be scheduled with it.
 * This will allow (hopefully) for "real" implementations of network protocols
 * to be simulated for correctness.
 *
 * To use this class, you need to add the nodes and links to the scheduler in the
 * main() function below, alternatively you can write your own main()..
 * (Remember to rmic the class!)
 *
 * Beware! This class has a narrow functionality, as I have implemented it for
 * my own purposes... :-D
 *
 *
 */
public class DynamicSchedulerImpl extends UnicastRemoteObject implements DynamicScheduler, Agent
{

    /**
     * This is a reference to the JNS simulator instance. This needs to
     * get passed to the
     */
    private Simulator m_simulator = null;

    /**
     * This is the Trace used to write the JVS file for use with Javis (or NAM)
     */
    private Trace m_trace = null;

    /**
     * This is a hashmap of message queues mapped onto the IP address of the
     * node which sent it.
     */
    private HashMap m_msgQueues = null;

    /**
     * This is a hashmap of the nodes in the simulator
     */
    private HashMap m_nodes = null;

    /**
     * The bandwidth of the links in this simulation
     */
    private int m_bandwidth;

    /**
     * The error rate of the links in this simulation
     */
    private double m_errorRate;

    /**
     * The link delay in this simulation
     */
    private double m_delay;

    /**
     * This holds a hashmap of all the links created.
     */
    private HashMap m_links = null;

    /**
     * This is the subnet mask used.
     */
    private IPAddr m_subnetMask = null;

    /**
     * This is the time the simulator was started
     */
    private double m_startTime;

    /**
     * This determines if the simulation has started, in which no more nodes can be
     * added to the simulation run
     */
    private boolean m_started = false;


    /**
     * Constructs a new dynamic.DynamicSchedulerImpl
     *
     * @param nameOfRun The name of this simulation run. Gives name to the JVS file.
     * @param linkBandwidth The bandwidth of all the links between the nodes (could change this to set it for each link added)
     * @param linkDelay The link delay of all the links between the nodes (could change this to set it for each link added)
     * @param linkErrorRate The link error rate of all the links between the nodes (could change this to set it for each link added)
     * @param subnetMask The subnet mask of all the routes given to the nodes (could change this to set it for each link added)
     */
    public DynamicSchedulerImpl(String nameOfRun, int linkBandwidth, double linkDelay, double linkErrorRate, IPAddr subnetMask) throws RemoteException
    {
        m_simulator = Simulator.getInstance();
        try
        {
            m_trace = new JavisTrace(nameOfRun + ".jvs");
        }
        catch(IOException e)
        {
            System.err.println("Could not create " + nameOfRun + ".jvs!");
            e.printStackTrace();
            System.exit(-1);
        }
        m_simulator.setTrace(m_trace);
        m_msgQueues = new HashMap();
        m_nodes = new HashMap();
        m_bandwidth = linkBandwidth;
        m_delay = linkDelay;
        m_errorRate = linkErrorRate;
        m_links = new HashMap();
        m_subnetMask = subnetMask;


    }

    /**
     * Adds a node to the simulator. The IP address is used as both
     * name and IP address.
     * This method can currently not be called remotely
     */
    public void addNode(IPAddr IPAddress)
    {
        if(m_started)
        {
            System.err.println("Can't add nodes after the simulation has started..");
            return;
        }
        //Create the node
        Node node = new Node(IPAddress.toString());
        //Attach to the simulator
        m_simulator.attachWithTrace(node, m_trace);
        //Create a queue of messages destined for the external node
        Queue incoming = new Queue();
        //Add the queue to the hashmap of incoming quueues
        m_msgQueues.put(IPAddress.toString(), incoming);
        //Attach the dynamic Scheduler (this) as the "higher level agent", so messages
        //can be passed up to it.
        node.attach(this, Protocols.UDP);
         //Add to hashmap of nodes
        m_nodes.put(IPAddress.toString(), node);

    }

    /**
     * Adds a link between the two nodes. Beware that this is a
     * two way link, so there is no need to add a link "the other way"
     * This method can currently not be called remotely
     *
     * @param nodeA The IP address of the first node to connect
     * @param nodeB The IP address of the second node to connect
     */
    public void addLink(IPAddr nodeA, IPAddr nodeB)
    {

        String linkName = nodeA.toString() + "-" + nodeB.toString();
        String invLinkName = nodeB.toString() + "-" + nodeA.toString();
        Node a = (Node) m_nodes.get(nodeA.toString());
        Node b = (Node) m_nodes.get(nodeB.toString());

        //First check that the nodes are there
        if(a == null || b == null)
        {
            System.err.println("Trying to add a link between two nodes (" + linkName + "), one or more which does not exits.");
            return;
        }

        //Now check that the link does not already exist.
        if(m_links.get(linkName) != null || m_links.get(invLinkName) != null)
        {
            System.err.println("Duplicate link: " + linkName + ". Link not added.");
            return;
        }

        //Need to create an interface on either node.
        Interface a2b = new DuplexInterface(nodeA);
        a.attach(a2b);
        m_simulator.attachWithTrace(a2b, m_trace);

        Interface b2a = new DuplexInterface(nodeB);
        b.attach(b2a);
        m_simulator.attachWithTrace(b2a, m_trace);

        //Then create the link
        Link link = new DuplexLink(m_bandwidth, m_delay, m_errorRate);

        //Attach the link to either interface
        a2b.attach(link, true);
        b2a.attach(link, true);

        //attach the link to the simulator
        m_simulator.attachWithTrace(link, m_trace);

        //Add the link to m_links
        m_links.put(linkName, link);

        //And finally add route between the two.
        a.addRoute(nodeB, m_subnetMask, a2b);
        b.addRoute(nodeA, m_subnetMask, b2a);


    }


    /**
     * This method schedules a sending of a given packet of data (an object) from
     * one node to the other. The sending is scheduled to happen at
     * (System.currentTimeMillis() - Time of start of simulator)
     */
    public synchronized void scheduleUnicast(InetAddress senderIPAddress, InetAddress receiverIPAddress, byte[] data) throws RemoteException
    {

        IPAddr senderIPAddr = new IPAddr(senderIPAddress);
        IPAddr receiverIPAddr = new IPAddr(receiverIPAddress);

        // Firsy check that the two nodes exist in the simulator..
        Node sender = (Node) m_nodes.get(senderIPAddr.toString());
        Node receiver = (Node) m_nodes.get(receiverIPAddr.toString());

        if(sender == null)
        {
            System.err.println("Trying to send a packet FROM a non-existant node: " + senderIPAddr);
            return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人久久18免费网站麻豆| 狠狠色狠狠色综合日日91app| 国产精品一区二区久久精品爱涩| 欧美日韩国产首页| 美女网站视频久久| 久久久影院官网| 成人丝袜18视频在线观看| 国产精品久久夜| 日本国产一区二区| 日韩不卡免费视频| 欧美电影精品一区二区| 亚洲国产精品久久久久秋霞影院| 欧美剧情电影在线观看完整版免费励志电影 | 亚洲不卡在线观看| 精品久久久久一区二区国产| 波多野结衣中文一区| 亚洲图片有声小说| 精品国产免费久久| 欧美在线你懂的| 九九**精品视频免费播放| 自拍偷拍国产亚洲| 日韩欧美国产午夜精品| 国产精品影视天天线| 视频一区二区中文字幕| 久久久久国产精品麻豆ai换脸| 日产国产高清一区二区三区| 亚洲靠逼com| 国产精品久久久久7777按摩| 精品国产乱码久久久久久影片| 99久精品国产| 免费人成黄页网站在线一区二区| 中文字幕一区二区三区乱码在线| 精品久久久久久久一区二区蜜臀| 欧美日本高清视频在线观看| 91片黄在线观看| 精品综合免费视频观看| 麻豆精品一区二区av白丝在线| 亚洲一区中文日韩| 亚洲午夜久久久久久久久久久| 一区二区三区欧美激情| 一区二区三区四区在线播放 | 欧美日韩不卡一区二区| 欧美人与禽zozo性伦| 欧美日韩精品一区二区三区蜜桃| 精品久久久久久久久久久久久久久| 欧美精品在线观看播放| 日韩欧美一区二区三区在线| 欧美精品亚洲二区| 欧美综合视频在线观看| 欧美日本免费一区二区三区| 国产欧美综合在线| 亚洲成人综合网站| 成人丝袜视频网| 日韩欧美国产一区二区在线播放 | 岛国av在线一区| 精品欧美一区二区三区精品久久| 中文字幕亚洲区| 国产91色综合久久免费分享| 欧美高清www午色夜在线视频| 亚洲欧洲日本在线| 亚洲精品国产第一综合99久久| 成人性视频免费网站| 亚洲欧美电影一区二区| 极品少妇一区二区三区精品视频| 69堂国产成人免费视频| 亚洲人123区| 91免费看视频| 午夜久久久影院| 欧美一级生活片| 日本成人在线电影网| 欧美一区三区二区| 免费国产亚洲视频| 精品国产91洋老外米糕| 国模无码大尺度一区二区三区| 日韩欧美自拍偷拍| 国产98色在线|日韩| 综合在线观看色| 欧美熟乱第一页| 免费成人在线观看| 国产精品私房写真福利视频| 91亚洲资源网| 性欧美疯狂xxxxbbbb| 久久久夜色精品亚洲| av毛片久久久久**hd| 麻豆免费看一区二区三区| 精品久久免费看| 色久优优欧美色久优优| 日韩精品电影在线观看| 国产精品国产三级国产普通话99| 色综合天天在线| 国产综合色在线| 香蕉影视欧美成人| 国产精品美女www爽爽爽| 日韩免费成人网| 91九色02白丝porn| 成人免费视频视频| 日韩不卡一区二区三区| 亚洲免费在线视频一区 二区| 久久免费看少妇高潮| 欧美一区三区四区| 欧美日韩一区二区三区在线看| av在线播放成人| 91在线视频免费观看| 白白色 亚洲乱淫| 国产精品18久久久久久久久久久久| 亚洲永久精品大片| 亚洲v中文字幕| 视频一区二区三区中文字幕| 亚洲国产美女搞黄色| 尤物av一区二区| 亚洲国产一区二区三区| 亚洲午夜视频在线| 亚洲妇女屁股眼交7| 亚洲www啪成人一区二区麻豆| 日本不卡一区二区三区| 日韩黄色片在线观看| 日韩1区2区日韩1区2区| 激情五月婷婷综合网| 成人av在线资源| 99精品在线免费| 制服丝袜亚洲色图| 日本一区二区免费在线观看视频| 中文字幕免费观看一区| 亚洲男人都懂的| 久久精品国产一区二区三| 国产·精品毛片| 99re热这里只有精品视频| 精品视频免费看| 欧美日韩久久久一区| 日韩欧美在线1卡| 国产精品天干天干在线综合| 亚洲一区免费视频| 国产在线观看一区二区| 色婷婷精品久久二区二区蜜臂av| 日韩西西人体444www| 中文字幕中文字幕中文字幕亚洲无线 | 爽好多水快深点欧美视频| 狠狠色丁香婷婷综合久久片| 欧美日韩一区精品| 亚洲国产aⅴ天堂久久| caoporn国产一区二区| 欧美日韩精品系列| 亚洲欧美激情小说另类| 成人免费av网站| 久久综合九色综合97_久久久| 看片的网站亚洲| 欧美一区二区不卡视频| 午夜视频在线观看一区二区| 91老师国产黑色丝袜在线| 国产精品美女久久久久久久| 97久久精品人人做人人爽| 午夜精品福利视频网站| 成人v精品蜜桃久久一区| 欧美国产精品v| 欧美日韩中文精品| 国内成人免费视频| 久久久久成人黄色影片| 成人涩涩免费视频| 日韩一区中文字幕| 色诱视频网站一区| 夜夜揉揉日日人人青青一国产精品| 成人av电影在线网| 依依成人精品视频| 日韩欧美一区电影| 成人免费视频视频| 国产欧美一区二区三区在线看蜜臀| 不卡高清视频专区| 精品一区二区三区免费| 亚洲精品久久久久久国产精华液| 欧美一区二区三区性视频| 国内精品写真在线观看| 亚洲一区免费在线观看| 国产欧美视频一区二区| 欧美一区二区三区公司| 色婷婷av一区二区三区大白胸| 成人精品视频一区二区三区 | 日本午夜一本久久久综合| 成人av电影免费在线播放| 国产精品免费视频一区| 一区二区三区中文免费| 夜夜精品浪潮av一区二区三区| 亚欧色一区w666天堂| 亚洲不卡av一区二区三区| 亚洲国产一区二区在线播放| 亚洲黄色性网站| 亚洲一区二区三区美女| 日韩毛片精品高清免费| 中文字幕第一区综合| 国产婷婷色一区二区三区| 国产欧美精品在线观看| 国产女人aaa级久久久级| 国产精品看片你懂得| 亚洲图片另类小说| 奇米影视在线99精品| 亚洲高清视频在线| 国产永久精品大片wwwapp| 成人午夜激情影院| 91精品国产一区二区人妖| 精品理论电影在线观看| 亚洲丝袜美腿综合|