freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計算機網(wǎng)絡(luò)課程設(shè)計(1)(已改無錯字)

2023-07-17 15:16:18 本頁面
  

【正文】 uct ip *ip。 struct icmp *icmp。 struct timeval *tvsend。 ip = (struct ip *) ptr。 /* start of IP header */ hlen1 = ipip_hl 2。 /* length of IP header */ icmp = (struct icmp *) (ptr + hlen1)。 /* start of ICMP header */ if ( (icmplen = len hlen1) 8) err_quit(icmplen (%d) 8, icmplen)。 if (icmpicmp_type == ICMP_ECHOREPLY) { if (icmpicmp_id != pid) return。 /* not a response to our ECHO_REQUEST */ if (icmplen 16) err_quit(icmplen (%d) 16, icmplen)。 tvsend = (struct timeval *) icmpicmp_data。 tv_sub(tvrecv, tvsend)。 rtt = tvrecvtv_sec * + tvrecvtv_usec / 。 if(!quite_mode) printf(%d bytes from %s: seq=%u, ttl=%d, rtt=%.3f ms\n, icmplen, Sock_ntop_host(prsarecv, prsalen), icmpicmp_seq, ipip_ttl, rtt)。 ++recv_pk_num。 if(rttmax_rtt) max_rtt=rtt。 if(rttmin_rtt) min_rtt=rtt。 total_rtt+=rtt。 } else if (verbose) { if(!quite_mode) printf( %d bytes from %s: type = %d, code = %d\n, icmplen, Sock_ntop_host(prsarecv, prsalen), icmpicmp_type, icmpicmp_code)。 } } 版本 void proc_v6(char *ptr, ssize_t len, struct timeval* tvrecv) { ifdef IPV6 int hlen1, icmp6len。 double rtt。 struct ip6_hdr *ip6。 struct icmp6_hdr *icmp6。 struct timeval *tvsend。 icmp6=(struct icmp6_hdr *)ptr。 if((icmp6len=len)8) //len40 err_quit(icmp6len (%d) 8, icmp6len)。 if (icmp6icmp6_type == ICMP6_ECHO_REPLY) { if (icmp6icmp6_id != pid) return。 /* not a response to our ECHO_REQUEST */ if (icmp6len 16) err_quit(icmp6len (%d) 16, icmp6len)。 tvsend = (struct timeval *) (icmp6 + 1)。 tv_sub(tvrecv, tvsend)。 rtt = tvrecvtv_sec * + tvrecvtv_usec / 。 if(!quite_mode) printf(%d bytes from %s: seq=%u, rtt=%.3f ms\n, icmp6len, Sock_ntop_host(prsarecv, prsalen), icmp6icmp6_seq, rtt)。 ++recv_pk_num。 if(rttmax_rtt) max_rtt=rtt。 if(rttmin_rtt) min_rtt=rtt。 total_rtt+=rtt。 } else if (verbose) { if(!quite_mode) printf( %d bytes from %s: type = %d, code = %d\n, icmp6len, Sock_ntop_host(prsarecv, prsalen), icmp6icmp6_type, icmp6icmp6_code)。 } endif /* IPV6 */ } 發(fā)送分組函數(shù) send 核心代碼 版本 void send_v4(void) { int len。 int head_len。 struct icmp *icmp。 struct ip *ip。 if(en_false_source_addr) { head_len=sizeof(struct ip)+ sizeof(struct icmp)。 ip=(struct ip *)sendbuf。 ipip_v=IPVERSION。 ipip_hl=sizeof(struct ip) 2。 ipip_tos=server_type。 ipip_len=head_len+datalen。 ipip_id=0。 ipip_off=0。 ipip_ttl=ttl。 ipip_p=IPPROTO_ICMP。 ipip_sum=0。 ip=i_addr(prsasendsa_data)。 ip=。 icmp= (struct icmp *)(sendbuf+sizeof(struct ip))。 } else icmp = (struct icmp *) sendbuf。 icmpicmp_type = ICMP_ECHO。 icmpicmp_code = 0。 icmpicmp_id = pid。 icmpicmp_seq = nsent++。 gettimeofday((struct timeval *) icmpicmp_data, NULL)。 len = 8 + datalen。 /* checksum ICMP header and data */ icmpicmp_cksum = 0。 icmpicmp_cksum = in_cksum((u_short *) icmp, len)。 if(en_false_source_addr) len+=sizeof(struct ip)。 sendto(sockfd, sendbuf, len, 0, prsasend, prsalen)。 } 版本 void send_v6() { ifdef IPV6 int len。 struct icmp6_hdr *icmp6。 icmp6 = (struct icmp6_hdr *) sendbuf。 icmp6icmp6_type = ICMP6_ECHO_REQUEST。 icmp6icmp6_code = 0。 icmp6icmp6_id = pid。 icmp6icmp6_seq = nsent++。 gettimeofday((struct timeval *) (icmp6 + 1), NULL)。 len = 8 + datalen。 /* 8byte ICMPv6 header */ sendto(sockfd, sendbuf, len, 0, prsasend, prsalen)。 /* kernel calculates and stores checksum for us */ endif /* IPV6 */ } 計算校驗和函數(shù)核心代碼 unsigned short in_cksum(unsigned short *addr, int len) { int nleft = len。 int sum = 0。 unsigned short *w = addr。 unsigned short answer = 0。 while (nleft 1) { sum += *w++。 nleft = 2。 } /* 4mop up an odd byte, if necessary */ if (nleft == 1) { *(unsigned char *)(amp。answer) = *(unsigned char *)w 。 sum += answer。 } /* 4add back carry outs from top 16 bits to low 16 bits */ sum = (sum 16) + (sum amp。 0xffff)。 /* add hi 16 to low 16 */ sum += (sum 16)。 /* add carry */ answer = ~sum。 /* truncate to 16 bits */ return(answer)。 } 六、程序擴展功能的需求分析與實現(xiàn) 實驗一數(shù)據(jù)包的捕獲與分析的擴展功能 抓包實驗的擴展功能,我們主要放在了利用 Wireshark 強大的統(tǒng)計功能對龐大的數(shù)據(jù)包信息的統(tǒng)計功能上了,其實,這是很重要的一個功能,在一個龐大吞吐量的網(wǎng)絡(luò)環(huán)境,這尤其顯得重要,我們可以知道現(xiàn)在最頻繁的包是什么,可以 知道一種包的具體信息。 總體數(shù)據(jù)包統(tǒng)計: 特定過濾條件數(shù)據(jù)包統(tǒng)計信息: 協(xié)議分析狀態(tài): 會話列表選擇所有 ipv4 會話: 實驗二 Ping 程序的 擴展功能 這部分的內(nèi)容不算很多,但是都比較有用,所以就作為擴展功能增加到了我們的ping 程序中了,下面就詳細的單個的介紹一下: 發(fā)送指定數(shù)量得包后停止 要是沒有這選項,我們的程序會一直不停的給目標主機發(fā)回射請求,直到用于強制退出程序,但很多時候我們都是只想直到我們的電腦和目標主機之間的網(wǎng)絡(luò)線路是不是通暢的,所以只需 發(fā)送一定數(shù)量的包就可以啦,不需要一直發(fā)。 因此,我們設(shè)計了 c 選項,在它后面加一個數(shù)字的參數(shù),就是指定要發(fā)送的包的數(shù)量。 具體的實現(xiàn)如下: 在命令行參數(shù)處理部分加入如下代碼: case 39。c39。: ping_count=atoi(optarg)。 break。 ping_count 記錄著指定的要發(fā)送的包的數(shù)量。 修改 SIGALARM 信號處理函數(shù)如下: void sig_alrm(int signo) { if(send_pk_num==ping_count) readloopstop(SIGINT)。 (*prfsend)()。 ++send_pk_num。 alarm(delay)。 return。 /* probably interrupts recvfrom() */ } 這
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1