⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dca_mastro.cc

📁 clustering for ns-2 simulation
💻 CC
字号:
/** * Copyright (c) 2006 Michele Mastrogiovanni. * *   Licensed under the Apache License, Version 2.0 (the "License"); *   you may not use this file except in compliance with the License. *   You may obtain a copy of the License at * *       http://www.apache.org/licenses/LICENSE-2.0 * *   Unless required by applicable law or agreed to in writing, software *   distributed under the License is distributed on an "AS IS" BASIS, *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *   See the License for the specific language governing permissions and *   limitations under the License. * */ ////////////////// NS Headers //////////////////#include "dca_mastro.h"#include "random.h"#include "gridkeeper.h"#include <algorithm>#include <typeinfo>#include "Separator.h"///////////////////////////////////// Parte di dichiarazione comune /////////////////////////////////////int hdr_dca::offset_;int DCA_Agent::degree;int DCA_Agent::_DEBUG_;double DCA_Agent::max_delay;int DCA_Agent::max_timeout_hello;double DCA_Agent::jitter_timeout_hello;double DCA_Agent::timeout_hello;int DCA_Agent::max_timeout_join;double DCA_Agent::jitter_timeout_join;double DCA_Agent::timeout_join;int DCA_Agent::max_timeout_ch;double DCA_Agent::jitter_timeout_ch;double DCA_Agent::timeout_ch;int DCA_Agent::max_timeout_signal;double DCA_Agent::jitter_timeout_signal;double DCA_Agent::timeout_signal;static class DcaClass : public TclClass {public:    DcaClass() : TclClass("Agent/DCA") {}    TclObject* create(int , const char*const* ) {        return(new DCA_Agent());    }} class_dca;static class DcaHeaderClass : public PacketHeaderClass {public:	DcaHeaderClass() : PacketHeaderClass("PacketHeader/DCA",					      sizeof(hdr_dca)) {		bind_offset(&hdr_dca::offset_);                   	}} class_dcahdr;//// Costruttore//DCA_Agent::DCA_Agent() : ClusteringModule(PT_DCA) /*, msgClustering(0.0), bytesClustering(0.0), 	msgBackbone(0.0), bytesBackbone(0.0) */{    timer = new DcaTimer(this);		bind_bool("degree", &degree);		bind_bool("debug", &_DEBUG_);	bind("max-delay", &max_delay);	bind("max-timeout-join", &max_timeout_hello);	bind("jitter-timeout-join", &jitter_timeout_hello);	bind("timeout-join", &timeout_hello);	bind("max-timeout-join", &max_timeout_join);	bind("jitter-timeout-join", &jitter_timeout_join);	bind("timeout-join", &timeout_join);	bind("max-timeout-ch", &max_timeout_ch);	bind("jitter-timeout-ch", &jitter_timeout_ch);	bind("timeout-ch", &timeout_ch);	bind("max-timeout-signal", &max_timeout_signal);	bind("jitter-timeout-signal", &jitter_timeout_signal);	bind("timeout-signal", &timeout_signal);	}void DCA_Agent::receive(Packet *p, Handler *h) {    struct hdr_dca *dcah = HDR_DCA(p);    struct hdr_ip *iph = HDR_IP(p);        // Mittente.    NodeAddress sender_address = iph->saddr();    // Destinazione.    NodeAddress destination_address = iph->daddr();		// La richiesta pu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -