⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventgenerator.java

📁 The Java Network Simulator is a Java implementation of the ns-2 simulator originally from Berkeley.n
💻 JAVA
字号:
package jns.util;

import jns.element.IPPacket;
import jns.trace.Event;


/**
 EventGenerator provides a number of static utility functions that help with
 generating different kinds of events by filling in the common bits.
 */
public class EventGenerator
{


    /**
     makePacketEvent will create a packet event of type 'name', where name
     is HopEvent, ReceiveEvent, etc. from the IP packet that is passed.
     @param name the event name of the packet event to be generated, e.g.
     "HopEvent"
     @param packet the IP packet from which to take event information
     @return a new packet event of the desired type.
     */
    public static Event makePacketEvent(String name, IPPacket packet)
    {

        Event event = new Event(name);

        event.addParameter("Source Address", packet.source);
        event.addParameter("Destination Address", packet.destination);
        event.addParameter("Source Hop", packet.source_hop);
        event.addParameter("Destination Hop", packet.destination_hop);
        event.addParameter("Packet ID", new Integer(packet.id));
        event.addParameter("Packet Length", new Integer(packet.length));
        event.addParameter("Packet Protocol",
                           new Integer(packet.protocol));

        return event;
    }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -