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

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

?? path.cc

?? 在Linux下做的QuadTree的程序
?? CC
字號:
/* path.cc   handles source routes   $Id: path.cc,v 1.1.1.1 2000/08/28 18:40:09 jinyang Exp $*/extern "C" {#include <assert.h>#include <stdio.h>}#include <packet.h>#include <ip.h>#include <cmu/dsr/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(const 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一区二区三区免费野_久草精品视频
免费看欧美美女黄的网站| 一本大道久久a久久精二百| 成人精品鲁一区一区二区| 97aⅴ精品视频一二三区| 精品日韩av一区二区| 亚洲国产精品综合小说图片区| 久久99最新地址| 欧美日韩免费观看一区二区三区| 国产色婷婷亚洲99精品小说| 日韩av在线发布| 91国偷自产一区二区使用方法| 国产午夜精品久久久久久免费视 | 日本色综合中文字幕| 色综合久久久久综合| 国产清纯白嫩初高生在线观看91| 日日摸夜夜添夜夜添精品视频| 一本一道综合狠狠老| 国产精品久久久久久福利一牛影视| 捆绑调教美女网站视频一区| 欧美日韩不卡一区| 一区二区三区免费网站| 91在线视频观看| 亚洲特黄一级片| eeuss鲁片一区二区三区在线观看| 久久影院视频免费| 精品亚洲porn| 亚洲精品一区二区三区福利 | 精品国产a毛片| 免费看精品久久片| 日韩欧美国产麻豆| 久久不见久久见免费视频1| 7777精品伊人久久久大香线蕉 | 国产精品久久久久久久久果冻传媒| 国产剧情一区二区| 国产亚洲综合性久久久影院| 精品一区二区三区久久| 久久亚洲私人国产精品va媚药| 激情av综合网| 国产清纯白嫩初高生在线观看91| 粉嫩绯色av一区二区在线观看 | 国产精品嫩草99a| 91丨porny丨户外露出| 亚洲欧美成aⅴ人在线观看 | 成人开心网精品视频| 国产精品色噜噜| 色爱区综合激月婷婷| 亚洲成人一区在线| 欧美α欧美αv大片| 国产精品1区2区| 1000部国产精品成人观看| 色综合视频在线观看| 午夜欧美大尺度福利影院在线看| 91精品国产一区二区三区| 免费成人美女在线观看.| 国产亚洲精品aa| 91免费观看在线| 日本伊人色综合网| 国产亚洲精品超碰| 色婷婷av一区二区| 蜜桃视频第一区免费观看| 国产精品少妇自拍| 欧美精品亚洲二区| 国产精品一二三四五| 自拍偷自拍亚洲精品播放| 91精品国产福利在线观看 | 蜜臀精品一区二区三区在线观看 | 欧美经典一区二区| 色悠悠久久综合| 久久国产欧美日韩精品| 国产精品家庭影院| 欧美一二三区在线| 一本大道久久精品懂色aⅴ| 日韩中文字幕91| 国产精品福利影院| 日韩女优制服丝袜电影| 99久久久久久| 国产一区 二区 三区一级| 亚洲精品成人在线| 国产色爱av资源综合区| 欧美男同性恋视频网站| 成人av午夜电影| 久久国产尿小便嘘嘘尿| 亚洲夂夂婷婷色拍ww47| 国产欧美一区二区三区网站| 91麻豆精品国产91久久久更新时间| 99精品视频在线免费观看| 久久精工是国产品牌吗| 亚洲国产va精品久久久不卡综合| 中文乱码免费一区二区| 337p日本欧洲亚洲大胆色噜噜| 欧美日韩国产不卡| 91官网在线观看| 97超碰欧美中文字幕| 国产白丝网站精品污在线入口| 日本亚洲天堂网| 亚洲一卡二卡三卡四卡无卡久久| 中文字幕永久在线不卡| 国产日产欧美一区| 久久蜜桃av一区精品变态类天堂| 日韩亚洲欧美在线| 在线电影欧美成精品| 欧美人成免费网站| 欧美三级中文字| 91久久国产综合久久| 色av综合在线| 91福利国产成人精品照片| av爱爱亚洲一区| 成人97人人超碰人人99| 成人小视频免费观看| 懂色av一区二区三区免费观看 | 久久国产婷婷国产香蕉| 免费成人小视频| 蜜臀精品久久久久久蜜臀| 日本女优在线视频一区二区| 婷婷中文字幕综合| 午夜精品福利视频网站| 首页亚洲欧美制服丝腿| 男男视频亚洲欧美| 精品亚洲欧美一区| 国产精品资源在线观看| 成人黄色大片在线观看| 92国产精品观看| 欧美日韩国产在线播放网站| 欧美一区二区三区四区久久| 欧美大片国产精品| 久久亚洲私人国产精品va媚药| 亚洲国产精品二十页| 国产精品高潮呻吟| 亚洲丶国产丶欧美一区二区三区| 亚洲成在人线在线播放| 捆绑变态av一区二区三区| 久久国产精品99久久久久久老狼| 国产乱子伦视频一区二区三区| 成人精品gif动图一区| 91麻豆精品视频| 7878成人国产在线观看| 精品盗摄一区二区三区| 欧美国产亚洲另类动漫| 亚洲愉拍自拍另类高清精品| 日本不卡的三区四区五区| 丰满白嫩尤物一区二区| 在线亚洲一区观看| 欧美一级理论片| 中文字幕日韩欧美一区二区三区| 亚洲精品久久久蜜桃| 精品一区二区久久久| 91热门视频在线观看| 日韩一区二区三区免费看| 国产精品网站在线| 日韩va欧美va亚洲va久久| 国产一区二区视频在线| 91色porny| 久久免费视频一区| 亚洲国产视频一区二区| 国产成人精品亚洲日本在线桃色| 一本到不卡精品视频在线观看 | 精品一区二区三区视频| 色欧美日韩亚洲| 国产色爱av资源综合区| 亚洲成av人在线观看| 国产传媒久久文化传媒| 91精品国产综合久久香蕉麻豆| 国产精品久久久久久久久久免费看 | 亚洲精品视频自拍| 国内外精品视频| 欧美剧情电影在线观看完整版免费励志电影| 欧美不卡一区二区| 亚洲成人tv网| 色综合久久久久综合| 欧美国产精品一区二区三区| 美脚の诱脚舐め脚责91 | 亚洲九九爱视频| 国产一区不卡视频| 日韩欧美中文一区| 一区二区三区四区精品在线视频| 国产高清在线精品| 亚洲精品在线观看网站| 日本aⅴ精品一区二区三区 | 麻豆精品国产传媒mv男同| 欧美视频一区二区三区| 亚洲视频图片小说| 国产成人免费9x9x人网站视频| 精品国产麻豆免费人成网站| 视频一区二区三区在线| 欧美日韩一区二区三区不卡| 亚洲欧洲日产国码二区| 国产成人亚洲综合a∨猫咪| 欧美大片在线观看一区二区| 日韩国产欧美一区二区三区| 91久久精品一区二区三| 亚洲精品国产无天堂网2021| 94-欧美-setu| 亚洲欧美欧美一区二区三区| 99这里只有精品| 国产精品久久久久9999吃药| 成人永久看片免费视频天堂| 久久精品日产第一区二区三区高清版| 精品亚洲国产成人av制服丝袜 | 亚洲欧美日韩久久精品| 暴力调教一区二区三区|