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

📄 fromcapdump.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
// -*- mode: c++; c-basic-offset: 4 -*-#ifndef CLICK_FROMCAPDUMP_HH#define CLICK_FROMCAPDUMP_HH#include <click/element.hh>#include <click/task.hh>#include <click/notifier.hh>#include <click/ipflowid.hh>#include "elements/userlevel/fromfile.hh"CLICK_DECLS/*=cFromCapDump(FILENAME [, I<KEYWORDS>])=s analysisreads packets from a 'cap' output file=dReads TCP packet descriptors from a file produced by Mark Allman's 'cap' tooland emits the corresponding TCP packets.  Here's an example 'cap' file:   SND 0   INF - cap v2.13   SYN > 1046102982.856142 0 0 40 0   SYN < 1046102982.931832 0 0 40 0   DAT > 1046102982.931941 1 1 1500 1460   ACK < 1046102983.156387 1 1 40 0   DAT > 1046102983.156531 2 2 1500 1460   ...   DAT > 1046102996.137294 5068 5000 1500 1460 FIN   ACK < 1046102996.215164 5068 5000 40 0 FINC<SYN>, C<DAT>, and C<ACK> lines have the following fields: packet type,direction, timestamp (in seconds past the epoch), unique packet number, packetsequence number, packet IP length, payload length, and optional flags.The file may be compressed with gzip(1) or bzip2(1); FromCapDump willrun zcat(1) or bzcat(1) to uncompress it.FromCapDump 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.Output packets have timestamp, aggregate, paint, and packet numberannotations.  The paint annotation is 0 for data packets and 1 foracknowledgements.  The first packet number annotation equals the unique packetnumber; the second equals the packet sequence number.Keyword arguments are:=over 8=item STOPBoolean. If true, then FromCapDump will ask the router to stop when itis done reading. Default is false.=item ACTIVEBoolean. If false, then FromCapDump 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. Iffalse (the default), the checksum fields contain random garbage.=item SAMPLEUnsigned real number between 0 and 1. FromCapDump will output eachpacket with probability SAMPLE. Default is 1. FromCapDump 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 FLOWIDString, containing a space-separated flow ID (source address, source port,destination address, destination port, and, optionally, protocol). Defines theIP addresses and ports on output packets.  If no FLOWID is given, FromCapDumpuses C<1.0.0.1 1 2.0.0.2 2>.=item AGGREGATEUnsigned integer.  Defines the aggregate annotation for output packets.Default is 1.=backOnly available in user-level processes.=nPackets generated by FromCapDump always have IP version 4 and a correctIP header length. The rest of the packet data is zero or garbage, unless setby the dump. Generated packets will usually have short lengths, but the extraheader length annotations are set correctly.FromCapDump 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 FromCapDump file, in bytes, or "-" if thatlength cannot be determined.=h filepos read-onlyReturns FromCapDump's position in the file, in bytes.=h stop write-onlyWhen written, sets `active' to false and stops the driver.=aFromIPSummaryDump, ToIPSummaryDumpMark Allman, "Measuring End-to-End Bulk Transfer Capacity", Proc. InternetMeasurement Workshop 2001.*/class FromCapDump : public Element { public:    FromCapDump();    ~FromCapDump();    const char *class_name() const	{ return "FromCapDump"; }    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();    Packet *pull(int);  private:    enum { SAMPLING_SHIFT = 28 };    enum { NO_SEQNO = 0xFFFFFFFFU };    FromFile _ff;    uint32_t _sampling_prob;    IPFlowID _flowid;    bool _flowid_is_rcv;    uint32_t _aggregate;    Vector<uint32_t> _p2s_map;    bool _stop : 1;    bool _zero : 1;    bool _checksum : 1;    bool _active : 1;    bool _binary : 1;    Task _task;    ActiveNotifier _notifier;    uint32_t packno2seqno(uint32_t packno);    uint32_t packno2seqno(uint32_t packno, int len);        Packet *read_packet(ErrorHandler *);    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 + -