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

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

?? rerr.c

?? 一種AODV實現方法
?? C
字號:
/*               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 "rerr.h"/****************************************************   rerr----------------------------------------------------Handles the generation of RERR messages****************************************************/extern u_int32_t g_broadcast_ip;extern u_int32_t g_my_ip;void free_rerrhdr(struct rerrhdr *tmp_rerrhdr);int send_rerr(struct rerrhdr *tmp_rerrhdr, u_int32_t sent_to);/****************************************************   link_break----------------------------------------------------link_break is called when a broken link to a neighbouringis detected. All active routes that have the unreachable node as nexthop are invalidated. All precursors for this entry are removed. TheRERR meassage including the unreachable destinations and their incremented seq numbers is finally rebroadcast.****************************************************/int link_break( u_int32_t brk_dst_ip){    struct route_table_entry *tmp_entry;    struct rerrhdr *new_rerrhdr = NULL;    struct precursor_entry *tmp_precursor;    struct precursor_entry *dead_precursor;    u_int32_t last_precursor;    u_int8_t precursor_num=0;    int rerrhdr_created = 0;    // remove the borken link from all the route table entries    delete_precursor_entry_from_route_table(brk_dst_ip);    tmp_entry=get_first_route_table_entry();    //go through list    while(tmp_entry != NULL)    {        //if the route has the broken IP for the next hop and is active        if((tmp_entry->next_hop == brk_dst_ip) && (tmp_entry->route_valid))        {#ifdef MESSAGES            printk("RERR: Broken link as next hop for - %s \n",inet_ntoa(tmp_entry->dst_ip));#endif            //expire the route            route_expiry(tmp_entry);#ifdef TRACE            printk("RERR: Route marked as expired\n");#endif            //if the rerr header has not been created yet            if(!rerrhdr_created)            {                if((new_rerrhdr =create_rerrhdr(tmp_entry->dst_ip,tmp_entry->dst_seq)) == NULL)                    return 1;                rerrhdr_created = 1;            }            else            {                append_unr_dst(new_rerrhdr, tmp_entry->dst_ip, tmp_entry->dst_seq);            }#ifdef TRACE            printk("RERR: About to delete precursors from route table entry\n");#endif            //remove all the precursors from the route            tmp_precursor=tmp_entry->precursors;            while (tmp_precursor!=NULL)            {                precursor_num++;                last_precursor=tmp_precursor->ip;                dead_precursor=tmp_precursor;                tmp_precursor=tmp_precursor->next;                kfree(dead_precursor);            }            tmp_entry->precursors=NULL;        }        //move on to the next entry        tmp_entry = tmp_entry->next;    }    //if there was a RERR created, send it out    if(rerrhdr_created)    {        if (precursor_num==1)            send_rerr(new_rerrhdr,last_precursor);        else            send_rerr(new_rerrhdr,g_broadcast_ip);        free_rerrhdr(new_rerrhdr);    }    return 0;}/****************************************************   route_expiry---------------------------------------------------- route_expiry invalidates an active route, i e an entry in the routing table.****************************************************/void route_expiry(struct route_table_entry *tmp_entry){    //marks a route as expired    tmp_entry->lifetime = (getcurrtime() + DELETE_PERIOD);    tmp_entry->dst_seq++;    tmp_entry->route_valid=FALSE;    delete_kernel_route_entry(tmp_entry->dst_ip, tmp_entry->next_hop);}/****************************************************   host_unr----------------------------------------------------host_unr is called when a packet is received destined for a nodewhich the forwarding node does not have an active route to. A RERRmessage is created to inform neighbours.****************************************************/int  host_unr(u_int32_t brk_dst_ip){    struct rerrhdr *new_rerrhdr = NULL;    struct route_table_entry *tmp_entry;    tmp_entry = find_route_table_entry(brk_dst_ip);    if((new_rerrhdr = create_rerrhdr(brk_dst_ip, 1)) == NULL)        return 1;    send_rerr(new_rerrhdr,g_broadcast_ip);    free_rerrhdr(new_rerrhdr);    return 0;}/****************************************************   rec_rerr----------------------------------------------------rec_rerr is called when the node receives a RERR packet fromanother node. If the precursor list for a broken destinations isnot empty a new RERR is created for that destination.****************************************************/int recv_rerr(struct event_queue_entry *working_packet){    struct rerr *tmp_hdr;    struct rerrhdr *new_rerrhdr = NULL;    struct rerrdst *tmp_dst;    struct route_table_entry *tmp_route;    struct interface_list_entry *tmp_interface;    int new_rerr_created = 0;    int i;    tmp_interface=find_interface_by_dev(working_packet->dev);    if (tmp_interface==NULL)        return 0;    tmp_hdr =(struct rerr *) ((char *) working_packet->data);    tmp_dst = (struct rerrdst *) ((char *) tmp_hdr + sizeof (struct rerr));#ifdef MESSAGES    printk("RERR: recieved a route error, count= %u\n",tmp_hdr->dst_count);#endif    for(i = 0; i < tmp_hdr->dst_count; i++)    {        //go through all the unr dst in the rerr#ifdef MESSAGES        printk("       -> %s",inet_ntoa(tmp_dst->unr_dst_ip));#endif        tmp_route = find_route_table_entry(tmp_dst->unr_dst_ip);        //Is the sender of the rerr the next hop for a broken destination for the current node?        if(tmp_route != NULL)        {            if( tmp_route->dst_ip != tmp_interface->ip )            {                if (tmp_route->next_hop == working_packet->src_ip)                {#ifdef MESSAGES                    printk(" Removing route");#endif                    tmp_route->dst_seq = ntohl(tmp_dst->unr_dst_seq);                    tmp_route->route_valid=FALSE;                    tmp_route->lifetime = (getcurrtime() + DELETE_PERIOD);                    delete_kernel_route_entry(tmp_route->dst_ip, tmp_route->next_hop);                    if(tmp_route->precursors != NULL)                    {                        // precursors exist                        if(!new_rerr_created)                        {                            new_rerr_created = 1;                            new_rerrhdr = create_rerrhdr(tmp_dst->unr_dst_ip, tmp_dst->unr_dst_seq);                        }                        else                        {                            append_unr_dst(new_rerrhdr, tmp_dst->unr_dst_ip,  tmp_dst->unr_dst_seq);                        }                    }                }            }        }	#ifdef MESSAGES        printk(" \n");	#endif        tmp_dst =(struct rerrdst *) ((char *) tmp_dst + sizeof (struct rerrdst));    }    if(new_rerr_created)    {        send_rerr(new_rerrhdr,g_broadcast_ip);        free_rerrhdr(new_rerrhdr);    }    return 0;}/****************************************************   create_rerrhdr----------------------------------------------------create_rerrhdr is used to create a new RERR message****************************************************/struct rerrhdr* create_rerrhdr(u_int32_t tmp_ip, u_int32_t tmp_dst_seq){    struct rerr_unr_dst *tmp_rerr_unr_dst;    struct rerrhdr *tmp_rerrhdr;    //create header    if((tmp_rerrhdr = kmalloc(sizeof(struct rerrhdr),GFP_ATOMIC)) == NULL)    {#ifndef NO_ERROR        printk("RERR: Error creating tmp_rerrhdr \n");#endif        return NULL;    }    //create spot for first entry    if((tmp_rerr_unr_dst = kmalloc(sizeof(struct rerr_unr_dst),GFP_ATOMIC)) == NULL)    {#ifndef NO_ERROR        printk("RERR: Error creating temp_rerr_unr_dst\n");#endif        return NULL;    }    //fill in info for first entry    tmp_rerr_unr_dst->unr_dst_ip = tmp_ip;    tmp_rerr_unr_dst->unr_dst_seq = tmp_dst_seq;    tmp_rerr_unr_dst->next = NULL;    //fill in info for header    tmp_rerrhdr->unr_dst = tmp_rerr_unr_dst;    tmp_rerrhdr->type = 3;    tmp_rerrhdr->dst_count = 1;    return tmp_rerrhdr;}/****************************************************   append_unr_dst----------------------------------------------------append_unr_dst adds an unreachable node to the previouslycreated RERR message.****************************************************/int append_unr_dst(struct rerrhdr *tmp_rerrhdr, u_int32_t tmp_ip,u_int32_t tmp_dst_seq){    struct rerr_unr_dst *tmp_rerr_unr_dst;    //get memory for new entry    if((tmp_rerr_unr_dst = kmalloc(sizeof(struct rerr_unr_dst),GFP_ATOMIC)) == NULL)    {#ifndef NO_ERROR        printk("RERR: Error appending new unr_dst\n");#endif        return 1;    }    //fill in info for entry    tmp_rerr_unr_dst->next = tmp_rerrhdr->unr_dst;    tmp_rerrhdr->unr_dst = tmp_rerr_unr_dst;    tmp_rerrhdr->dst_count++;    tmp_rerr_unr_dst->unr_dst_ip = tmp_ip;    tmp_rerr_unr_dst->unr_dst_seq = tmp_dst_seq;    return 0;}/****************************************************   free_rerrhdr---------------------------------------------------- free_rerrhdr frees the allocated memory for the rerrhdr list structure.****************************************************/void free_rerrhdr(struct rerrhdr *tmp_rerrhdr){    struct rerr_unr_dst *tmp_unr_dst;    struct rerr_unr_dst *dead_dst;    //for all the unreachable destinataion in the rerr    tmp_unr_dst=tmp_rerrhdr->unr_dst;    while (tmp_unr_dst!=NULL)    {        dead_dst=tmp_unr_dst;        tmp_unr_dst = tmp_unr_dst->next;        kfree(tmp_unr_dst);    }    kfree(tmp_rerrhdr);}/****************************************************   send_rerr---------------------------------------------------- send_rerr copies the incoming RERR message to a connected data area, which is a suitable format for the function send_datagram.****************************************************/int send_rerr(struct rerrhdr *tmp_rerrhdr, u_int32_t sent_to){    struct rerr *out_hdr;    struct rerrdst *out_dst;    struct rerr_unr_dst *tmp_dst;    void *data;    int datalen, i;    datalen = sizeof(struct rerr) + sizeof(struct rerrdst) * (tmp_rerrhdr->dst_count);    //get the needed memory    if((data = kmalloc(datalen,GFP_ATOMIC)) == NULL)    {#ifndef NO_ERROR        printk("RERR: Error creating packet to send RERR\n");#endif        return -1;    }    out_hdr =(struct rerr *) ((char *) data);    out_hdr->type = 3;    out_hdr->dst_count = tmp_rerrhdr->dst_count;    out_hdr->reserved =0;    out_dst=(struct rerrdst *) ((char *) out_hdr + sizeof(struct rerr));    tmp_dst = tmp_rerrhdr->unr_dst;    for(i = 0; i < tmp_rerrhdr->dst_count; i++)    {        out_dst->unr_dst_ip=tmp_dst->unr_dst_ip;	#ifdef MESSAGES        printk("RERR: adding... %s to RERR\n",inet_ntoa(out_dst->unr_dst_ip));	#endif        //convert it to network byte order        out_dst->unr_dst_seq=htonl(tmp_dst->unr_dst_seq);        out_dst =(struct rerrdst *) ((char *) out_dst + sizeof(struct rerrdst));        tmp_dst = tmp_dst->next;    }#ifdef TRACE    printk("RERR: sending out a RERR with %d UNR hosts\n",i);#endif    if (sent_to==g_broadcast_ip)        local_broadcast(NET_DIAMETER, data, datalen);    else        send_message(sent_to,NET_DIAMETER, data, datalen);    kfree(data);    return 0;}/* * print_rerrhdr * * Description: *   print_rerrhdr prints a RERR message * * Arguments: *   struct rerrhdr *new_rerrhdr - Pointer to the rerrhdr * * Returns: void */void print_rerrhdr(struct rerrhdr *new_rerrhdr){    struct rerr_unr_dst *tmp_rerr_unr_dst;    struct in_addr tmp_in_addr;    int i;    printk("Outgoing RERR message: type: %d dst_cnt: %d\n",           new_rerrhdr->type, new_rerrhdr->dst_count);    for(i = 0, tmp_rerr_unr_dst = new_rerrhdr->unr_dst;            i < new_rerrhdr->dst_count;            i++, tmp_rerr_unr_dst = tmp_rerr_unr_dst->next)    {        tmp_in_addr.s_addr = tmp_rerr_unr_dst->unr_dst_ip;        printk("unr_dst_ip: %s unr_dst_seq %d\n",               inet_ntoa(tmp_in_addr.s_addr),               tmp_rerr_unr_dst->unr_dst_seq);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产wwwccc36天堂| 亚洲一区国产视频| 精品美女在线播放| 欧美一区二区日韩| 7878成人国产在线观看| 69堂亚洲精品首页| 欧美久久久一区| 欧美人狂配大交3d怪物一区| 欧美私人免费视频| 91精品国产欧美一区二区| 欧美一区二区三区成人| 日韩欧美的一区| 国产香蕉久久精品综合网| 国产婷婷色一区二区三区| 亚洲国产岛国毛片在线| 综合久久给合久久狠狠狠97色| 亚洲品质自拍视频| 婷婷综合久久一区二区三区| 蜜桃视频在线观看一区| 国内外成人在线视频| 99久久精品免费看国产| 欧美视频一区二区在线观看| 日韩欧美一区二区视频| 欧美激情一区二区在线| 亚洲色图欧洲色图婷婷| 亚洲无人区一区| 看电影不卡的网站| 成人黄色777网| 欧美日韩黄色一区二区| 精品嫩草影院久久| 亚洲人妖av一区二区| 日韩成人精品在线观看| 成人午夜视频网站| 欧美久久婷婷综合色| 久久久久国产精品麻豆| 亚洲激情图片小说视频| 精品在线观看免费| 91蝌蚪porny九色| 日韩女优电影在线观看| 亚洲欧美在线aaa| 日本欧美一区二区三区| 成人av第一页| 欧美一激情一区二区三区| ㊣最新国产の精品bt伙计久久| 午夜欧美在线一二页| 成人激情免费网站| 日韩视频一区二区三区| 亚洲精品成人a在线观看| 国产盗摄一区二区三区| 777久久久精品| 亚洲欧美一区二区三区国产精品| 精品一区二区三区日韩| 欧美中文字幕一二三区视频| 中文字幕精品三区| 精品亚洲国产成人av制服丝袜| 在线免费观看视频一区| 国产网站一区二区| 日韩和欧美一区二区三区| 91影院在线观看| 久久久久久免费毛片精品| 日韩精品成人一区二区三区| 色哟哟一区二区| 国产精品久久久久影视| 国产最新精品精品你懂的| 在线电影欧美成精品| 日韩码欧中文字| av一区二区三区在线| 国产偷国产偷亚洲高清人白洁| 免费成人在线网站| 欧美一区二区免费| 亚洲超丰满肉感bbw| 欧美无人高清视频在线观看| 亚洲中国最大av网站| 99国产欧美另类久久久精品| 国产精品区一区二区三区| 国产精品一区二区久久不卡 | 中文字幕日韩欧美一区二区三区| 国产一区二区三区久久久| 精品成人私密视频| 韩国视频一区二区| 久久亚洲影视婷婷| 丁香婷婷深情五月亚洲| 国产欧美一区二区三区鸳鸯浴| 国产美女精品一区二区三区| 久久婷婷综合激情| 成人一二三区视频| 中文字幕在线不卡国产视频| 91尤物视频在线观看| 亚洲黄色av一区| 欧美精品在线一区二区三区| 三级影片在线观看欧美日韩一区二区| 欧美人妇做爰xxxⅹ性高电影| 日韩精品每日更新| 国产拍欧美日韩视频二区 | 亚洲人午夜精品天堂一二香蕉| 91亚洲资源网| 亚洲成人777| 日韩精品中文字幕一区| 国产精品一二三区在线| 自拍av一区二区三区| 欧美伊人久久久久久久久影院| 天天亚洲美女在线视频| 日韩一区二区三免费高清| 麻豆国产欧美一区二区三区| 久久久久9999亚洲精品| 91啪在线观看| 日本一不卡视频| 国产精品的网站| 欧美精品少妇一区二区三区| 国产伦精品一区二区三区视频青涩 | 国产99久久久精品| 亚洲欧美电影一区二区| 日韩一区二区三区视频| 懂色av噜噜一区二区三区av| 亚洲成av人片一区二区| 国产亚洲1区2区3区| 欧美日韩中文字幕一区二区| 国产精品综合视频| 日本在线不卡一区| 亚洲男人的天堂在线观看| 欧美变态tickling挠脚心| 一本一道久久a久久精品综合蜜臀| 欧美a级一区二区| 亚洲同性同志一二三专区| 久久在线免费观看| 欧美日韩国产三级| 91一区二区在线| 成熟亚洲日本毛茸茸凸凹| 久久精品国产亚洲一区二区三区| 亚洲欧美电影院| 中文字幕高清一区| 精品国产免费久久| 欧美性一区二区| 99国产一区二区三精品乱码| 韩国理伦片一区二区三区在线播放| 亚洲一区二区三区小说| 国产精品天美传媒沈樵| 欧美精品一区男女天堂| 欧美一区二区三区在线电影| 欧美又粗又大又爽| 一本久道久久综合中文字幕| 国产成人午夜视频| 国产一区二区在线影院| 久久99国产精品尤物| 男人操女人的视频在线观看欧美| 亚洲成人福利片| 亚洲18色成人| 亚洲一区二区3| 亚洲综合丁香婷婷六月香| 怡红院av一区二区三区| 亚洲美女视频在线观看| 亚洲黄色性网站| 亚洲精品va在线观看| 亚洲综合在线观看视频| 一区二区三区精品在线| 亚洲乱码国产乱码精品精的特点| 国产精品毛片久久久久久久| 国产精品网站导航| 国产精品的网站| 亚洲综合在线视频| 午夜精品久久久久久久99樱桃| 亚洲综合一区二区| 五月天激情综合| 蜜桃精品视频在线| 国产高清视频一区| 97超碰欧美中文字幕| 色丁香久综合在线久综合在线观看| 色综合久久精品| 欧美人妇做爰xxxⅹ性高电影| 91精选在线观看| 欧美成人伊人久久综合网| 久久综合色婷婷| 中文字幕在线观看一区| 亚洲精选一二三| 日韩精品一区第一页| 激情五月婷婷综合| 不卡视频在线观看| 欧美性大战久久| 欧美va在线播放| 国产精品免费免费| 亚洲国产日韩a在线播放性色| 日韩电影在线观看一区| 国模冰冰炮一区二区| 处破女av一区二区| 欧美日本国产视频| 亚洲国产高清不卡| 亚洲成人手机在线| 国产成人精品网址| 欧美性猛交xxxxxxxx| 久久综合狠狠综合久久综合88| 最新热久久免费视频| 蜜臀av在线播放一区二区三区| 国产99久久精品| 欧美老肥妇做.爰bbww视频| 久久理论电影网| 午夜精品影院在线观看| 国产99精品在线观看| 欧美一区二区视频免费观看| 国产精品国产三级国产三级人妇 | 懂色av一区二区夜夜嗨|