?? ackresponder2.cc
字號:
/* * ackresponder2.{cc,hh} -- element sends link-level ACKs * Douglas S. J. De Couto * * Copyright (c) 2004 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, subject to the conditions * listed in the Click LICENSE file. These conditions include: you must * preserve this copyright notice, and you cannot mention the copyright * holders in advertising related to the Software without their permission. * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This * notice is a summary of the Click LICENSE file; the license in that file is * legally binding. */#include <click/config.h>#include <click/glue.hh>#include <clicknet/ether.h>#include <click/confparse.hh>#include <click/packet.hh>#include "ackresponder2.hh"CLICK_DECLSACKResponder2::ACKResponder2() : Element(1, 2){}ACKResponder2::~ACKResponder2(){}Packet *ACKResponder2::simple_action(Packet *p){ IPAddress src(p->data()); IPAddress dst(p->data() + 4); if (dst == _ip) { WritablePacket *xp = Packet::make(8); memcpy(xp->data(), _ip.data(), 4); memcpy(xp->data() + 4, src.data(), 4); output(1).push(xp); } p->pull(8); return p;}intACKResponder2::configure(Vector<String> &conf, ErrorHandler *errh){ return cp_va_parse(conf, this, errh, cpIPAddress, "our IP address", &_ip, cpEnd);}CLICK_ENDDECLSEXPORT_ELEMENT(ACKResponder2)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -