📄 fromnetflowsumdump.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_FROMNETFLOWSUMDUMP_HH#define CLICK_FROMNETFLOWSUMDUMP_HH#include <click/element.hh>#include <click/task.hh>#include <click/notifier.hh>#include "elements/userlevel/fromfile.hh"CLICK_DECLS/*=cFromNetFlowSummaryDump(FILE [, I<KEYWORDS>])=s analysisreads packets from a NetFlow summary file=dReads IP packet descriptors from a file containing NetFlow data, in the ASCIIsummary format described below, then creates packets containing info from thedescriptors and pushes them out the output. Optionally stops the driver whenthere are no more packets.FILE may be compressed with gzip(1) or bzip2(1); FromNetFlowSummaryDump willrun zcat(1) or bzcat(1) to uncompress it.Keyword arguments are:=over 8=item STOPBoolean. If true, then FromNetFlowSummaryDump will ask the router to stop whenit is done reading. Default is false.=item ACTIVEBoolean. If false, then FromNetFlowSummaryDump will not emit packets (untilthe `C<active>' handler is written). Default is true.=item ZEROBoolean. If true (the default), then emitted packet data is zero, except fordata set by the dump. If false, this data is random garbage.=item MULTIPACKETBoolean. If true, then generate multiple packets for each flow, according tothe flow's packet count. Packet timestamps vary smoothly from the flow starttimestamp to the flow end timestamp. Default is false.=item LINKSets the interface type used to set the paint annotation. Can be "input","output", or "both", which means the upper 4 bits of the annotation are theinput interface and the lower 4 bits are the output interface. Too-largeinterface numbers are pinned at 255 (or 15, for "both"). Default is "input".=backOnly available in user-level processes.=nPackets generated by FromNetFlowSummaryDump always have IP version 4 and IPheader length 5. The rest of the packet data is zero or garbage, unless setby the dump. Generated packets will usually have incorrect checksums. Thelink annotation is equal to one of the interface numbers, or a combination ofboth.=head1 FILE FORMATFromNetFlowSummaryDump reads line-oriented ASCII files. Blank lines, and linesstarting with `C<!>' or `C<#>', are ignored. Data lines contain 15 or morefields separated by vertical bars `C<|>'. FromNetFlowSummaryDump paysattention to some of these fields: Field Meaning Example ----- ---------------------------- ---------- 0 Source IP address 192.4.1.32 1 Destination IP address 18.26.4.44 3 Input interface number 14 4 Output interface number 16 5 Packet count in flow 5 6 Byte count in flow 10932 7 Flow timestamp (UNIX-style) 998006995 8 Flow end timestamp 998006999 9 Source port 3917 10 Destination port 80 12 TCP flags (OR of all pkts) 18 13 IP protocol 6 14 IP TOS bits 0Generated packets have both their "first timestamp" and timestamp annotationsset. The timestamp annotation is set to the flow end timestamp unless that waszero, in which case it is set to the flow timestamp. The "first timestamp"annotation is always set to the flow timestamp.FromNetFlowSummaryDump is a notifier signal, active when the element is activeand the dump contains more packets.=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 NetFlow summary file, in bytes, or "-" if thatlength cannot be determined.=h filepos read-onlyReturns FromNetFlowSummaryDump's position in the file, in bytes.=aFromDump, FromIPSummaryDump */class FromNetFlowSummaryDump : public Element { public: FromNetFlowSummaryDump(); ~FromNetFlowSummaryDump(); const char *class_name() const { return "FromNetFlowSummaryDump"; } 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: FromFile _ff; Vector<int> _contents; bool _stop : 1; bool _format_complaint : 1; bool _zero; bool _active; bool _multipacket; uint8_t _link; Packet *_work_packet; uint32_t _multipacket_length; Timestamp _multipacket_timestamp_delta; Timestamp _multipacket_end_timestamp; Task _task; ActiveNotifier _notifier; Timestamp _time_offset; 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 + -