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

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

?? path.cc

?? NS2的dsr-ocean仿真代碼,對學習研究NS2的人非常有研究價值
?? 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一区二区三区免费野_久草精品视频
欧美成人bangbros| 三级在线观看一区二区| 亚洲成av人片在线| 欧美性高清videossexo| 久久精品在线观看| 免费看日韩精品| 色综合久久久久| 国产欧美一区二区精品性色| 日韩av电影免费观看高清完整版在线观看| 粉嫩蜜臀av国产精品网站| 日韩一区二区精品葵司在线| 亚洲卡通动漫在线| 北条麻妃国产九九精品视频| 精品欧美乱码久久久久久| 视频在线观看一区二区三区| 日本乱人伦一区| 亚洲欧洲日韩综合一区二区| 成人在线视频一区二区| 精品处破学生在线二十三| 日本怡春院一区二区| 欧美亚洲日本国产| 一区二区三区不卡在线观看| 91丨porny丨中文| 亚洲视频中文字幕| aaa亚洲精品| 亚洲少妇30p| 91丨porny丨首页| 亚洲精品国产无天堂网2021| 99国产精品久久久久久久久久| 国产亚洲精品免费| 欧美丝袜丝交足nylons| 亚洲一区国产视频| 欧美日韩一二三| 午夜精品成人在线视频| 欧美精品乱码久久久久久按摩| 亚洲h动漫在线| 欧美喷潮久久久xxxxx| 日韩制服丝袜av| 日韩欧美成人午夜| 国产专区欧美精品| 亚洲国产精品高清| 成人av资源在线| 一区二区在线观看视频| 91福利视频网站| 日韩精品91亚洲二区在线观看 | 一区二区三区在线播| 一本色道**综合亚洲精品蜜桃冫| 一区二区三区中文在线| 欧美日韩一区三区| 美女精品一区二区| 国产日产亚洲精品系列| 日韩欧美激情四射| 国产麻豆91精品| 《视频一区视频二区| 欧美中文一区二区三区| 日本午夜精品视频在线观看| 久久久久久久久伊人| 99久久久精品免费观看国产蜜| 伊人婷婷欧美激情| 精品国免费一区二区三区| 成人精品在线视频观看| 亚洲午夜视频在线观看| 精品对白一区国产伦| 一本到三区不卡视频| 日本视频一区二区三区| 国产精品丝袜一区| 欧美日韩国产首页| 成人黄色电影在线| 丝袜美腿亚洲一区二区图片| 久久精品这里都是精品| 欧洲视频一区二区| 国产高清不卡一区| 天堂午夜影视日韩欧美一区二区| 久久色在线观看| 在线观看亚洲专区| 国产高清亚洲一区| 日韩成人一级大片| 亚洲日本一区二区三区| 欧美成人r级一区二区三区| 色综合天天做天天爱| 国产综合成人久久大片91| 亚洲国产欧美在线| 国产精品日日摸夜夜摸av| 91麻豆精品91久久久久同性| 91丨九色丨蝌蚪富婆spa| 色老汉av一区二区三区| 国产美女精品在线| 人人狠狠综合久久亚洲| 一区二区三区日韩欧美精品| 欧美国产成人在线| 精品国产免费人成电影在线观看四季 | 粉嫩一区二区三区性色av| 免费人成网站在线观看欧美高清| 亚洲免费av观看| 久久久精品国产免费观看同学| 欧美日韩国产综合久久 | 亚洲精品成人少妇| 国产精品日日摸夜夜摸av| 久久免费看少妇高潮| 日韩你懂的在线观看| 制服丝袜成人动漫| 欧美美女bb生活片| 色婷婷综合在线| 99re热视频精品| av中文字幕在线不卡| 国产电影精品久久禁18| 国产美女在线观看一区| 久久66热re国产| 精久久久久久久久久久| 久久99精品国产麻豆婷婷| 免费的国产精品| 另类小说图片综合网| 奇米精品一区二区三区在线观看| 五月天中文字幕一区二区| 亚洲成人免费在线观看| 天天综合网 天天综合色| 9l国产精品久久久久麻豆| 成人性生交大片免费| 99亚偷拍自图区亚洲| 一本一道波多野结衣一区二区| 色综合久久综合网97色综合 | 欧美美女喷水视频| 3d动漫精品啪啪| 欧美不卡一区二区| 久久久久久久久蜜桃| 国产精品日日摸夜夜摸av| 成人欧美一区二区三区白人| 亚洲最大的成人av| 日韩高清电影一区| 久久99最新地址| 成人免费视频一区二区| 日本久久精品电影| 欧美美女黄视频| 久久蜜桃香蕉精品一区二区三区| 国产日韩精品久久久| 亚洲欧美一区二区三区久本道91| 亚洲精品乱码久久久久久久久 | 91国内精品野花午夜精品| 欧美日韩五月天| 欧美v国产在线一区二区三区| 久久亚洲综合色一区二区三区 | 精品成人a区在线观看| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲色图色小说| 日本午夜一本久久久综合| 国产精品一区二区免费不卡| 99久久精品情趣| 在线不卡免费欧美| 中文字幕电影一区| 成人夜色视频网站在线观看| 在线精品亚洲一区二区不卡| 日韩精品最新网址| 成人欧美一区二区三区小说| 人妖欧美一区二区| 成人动漫视频在线| 欧美一区二区人人喊爽| 国产精品入口麻豆原神| 日韩中文字幕麻豆| youjizz久久| 精品日韩一区二区| 亚洲一区二区三区四区在线免费观看| 毛片一区二区三区| 色妹子一区二区| 久久久久久久久一| 日韩av一二三| 99re热这里只有精品免费视频| 欧美va亚洲va在线观看蝴蝶网| 一区二区三区精品在线| 国产成人小视频| 欧美一区二区三区公司| 一区二区三区在线观看国产 | 一本色道久久综合狠狠躁的推荐| 日韩免费一区二区三区在线播放| 亚洲人成小说网站色在线 | 免费成人在线播放| 欧美性淫爽ww久久久久无| 国产精品久久久久7777按摩| 日韩不卡在线观看日韩不卡视频| 91日韩一区二区三区| 欧美激情自拍偷拍| 激情av综合网| 欧美大胆人体bbbb| 偷拍与自拍一区| 欧美伊人久久久久久午夜久久久久| 国产欧美综合色| 国内精品免费**视频| 欧美一区二区三区免费大片| 天堂蜜桃一区二区三区| 欧美专区在线观看一区| 亚洲欧美日韩中文字幕一区二区三区| 国产精品88av| 国产亚洲欧美日韩日本| 国产在线视频一区二区三区| 欧美videos中文字幕| 久久精品国产澳门| 日韩精品一区二区三区swag| 毛片av一区二区| 精品免费视频一区二区| 精品一区二区三区在线播放视频| 日韩女同互慰一区二区|