📄 fromsocket.hh
字号:
// -*- mode: c++; c-basic-offset: 2 -*-#ifndef CLICK_FROMSOCKET_HH#define CLICK_FROMSOCKET_HH#include <click/element.hh>CLICK_DECLS/*=cFromSocket("TCP", IP, PORTNUMBER [, I<KEYWORDS>])FromSocket("UDP", IP, PORTNUMBER [, I<KEYWORDS>])FromSocket("UNIX", FILENAME [, I<KEYWORDS>])=s devicesreads data from socket (user-level)=dReads data from the specified socket. Specifying a non-zero IP addressreverses the normal connection sense for TCP FromSockets, i.e. theFromSocket will attempt to connect(2) instead of listen(2).Keyword arguments are:=over 8=item SNAPLENUnsigned integer. Maximum packet length. This value (minus 4 If FRAMEis true), represents the MRU of the FromSocket if it is used as apacket source. If the MRU is violated by the peer, i.e. if a packetlonger than SNAPLEN (minus 4 is FRAME is true) is sent, the connectionmay be terminated.=item FRAMEBoolean. If true, assume that packets in the data stream are framedwith a 4 byte record boundary in network order that represents thelength of the packet (including the record boundary). Default is true.=item VERBOSEBoolean. When true, FromSocket will print messages whenever it accepts anew connection or drops an old one. Default is false.=back=e FromSocket(UDP, 0.0.0.0, 47) -> ...=a ToSocket, FromDump, ToDump, FromDevice, FromDevice.u, ToDevice, ToDevice.u */class FromSocket : public Element { public: FromSocket(); ~FromSocket(); const char *class_name() const { return "FromSocket"; } enum { CONFIGURE_PHASE = CONFIGURE_PHASE_DEFAULT - 1 }; int configure_phase() const { return CONFIGURE_PHASE; } int configure(Vector<String> &conf, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); void * handle(int); void selected(int); private: bool _verbose; int _fd; int _family; int _socktype; int _protocol; IPAddress _ip; unsigned short _port; String _pathname; unsigned _snaplen; bool _frame; Vector<WritablePacket *> _packets; Vector<int> _active; int initialize_socket_error(ErrorHandler *, const char *);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -