📄 ackresponder.cc
字号:
/* * ackresponder.{cc,hh} -- element sends link-level ACKs * Douglas S. J. De Couto * * Copyright (c) 2002 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 "ackresponder.hh"CLICK_DECLSACKResponder::ACKResponder() : Element(1, 2){}ACKResponder::~ACKResponder(){}Packet *ACKResponder::simple_action(Packet *p){ click_ether *e = (click_ether *) p->data(); EtherAddress dest(e->ether_dhost); if (dest == _eth) { WritablePacket *xp = Packet::make(sizeof(click_ether) + 2); // +2 to align ether hdr xp->pull(2); click_ether *eth = (click_ether *) xp->data(); eth->ether_type = htons(ETHERTYPE_GRID_ACK); memcpy(eth->ether_shost, e->ether_dhost, 6); memcpy(eth->ether_dhost, e->ether_shost, 6); output(1).push(xp); } return p;}intACKResponder::configure(Vector<String> &conf, ErrorHandler *errh){ return cp_va_parse(conf, this, errh, cpEthernetAddress, "our Ethernet address", &_eth, cpEnd);}CLICK_ENDDECLSEXPORT_ELEMENT(ACKResponder)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -