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

📄 paraq-timers.cc

📁 TCP westwood code, download
💻 CC
字号:
/* * ParaQ W-LAN Energy Model Timers * * by Fabio A. Favia [faz(at)lugbari.org] * * Dipartimento di Elettrotecnica ed Elettronica, Politecnico di Bari * Via Orabona,4 - 70125 BARI, Italy * July, 2004 * * * Copyright (c) 2004 Politecnico di Bari, Italy. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code and binary code must contain * the above copyright notice, this list of conditions and the following * disclaimer. * * 2. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed at Politecnico di Bari, Italy * * 3. The name of the University may not be used to endorse or promote * products derived from this software without specific prior written * permission. * POLITECNICO DI BARI, ITALY, 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. * */#include <cstdlib>#include <stdlib.h>#include <stdio.h>#include <assert.h>#include "config.h"#include "trace.h"#include "rng.h" #include "energy-model.h"//#include "paraq-timers.h"#include "mac.h"#include "mac-802_11.h"//#include "mac-timers.h"void ParaqWakeUPT::handle(Event *){	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;		int node_sleep = nid_->sleep();	if (node_sleep) {   /* if node is sleeping turn on the node*/		nid_->set_node_sleep(0);		//printf("Node %d wakes up at time %2.9f \n",mac->index_,Scheduler::instance().clock());		//printf("Node %d status: %d \n",mac->index_,nid_->sleep());	} else {		//printf("Node %d was already up at time %2.9f \n",mac->index_,Scheduler::instance().clock());	}}void ParaqGoSleepT::handle(Event *) {	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;		//printf("ParaqGoSleepT expires at %2.9f \n",Scheduler::instance().clock());	int node_sleep = nid_->sleep();	if (!node_sleep) {		if (Scheduler::instance().clock() > (mac->TBTT_ - mac->pifs_)) {			//printf("No need to turn node %d in sleep mode...\n",mac->index_);			return;		}		if (mac->ParaqPreSleep()) {			nid_->set_node_sleep(1);			//printf("Putting Node %d in sleep mode at time %2.9f \n",mac->index_,Scheduler::instance().clock());			//printf("Node %d status: %d \n",mac->index_,nid_->sleep());		}	}}void ParaqWakeUPatBeacon::handle(Event *){	busy_ = 0;	paused_ = 0;	stime = 0.0;	rtime = 0.0;		//printf("ParaqWakeUPatBeacon EXPIRES at time %2.9f\n",Scheduler::instance().clock());	int node_sleep=nid_->sleep();	if (node_sleep) {		nid_->set_node_sleep(0);		//printf("Wake up node %d for BEACON in time %2.9f \n",mac->index_,Scheduler::instance().clock());		//printf("Node %d status: %d \n",mac->index_,nid_->sleep());	}}

⌨️ 快捷键说明

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