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

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

?? riprouter.java

?? 中間件開發詳細說明:清華大學J2EE教程講義(ppt)-Tsinghua University J2EE tutorial lectures (ppt) [上載源碼成為會員下載此源碼] [成為VIP會
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        // log / record ....        if (super.reportWriter_ != null)        {            super.write("");            super.write("receive incoming, " + pkt + ", delay, " + nextTime);            super.write("break this packet into, " + numPackets);        }        // break a large packet into smaller ones that fit into MTU        // by making null or empty packets except for the last one        for (int i = 0; i < numPackets - 1; i++)        {            NetPacket np = new NetPacket(null, pkt.getID(), MTU, tag,                                         pkt.getSrcID(), pkt.getDestID(),                                         pkt.getNetServiceType(),i+1,numPackets);            np.setLast(id);            super.write("enqueing, " + np);            sched.enque(np);  // put the packet into the scheduler        }        // put the actual packet into the last one and resize it accordingly        pkt.setLast(id);        pkt.setSize(pkt.getSize() - MTU * (numPackets - 1));        super.write("enqueing, " + pkt);        sched.enque(pkt);  // put the packet into the scheduler    }    /**     * Gets the link's name for a given id     * @param destID    a destination id     * @return the link's man     * @pre destID > 0     * @post $none     */    private synchronized String getLinkName(int destID)    {        String destName = GridSim.getEntityName(destID);        String linkName = null;        //directly connected        if (hostTable.containsValue(destName)) {            linkName = (String)linkTable.get(destName);        }        else        {            // need to forward to another router            Object[] data = (Object[]) forwardTable.get(destName);            String router = (String) data[0];            linkName = (String) linkTable.get(router);        }        return linkName;    }    /**     * Returns the Scheduler associated with a packet.     *     * @param np NetPacket for which the associated scheduler is to be returned     * @return the packet's scheduler or <tt>null</tt> if the packet is empty     * @pre np != null     * @post $none     */    public PacketScheduler getScheduler(Packet np)    {        if (np == null) {            return null;        }        String destName = GridSim.getEntityName( np.getDestID() );        return getScheduler(destName);    }    /**     * Returns the Scheduler that the router would use to reach a particular     * destination. This can be used to set weigths, priorities etc. as the     * case may be on the Scheduler     *     * @param dest id of the destination for which the Scheduler is required.     * @return the destination's packet scheduler     * @pre dest > 0     * @post $none     */    public PacketScheduler getScheduler(int dest)    {        if (dest < 0) {            return null;        }        String destName = GridSim.getEntityName(dest);        return getScheduler(destName);    }    /**     * Returns the Scheduler that the router would use to reach a particular     * destination. This can be used to set weigths, priorities etc. as the     * case may be on the Scheduler     *     * @param dest Name of the destination for which the Scheduler is required.     * @return destination's packet scheduler or <tt>null</tt> if destination     *         name is invalid.     * @pre dest != null     * @post $none     */    public PacketScheduler getScheduler(String dest)    {        if (dest == null || dest.length() == 0) {            return null;        }        PacketScheduler sched = null;        try        {            if ( hostTable.containsValue(dest) )            {                String linkName = (String) linkTable.get(dest);                sched = (PacketScheduler) schedTable.get(linkName);            }            else            {                // need to forward to another router                Object[] data = (Object[]) forwardTable.get(dest);                // in case the forwarding table is incomplete                if (data == null) {                    return null;                }                String router = (String) data[0];                String linkName = (String) linkTable.get(router);                sched = (PacketScheduler) schedTable.get(linkName);            }        }        catch (Exception e) {            sched = null;        }        return sched;    }    /**     * Processes internal event     * @param ev    a Sim_event object     * @pre ev != null     * @post $none     */    private synchronized void processInternalEvent(Sim_event ev)    {        PacketScheduler sched = (PacketScheduler) ev.get_data();        dequeue(sched);    }    /**     * Dequeue a packet from the scheduler and sends it to the next     * destination via a link.     * @param sched  the packet scheduler     * @pre sched != null     * @post $none     */    private synchronized void dequeue(PacketScheduler sched)    {        Packet np = sched.deque();        // process ping() packet        if (np instanceof InfoPacket) {            ((InfoPacket) np).addExitTime( GridSim.clock() );        }        super.write("dequeuing, " + np);        // must distinguish between normal and junk packet        int tag = GridSimTags.PKT_FORWARD;        if (np.getTag() == GridSimTags.JUNK_PKT) {            tag = GridSimTags.JUNK_PKT;        }        // sends the packet via the link        String linkName = getLinkName( np.getDestID() );        super.sim_schedule(GridSim.getEntityId(linkName),                           GridSimTags.SCHEDULE_NOW, tag, np);        // process the next packet in the scheduler        if ( !sched.isEmpty() )        {            double nextTime = (np.getSize() * BITS) / sched.getBaudRate();            sendInternalEvent(nextTime, sched);        }    }    /**     * Sends an internal event to itself     * @param time  the delay time period     * @param data  the data to be sent     * @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise     * @pre time >= 0     * @post $none     */    private synchronized boolean sendInternalEvent(double time, Object data)    {        if (time < 0.0) {            return false;        }        super.sim_schedule(id, time, GridSimTags.INSIGNIFICANT, data);        return true;    }    /**     * Prints this router's routing table in a nice-formatted layout     * @pre $none     * @post $none     */    public synchronized void printRoutingTable()    {        synchronized (System.out)        {            System.out.println();            System.out.println("--- Routing Table for " +                               super.get_name() + " ---");            for (Enumeration e = hostTable.keys(); e.hasMoreElements(); )            {                String link = (String) e.nextElement();                System.out.println(hostTable.get(link) + "\t\t" + link);            }            for (Enumeration e = forwardTable.keys(); e.hasMoreElements(); )            {                String host = (String)e.nextElement();                Object[] data = (Object[])forwardTable.get(host);                String nextHop = (String)data[0];                System.out.println(host + "\t\t" + nextHop);            }            System.out.println("-------------------------------------");            System.out.println();        }    }    //----------- ADVERTISING FUNCTIONS --------------//    /**     * All hosts connected to this router are advertised to adjacent routers     * @pre $none     * @post $none     */    protected synchronized void advertiseHosts()    {        Collection hosts = hostTable.values(); // who to advertise        Enumeration routers = routerTable.elements();        while ( routers.hasMoreElements() )        {            RIPAdPack ad = new RIPAdPack(super.get_name(), hosts);            String router = (String) routers.nextElement();            super.write("advertise to router, " + router);            sim_schedule(Sim_system.get_entity_id(router),                         GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, ad);        }        super.sim_pause(5);   // wait for 5 secs to gather the results    }    /**     * When an ad is recieved, the forwarding table is updated. After that we     * need to propogate this ad along all links except the incoming one.     * {@link #forwardAd(RIPAdPack)} is used for that     * @param ev  a Sim_event object     * @pre ev != null     * @post $none     */    private synchronized void receiveAd(Sim_event ev)    {        super.write("receive router ad from, "+GridSim.getEntityName(ev.get_src()));        // what to do when an ad is received        RIPAdPack ad = (RIPAdPack)ev.get_data();        // prevent count-to-infinity        if (ad.getHopCount() > 15) {            return;        }        String sender = ad.getSender();        Iterator it = ad.getHosts().iterator();        while ( it.hasNext() )        {            String host = (String) it.next();            if ( host.equals(super.get_name()) ) {                continue;            }            if (hostTable.containsValue(host)) { // direct connection                continue;            }            if (forwardTable.containsKey(host))            {                Object[] data = (Object[])forwardTable.get(host);                int hop = ((Integer)data[1]).intValue();                if ((hop) > ad.getHopCount())                {                    Object[] toPut = { sender, new Integer(ad.getHopCount()) };                    forwardTable.put(host, toPut);                }            }            else            {                Object[] toPut = { sender, new Integer(ad.getHopCount()) };                forwardTable.put(host, toPut);            }        }        forwardAd(ad);    }    /**     * Received ads should be forwarded along all links except the incoming     * one. Also need to change id to onself     *     * @param ad    a RIPAdPack object     * @pre ad != null     * @post $none     */    private synchronized void forwardAd(RIPAdPack ad)    {        String sender = ad.getSender();        ad.incrementHopCount();        RIPAdPack newad = new RIPAdPack(super.get_name(),ad.getHosts());        newad.setHopCount(ad.getHopCount());        Enumeration routers = routerTable.elements();        while ( routers.hasMoreElements() )        {            String router = (String)routers.nextElement();            if (!router.equals(sender))            {                sim_schedule(Sim_system.get_entity_id(router),                      GridSimTags.SCHEDULE_NOW, GridSimTags.ROUTER_AD, newad);            }        }    }} // end class

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区视频免费| 国精产品一区一区三区mba桃花| 精品国产3级a| 欧美一区二区三区日韩| 91久久精品一区二区三| 91在线精品秘密一区二区| 成人动漫在线一区| 成人高清视频在线| 成人激情图片网| 91免费国产在线| 在线一区二区三区做爰视频网站| 99re这里只有精品首页| 日本韩国一区二区| 欧美中文字幕一区二区三区 | 中文字幕日韩一区二区| 国产精品婷婷午夜在线观看| 中文字幕成人网| 亚洲欧美日本韩国| 亚洲成人av电影在线| 美腿丝袜亚洲一区| 国产mv日韩mv欧美| 欧美最猛性xxxxx直播| 欧美精品日韩综合在线| 日韩欧美国产一区二区在线播放| 精品国产乱码久久久久久老虎 | 99riav一区二区三区| 色视频成人在线观看免| 欧美一级黄色大片| 中国色在线观看另类| 悠悠色在线精品| 久久精品国产精品亚洲综合| 国产91丝袜在线播放| 欧美午夜不卡视频| 久久伊99综合婷婷久久伊| 亚洲欧洲日韩综合一区二区| 亚洲午夜久久久久久久久电影网| 日本不卡视频在线| 91在线视频在线| 欧美不卡一区二区三区四区| 国产精品毛片久久久久久 | 91精品国产美女浴室洗澡无遮挡| 欧美v国产在线一区二区三区| 国产精品久久久久天堂| 天天亚洲美女在线视频| 丰满少妇在线播放bd日韩电影| 91黄色免费网站| 国产日本欧美一区二区| 午夜精品免费在线观看| 91蜜桃在线免费视频| 精品久久久久久亚洲综合网| 一区二区三区不卡视频在线观看 | 色噜噜狠狠色综合中国| 亚洲精品在线一区二区| 亚洲成人自拍偷拍| 99精品偷自拍| 日本一区二区三区国色天香 | 精品粉嫩aⅴ一区二区三区四区| 中文字幕在线视频一区| 国产在线精品免费| 91精品国产91久久综合桃花| 亚洲欧美日韩国产一区二区三区 | 国产精品白丝jk黑袜喷水| 欧美伦理视频网站| 亚洲永久免费视频| 99国内精品久久| 国产欧美精品一区aⅴ影院| 精品一区二区在线视频| 7878成人国产在线观看| 亚洲va欧美va天堂v国产综合| 成人动漫一区二区三区| 久久久精品人体av艺术| 久久精品国产秦先生| 91精品国产色综合久久久蜜香臀| 亚洲欧美一区二区三区久本道91| 高清不卡一二三区| 国产亚洲综合色| 国产成人免费在线观看不卡| 久久女同互慰一区二区三区| 激情欧美一区二区三区在线观看| 日韩亚洲欧美综合| 久久66热re国产| 26uuu国产一区二区三区| 精品亚洲成a人| 久久视频一区二区| 国产麻豆精品视频| 国产精品私房写真福利视频| 国产成人精品免费看| 亚洲欧美在线观看| 91浏览器打开| 亚洲一二三区在线观看| 欧美一区午夜视频在线观看| 美脚の诱脚舐め脚责91| 日韩欧美高清一区| 丁香婷婷深情五月亚洲| 亚洲欧洲在线观看av| 欧美亚洲日本国产| 免播放器亚洲一区| 中文字幕精品三区| 在线观看日韩精品| 美女脱光内衣内裤视频久久影院| 久久一区二区三区国产精品| 粉嫩av一区二区三区| 亚洲伊人色欲综合网| 91精品国产综合久久精品性色| 久久se这里有精品| 亚洲欧洲av在线| 欧美人xxxx| 国产白丝网站精品污在线入口| 亚洲精品大片www| 日韩色视频在线观看| 成人免费av网站| 青青草97国产精品免费观看| 国产午夜一区二区三区| 91黄视频在线观看| 国产乱码精品一区二区三区av| 亚洲视频一区二区在线观看| 51久久夜色精品国产麻豆| 国产成人精品免费视频网站| 亚洲成va人在线观看| 国产精品免费人成网站| 欧美精品高清视频| 99re视频这里只有精品| 日韩精品国产欧美| 亚洲欧洲av在线| 久久众筹精品私拍模特| 欧美日韩成人综合天天影院 | 成人综合在线视频| 日韩中文字幕av电影| 国产精品成人在线观看| 日韩视频在线你懂得| 色欧美日韩亚洲| 成人美女视频在线观看| 另类小说欧美激情| 亚洲18色成人| 亚洲综合色在线| 亚洲美女偷拍久久| 欧美国产日韩在线观看| 精品少妇一区二区| 日韩欧美专区在线| 欧美久久久久久蜜桃| 在线精品亚洲一区二区不卡| 成人涩涩免费视频| 国产一区91精品张津瑜| 日本免费在线视频不卡一不卡二| 亚洲欧美经典视频| 亚洲人成小说网站色在线| 国产欧美日韩视频在线观看| 精品国产网站在线观看| 欧美一区二区三区人| 日韩一级成人av| 欧美mv和日韩mv国产网站| 欧美精品三级在线观看| 欧美精品亚洲二区| 6080日韩午夜伦伦午夜伦| 欧美日韩成人在线| 欧美二区乱c少妇| 日韩一区二区电影在线| 欧美一区二区三区的| 日韩女优av电影| 精品久久久久99| 亚洲国产精品传媒在线观看| 日本一区二区三区视频视频| 国产精品国模大尺度视频| 亚洲天堂2016| 亚洲图片有声小说| 日韩不卡一区二区| 奇米色一区二区三区四区| 久久国产精品色| 国产九九视频一区二区三区| 国产白丝精品91爽爽久久| 91一区二区在线| 欧美日韩日日摸| 91精品欧美福利在线观看| 欧美精品一区二区高清在线观看| 久久久久久久网| 亚洲另类春色国产| 五月天中文字幕一区二区| 美女网站色91| av在线综合网| 欧美精品aⅴ在线视频| 日韩一区二区电影| 综合久久国产九一剧情麻豆| 亚洲成人激情自拍| 国内成人免费视频| 色悠悠久久综合| 日韩视频免费观看高清完整版| 国产日产精品一区| 亚洲成av人影院| 高清国产午夜精品久久久久久| 91免费版在线看| ww亚洲ww在线观看国产| 亚洲精品免费在线| 国产综合成人久久大片91| 91亚洲精品久久久蜜桃| 欧美一卡2卡3卡4卡| 1区2区3区欧美| 国产一区二区91| 欧美日韩亚洲高清一区二区| 国产欧美日韩精品在线| 日韩不卡免费视频|