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

📄 tosocket.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
// -*- mode: c++; c-basic-offset: 2 -*-#ifndef CLICK_TOSOCKET_HH#define CLICK_TOSOCKET_HH#include <click/element.hh>#include <click/string.hh>#include <click/task.hh>#include <click/notifier.hh>#include <sys/un.h>#include "fromsocket.hh"CLICK_DECLS/*=cToSocket("TCP", IP, PORTNUMBER [, I<KEYWORDS>])ToSocket("UDP", IP, PORTNUMBER [, I<KEYWORDS>])ToSocket("UNIX", FILENAME [, I<KEYWORDS>])=s devicessends data to socket (user-level)=dSends data to the specified socket. Specifying a zero IP addressreverses the normal connection sense for TCP ToSockets, i.e. theFromSocket will attempt to listen(2) instead of connect(2).Keyword arguments are:=over 8=item SNAPLENUnsigned integer. Maximum packet length. This value (minus 4 If FRAMEis true), represents the MTU of the ToSocket if it is used as a packetsink.=item FRAMEBoolean. If true, frame packets in the data stream with a 4 byterecord boundary in network order that represents the length of thepacket (including the record boundary). Default is true.=item NODELAYBoolean. Applies to TCP sockets only. If set, disable the Naglealgorithm. This means that segments are always sent as soon aspossible, even if there is only a small amount of data. When not set,data is buffered until there is a sufficient amount to send out,thereby avoiding the frequent sending of small packets, which resultsin poor utilization of the network. Default is true.=item VERBOSEBoolean. When true, ToSocket will print messages whenever it accepts anew connection or drops an old one. Default is false.=back=e  ... -> ToSocket(1.2.3.4, UDP, 47)=a FromSocket, FromDump, ToDump, FromDevice, FromDevice.u, ToDevice, ToDevice.u */class ToSocket : public Element { public:  ToSocket();  ~ToSocket();  const char *class_name() const	{ return "ToSocket"; }  const char *processing() const	{ return AGNOSTIC; }  enum { CONFIGURE_PHASE = FromSocket::CONFIGURE_PHASE + 1 };  int configure_phase() const		{ return CONFIGURE_PHASE; }  int configure(Vector<String> &conf, ErrorHandler *);  int initialize(ErrorHandler *);  void cleanup(CleanupStage);  void add_handlers();  void notify_noutputs(int);  void selected(int);  void push(int port, Packet *);  bool run_task();protected:  Task _task;  void send_packet(Packet *); private:  bool _verbose;  int _fd;  int _active;  int _family;  int _socktype;  int _protocol;  IPAddress _ip;  int _port;  String _pathname;  int _snaplen;  union { struct sockaddr_in in; struct sockaddr_un un; } sa;  socklen_t sa_len;  NotifierSignal _signal;  int _nodelay;  bool _frame;  int initialize_socket_error(ErrorHandler *, const char *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

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