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

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

?? route_table.c

?? linux 下的aodv實現源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*               Kernel AODV  v2.1National Institute of Standards and Technology               Luke Klein-Berndt-----------------------------------------------------  Version 2.1 new features:     * Much more stable!     * Added locks around important areas     * Multihop Internet gatewaying now works     * Multicast hack added     * Many bug fixes!-----------------------------------------------------Originally based upon MadHoc code. I am notsure how much of it is left anymore, but MadHocproved to be a great starting point.MadHoc was written by - Fredrik Lilieblad,Oskar Mattsson, Petra Nylund, Dan Ouchterlonyand Anders Roxenhag Mail: mad-hoc@flyinglinux.netThis software is Open Source under the GNU General Public Licence.*/#include "route_table.h"/****************************************************   route_table----------------------------------------------------A table which contains all the needed routinginformation to contact other nodes****************************************************/extern u_int32_t g_broadcast_ip;extern struct route_table_entry *g_my_entry;struct route_table_entry *route_table;rwlock_t route_lock = RW_LOCK_UNLOCKED;/* Declaration of internal procedures */struct precursor_entry *find_precursor_entry(struct route_table_entry* tmp_entry, u_int32_t tmp_ip);void route_read_lock(){  read_lock_bh(&route_lock);}void route_read_unlock(){  read_unlock_bh(&route_lock);}void route_write_lock(){  write_lock_bh(&route_lock);}void route_write_unlock(){  write_unlock_bh(&route_lock);}/* * init_rt * * Description: *   Initializes the main routing table by creating a *   head for the list. * * Arguments: void * * Return: void *//****************************************************   init_route_table----------------------------------------------------Initalizes the route table so it can hold data****************************************************/int init_route_table( void){    route_table=NULL;    return 0;}/****************************************************   get_first_route_table_entry----------------------------------------------------Returns the first entry in the routing table****************************************************/struct route_table_entry *get_first_route_table_entry(){    return route_table;}/****************************************************   find_inactive_route_table_entries----------------------------------------------------Finds expired route table entries and deletesthem****************************************************/void find_inactive_route_table_entries(){    struct route_table_entry *tmp_route;    struct route_table_entry *dead_route;    u_int64_t curr_time;    curr_time=getcurrtime();    /*lock table*/    route_write_lock();    tmp_route=route_table;    while(tmp_route!=NULL)    {        if ((tmp_route->lifetime < curr_time) && !tmp_route->self_route)        {            if(tmp_route->route_valid==FALSE)            {                printk(KERN_INFO "ROUTE_TABLE: Route: %s has expired and will be deleted from the Route Table\n",inet_ntoa(tmp_route->dst_ip));		/* step back before deletion */                dead_route=tmp_route;		tmp_route=tmp_route->next;                if (route_table==dead_route)                    route_table=dead_route->next;                if (dead_route->prev!=NULL)                    dead_route->prev->next = dead_route->next;                if (dead_route->next!=NULL)                    dead_route->next->prev = dead_route->prev;                delete_precursors_from_route_table_entry(dead_route);                kfree(dead_route);            }            else	      {                if(tmp_route->self_route==0)		  {                    if(tmp_route->next_hop == tmp_route->dst_ip)		      {			route_write_unlock();			/* break also performs route_expiry */			link_break(tmp_route->dst_ip);			route_write_lock();		      }                    else		      {                        printk(KERN_INFO "AODV: Route Table Entry: %s is inactive  and will be marked as expired!!\n",inet_ntoa(tmp_route->dst_ip));			route_write_unlock();                        route_expiry(tmp_route);			route_write_lock();                    }                }		                tmp_route=tmp_route->next;		            }        }        else	  {            tmp_route=tmp_route->next;	    	  }    }    route_write_unlock();}/****************************************************   create_route_table_entry----------------------------------------------------Allocates memory for a new route table entry,places that entry into the linked list and thenreturns a pointer for that entry****************************************************/struct route_table_entry *create_route_table_entry(){    struct route_table_entry *tmp_entry;    /* Allocate memory for new entry */    if((tmp_entry = (struct route_table_entry*)kmalloc(sizeof(struct route_table_entry),GFP_ATOMIC)) == NULL)    {        printk(KERN_WARNING "AODV: Error getting memory for inserting new rtentry\n");        return NULL;    }    tmp_entry->precursors=NULL;    tmp_entry->self_route=FALSE;    tmp_entry->rreq_id=0;    tmp_entry->link=255;    tmp_entry->dev=NULL;    tmp_entry->route_valid=FALSE;    tmp_entry->route_seq_valid=FALSE;    tmp_entry->prev = NULL;      /*lock table*/    route_write_lock();        if (route_table!=NULL)        route_table->prev = tmp_entry;    tmp_entry->next = route_table;    route_table=tmp_entry;    /*unlock table*/    route_write_unlock();    return tmp_entry;}/****************************************************   find_route_table_entry----------------------------------------------------Returns a pointer to a route table entry whichmatches the ip address****************************************************/struct route_table_entry *fast_find_route_table_entry(u_int32_t tmp_ip){    struct route_table_entry *tmp_entry;    tmp_entry=route_table;    while(tmp_entry!=NULL)    {        if(tmp_entry->dst_ip == tmp_ip)        {          return tmp_entry;        }	        tmp_entry=tmp_entry->next;    }    return NULL;}/****************************************************   find_route_table_entry----------------------------------------------------Returns a pointer to a route table entry whichmatches the ip address****************************************************/struct route_table_entry *find_route_table_entry(u_int32_t tmp_ip){    struct route_table_entry *tmp_entry;    /*lock table*/    route_read_lock();    tmp_entry=route_table;    while(tmp_entry!=NULL)    {        if(tmp_entry->dst_ip == tmp_ip)        {	  /*unlock table*/	  route_read_unlock();          return tmp_entry;        }	        tmp_entry=tmp_entry->next;    }    /*unlock table*/    route_read_unlock();    return NULL;}/****************************************************   delete_route_table_entry----------------------------------------------------Deletes a route table entry which matches theip address****************************************************/int delete_route_table_entry(u_int32_t tmp_ip){    struct route_table_entry *tmp_entry;    if ((tmp_entry=find_route_table_entry(tmp_ip))==NULL)        return -ENOENT;    delete_kernel_route_entry(tmp_entry->dst_ip,tmp_entry->next_hop);    /*lock table*/    route_write_lock();        if (route_table==tmp_entry)        route_table=tmp_entry->next;    if (tmp_entry->prev!=NULL)        tmp_entry->prev->next = tmp_entry->next;    if (tmp_entry->next!=NULL)        tmp_entry->next->prev = tmp_entry->prev;    /*unlock table*/    route_write_unlock();        delete_precursors_from_route_table_entry(tmp_entry);    kfree(tmp_entry);    return 0;}/****************************************************   read_monitor_proc----------------------------------------------------Prints out the route table to a buffer. It is calledwhen the related proc file is read****************************************************/int read_monitor_proc(char *buffer, char **buffer_location, off_t offset, int buffer_length,int *eof,void *data){    static char *my_buffer;    char temp_buffer[80];    struct route_table_entry *tmp_entry;    int len;    char dst[16];    char hop[16];    /*lock table*/    route_read_lock();        tmp_entry=route_table;    my_buffer=buffer;    sprintf(my_buffer,"\n");    tmp_entry=route_table;    while (tmp_entry!=NULL)    {        if (tmp_entry->hop_count==0)        {            strcpy(hop,inet_ntoa(tmp_entry->next_hop));            strcpy(dst,inet_ntoa(tmp_entry->dst_ip));            sprintf(temp_buffer,"%s %s %d \n",dst ,hop,tmp_entry->hop_count);            strcat(my_buffer,temp_buffer);        }        tmp_entry=tmp_entry->next;    }    tmp_entry=route_table;    while (tmp_entry!=NULL)    {        if (tmp_entry->hop_count==1)        {            strcpy(hop,inet_ntoa(tmp_entry->next_hop));            strcpy(dst,inet_ntoa(tmp_entry->dst_ip));            sprintf(temp_buffer,"%s %s %d \n",dst ,hop,tmp_entry->hop_count);            strcat(my_buffer,temp_buffer);        }        tmp_entry=tmp_entry->next;    }    tmp_entry=route_table;    while (tmp_entry!=NULL)    {        if (tmp_entry->hop_count>1)        {            strcpy(hop,inet_ntoa(tmp_entry->next_hop));            strcpy(dst,inet_ntoa(tmp_entry->dst_ip));            sprintf(temp_buffer,"%s %s %d \n",dst ,hop,tmp_entry->hop_count);            strcat(my_buffer,temp_buffer);        }        tmp_entry=tmp_entry->next;    }    /*unlock table*/    route_read_unlock();        len = strlen(my_buffer);    *buffer_location = my_buffer + offset;    len -= offset;    if (len > buffer_length)        len = buffer_length;    else if (len < 0)        len = 0;    return len;}/****************************************************   read_route_table_proc----------------------------------------------------Prints out the route table to a buffer. It is calledwhen the related proc file is read****************************************************/int read_route_table_proc(char *buffer, char **buffer_location, off_t offset, int buffer_length,int *eof,void *data){    static char *my_buffer;    char temp_buffer[200];    char temp[40];    struct route_table_entry *tmp_entry;    struct precursor_entry  *tmp_precursor;    u_int64_t remainder, numerator;    u_int64_t tmp_time;    int len,i;    u_int64_t currtime;    char dst[16];    char hop[16];    currtime=getcurrtime();    /*lock table*/    route_read_lock();        tmp_entry=route_table;    my_buffer=buffer;    sprintf(my_buffer,"\nRoute Table \n---------------------------------------------------------------------------------\n");    sprintf(temp_buffer,"        IP        |       Seq    |   Hop Count  |     Next Hop\n");    strcat(my_buffer,temp_buffer);    sprintf(temp_buffer,"---------------------------------------------------------------------------------\n");    strcat(my_buffer,temp_buffer);    while (tmp_entry!=NULL)    {        strcpy(hop,inet_ntoa(tmp_entry->next_hop));        strcpy(dst,inet_ntoa(tmp_entry->dst_ip));        sprintf(temp_buffer,"  %-16s       %5u          %3d         %-16s   ",dst ,tmp_entry->dst_seq,tmp_entry->hop_count,hop);        strcat(my_buffer,temp_buffer);	if (tmp_entry->route_valid)	  strcat(my_buffer, " Valid ");		tmp_time=tmp_entry->lifetime-currtime;	numerator = (tmp_time);	remainder = do_div( numerator, 1000 );	        if (tmp_entry->lifetime < currtime )	{	  sprintf(temp," Expired!\n");	}	else	  {	    sprintf(temp," sec/msec: %lu/%lu %d\n", (unsigned long)numerator, (unsigned long)remainder,tmp_entry->self_route);	  }	strcat(my_buffer,temp);        tmp_precursor=tmp_entry->precursors;#ifndef ARM

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天操天天综合网| 粉嫩欧美一区二区三区高清影视| 国产一区二区三区免费观看| 91久久精品一区二区| 亚洲精品一区二区三区四区高清| 亚洲欧洲精品成人久久奇米网| 日韩av一区二区在线影视| av成人免费在线| 国产欧美日韩麻豆91| 国产真实乱子伦精品视频| 欧美二区三区的天堂| 久久精品一区二区| 99re亚洲国产精品| 日韩视频中午一区| 一区二区三区鲁丝不卡| 成人免费福利片| 久久影院视频免费| 亚洲国产aⅴ天堂久久| 91在线精品一区二区| 国产欧美精品一区二区三区四区| 日本视频一区二区三区| 欧美日韩精品免费| 一区二区成人在线观看| 一本到高清视频免费精品| 久久综合九色欧美综合狠狠| 久久99久久99| 日韩精品专区在线| 久久激五月天综合精品| 日韩欧美一级精品久久| 精品在线播放免费| 日韩一区和二区| 免费xxxx性欧美18vr| 欧美一区二区三区在线观看| 奇米亚洲午夜久久精品| 日韩一区二区三区三四区视频在线观看 | 岛国av在线一区| 久久精品一二三| 国产传媒欧美日韩成人| 国产精品欧美极品| 日本高清免费不卡视频| 午夜天堂影视香蕉久久| 日韩三级在线观看| 国产在线精品一区二区| 久久久久久黄色| 99国产精品99久久久久久| 一区二区三区国产| 这里只有精品免费| 国产一区 二区| 国产精品久久久久久久裸模| 色老综合老女人久久久| 图片区小说区区亚洲影院| 精品国产乱码久久久久久闺蜜| 国产剧情一区二区| 亚洲精品欧美综合四区| 777奇米四色成人影色区| 韩国三级电影一区二区| 亚洲欧美自拍偷拍色图| 在线成人高清不卡| 国产精品一区免费在线观看| 亚洲美女一区二区三区| 欧美一区二区视频在线观看| 成人免费视频视频在线观看免费| 一区二区在线观看免费视频播放| 69成人精品免费视频| 国产一区二区h| 一区二区三区免费网站| 精品欧美一区二区久久| 91麻豆国产精品久久| 琪琪一区二区三区| 亚洲精品伦理在线| 26uuu亚洲综合色欧美| 色综合久久66| 国产成人欧美日韩在线电影| 亚洲福利一二三区| 国产精品护士白丝一区av| 在线成人高清不卡| 色偷偷成人一区二区三区91| 狠狠色丁香婷婷综合久久片| 亚洲一卡二卡三卡四卡无卡久久| 欧美精品一区二区三区很污很色的| 色综合久久中文字幕综合网| 国产乱子伦视频一区二区三区 | 欧美日韩一区二区三区免费看| 国产在线视频精品一区| 亚洲成人av中文| 综合中文字幕亚洲| 久久久三级国产网站| 欧美日韩精品专区| 不卡一区二区三区四区| 国产在线不卡视频| 丝袜美腿亚洲一区二区图片| 亚洲色图一区二区三区| 亚洲国产精品黑人久久久| 日韩欧美一区二区视频| 宅男噜噜噜66一区二区66| 91日韩在线专区| 岛国精品一区二区| 国产福利精品一区二区| 国产一区在线精品| 免费欧美在线视频| 日韩中文字幕一区二区三区| 一区二区成人在线观看| 综合在线观看色| 国产精品欧美综合在线| 国产日韩精品一区二区三区| 91麻豆精品久久久久蜜臀 | 日本免费新一区视频| 亚洲激情成人在线| 亚洲日本电影在线| 亚洲视频免费在线观看| 日韩美女啊v在线免费观看| 国产日韩欧美一区二区三区综合| 精品少妇一区二区三区视频免付费 | 91超碰这里只有精品国产| 欧美日韩一区二区在线视频| 欧美视频一区二区| 欧美日韩久久一区| 91麻豆精品91久久久久久清纯| 欧美日韩综合色| 91精品久久久久久久91蜜桃| 欧美一区二区三区影视| 精品少妇一区二区三区在线视频| 久久免费看少妇高潮| 中文字幕免费在线观看视频一区| 国产精品午夜在线观看| 亚洲欧洲精品一区二区三区不卡| 亚洲欧美视频在线观看视频| 亚洲欧美另类综合偷拍| 亚洲一二三四久久| 午夜精品一区在线观看| 午夜精品福利一区二区蜜股av| 日本不卡视频在线观看| 久久av老司机精品网站导航| 国产呦精品一区二区三区网站| 成人美女视频在线看| 91日韩精品一区| 日韩一区二区在线免费观看| 久久精品免视看| 一区二区三区在线免费观看 | 日韩午夜在线影院| 国产拍揄自揄精品视频麻豆| 亚洲欧美另类小说| 久久精品久久综合| 成人福利视频在线| 欧美久久久一区| 国产亚洲成年网址在线观看| 一区二区三区欧美在线观看| 开心九九激情九九欧美日韩精美视频电影| 国产麻豆欧美日韩一区| 欧美中文字幕亚洲一区二区va在线| 欧美一级日韩一级| 亚洲色图欧洲色图| 免费成人结看片| 91蜜桃在线观看| 国产精品一区二区久久不卡 | 免费人成网站在线观看欧美高清| 国产在线不卡一区| 欧美日韩中文一区| 国产欧美一区二区精品忘忧草| 亚洲视频一区二区在线| 韩国v欧美v亚洲v日本v| 欧美影片第一页| 欧美国产成人在线| 久久精品国产秦先生| 欧美伊人久久大香线蕉综合69| 久久欧美中文字幕| 日本午夜一本久久久综合| 一本色道久久综合亚洲91| 国产亚洲精品bt天堂精选| 日韩和欧美的一区| 色呦呦网站一区| 中文字幕 久热精品 视频在线 | 国产视频一区二区三区在线观看| 日韩激情中文字幕| 91九色02白丝porn| 日韩美女视频一区| 成人性视频网站| 久久先锋资源网| 精品无人码麻豆乱码1区2区 | 国产综合久久久久久鬼色| 欧美日本国产视频| 亚洲精品视频在线观看网站| 福利91精品一区二区三区| 精品三级在线观看| 日本不卡1234视频| 7777精品伊人久久久大香线蕉超级流畅| 亚洲日本欧美天堂| 一本色道久久综合亚洲精品按摩| 国产精品美女久久久久久久久久久| 捆绑调教一区二区三区| 精品少妇一区二区三区免费观看 | 韩国av一区二区| 日韩欧美色综合| 秋霞av亚洲一区二区三| 欧美肥妇free| 日本伊人色综合网| 5858s免费视频成人| 全国精品久久少妇| 精品国产不卡一区二区三区| av中文字幕亚洲|