📄 ipdecappaint.cc
字号:
/* * ipdecappaint.{cc,hh} -- element strips ip encapsulation header from front of packet * Alexander Yip * * Copyright (c) 2001 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 following * conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * Further elaboration of this license, including a DISCLAIMER OF ANY * WARRANTY, EXPRESS OR IMPLIED, is provided in the LICENSE file, which is * also accessible at http://www.pdos.lcs.mit.edu/click/license.html */#include <click/config.h>#include "ipdecappaint.hh"#include <click/confparse.hh>#include <click/error.hh>#include <click/glue.hh>#include <clicknet/ip.h>#include <click/packet_anno.hh>IPDecapPaint::IPDecapPaint() : Element(1, 1){}IPDecapPaint::~IPDecapPaint(){}Packet *IPDecapPaint::simple_action(Packet *p){ const click_ip *ip = p->ip_header(); assert(ip); if (ip->ip_p != IP_PROTO_IPIP) { p->kill(); } // set annotation using the first byte of the packet SET_PAINT_ANNO(p, p->data()[ sizeof(click_ip)] ); // pull off first header and annotation byte p->pull( (int)p->ip_header_offset() + p->ip_header_length() + 1); return p;}static Stringread_handler(Element *, void *){ return "false\n";}voidIPDecapPaint::add_handlers(){ // needed for QuitWatcher add_read_handler("scheduled", read_handler, 0);}//ELEMENT_REQUIRES(false)EXPORT_ELEMENT(IPDecapPaint)ELEMENT_MT_SAFE(IPDecapPaint)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -