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

📄 fromipsumdump.hh

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 HH
字号:
// -*- mode: c++; c-basic-offset: 4 -*-#ifndef CLICK_FROMIPSUMDUMP_HH#define CLICK_FROMIPSUMDUMP_HH#include <click/element.hh>#include <click/task.hh>#include <click/timer.hh>#include <click/notifier.hh>#include <click/ipflowid.hh>#include "elements/userlevel/fromfile.hh"#include "ipsumdumpinfo.hh"CLICK_DECLS/*=cFromIPSummaryDump(FILENAME [, I<keywords> STOP, TIMING, ACTIVE, ZERO, CHECKSUM, PROTO, MULTIPACKET, SAMPLE, CONTENTS, FLOWID])=s tracesreads packets from an IP summary dump file=dReads IP packet descriptors from a file produced by ToIPSummaryDump, thencreates packets containing info from the descriptors and pushes them out theoutput. Optionally stops the driver when there are no more packets.The file may be compressed with gzip(1) or bzip2(1); FromIPSummaryDump willrun zcat(1) or bzcat(1) to uncompress it.FromIPSummaryDump reads from the file named FILENAME unless FILENAME is asingle dash 'C<->', in which case it reads from the standard input. It willnot uncompress the standard input, however.Keyword arguments are:=over 8=item STOPBoolean. If true, then FromIPSummaryDump will ask the router to stop when itis done reading. Default is false.=item TIMINGBoolean. If true, then FromIPSummaryDump tries to maintain the timing of theoriginal packet stream. The first packet is emitted immediately; thereafter,FromIPSummaryDump maintains the delays between packets. Default is false.=item ACTIVEBoolean. If false, then FromIPSummaryDump will not emit packets (until the'C<active>' handler is written). Default is true.=item ZEROBoolean. Determines the contents of packet data not set by the dump. If trueE<lparen>the default), this data is zero. If false, it is random garbage.=item CHECKSUMBoolean. If true, then output packets' IP, TCP, and UDP checksums are set, andhave actual data bytes covering the entire IP length (whether or not thosedata bytes were defined). If false (the default), then the checksum fieldscontain random garbage, and output packets may be shorter than their IPheaders' length fields (the EXTRA_LENGTH annotation is set to account for thedifference).=item PROTOByte (0-255). Sets the IP protocol used for output packets when the dumpdoesn't specify a protocol. Default is 6 (TCP).=item MULTIPACKETBoolean. If true, then FromIPSummaryDump will emit multiple packets for eachline---specifically, it will emit as many packets as the packet count fieldspecifies. Default is false.=item SAMPLEUnsigned real number between 0 and 1. FromIPSummaryDump will output eachpacket with probability SAMPLE. Default is 1. FromIPSummaryDump usesfixed-point arithmetic, so the actual sampling probability may differsubstantially from the requested sampling probability. Use theC<sampling_prob> handler to find out the actual probability. If MULTIPACKET istrue, then the sampling probability applies separately to the multiple packetsgenerated per record.=item CONTENTSString, containing a space-separated list of content names (seeToIPSummaryDump for the possibilities). Defines the default contents of thedump.=item FLOWIDString, containing a space-separated flow ID (source address, source port,destination address, destination port, and, optionally, protocol). Defines theIP addresses and ports used by default. Any flow information in the input filewill override this setting.=backOnly available in user-level processes.=nPackets generated by FromIPSummaryDump always have IP version 4 and a correctIP header length. The default IP protocol is TCP (6) and the defaulttime-to-live is 100. The rest of the packet data is zero or garbage, unlessset by the dump. Generated packets will usually have short lengths, but theextra header length annotations are set correctly.FromIPSummaryDump is a notifier signal, active when the element is active andthe dump contains more packets.=h sampling_prob read-onlyReturns the sampling probability (see the SAMPLE keyword argument).=h active read/writeValue is a Boolean.=h encap read-onlyReturns 'IP'. Useful for ToDump's USE_ENCAP_FROM option.=h filesize read-onlyReturns the length of the FromIPSummaryDump file, in bytes, or "-" if thatlength cannot be determined.=h filepos read-onlyReturns FromIPSummaryDump's position in the file, in bytes.=h stop write-onlyWhen written, sets 'active' to false and stops the driver.=aToIPSummaryDump */class FromIPSummaryDump : public Element, public IPSummaryDumpInfo { public:    FromIPSummaryDump();    ~FromIPSummaryDump();    const char *class_name() const	{ return "FromIPSummaryDump"; }    const char *port_count() const	{ return PORTS_0_1; }    const char *processing() const	{ return AGNOSTIC; }    void *cast(const char *);    int configure(Vector<String> &, ErrorHandler *);    int initialize(ErrorHandler *);    void cleanup(CleanupStage);    void add_handlers();    bool run_task(Task *);    Packet *pull(int);    void run_timer(Timer *timer);  private:    enum { SAMPLING_SHIFT = 28 };    FromFile _ff;    Vector<const IPSummaryDump::FieldReader *> _fields;    Vector<int> _field_order;    uint16_t _default_proto;    uint32_t _sampling_prob;    IPFlowID _flowid;    uint32_t _aggregate;    bool _stop : 1;    bool _format_complaint : 1;    bool _zero : 1;    bool _checksum : 1;    bool _active : 1;    bool _multipacket : 1;    bool _have_flowid : 1;    bool _have_aggregate : 1;    bool _binary : 1;    bool _timing : 1;    bool _have_timing : 1;    Packet *_work_packet;    uint32_t _multipacket_length;    Timestamp _multipacket_timestamp_delta;    Timestamp _multipacket_end_timestamp;    Timestamp _timing_offset;    Task _task;    ActiveNotifier _notifier;    Timer _timer;    int _minor_version;    IPFlowID _given_flowid;    int read_binary(String &, ErrorHandler *);    static int sort_fields_compare(const void *, const void *, void *);    void bang_data(const String &, ErrorHandler *);    void bang_proto(const String &line, const char *type, ErrorHandler *errh);    void bang_flowid(const String &, ErrorHandler *);    void bang_aggregate(const String &, ErrorHandler *);    void bang_binary(const String &, ErrorHandler *);    void check_defaults();    bool check_timing(Packet *p);    Packet *read_packet(ErrorHandler *);    Packet *handle_multipacket(Packet *);    static String read_handler(Element *, void *);    static int write_handler(const String &, Element *, void *, ErrorHandler *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

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