📄 udp.h
字号:
/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- *//* * Copyright (c) Xerox Corporation 1997. All rights reserved. * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Xerox is * acknowledged in all documentation pertaining to any such copy or derivative * work. Xerox grants no other licenses expressed or implied. The Xerox trade * name should not be used in any advertising without its written permission. * * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" without * express or implied warranty of any kind. * * These notices must be retained in any copies of any part of this software. * * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/apps/udp.h,v 1.14 2001/11/16 22:29:59 buchheim Exp $ (Xerox) */#ifndef ns_udp_h#define ns_udp_h#include "agent.h"#include "trafgen.h"#include "packet.h"#include "timer-handler.h"//"rtp timestamp" needs the samplerate#define SAMPLERATE 8000#define RTP_M 0x0080 // marker for significant events//Yuan addclass UdpAgent; //Yuan addclass UdpTrafficTimer : public TimerHandler {public: UdpTrafficTimer(UdpAgent* tg) : udpagent_(tg) {}protected: void expire(Event*); UdpAgent* udpagent_;};//Yuan addstruct hdr_pdp { double rate_; double price_; double grad_; double enqueue_time_; int flag_; //1, price_ is valid, 0, price_ is invalid, static int offset_; inline static int& offset() { return offset_; } inline static hdr_pdp* access(Packet* p) { return (hdr_pdp*) p->access(offset_); } double& rate() { return (rate_); } double& price() { return (price_); } int& flag() { return (flag_); }};class UdpAgent : public Agent {public: UdpAgent(); UdpAgent(packet_t); virtual void sendmsg(int nbytes, const char *flags = 0) { sendmsg(nbytes, NULL, flags); } virtual void sendmsg(int nbytes, AppData* data, const char *flags = 0); virtual void recv(Packet* pkt, Handler*); virtual int command(int argc, const char*const* argv); //Yuan double next_interval(); void timeout(); void sendbackmsg(double price); double cal_rate(double price); protected: int seqno_; int fseqno_; double EPSILON; double BETA; double rate_; //the sending rate of the source double price_; // the dest records the current aggregated price double grad_; int myfid_; UdpTrafficTimer timer_; double nextPkttime_; int iter; int first_pkt; int first_time; FILE* fd_x; FILE* fd_u;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -