shiva.cc

来自「clustering for ns-2 simulation」· CC 代码 · 共 115 行

CC
115
字号
/** * 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. * */ #include "shiva.h"#include "random.h"#include "gridkeeper.h"int hdr_shiva::offset_;// int SHIVA_Agent::with_bottom_router;int SHIVA_Agent::_DEBUG_;int SHIVA_Agent::max_length;							// 3;   // Lunghezza massima dei cicli 													// (di nodi BLACK) da tagliare	double SHIVA_Agent::max_delay;					// 0.2; // Delay di una broadcast	double SHIVA_Agent::jitter_timeout_destruction;double SHIVA_Agent::timeout_destruction;	int SHIVA_Agent::max_timeout_discover;			// 4;   // Numero massimo di timeout al messaggio DISCOVERdouble SHIVA_Agent::jitter_timeout_discover;		// 0.2;	// Jitter per il messaggio DISCOVER.double SHIVA_Agent::timeout_discover;			// 1.0;	// Durata timeout messaggio DISCOVER.	int SHIVA_Agent::max_timeout_turn_on;			// 4;   // Numero massimo di timeout al messaggio DISCOVERdouble SHIVA_Agent::jitter_timeout_turn_on;		// 0.2;	// Jitter per il messaggio DISCOVER.double SHIVA_Agent::timeout_turn_on;				// 1.0;	// Durata timeout messaggio DISCOVER.static class ShivaClass : public TclClass {public:    ShivaClass() : TclClass("Agent/SHIVA") {}    TclObject* create(int , const char*const* ) {        return(new SHIVA_Agent());    }} class_shiva;static class ShivaHeaderClass : public PacketHeaderClass {public:	ShivaHeaderClass() : PacketHeaderClass("PacketHeader/SHIVA",										   sizeof(hdr_shiva)) {		bind_offset(&hdr_shiva::offset_);	}} class_shivahdr;SHIVA_Agent::SHIVA_Agent() : ClusteringModule(PT_SHIVA), seq(0){    timer = new ShivaTimer(this);		// bind_bool("with-bottom-router", &with_bottom_router);	bind_bool("debug", &_DEBUG_);	bind("max-length", &max_length);		bind("max-delay", &max_delay);		bind("jitter-timeout-destruction", &jitter_timeout_destruction);	bind("timeout-destruction", &timeout_destruction);		bind("max-timeout-discover", &max_timeout_discover);	bind("jitter-timeout-discover", &jitter_timeout_discover);	bind("timeout-discover", &timeout_discover);		bind("max-timeout-turn-on", &max_timeout_turn_on);	bind("jitter-timeout-turn-on", &jitter_timeout_turn_on);	bind("timeout-turn-on", &timeout_turn_on);}/*int SHIVA_Agent::command(int argc, const char * const * argv) {    if (argc == 2) {		if (strcmp (argv[1], "ended") == 0) {			if (status != SHIVA_STATUS_END)				endModule();			return (TCL_OK);		}        else if (strcmp (argv[1], "destruction") == 0) {			timer->beginDestruction();            return (TCL_OK);        }	}	    return ClusteringModule::command(argc, argv);}*///// Questa procedura parte dalla lista dei nodi contenuta in black_neighbors// ed elimina tutti i nodi che fanno parte dei cicli. // Successivamente passa alla fase di colorazione dei nodi vicini che sono// interessati con i legami verso gli altri nodi BLACK.//void SHIVA_Agent::endCycleDiscover(){	//    // Se la funzione viene chiamata e il nodo 

⌨️ 快捷键说明

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