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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? path.cc

?? 動態源路由協議(Dynamic Source Routing, DSR)源碼。DSR是在移動自組網(MANET)中使用的一種路由協議。
?? CC
字號:
/* * path.cc * Copyright (C) 2000 by the University of Southern California * $Id: path.cc,v 1.7 2005/08/25 18:58:05 johnh Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * * The copyright of this module includes the following * linking-with-specific-other-licenses addition: * * In addition, as a special exception, the copyright holders of * this module give you permission to combine (via static or * dynamic linking) this module with free software programs or * libraries that are released under the GNU LGPL and with code * included in the standard release of ns-2 under the Apache 2.0 * license or under otherwise-compatible licenses with advertising * requirements (or modified versions of such code, with unchanged * license).  You may copy and distribute such a system following the * terms of the GNU GPL for this module and the licenses of the * other code concerned, provided that you include the source code of * that other code when and as the GNU GPL requires distribution of * source code. * * Note that people who make modified versions of this module * are not obligated to grant this special exception for their * modified versions; it is their choice whether to do so.  The GNU * General Public License gives permission to release a modified * version without this exception; this exception also makes it * possible to release a modified version which carries forward this * exception. * *///// Other copyrights might apply to parts of this software and are so// noted when applicable.//// Ported from CMU/Monarch's code, appropriate copyright applies.  /* path.cc   handles source routes*/extern "C" {#include <assert.h>#include <stdio.h>}#include <packet.h>#include <ip.h>#include "hdr_sr.h"#include "path.h"/*===========================================================================  global statics---------------------------------------------------------------------------*/ID invalid_addr(0xffffffff,::NONE);ID IP_broadcast(IP_BROADCAST,::IP);/*===========================================================================  ID methods---------------------------------------------------------------------------*/voidID::unparse(FILE *out) const{  fprintf(out,"%d",(int) addr);}char *ID::dump() const{  static char buf[MAX_SR_LEN+1][50];  static int which = 0;  char *ptr = buf[which];  which = (which + 1) % (MAX_SR_LEN+1);  assert(type == ::NONE || type == ::MAC || type == ::IP);  if (type == ::IP)    sprintf(ptr,"%d",(int) addr);  else if (type == ::NONE)    sprintf(ptr,"NONE");  else    sprintf(ptr,"0x%x",(int) addr);  return ptr;}/*===========================================================================  Path methods---------------------------------------------------------------------------*//* rep invariants:   -1 <= cur_index <= len  (neither bound is really hard)   0 <= len < MAX_SR_LEN*/Path::Path(int route_len, const ID *route){  path = new ID[MAX_SR_LEN];  assert(route_len <= MAX_SR_LEN);  //  route_len = (route == NULL : 0 ? route_len);   // a more cute solution, follow the above with the then clause  if (route != NULL)    {      for (int c = 0; c < route_len; c++)        {	  path[c] = route[c];        }      len = route_len;    }  else    {      len = 0;    }  cur_index = 0;}Path::Path(){  path = new ID[MAX_SR_LEN];  len = 0;  cur_index = 0;}Path::Path(const struct sr_addr *addrs, int len){ /* make a path from the bits of an NS source route header */  assert(len <= MAX_SR_LEN);  path = new ID[MAX_SR_LEN];  for (int i = 0 ; i < len ; i++)    path[i] = ID(addrs[i]);  this->len = len;  cur_index = 0;}Path::Path(struct hdr_sr *srh){ /* make a path from the bits of an NS source route header */	path = new ID[MAX_SR_LEN];	if (! srh->valid()) {		len = 0;		cur_index = 0;		return;	}	len = srh->num_addrs();	cur_index = srh->cur_addr();	assert(len <= MAX_SR_LEN);		for (int i = 0 ; i < len ; i++)		path[i] = ID(srh->addrs()[i]);}voidPath::fillSR(struct hdr_sr *srh){  for (int i = 0 ; i < len ; i++)    {      path[i].fillSRAddr(srh->addrs()[i]);    }  srh->num_addrs() = len;  srh->cur_addr() = cur_index;}Path::Path(const Path& old){  path = new ID[MAX_SR_LEN];  if (old.path != NULL)    {      for (int c = 0; c < old.len; c++)	path[c] = old.path[c];      len = old.len;    }  else    {      len = 0;    }  cur_index = old.cur_index;  path_owner = old.path_owner;}Path::~Path(){  delete[] path;}voidPath::operator=(const Path &rhs)     // makes the lhs a copy of the rhs: lhs may share data with     // the rhs such that changes to one will be seen by the other     // use the provided copy operation if you don't want this.{/* OLD  NOTE:  we save copying the path by doing a delete[] path; path = rhs.path;   but then the following code will be fatal (it calls delete[]   twice on the same address)     { Path p1();       { Path p2();         p2 = p1;       }     }   you'd have to implement reference counts on the path array to   save copying the path.   NEW NOTE: we just copy like everything else*/  if (this != &rhs)    {// beware of path = path (see Stroustrup p. 238)      cur_index = rhs.cur_index;      path_owner = rhs.path_owner;      len = rhs.len;      for (int c = 0 ; c < len ; c++)	path[c] = rhs.path[c];    }  // note: i don't return *this cause I don't think assignments should  // be expressions (and it has slightly incorrect semantics: (a=b) should  // have the value of b, not the new value of a)}boolPath::operator==(const Path &rhs){  int c;  if (len != rhs.len) return false;  for (c = 0; c < len; c++)    if (path[c] != rhs.path[c]) return false;  return true;} void Path::appendPath(Path& p){  int i;  for (i = 0; i < p.length() ; i++)    {      path[len] = p[i];      len++;      if (len > MAX_SR_LEN)	{	  fprintf(stderr,"DFU: overflow in appendPath len2 %d\n",		  p.length());	  len--;	  return;	}    }}void Path::removeSection(int from, int to)  // the elements at indices from -> to-1 are removed from the path{  int i,j;  if (to <= from) return;  if (cur_index > from) cur_index = cur_index - (to - from);  for (i = to, j = 0; i < len ; i++, j++)    path[from + j] = path[i];  len = from + j;}PathPath::copy() const{  Path p(len,path);  p.cur_index = cur_index;  p.path_owner = path_owner;  return p;}voidPath::copyInto(Path& to) const{  to.cur_index = cur_index;  to.len = len;  for (int c = 0 ; c < len ; c++)    to.path[c] = path[c];    to.path_owner = path_owner;}PathPath::reverse() const     // return an identical path with the index pointing to the same     // host, but the path in reverse order{  if (len == 0) return *this;  Path p;  int from, to;  for (from = 0, to = (len-1) ; from < len ; from++,to--)    p.path[to] = path[from];  p.len = len;  p.cur_index = (len - 1) - cur_index;  return p;}voidPath::reverseInPlace(){  if (len == 0) return;  int fp,bp;	   // forward ptr, back ptr  ID temp;  for (fp = 0, bp = (len-1) ; fp < bp ; fp++, bp--)    {      temp = path[fp];      path[fp] = path[bp];      path[bp] = temp;    }  cur_index = (len - 1) - cur_index;}intPath::size() const{  // this should be more clever and ask the id's what their sizes are.  return len*4;}boolPath::member(const ID& id) const// rtn true iff id is in path{  return member(id, invalid_addr);  }boolPath::member(const ID& id, const ID& MAC_id) const// rtn true iff id or MAC_id is in path{  for (int c = 0; c < len ; c++)    if (path[c] == id || path[c] == MAC_id)      return true;  return false;}voidPath::unparse(FILE *out) const{  // change to put ()'s around the cur_index entry?  if (len==0)    {      fprintf(out,"<empty path>");      return;    }  for (int c = 0 ; c < len-1 ; c ++)    {      if (c == cur_index) fprintf(out,"(");      path[c].unparse(out);      if (c == cur_index) fprintf(out,")");      fprintf(out,",");    }  if (len-1 == cur_index) fprintf(out,"(");  path[len-1].unparse(out);  if (len-1 == cur_index) fprintf(out,")");}char *Path::dump() const{  static int which = 0;  static char buf[4][100];  char *ptr = buf[which];  char *rtn_buf = ptr;  which = (which + 1) % 4;    if (len == 0)    {      sprintf(rtn_buf,"[<empty path>]");      return rtn_buf;    }  *ptr++ = '[';  for (int c = 0 ; c < len ; c ++)    {      if (c == cur_index) *ptr++ = '(';      ptr += sprintf(ptr,"%s%s ",path[c].dump(), c == cur_index ? ")" : "");    }  *ptr++ = ']';  *ptr++ = '\0';  return rtn_buf;}voidcompressPath(Path &path)// take a path and remove any double backs from it// eg:  A B C B D --> A B D{  // idea: walk one pointer from begining  //  for each elt1 start at end of path and walk a pointer backwards (elt2)  //   if forward pointer = backward pointer, go on and walk foward one more  //   if elt1 = elt2 then append {(elt2 + 1) to end} after forward pointer  //    update length of path (we just cut out a loopback) and walk forward  //  when forward walking pointer reaches end of path we're done  int fp = 0, bp; // the forward walking ptr and the back walking ptr  while (fp < path.len)    {      for (bp = path.len - 1; bp != fp; bp--)	{	  if (path.path[fp] == path.path[bp])	    { int from, to;	      for (from = bp, to = fp;		   from < path.len ;		   from++, to++)		path.path[to] = path.path[from];	      path.len = to;	      break;	    } // end of removing double back	} // end of scaning to check for double back      fp++; // advance the forward moving pointer    }}void CopyIntoPath(Path& to, const Path& from, int start, int stop)// sets to[0->(stop-start)] = from[start->stop]{  assert(start >= 0 && stop < from.len);  int f, t,c ;			// from and to indices  for(f = start, t = 0; f <= stop; f++, t++)    to.path[t] = from.path[f];  if (to.len < stop - start + 1) to.len = stop - start + 1;  for (c = to.len - 1; c >= 0; c--)    {      if (to.path[c] == to.owner()) break;      if (to.path[c] == ((Path &)from).owner()) 	{	  to.owner() = ((Path &)from).owner();	  break;	}    } }voidPath::checkpath() const{  for(int c = 0; c < MAX_SR_LEN; c++)    {           assert(path[c].type == NONE ||             path[c].type == MAC ||             path[c].type == IP);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产馆在线真实露脸| 久久久久国产精品免费免费搜索| 加勒比av一区二区| 日韩精品三区四区| 日韩在线一区二区| 蜜臀va亚洲va欧美va天堂| 视频一区在线播放| 日韩二区三区四区| 日本人妖一区二区| 久久99久久99| 国产69精品久久99不卡| 高清av一区二区| 91小视频在线| 欧美欧美欧美欧美首页| 日韩欧美中文一区| 久久精品视频网| 《视频一区视频二区| 亚洲精品久久嫩草网站秘色| 一区二区三区产品免费精品久久75| 亚洲精品v日韩精品| 香蕉加勒比综合久久| 精品一区二区三区免费毛片爱| 国产一区二区三区蝌蚪| 粉嫩嫩av羞羞动漫久久久| 一本色道综合亚洲| 欧美一区二区三区思思人| 精品99一区二区| 国产精品久久久久久一区二区三区| 亚洲美女免费视频| 日av在线不卡| 大胆亚洲人体视频| 欧美日韩亚洲综合一区 | 国产精品网站一区| 亚洲男人天堂av网| 免费欧美在线视频| a级精品国产片在线观看| 欧美日韩一区在线观看| 久久久午夜精品理论片中文字幕| 18欧美乱大交hd1984| 日韩精品一级中文字幕精品视频免费观看 | 中文字幕在线观看一区二区| 亚洲午夜影视影院在线观看| 久久av资源网| 欧美亚洲高清一区| 久久综合狠狠综合久久综合88| 亚洲欧美一区二区不卡| 黄色日韩网站视频| 欧美日韩精品福利| 亚洲日本电影在线| 国产二区国产一区在线观看| 欧美系列在线观看| 中文字幕一区二区三区蜜月 | 精品国产91洋老外米糕| 亚洲精品视频自拍| 国产成人亚洲综合a∨婷婷| 欧美挠脚心视频网站| 亚洲婷婷在线视频| 国产成人久久精品77777最新版本| 在线观看免费视频综合| 国产精品久久久久影视| 久久99国产乱子伦精品免费| 欧美日韩亚洲综合一区二区三区 | 成人午夜在线免费| 精品免费国产一区二区三区四区| 亚洲国产日韩一级| 色天天综合久久久久综合片| 国产精品大尺度| 成人深夜在线观看| 国产日韩欧美不卡在线| 国产在线日韩欧美| 欧美精品一区二区三区四区| 日韩黄色一级片| 91精品国产丝袜白色高跟鞋| 亚洲在线免费播放| 在线观看网站黄不卡| 亚洲精品免费在线观看| 一本到一区二区三区| 亚洲天堂中文字幕| www.成人网.com| 亚洲欧美一区二区三区国产精品| 99re免费视频精品全部| 中文字幕一区在线观看视频| 成人免费视频一区| 中文字幕在线观看一区二区| 97久久精品人人澡人人爽| 亚洲欧美日本韩国| 欧美日韩国产一区| 老司机一区二区| 国产亚洲精品中文字幕| 成人午夜在线播放| 亚洲激情第一区| 6080yy午夜一二三区久久| 麻豆成人久久精品二区三区红| 欧美一区二区三区小说| 国产成人亚洲综合a∨婷婷图片| 国产精品灌醉下药二区| 在线观看中文字幕不卡| 日日夜夜一区二区| 久久久久久9999| 色综合视频在线观看| 婷婷亚洲久悠悠色悠在线播放| 91精品一区二区三区久久久久久| 免费观看成人av| 欧美国产精品中文字幕| 色美美综合视频| 日本麻豆一区二区三区视频| 久久久精品国产免费观看同学| 成人精品国产一区二区4080| 午夜影视日本亚洲欧洲精品| 久久中文娱乐网| 色一情一伦一子一伦一区| 日韩成人dvd| 中文字幕精品在线不卡| 欧美在线高清视频| 国产乱码精品一区二区三区五月婷| 国产精品美女视频| 欧美精品在线观看一区二区| 国产成人免费视频一区| 午夜成人免费电影| 中文字幕亚洲不卡| 日韩欧美123| 欧美曰成人黄网| 国产精品1区2区3区| 日韩中文字幕不卡| 亚洲免费视频成人| 久久久综合视频| 日韩三级视频中文字幕| 一本大道综合伊人精品热热| 国产最新精品精品你懂的| 亚洲第一久久影院| 亚洲免费资源在线播放| 中文字幕精品一区二区精品绿巨人 | 久久先锋影音av鲁色资源| 在线国产电影不卡| 白白色亚洲国产精品| 久久成人久久鬼色| 免费看欧美美女黄的网站| 亚洲综合久久av| 亚洲欧美偷拍三级| 中文字幕在线观看一区二区| 欧美精品一区二区三区四区 | 欧美无砖专区一中文字| 不卡一卡二卡三乱码免费网站 | 26uuu亚洲综合色| 欧美一级一区二区| 欧美日韩国产综合草草| 欧美优质美女网站| 欧美性色欧美a在线播放| 91视频在线看| 91麻豆自制传媒国产之光| 成人小视频在线| 不卡的电影网站| 99九九99九九九视频精品| 国产91精品久久久久久久网曝门| 极品少妇xxxx精品少妇偷拍| 蜜臀av一级做a爰片久久| 日韩av不卡在线观看| 蜜臀va亚洲va欧美va天堂| 日本不卡中文字幕| 久久精品噜噜噜成人av农村| 日韩成人精品视频| 久久99最新地址| 激情五月激情综合网| 国产河南妇女毛片精品久久久| 国产一区二区三区免费观看| 国产精品综合二区| www.亚洲在线| 日本二三区不卡| 欧美日韩亚洲另类| 日韩一区二区三区四区五区六区| 日韩一区二区电影| 中文字幕一区二区三区在线观看 | 中文字幕一区二区三区四区不卡 | 欧美日本一道本| 日韩女同互慰一区二区| 国产亚洲精品aa| 综合久久国产九一剧情麻豆| 亚洲综合网站在线观看| 久久99九九99精品| 成人免费视频国产在线观看| 色婷婷综合久久久中文字幕| 欧美乱妇23p| 欧美国产乱子伦| 亚洲国产欧美另类丝袜| 久久99在线观看| 成人av手机在线观看| 欧美美女喷水视频| 久久久精品黄色| 亚洲丶国产丶欧美一区二区三区| 久久99精品国产麻豆婷婷| av电影天堂一区二区在线观看| 欧美日韩国产综合一区二区三区| 精品成人一区二区三区| 一区二区三区精品在线| 精品在线免费视频| 欧美视频精品在线观看| 久久九九影视网| 天堂在线亚洲视频| fc2成人免费人成在线观看播放| 欧美区一区二区三区|