亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
av电影天堂一区二区在线| 精品国产一二三| 日韩欧美精品在线| 一级日本不卡的影视| 国产一区二区三区精品视频| 欧美日韩国产另类一区| 亚洲欧美在线aaa| 精品一区二区三区欧美| 欧美性极品少妇| 国产精品久久综合| 国内成人自拍视频| 欧美成人video| 日韩国产成人精品| 精品视频在线视频| 亚洲一区二区三区免费视频| 国产成人自拍网| 亚洲精品一区二区三区影院| 日本欧美在线看| 欧美老肥妇做.爰bbww视频| 亚洲综合免费观看高清完整版在线| 成人的网站免费观看| 国产清纯白嫩初高生在线观看91| 国产一区二区福利| 欧美一区二区三区思思人| 夜夜夜精品看看| 色香蕉成人二区免费| 亚洲视频一区在线| 99re6这里只有精品视频在线观看| 国产精品午夜免费| 不卡视频在线看| 国产精品九色蝌蚪自拍| 99久久精品免费看| 自拍av一区二区三区| 不卡视频一二三四| 亚洲视频免费在线观看| 99久久久久久99| 亚洲一本大道在线| 在线观看日韩电影| 视频在线观看91| 欧美日韩一二三区| 老司机精品视频在线| 久久精品视频免费| 97se亚洲国产综合自在线不卡| 亚洲天堂2014| 99久久久久久| 亚洲3atv精品一区二区三区| 在线观看91精品国产麻豆| 麻豆成人91精品二区三区| 亚洲精品一区二区三区在线观看| 国产成人亚洲综合a∨婷婷图片| 国产精品美女久久久久久久网站| 色999日韩国产欧美一区二区| 亚洲电影你懂得| www亚洲一区| 成人h动漫精品一区二区| 一区二区三区四区不卡视频| 欧美日韩一区 二区 三区 久久精品 | 国产麻豆视频一区| 中文字幕亚洲精品在线观看 | 欧美人动与zoxxxx乱| 日本人妖一区二区| 日本一区二区动态图| 欧洲精品中文字幕| 狠狠色综合日日| 亚洲免费色视频| 精品国产一区二区精华| 91色porny| 久久狠狠亚洲综合| 亚洲人成网站色在线观看| 日韩欧美国产综合在线一区二区三区| 丁香亚洲综合激情啪啪综合| 亚洲福中文字幕伊人影院| 久久综合色8888| 欧美亚洲动漫另类| 国产精品一区二区无线| 午夜电影网亚洲视频| 欧美高清在线一区| 精品欧美一区二区三区精品久久| 99久精品国产| 国产精品一线二线三线精华| 偷偷要91色婷婷| 亚洲欧美日韩系列| 日本一区二区在线不卡| 欧美一级专区免费大片| 色欧美乱欧美15图片| 国产成人亚洲精品青草天美| 日韩二区在线观看| 亚洲欧美日韩国产另类专区 | 9191成人精品久久| 99国内精品久久| 国产一区二区三区在线观看免费视频 | 日韩**一区毛片| 亚洲欧美色图小说| 国产午夜精品理论片a级大结局| 这里只有精品视频在线观看| 91美女在线视频| 91在线观看成人| 风间由美一区二区av101 | 日韩欧美高清在线| 在线免费观看日本一区| 91丨九色丨蝌蚪富婆spa| 国产一区二区导航在线播放| 韩日精品视频一区| 六月丁香婷婷色狠狠久久| 午夜视频一区二区| 亚洲高清一区二区三区| 一区二区三区欧美视频| 亚洲女人****多毛耸耸8| 国产精品天美传媒| 亚洲国产精品黑人久久久| 国产欧美一区二区三区沐欲| 日韩精品一区在线观看| 日韩精品一区二区三区在线播放 | 亚洲国产精品精华液网站| 亚洲精选视频免费看| 亚洲女人****多毛耸耸8| 亚洲少妇30p| 一区二区在线观看免费 | 色哟哟日韩精品| 91福利社在线观看| 在线视频综合导航| 欧美三级在线看| 欧美一级生活片| 欧美mv和日韩mv的网站| 久久久美女艺术照精彩视频福利播放| 精品精品国产高清a毛片牛牛| 久久久国产午夜精品| 中文av一区二区| 亚洲精品日产精品乱码不卡| 亚洲一线二线三线久久久| 亚洲国产cao| 精品写真视频在线观看| 国产不卡在线播放| 色婷婷久久久久swag精品| 欧美羞羞免费网站| 日韩精品专区在线影院重磅| 久久夜色精品国产噜噜av| 欧美激情一区三区| 亚洲一区二区中文在线| 美国欧美日韩国产在线播放| 粉嫩嫩av羞羞动漫久久久| 99热这里都是精品| 在线播放亚洲一区| 国产无一区二区| 尤物视频一区二区| 久久se这里有精品| 91蜜桃视频在线| 欧美变态口味重另类| 中文字幕一区三区| 午夜精品久久久久久不卡8050| 精品一区二区三区影院在线午夜| 99视频精品免费视频| 欧美一级片在线| 最新高清无码专区| 久久99热99| 在线观看国产日韩| 久久久www成人免费毛片麻豆 | 精品制服美女丁香| 99久久久精品免费观看国产蜜| 欧美一区中文字幕| 中文字幕在线观看一区二区| 日韩成人一区二区三区在线观看| 波多野结衣中文字幕一区| 欧美一区二区三区四区视频| 樱花影视一区二区| 国产综合一区二区| 4438x亚洲最大成人网| 国产精品传媒在线| 国产毛片精品一区| 欧美一区二区三区免费| 亚洲精品国产a| www.激情成人| 久久久一区二区三区捆绑**| 丝袜美腿一区二区三区| 色噜噜久久综合| 亚洲国产成人私人影院tom| 青青草精品视频| 欧美人成免费网站| 亚洲五月六月丁香激情| 99精品在线免费| 国产精品丝袜黑色高跟| 国产综合久久久久久鬼色| 在线播放中文一区| 午夜视频在线观看一区| 欧美性色黄大片手机版| 一区二区三区在线高清| 色综合婷婷久久| 最新久久zyz资源站| 春色校园综合激情亚洲| 久久久精品免费免费| 国产原创一区二区三区| 精品少妇一区二区三区 | 精品国产1区二区| 蜜臀av性久久久久蜜臀aⅴ| 欧美在线观看一区| 亚洲欧洲制服丝袜| 91国偷自产一区二区使用方法| 国产精品久久久久久久蜜臀| 成人永久aaa| 国产精品福利一区|