亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? lqiforwardingenginep.nc

?? tinyos-2.x.rar
?? NC
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
// $Id: LqiForwardingEngineP.nc,v 1.15 2008/06/11 00:46:25 razvanm Exp $

/* Copyright (c) 2007 Stanford University.
 * 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 Stanford University 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``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 STANFORD
 * UNIVERSITY OR ITS CONTRIBUTORS 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.
 */

/*
 * "Copyright (c) 2000-2003 The Regents of the University  of California.  
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
 *
 * Copyright (c) 2002-2003 Intel Corporation
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE     
 * file. If you do not find these files, copies can be found by writing to
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, 
 * 94704.  Attention:  Intel License Inquiry.
 */

/* 
 * A simple module that handles multihop packet movement.  It accepts 
 * messages from both applications and the network and does the necessary
 * interception and forwarding.
 * It interfaces to an algorithmic componenet via RouteSelect. It also acts
 * as a front end for RouteControl
 */


/**
 * @author Philip Buonadonna
 * @auihor Alec Woo
 * @author Crossbow Inc.
 * @author Philip Levis (port from TinyOS 1.x)
 */

#include "AM.h"
#include "MultiHopLqi.h"
#include "CollectionDebugMsg.h"

module LqiForwardingEngineP {
  provides {
    interface Init;
    interface Send;
    interface Receive[collection_id_t id];
    interface Receive as Snoop[collection_id_t];
    interface Intercept[collection_id_t id];
    interface CollectionPacket;
    interface RouteControl;
    interface LqiRouteStats;
    interface Packet;
  }
  uses {
    interface SplitControl;
    interface Receive as SubReceive;
    interface AMSend as SubSend;
    interface AMSend as SubSendMine;
    interface RouteControl as RouteSelectCntl;
    interface RouteSelect;
    interface Leds;
    interface Packet as SubPacket;
    interface AMPacket;
    interface RootControl;
    interface Random;
    interface PacketAcknowledgements;
    interface CollectionDebug;
  }
}

implementation {

  enum {
    FWD_QUEUE_SIZE = MHOP_QUEUE_SIZE, // Forwarding Queue
    EMPTY = 0xff,
    MAX_RETRIES = 5
  };

  /* Internal storage and scheduling state */
  message_t FwdBuffers[FWD_QUEUE_SIZE];
  message_t *FwdBufList[FWD_QUEUE_SIZE];
  uint8_t FwdBufBusy[FWD_QUEUE_SIZE];
  uint8_t iFwdBufHead, iFwdBufTail;
  uint16_t sendFailures = 0;
  uint8_t fwd_fail_count = 0;
  uint8_t my_fail_count = 0;
  bool fwdbusy = FALSE;
  bool running = FALSE;
 
  lqi_header_t* getHeader(message_t* msg) {
    return (lqi_header_t*) call SubPacket.getPayload(msg, sizeof(lqi_header_t));
  }
  
  /***********************************************************************
   * Initialization 
   ***********************************************************************/


  static void initialize() {
    int n;

    for (n=0; n < FWD_QUEUE_SIZE; n++) {
      FwdBufList[n] = &FwdBuffers[n];
      FwdBufBusy[n] = 0;
    } 
    iFwdBufHead = iFwdBufTail = 0;

    sendFailures = 0;
  }

  command error_t Init.init() {
    initialize();
    return SUCCESS;
  }
 
  message_t* nextMsg();
  static void forward(message_t* msg);

  event void SplitControl.startDone(error_t err) {
    message_t* nextToSend;
    if (err != SUCCESS) {return;}
    nextToSend = nextMsg();
    running = TRUE;
    fwdbusy = FALSE;

    if (nextToSend != NULL) {
      forward(nextToSend);
    }
  }


  event void SplitControl.stopDone(error_t err) {
    if (err != SUCCESS) {return;}
    running = FALSE;
  }
  /***********************************************************************
   * Commands and events
   ***********************************************************************/
  command error_t Send.send(message_t* pMsg, uint8_t len) {
    len += sizeof(lqi_header_t);
    if (len > call SubPacket.maxPayloadLength()) {
      return ESIZE;
    }
    if (call RootControl.isRoot()) {
      return FAIL;
    }
    if (running == FALSE) {
      return EOFF;
    }
    call RouteSelect.initializeFields(pMsg);
    
    if (call RouteSelect.selectRoute(pMsg, 0) != SUCCESS) {
      return FAIL;
    }
    call PacketAcknowledgements.requestAck(pMsg);
    if (call SubSendMine.send(call AMPacket.destination(pMsg), pMsg, len) != SUCCESS) {
      sendFailures++;
      return FAIL;
    }

    return SUCCESS;
  } 
  
  int8_t get_buff(){
    uint8_t n;
    for (n=0; n < FWD_QUEUE_SIZE; n++) {
	uint8_t done = 0;
        atomic{
	  if(FwdBufBusy[n] == 0){
	    FwdBufBusy[n] = 1;
	    done = 1;
	  }
        }
	if(done == 1) return n;
      
    } 
    return -1;
  }

  int8_t is_ours(message_t* ptr){
    uint8_t n;
    for (n=0; n < FWD_QUEUE_SIZE; n++) {
       if(FwdBufList[n] == ptr){
		return n;
       }
    } 
    return -1;
  }

  static char* fields(message_t* msg) {
#ifdef TOSSIM
    static char mbuf[1024];
    lqi_header_t* hdr = getHeader(msg);
    sprintf(mbuf, "origin = %hu, seqno = %hu, oseqno = %hu, hopcount =%hu", hdr->originaddr, hdr->seqno, hdr->originseqno, hdr->hopcount);
    return mbuf;
#else
    return NULL;
#endif
  }

  static void forward(message_t* msg);
  
  static message_t* mForward(message_t* msg) {
    int8_t buf = get_buff();
    dbg("LQI", " Asked to forward packet @%s:\t%s\n", sim_time_string(), fields(msg));
    if (buf == -1) {
      dbg("LQI", "%s Dropped packet due to no space in queue.\n", __FUNCTION__);
      call CollectionDebug.logEvent(NET_C_FE_SEND_QUEUE_FULL);
      return msg;
    }
    if ((call RouteSelect.selectRoute(msg, 0)) != SUCCESS) {
      FwdBufBusy[(uint8_t)buf] = 0;
      call CollectionDebug.logEvent(NET_C_FE_NO_ROUTE);
      dbg("LQI", "%s Dropped packet due to no route.\n", __FUNCTION__);
      return msg;
    }
    else {
      message_t* newMsg = FwdBufList[(uint8_t)buf];
      FwdBufList[(uint8_t)buf] = msg;
      forward(msg);
      return newMsg;
    }
  }
  
  static void forward(message_t* msg) {
    // Failures at the send level do not cause the seq. number space to be 
    // rolled back properly.  This is somewhat broken.
    if (fwdbusy || running == FALSE) {
      dbg("LQI", "%s forwarding busy or off, wait for later.\n", __FUNCTION__);
      return;
    }
    else {
      call PacketAcknowledgements.requestAck(msg);
      if (call SubSend.send(call AMPacket.destination(msg),
			    msg,
			    call SubPacket.payloadLength(msg)) == SUCCESS) {
	call CollectionDebug.logEventMsg(NET_C_DBG_1, 
					 call CollectionPacket.getSequenceNumber(msg), 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一级免费一区| 成人国产亚洲欧美成人综合网| 毛片av一区二区| 国产精品一区二区三区网站| 国产69精品久久久久777| 97aⅴ精品视频一二三区| 91精品国产综合久久福利| 久久九九久久九九| 一二三四社区欧美黄| 理论片日本一区| 99久免费精品视频在线观看| 日韩一区二区三区视频在线| 中文字幕乱码久久午夜不卡 | 九九九久久久精品| 波多野结衣91| 欧美一区二区免费视频| 国产精品女主播在线观看| 午夜成人在线视频| 成人av手机在线观看| 9191精品国产综合久久久久久| 国产日韩欧美制服另类| 视频一区欧美日韩| 不卡在线观看av| 日韩三级免费观看| 亚洲欧美国产三级| 国产一区二区三区在线观看免费视频 | 91在线国产观看| 日韩美女天天操| 亚洲综合网站在线观看| 国产成人精品亚洲777人妖 | 免费欧美高清视频| 91成人国产精品| 国产亚洲成av人在线观看导航| 亚洲高清久久久| 99精品视频在线观看免费| 精品乱码亚洲一区二区不卡| 午夜视频在线观看一区二区三区| 国产精品夜夜爽| 日韩一区二区在线看| 亚洲免费高清视频在线| 成人午夜激情在线| 久久女同性恋中文字幕| 成人99免费视频| 久久这里只有精品6| 三级在线观看一区二区| 色婷婷综合久久久久中文一区二区| 欧美极品美女视频| 精品在线你懂的| 在线不卡a资源高清| 亚洲欧美中日韩| 成人精品免费视频| 国产偷国产偷亚洲高清人白洁| 免费人成精品欧美精品| 欧美精品亚洲一区二区在线播放| 亚洲欧美偷拍卡通变态| av激情综合网| 国产精品嫩草影院com| 国产美女主播视频一区| 精品国产乱码久久久久久闺蜜| 亚洲一区二区三区美女| 一本久久精品一区二区| 国产精品成人在线观看| www.爱久久.com| 欧美激情综合五月色丁香小说| 国产成人免费在线观看不卡| www激情久久| 国产一区欧美日韩| 精品国产91洋老外米糕| 久久99蜜桃精品| www精品美女久久久tv| 国产一区二区三区综合| 久久久精品欧美丰满| 国产高清在线观看免费不卡| 久久亚洲一级片| 国产老肥熟一区二区三区| 久久综合色鬼综合色| 国产乱淫av一区二区三区| 久久精品视频网| 成人免费高清在线| 国产精品初高中害羞小美女文| 93久久精品日日躁夜夜躁欧美| 亚洲欧美aⅴ...| 欧美午夜理伦三级在线观看| 亚洲高清免费观看高清完整版在线观看| 日本丰满少妇一区二区三区| 亚洲午夜在线电影| 欧美妇女性影城| 精品在线观看视频| 国产农村妇女精品| 91热门视频在线观看| 亚洲综合一区二区精品导航| 欧美久久婷婷综合色| 裸体一区二区三区| 久久久国产精品麻豆| av网站免费线看精品| 一区二区在线观看av| 欧美日韩成人一区| 美女mm1313爽爽久久久蜜臀| 国产亚洲欧美日韩俺去了| 成人免费毛片app| 亚洲一区二区视频在线| 日韩一区二区中文字幕| 国产很黄免费观看久久| 亚洲视频在线一区二区| 在线电影院国产精品| 国产一区久久久| 1024成人网色www| 欧美日本乱大交xxxxx| 麻豆精品蜜桃视频网站| 国产农村妇女毛片精品久久麻豆 | 亚洲欧美日韩久久| 欧美精品在线观看一区二区| 黑人巨大精品欧美黑白配亚洲| 国产精品的网站| 6080日韩午夜伦伦午夜伦| 国产一区二区免费在线| 亚洲乱码国产乱码精品精小说| 91精选在线观看| 成人综合婷婷国产精品久久 | 欧美日韩亚洲综合在线| 国产精品一区在线观看你懂的| 亚洲色图清纯唯美| 日韩三级视频在线看| 99re成人在线| 美腿丝袜亚洲综合| 亚洲视频免费看| 欧美videos中文字幕| 色哟哟精品一区| 久久精品国产精品青草| 亚洲品质自拍视频网站| 精品国产免费一区二区三区四区| 91亚洲精品乱码久久久久久蜜桃| 日本色综合中文字幕| 粉嫩蜜臀av国产精品网站| 视频精品一区二区| 国产精品伦理一区二区| 日韩亚洲欧美中文三级| 欧美在线观看一二区| 国产福利一区二区三区视频| 视频一区二区中文字幕| 亚洲三级视频在线观看| www久久精品| 91精品国产综合久久婷婷香蕉 | 亚洲色图20p| 久久久噜噜噜久久中文字幕色伊伊| 欧美日韩一区小说| 99久久久无码国产精品| 国产精品中文有码| 美国十次综合导航| 天天综合天天做天天综合| 国产精品成人免费精品自在线观看| 精品国产一区二区三区av性色| 欧美日韩日本视频| 97se狠狠狠综合亚洲狠狠| 国产成人av网站| 久久99精品一区二区三区 | 欧美一二三区在线| 欧美日韩在线播放三区四区| 91免费在线视频观看| 国产999精品久久| 久久av老司机精品网站导航| 亚洲成人av电影在线| 亚洲欧美日韩电影| 国产精品国产三级国产普通话99| 欧美精品一区二区高清在线观看| 91.com在线观看| 欧美蜜桃一区二区三区| 色狠狠色狠狠综合| 色av成人天堂桃色av| 色中色一区二区| 91免费版在线| 91美女福利视频| 91免费国产在线观看| 色综合久久久网| 91女神在线视频| 91极品视觉盛宴| 色综合久久久久网| 一本大道久久精品懂色aⅴ| 国产精品久久久久久久久免费丝袜| 精品国产乱码久久久久久夜甘婷婷 | 国产精品无圣光一区二区| 久久综合九色综合97_久久久| 精品国产乱码久久久久久夜甘婷婷| 日韩免费观看高清完整版 | 久久精品国产精品亚洲红杏 | 国产午夜精品一区二区三区嫩草 | 成人精品免费看| 99久久精品国产一区| 99re这里只有精品首页| 91丨九色丨蝌蚪丨老版| 一本久久a久久免费精品不卡| 91久久免费观看| 欧美日韩一区二区电影| 欧美一级电影网站| 日韩欧美一二三| 久久免费视频色| 国产精品久久久久aaaa樱花| 亚洲三级小视频| 亚洲成人自拍一区| 蜜臀av性久久久久蜜臀aⅴ |