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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? rrep.c

?? 一種AODV實(shí)現(xiàn)方法
?? C
字號(hào):
/*               Kernel AODV  v2.0National Institute of Standards and Technology               Luke Klein-Berndt-----------------------------------------------------  Version 2.0 new features:     * Updated to AODV draft version 11     * Managed internet gatewaying     * Monitor wireles signal strength     * 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 "rrep.h"/****************************************************   rrep----------------------------------------------------Handles sending and recieving RREPs****************************************************/extern struct route_table_entry *g_my_entry;extern u_int32_t g_my_ip;extern u_int32_t g_broadcast_ip;int recv_hello(struct event_queue_entry *working_packet){    struct route_table_entry *recv_route;    struct rrep *tmp_rrep;    struct neighbor_list_entry  *tmp_entry;    tmp_rrep=working_packet->data;    tmp_entry=find_neighbor_list_entry(tmp_rrep->src_ip);    if (tmp_entry==NULL)    {        tmp_entry=create_neighbor_list_entry(tmp_rrep->src_ip);        memcpy(&(tmp_entry->hw_addr),&(working_packet->src_hw_addr),sizeof(unsigned char) * ETH_ALEN);        tmp_entry->dev=working_packet->dev;        set_spy();    #ifdef TRACE        printk ("RREP: Node: %s is now our Neighbor.\n",inet_ntoa(tmp_rrep->src_ip));    #endif    }    delete_timer_queue_entry_of_id(tmp_entry->ip, EVENT_NEIGHBOR);    insert_timer_queue_entry(tmp_rrep->lifetime+getcurrtime()+20,NULL,0,tmp_rrep->src_ip,0,0,EVENT_NEIGHBOR);    update_timer_queue();    recv_route = find_route_table_entry(tmp_rrep->dst_ip);    if (recv_route==NULL)    {#ifdef TRACE        if (tmp_rrep!=NULL)            printk ("RREP: adding route for: %s.\n",inet_ntoa(tmp_rrep->src_ip));#endif        // No entry in RT found, generate a new        recv_route = create_route_table_entry();        recv_route->dst_ip = tmp_rrep->dst_ip;        recv_route->lifetime = 0;        recv_route->dev=working_packet->dev;        recv_route->next_hop = working_packet->src_ip;        recv_route->hop_count = tmp_rrep->hop_count ;        recv_route->route_valid=TRUE;        recv_route->route_seq_valid=TRUE;        insert_kernel_route_entry(recv_route->dst_ip, recv_route->next_hop,recv_route->dev->name);    }    if ((tmp_rrep->hop_count < recv_route->hop_count) || (recv_route->route_valid==FALSE))// || (( tmp_rrep->dst_seq>=recv_route->dst_seq) && (recv_route->next_hop!=recv_route->dst_ip)))    {        delete_kernel_route_entry(recv_route->dst_ip, recv_route->next_hop);        recv_route->dev=working_packet->dev;        recv_route->next_hop = working_packet->src_ip;        recv_route->hop_count = tmp_rrep->hop_count ;        recv_route->route_valid=TRUE;        recv_route->route_seq_valid=TRUE;        insert_kernel_route_entry(recv_route->dst_ip, recv_route->next_hop,recv_route->dev->name);    }    tmp_entry->route_entry=recv_route;    recv_route->lifetime = MAX(recv_route->lifetime,(tmp_rrep->lifetime+getcurrtime()+20));    recv_route->dst_seq = tmp_rrep->dst_seq;#ifdef TRACE    if ((getcurrtime()-tmp_entry->lifetime)>HELLO_INTERVAL*ALLOWED_HELLO_LOSS+20)    {        printk ("----> %u <------  since our last hello from Node:  ",getcurrtime()-tmp_entry->lifetime);        printk("%s  Life \n",inet_ntoa(tmp_entry->ip));    }#endif    tmp_entry->lifetime=getcurrtime();    return 0;}void convert_rrep_to_host(struct rrep *tmp_rrep){    tmp_rrep->dst_seq=ntohl(tmp_rrep->dst_seq);    tmp_rrep->lifetime=ntohl(tmp_rrep->lifetime);}void convert_rrep_to_network(struct rrep *tmp_rrep){    tmp_rrep->dst_seq=htonl(tmp_rrep->dst_seq);    tmp_rrep->lifetime=htonl(tmp_rrep->lifetime);}/****************************************************   recv_rrep----------------------------------------------------Handles recieving route replies. It is passedpackets from the AODV thread****************************************************/int recv_rrep(struct event_queue_entry *working_packet){    struct route_table_entry *send_route;    struct route_table_entry *recv_route;    struct rrep *tmp_rrep;    struct interface_list_entry *tmp_interface;    u_int64_t        curr_time;    u_int32_t	tmp_ip=0;#ifdef MESSAGES    char rt_ip[16];#endif#ifndef TRACE    char dst_ip[16];    char src_ip[16];#endif    tmp_interface=find_interface_by_dev(working_packet->dev);    //check to make sure the interface found    if (tmp_interface==NULL)    {    #ifndef NO_ERROR        printk("RECV_RREP: Error finding interface RREP recieved on!\n");#endif        return 0;    }    tmp_ip=tmp_interface->ip;    tmp_rrep=working_packet->data;    convert_rrep_to_host(tmp_rrep);    // increase the hop count on the rrep    tmp_rrep->hop_count = tmp_rrep->hop_count + 1;#ifdef TRACE    if(tmp_rrep->src_ip != tmp_rrep->dst_ip)    {        strcpy(dst_ip,inet_ntoa(tmp_rrep->dst_ip));        strcpy(src_ip,inet_ntoa(tmp_rrep->src_ip));        printk("RREP: Received a RREP: src: %s dst: %s \n",src_ip,dst_ip);    }#endif    if (tmp_rrep->hop_count==1)    {        //its a hello messages! HELLO WORLD!        recv_hello(working_packet);        return 1;    }    if ((tmp_ip!=0) && (working_packet->src_ip==tmp_ip))    {    	#ifdef MESSAGES        printk("RREP: Reading our own mail! \n");	#endif        return 0;    }    update_route_entry(tmp_rrep->dst_ip,  working_packet->src_ip, tmp_rrep->hop_count, tmp_rrep->dst_seq, working_packet->dev);    delete_timer_queue_entry_of_id(tmp_rrep->dst_ip,EVENT_RREQ);    recv_route = find_route_table_entry(tmp_rrep->dst_ip);    /* Remove RREQ from resend-queue */    //we might need to forward it    if((tmp_rrep->src_ip != tmp_ip) && (tmp_rrep->src_ip!=tmp_rrep->dst_ip))        /* If I'm not the destination of the RREP I forward it */    {#ifndef TRACE        strcpy(src_ip,inet_ntoa(tmp_rrep->src_ip));        strcpy(dst_ip,inet_ntoa(tmp_rrep->dst_ip));        printk("RREP: Forward a route to: %s from node: %s \n",dst_ip,src_ip);#endif        /* Get the entry to the source from RT */        send_route = find_route_table_entry(tmp_rrep->src_ip);        if (send_route!=NULL)        {            /* Add to precursors... */            if (insert_precursor_entry(recv_route, send_route->next_hop) == 1)            {                /* Couldn't add precursor. Ignore and continue */            }            recv_route->lifetime = curr_time + ACTIVE_ROUTE_TIMEOUT;            convert_rrep_to_network(tmp_rrep);            send_message(send_route->next_hop,NET_DIAMETER, working_packet->data, working_packet->size);        }	#ifndef NO_ERROR        else            printk("RREP: ERROR finding sending address!\n");	#endif    }#ifdef TRACE    printk("REC_RREP: Exited\n");#endif    return 0;}/****************************************************   gen_rrep----------------------------------------------------Generates a route reply****************************************************/int gen_rrep(u_int32_t src_ip, u_int32_t dst_ip, u_int32_t packet_src_ip, u_int32_t dst_seq, int grat_rrep){    struct rrep      tmp_rrep;    struct route_table_entry  *src_route;    struct route_table_entry  *dst_route;    struct interface_list_entry *tmp_interface=NULL;    u_int64_t        curr_time;  /* Current time */#ifdef MESSAGES    char srcip[16];    char dstip[16];#endif    curr_time = getcurrtime(); /* Get current time */#ifdef TRACE    printk("GEN_RREP: Entered\n");#endif    /* Get the source and destination IP address from the RREQ */    src_route = find_route_table_entry(src_ip);    dst_route = find_route_table_entry(dst_ip);#ifdef TRACE    printk("GEN_RREP: Found routes\n");#endif    if (dst_route!=NULL)        tmp_interface=find_interface_by_dev(dst_route->dev);    else        tmp_interface=find_interface_by_dev(src_route->dev);#ifndef NO_ERROR    if (dst_route==NULL)        printk("GEN_RREP: DST route invalid!\n");    if(src_route==NULL)        printk("GEN_RREP: SRC route invalid!\n");#endif    if ((dst_ip != tmp_interface->ip) && (dst_ip != g_broadcast_ip) && (grat_rrep))    {        /* Now send a datagram to the requested host telling it it has been        asked for */#ifdef TRACE        printk("GEN_RREP: Sending out Grateitous RREP\n");#endif        tmp_rrep.type = 2;        tmp_rrep.r = 0;        tmp_rrep.prefix_sz = 0;        tmp_rrep.reserved1=0;        tmp_rrep.reserved2=0;        /* Set the source to be the destination of the rreq (it has asked for        it itself)*/        tmp_rrep.src_ip = dst_ip;        /* Insert the rreq's source attributes */        tmp_rrep.dst_ip = src_ip;        //we want it to be in network byte order!        tmp_rrep.dst_seq = htonl(src_route->dst_seq);        tmp_rrep.hop_count = src_route->hop_count;        //we want it to be in network byte order!        tmp_rrep.lifetime = htonl(src_route->lifetime - curr_time);        /* Get info on the destination */#ifdef TRACE        printk("GEN_RREP: Sending out Datagram!\n");#endif#ifdef MESSAGES        strcpy(srcip,inet_ntoa(tmp_rrep.src_ip));        strcpy(dstip,inet_ntoa(tmp_rrep.dst_ip));        printk("RREP: Sending out a Grat RREP -  src: %s dst: %s \n",srcip,dstip);#endif        send_message(dst_route->next_hop,NET_DIAMETER, &tmp_rrep, sizeof(struct rrep));    }    /* Check if the destination IP of RREQ was this node */    if (dst_ip == tmp_interface->ip)    {        /* The RREQ was for this node */        /* Set the reply structure */        if (seq_greater(dst_seq,dst_route->dst_seq))            dst_route->dst_seq = dst_seq;        //we want it to be in network byte order!        tmp_rrep.dst_seq = htonl(dst_route->dst_seq);        tmp_rrep.hop_count = 0;        //we want it to be in network byte order!        tmp_rrep.lifetime = htonl(MY_ROUTE_TIMEOUT);    }    else    {        /* The RREQ was for a node in RT */        /* Set the reply structure */        //we want it to be in network byte order!        tmp_rrep.dst_seq = htonl(dst_route->dst_seq);        tmp_rrep.lifetime = htonl(dst_route->lifetime - curr_time);        tmp_rrep.hop_count = dst_route->hop_count;        /* Add to precursors... */        insert_precursor_entry(dst_route, packet_src_ip);        insert_precursor_entry(src_route, dst_route->next_hop);    }    /* Set the rest of the RREP structure */    tmp_rrep.src_ip = src_ip;    tmp_rrep.dst_ip = dst_ip;    tmp_rrep.type = 2;    tmp_rrep.r = 0;    tmp_rrep.prefix_sz = 0;#ifdef TRACE    strcpy(srcip,inet_ntoa(src_ip));    strcpy(dstip,inet_ntoa(dst_ip));    printk("RREP: sending out a rrep -  src: %s dst: %s \n",srcip,dstip);#endif    send_message(packet_src_ip,NET_DIAMETER, &tmp_rrep, sizeof(struct rrep));#ifdef TRACE    printk("GEN_RREP: Exited\n");#endif    return 0;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人免费在线观看| 亚洲国产精华液网站w| 欧洲日韩一区二区三区| 不卡的av电影在线观看| voyeur盗摄精品| 成人av免费在线观看| 成人一道本在线| 91网站在线观看视频| 99国产精品久久久久久久久久| www.日本不卡| 色噜噜久久综合| 精品视频免费在线| 这里是久久伊人| 欧美v亚洲v综合ⅴ国产v| www一区二区| 国产欧美一区二区三区在线看蜜臀 | 亚洲国产成人av好男人在线观看| 亚洲电影在线播放| 丝袜美腿高跟呻吟高潮一区| 首页国产欧美久久| 毛片av一区二区| 国产精品1区二区.| 99久久99精品久久久久久| 91日韩在线专区| 欧美精品123区| 久久综合久久久久88| 国产欧美日韩精品一区| 亚洲欧美日韩综合aⅴ视频| 午夜不卡在线视频| 国产原创一区二区三区| 懂色av一区二区三区免费观看| av电影天堂一区二区在线| 欧美综合天天夜夜久久| 日韩欧美国产麻豆| 欧美国产日本韩| 午夜不卡av免费| 国产成人午夜视频| 欧洲亚洲国产日韩| 极品少妇一区二区三区精品视频| 欧美电影在线免费观看| 日韩欧美高清一区| 日本一区二区三区在线观看| 亚洲午夜日本在线观看| 久久精品国内一区二区三区| 成人一区二区三区中文字幕| 欧美中文字幕一区| 久久久久久影视| 亚洲成人综合视频| 国产老肥熟一区二区三区| 欧美在线你懂得| 国产日韩精品一区| 亚洲动漫第一页| 成人黄色电影在线| 欧美一区二区精品| 亚洲免费毛片网站| 精品一区二区三区久久久| 日本道在线观看一区二区| 精品福利视频一区二区三区| 一区二区三区中文字幕| 国产在线播放一区三区四| 色婷婷狠狠综合| 久久九九影视网| 五月天激情综合网| 91视频一区二区三区| 久久久久久亚洲综合| 日韩精品一级中文字幕精品视频免费观看 | 日韩中文字幕不卡| www.欧美日韩| 久久精品夜色噜噜亚洲a∨| 亚洲第一av色| 色综合色综合色综合色综合色综合 | 久久欧美中文字幕| 午夜精品爽啪视频| 一本色道**综合亚洲精品蜜桃冫| 精品福利在线导航| 男女男精品视频网| 欧洲一区在线电影| 亚洲视频中文字幕| 国产1区2区3区精品美女| 日韩欧美一级在线播放| 亚洲成人一区二区| 色综合久久久久综合99| 国产精品入口麻豆原神| 国产自产高清不卡| 日韩一区二区在线观看| 亚洲福利视频一区二区| 色94色欧美sute亚洲线路一久| 欧美国产欧美综合| 国产麻豆精品theporn| 欧美r级电影在线观看| 免费在线观看不卡| 91精品国产综合久久久久久漫画 | 亚洲一级二级三级| 色哟哟国产精品| 樱桃视频在线观看一区| 99re8在线精品视频免费播放| 欧美激情一二三区| 懂色中文一区二区在线播放| 久久蜜臀精品av| 国产精品资源站在线| 国产欧美视频一区二区| 国产69精品一区二区亚洲孕妇| 欧美精品一区二区三区一线天视频 | 人人爽香蕉精品| 日韩一区二区三区视频| 久久爱www久久做| www久久精品| 国产精品资源在线| 国产三级精品三级在线专区| 国产69精品久久久久777| 国产精品卡一卡二| 91网站在线播放| 亚洲无线码一区二区三区| 欧美日韩国产经典色站一区二区三区| 性久久久久久久久久久久| 69堂国产成人免费视频| 麻豆国产精品一区二区三区| 亚洲精品在线免费播放| 成人美女在线观看| 亚洲精品乱码久久久久久日本蜜臀| 色999日韩国产欧美一区二区| 一级女性全黄久久生活片免费| 欧美在线不卡视频| 日产国产高清一区二区三区| 日韩欧美视频在线| 国产91高潮流白浆在线麻豆| 亚洲精品视频自拍| 3d动漫精品啪啪1区2区免费| 精品一区二区三区免费视频| 国产日韩精品久久久| 色婷婷久久99综合精品jk白丝| 丝瓜av网站精品一区二区| 日韩欧美国产三级| 成人福利视频在线看| 一区二区三区视频在线看| 欧美二区三区的天堂| 国产乱码精品一区二区三区五月婷| 中文字幕制服丝袜成人av | 一区二区三区色| 日韩视频一区二区三区| 成人在线视频一区二区| 亚洲成人一区二区在线观看| 亚洲精品一区二区三区在线观看| 99久久免费精品高清特色大片| 午夜精品久久久久久不卡8050 | 精品一区二区在线观看| 中文字幕在线一区免费| 欧美一二区视频| 91网站在线播放| 久久成人av少妇免费| 亚洲人快播电影网| 欧美精品一区二区三区高清aⅴ| 成人短视频下载| 奇米影视一区二区三区小说| 国产精品理伦片| 91精品国产综合久久久久久漫画| 国产**成人网毛片九色 | 国产成人自拍在线| 亚洲一区二区在线观看视频| 久久在线观看免费| 欧美另类高清zo欧美| 成人av在线播放网址| 老汉av免费一区二区三区| 椎名由奈av一区二区三区| 欧美大片免费久久精品三p| 91精彩视频在线观看| 国产成人精品免费在线| 日韩电影网1区2区| 亚洲激情综合网| 国产精品亲子伦对白| 精品国产一区二区三区四区四| 色美美综合视频| 成人永久免费视频| 国内精品嫩模私拍在线| 水野朝阳av一区二区三区| 亚洲你懂的在线视频| 欧美国产禁国产网站cc| 精品国产乱码久久久久久牛牛| 欧美三级一区二区| 色综合一个色综合亚洲| 成人免费av网站| 国产一区亚洲一区| 日产国产欧美视频一区精品| 亚洲一区二区欧美日韩| 中文字幕一区二区在线播放| 久久综合九色综合欧美98| 日韩三级免费观看| 欧美二区三区的天堂| 欧美综合色免费| 色先锋资源久久综合| 91亚洲资源网| 成人激情av网| 成人美女视频在线观看18| 国产精品一二一区| 国产在线不卡一区| 国产成人在线色| 成人妖精视频yjsp地址| 丁香婷婷综合色啪| 国产大片一区二区| 丁香啪啪综合成人亚洲小说 |