📄 pong-module.h
字号:
/* * Copyright (c) 2008, Karlstad University * Erik Andersson, Emil Ljungdahl, Lars-Olof Moilanen * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: pong-module.h 2 2008-06-04 10:05:48Z emil $ */#ifndef PONG_MODULE_H#define PONG_MODULE_H#include <module.h>#include <mac.h>#define PONG_DROP_REASON_UNKNOWN_TYPE "UKT"#define HDR_PONG(P) (hdr_pong::access(P))extern packet_t PT_MPONG;typedef struct hdr_pong { char ret; double send_time; double rcv_time; int seq; static int offset_; inline static int& offset() { return offset_; } inline static hdr_pong* access(const Packet* p) { return (hdr_pong*) p->access(offset_); }} hdr_pong;class PongModule : public Module { public: PongModule(); ~PongModule(); virtual int command(int argc, const char*const* argv); virtual void recv(Packet* p); virtual void recv(Packet* p, Handler* h); void sendPkt(nsaddr_t addr); void initPkt(Packet* p); void initRetPkt(Packet* p, double send_time, int seq); protected: int seq; int oneway; int size_; static int uidcnt_; double rtt;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -