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

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

?? dynamicschedulerimpl.java

?? The Java Network Simulator is a Java implementation of the ns-2 simulator originally from Berkeley.n
?? 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一区二区三区免费野_久草精品视频
91精品国产一区二区三区| 午夜精品福利久久久| 国产一区二区免费在线| 精品久久久久久久久久久久久久久| 日本一不卡视频| 欧美不卡激情三级在线观看| 国产在线看一区| 国产精品色婷婷久久58| 色偷偷久久一区二区三区| 亚洲国产精品久久久男人的天堂| 3d成人h动漫网站入口| 久国产精品韩国三级视频| 久久精品视频免费| 色94色欧美sute亚洲线路二| 午夜精品久久一牛影视| 久久青草欧美一区二区三区| 成人免费观看男女羞羞视频| 亚洲另类春色校园小说| 欧美一区二区三区在线观看| 国产乱码精品一区二区三区五月婷| 国产免费观看久久| 色综合天天综合狠狠| 视频一区欧美日韩| 久久午夜国产精品| 在线看不卡av| 久久超碰97人人做人人爱| 国产精品青草综合久久久久99| 在线观看日韩一区| 韩国三级在线一区| 夜夜爽夜夜爽精品视频| 欧美v国产在线一区二区三区| 91免费视频网| 看国产成人h片视频| 亚洲欧美日韩成人高清在线一区| 日韩欧美一区在线| 不卡视频在线观看| 免费高清在线一区| 伊人婷婷欧美激情| 久久久国产一区二区三区四区小说| 91亚洲精品久久久蜜桃网站| 日本成人在线一区| 一区二区三区四区蜜桃| 久久久精品欧美丰满| 欧美日韩色综合| 91亚洲精华国产精华精华液| 麻豆91在线看| 亚洲第四色夜色| 亚洲欧美电影一区二区| 久久影音资源网| 6080日韩午夜伦伦午夜伦| www.欧美日韩| 国产一区在线不卡| 石原莉奈在线亚洲三区| 亚洲精品美国一| 久久久精品欧美丰满| 欧美一卡二卡三卡| 欧美日韩国产一二三| 91久久免费观看| www.成人网.com| 成人一区二区视频| 国产乱子伦视频一区二区三区| 一区二区三区欧美日| 中文字幕欧美国产| 久久九九久精品国产免费直播| 69堂国产成人免费视频| 欧美日韩二区三区| 欧美日韩在线播| 欧美日本视频在线| 在线免费av一区| 欧美专区在线观看一区| 色婷婷久久久综合中文字幕| www.性欧美| 不卡av电影在线播放| 丁香桃色午夜亚洲一区二区三区| 久久精品国产免费看久久精品| 五月天久久比比资源色| 亚洲一级不卡视频| 亚洲欧美一区二区不卡| 亚洲男人的天堂一区二区| 自拍偷拍欧美精品| 亚洲视频免费在线| 亚洲丝袜自拍清纯另类| 亚洲欧洲精品一区二区精品久久久| 中文久久乱码一区二区| 日本一区二区三区在线不卡| 国产色产综合色产在线视频| 久久久91精品国产一区二区精品 | 成人激情小说乱人伦| 国产成人一级电影| 成人黄页毛片网站| 色噜噜狠狠色综合中国| 91成人看片片| 欧美一级电影网站| 久久蜜桃一区二区| 国产精品欧美精品| 亚洲激情中文1区| 日韩电影免费在线看| 久久精品国产网站| 成人av影视在线观看| 91日韩精品一区| 欧美日韩国产一二三| 欧美大肚乱孕交hd孕妇| 久久这里只有精品视频网| 中文子幕无线码一区tr| 亚洲激情综合网| 麻豆成人免费电影| bt7086福利一区国产| 欧美性感一区二区三区| 宅男在线国产精品| 欧美激情中文不卡| 亚洲一区在线播放| 韩国av一区二区三区| 97久久精品人人做人人爽| 欧美日韩电影在线| 国产区在线观看成人精品| 亚洲视频免费在线| 精品一区二区影视| youjizz国产精品| 欧美一级一区二区| 亚洲欧洲另类国产综合| 日韩影院免费视频| 粉嫩一区二区三区在线看| 色婷婷av一区二区三区软件| 日韩免费观看高清完整版在线观看| 国产三级一区二区| 亚洲bt欧美bt精品777| 成人性生交大合| 日韩午夜三级在线| 亚洲欧洲日韩一区二区三区| 久久狠狠亚洲综合| 色老汉av一区二区三区| www日韩大片| 天堂va蜜桃一区二区三区 | 在线精品视频一区二区三四| 日韩欧美高清dvd碟片| 亚洲欧美日韩综合aⅴ视频| 开心九九激情九九欧美日韩精美视频电影 | 免费人成精品欧美精品| 99久久久无码国产精品| 精品剧情v国产在线观看在线| 一区二区三区精品在线观看| 国产不卡免费视频| 欧美成人精精品一区二区频| 亚洲综合激情网| 91首页免费视频| 国产精品乱码一区二三区小蝌蚪| 麻豆一区二区三| 欧美日韩国产高清一区二区三区 | 六月丁香婷婷色狠狠久久| 欧美在线观看18| 亚洲日本青草视频在线怡红院 | 成人网男人的天堂| 欧美激情资源网| 国产很黄免费观看久久| 91精品国产一区二区三区| 亚洲一卡二卡三卡四卡无卡久久| 99re这里只有精品视频首页| 久久久九九九九| 国产一区久久久| 亚洲精品一区二区三区四区高清 | 一区二区三区日韩精品视频| 成人免费福利片| 中文天堂在线一区| a级精品国产片在线观看| 精品成人免费观看| 亚洲制服欧美中文字幕中文字幕| 91网站最新网址| 亚洲色图欧洲色图婷婷| 不卡的av网站| 18欧美乱大交hd1984| 91在线视频18| 亚洲女同一区二区| 欧美无砖专区一中文字| 午夜av一区二区| 欧美肥大bbwbbw高潮| 日本va欧美va精品| 欧美成人vr18sexvr| 国产一区二区三区精品视频| 久久日韩精品一区二区五区| 韩日av一区二区| 国产精品乱人伦中文| www.一区二区| 亚洲一二三级电影| 777奇米成人网| 激情亚洲综合在线| 国产亲近乱来精品视频| 99视频精品在线| 亚洲成人免费在线观看| 5月丁香婷婷综合| 国内精品写真在线观看| 国产精品拍天天在线| 色成人在线视频| 日韩在线播放一区二区| 久久久亚洲精品一区二区三区 | 99re这里只有精品首页| 亚洲高清不卡在线| 精品国产百合女同互慰| av激情综合网| 日本视频一区二区三区| 久久精品网站免费观看|