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

📄 rawsocket.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: 2 -*-#ifndef CLICK_RAWSOCKET_HH#define CLICK_RAWSOCKET_HH#include <click/element.hh>#include <click/task.hh>#include <click/timer.hh>#include <click/notifier.hh>CLICK_DECLS/*=cRawSocket("TCP", <TCP source port number> [, I<KEYWORDS>])RawSocket("UDP", <UDP source port number> [, I<KEYWORDS>])RawSocket("GRE", <GRE key or PPTP call ID> [, I<KEYWORDS>])RawSocket("ICMP", <ICMP identifier> [, I<KEYWORDS>])=s commtransports raw IP packets via safe raw sockets (user-level)=dReads data from and writes data to a raw IPv4 socket. The raw IPv4socket may optionally be bound to a source port number in the case ofTCP/UDP, a GRE key or PPTP call ID in the case of GRE, or anidentifier in the case of ICMP. Binding a port to a raw IPv4 socket toreserve it and suppress TCP RST and ICMP Unreachable errors, isspecific to PlanetLab Linux.Keyword arguments are:=over 8=item SNAPLENUnsigned integer. Maximum packet length. This valuerepresents the MRU of the RawSocket if it is used as apacket source. If the MRU is violated by the peer, i.e. if a packetlonger than SNAPLEN is sent, the connection may be terminated.=item PROPERBoolean. PlanetLab specific. If true and Click has been configured--with-proper, use Proper to bind a reserved port.=item HEADROOMUnsigned Integer. Amount of headroom to reserve in packets createdby this element. This could be useful for encapsulation protocolswhich add headers to the packet, and can avoid expensive pushoperations later in the packet's life.=back=e  RawSocket(UDP, 53) -> ...=a Socket */class RawSocket : public Element { public:  RawSocket();  ~RawSocket();  const char *class_name() const	{ return "RawSocket"; }  const char *port_count() const	{ return "0-1/0-1"; }  const char *processing() const	{ return "l/h"; }  const char *flow_code() const		{ return "x/y"; }  int configure(Vector<String> &conf, ErrorHandler *);  int initialize(ErrorHandler *);  void cleanup(CleanupStage);  void add_handlers();  bool run_task(Task *);  void selected(int);  void run_timer(Timer *);protected:  Task _task;  Timer _timer;private:  int _fd;			// socket descriptor  int _protocol;		// IP protocol to bind  uint16_t _port;		// (PlanetLab only) port to bind  bool _proper;			// (PlanetLab only) use Proper to bind port  int _snaplen;			// maximum received packet length  unsigned _headroom;           // header length to set aside in the packet  NotifierSignal _signal;	// packet is available to pull()  WritablePacket *_rq;		// queue to receive pulled packets  int _backoff;			// backoff timer for when sendto() blocks  Packet *_wq;			// queue to store pulled packet for when sendto() blocks  int _events;			// keeps track of the events for which select() is waiting  int initialize_socket_error(ErrorHandler *, const char *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

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