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

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

?? print-tcp.c

?? TCPDUMP的C語言源代碼,是在數據鏈路層的應用
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*	$NetBSD: print-tcp.c,v 1.9 2007/07/26 18:15:12 plunky Exp $	*//* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 *	The Regents of the University of California.  All rights reserved. * * Copyright (c) 1999-2004 The tcpdump.org project * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code distributions * retain the above copyright notice and this paragraph in its entirety, (2) * distributions including binary code include the above copyright notice and * this paragraph in its entirety in the documentation or other materials * provided with the distribution, and (3) all advertising materials mentioning * features or use of this software display the following acknowledgement: * ``This product includes software developed by the University of California, * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of * the University nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior * written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */#ifndef lintstatic const char rcsid[] _U_ ="@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.130.2.3 2007-12-22 03:08:45 guy Exp $ (LBL)";  #else__RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");#endif#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <tcpdump-stdinc.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "interface.h"#include "addrtoname.h"#include "extract.h"#include "tcp.h"#include "ip.h"#ifdef INET6#include "ip6.h"#endif#include "ipproto.h"#include "rpc_auth.h"#include "rpc_msg.h"#include "nameser.h"#ifdef HAVE_LIBCRYPTO#include <openssl/md5.h>#define SIGNATURE_VALID		0#define SIGNATURE_INVALID	1#define CANT_CHECK_SIGNATURE	2static int tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,                                const u_char *data, int length, const u_char *rcvsig);#endifstatic void print_tcp_rst_data(register const u_char *sp, u_int length);#define MAX_RST_DATA_LEN	30struct tha {#ifndef INET6        struct in_addr src;        struct in_addr dst;#else        struct in6_addr src;        struct in6_addr dst;#endif /*INET6*/        u_int port;};struct tcp_seq_hash {        struct tcp_seq_hash *nxt;        struct tha addr;        tcp_seq seq;        tcp_seq ack;};#define TSEQ_HASHSIZE 919/* These tcp optinos do not have the size octet */#define ZEROLENOPT(o) ((o) == TCPOPT_EOL || (o) == TCPOPT_NOP)static struct tcp_seq_hash tcp_seq_hash[TSEQ_HASHSIZE];struct tok tcp_flag_values[] = {        { TH_FIN, "F" },        { TH_SYN, "S" },        { TH_RST, "R" },        { TH_PUSH, "P" },        { TH_ACK, "." },        { TH_URG, "U" },        { TH_ECNECHO, "E" },        { TH_CWR, "W" },        { 0, NULL }};struct tok tcp_option_values[] = {        { TCPOPT_EOL, "eol" },        { TCPOPT_NOP, "nop" },        { TCPOPT_MAXSEG, "mss" },        { TCPOPT_WSCALE, "wscale" },        { TCPOPT_SACKOK, "sackOK" },        { TCPOPT_SACK, "sack" },        { TCPOPT_ECHO, "echo" },        { TCPOPT_ECHOREPLY, "echoreply" },        { TCPOPT_TIMESTAMP, "TS" },        { TCPOPT_CC, "cc" },        { TCPOPT_CCNEW, "ccnew" },        { TCPOPT_CCECHO, "" },        { TCPOPT_SIGNATURE, "md5" },        { TCPOPT_AUTH, "enhanced auth" },        { 0, NULL }};static int tcp_cksum(register const struct ip *ip,		     register const struct tcphdr *tp,		     register u_int len){        union phu {                struct phdr {                        u_int32_t src;                        u_int32_t dst;                        u_char mbz;                        u_char proto;                        u_int16_t len;                } ph;                u_int16_t pa[6];        } phu;        const u_int16_t *sp;        /* pseudo-header.. */        phu.ph.len = htons((u_int16_t)len);        phu.ph.mbz = 0;        phu.ph.proto = IPPROTO_TCP;        memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));        if (IP_HL(ip) == 5)                memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));        else                phu.ph.dst = ip_finddst(ip);        sp = &phu.pa[0];        return in_cksum((u_short *)tp, len,                        sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5]);}#ifdef INET6static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,                      u_int len){        size_t i;        u_int32_t sum = 0;        union {                struct {                        struct in6_addr ph_src;                        struct in6_addr ph_dst;                        u_int32_t	ph_len;                        u_int8_t	ph_zero[3];                        u_int8_t	ph_nxt;                } ph;                u_int16_t pa[20];        } phu;        /* pseudo-header */        memset(&phu, 0, sizeof(phu));        phu.ph.ph_src = ip6->ip6_src;        phu.ph.ph_dst = ip6->ip6_dst;        phu.ph.ph_len = htonl(len);        phu.ph.ph_nxt = IPPROTO_TCP;        for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)                sum += phu.pa[i];        return in_cksum((u_short *)tp, len, sum);}#endifvoidtcp_print(register const u_char *bp, register u_int length,	  register const u_char *bp2, int fragmented){        register const struct tcphdr *tp;        register const struct ip *ip;        register u_char flags;        register u_int hlen;        register char ch;        u_int16_t sport, dport, win, urp;        u_int32_t seq, ack, thseq, thack;        int threv;#ifdef INET6        register const struct ip6_hdr *ip6;#endif        tp = (struct tcphdr *)bp;        ip = (struct ip *)bp2;#ifdef INET6        if (IP_V(ip) == 6)                ip6 = (struct ip6_hdr *)bp2;        else                ip6 = NULL;#endif /*INET6*/        ch = '\0';        if (!TTEST(tp->th_dport)) {                (void)printf("%s > %s: [|tcp]",                             ipaddr_string(&ip->ip_src),                             ipaddr_string(&ip->ip_dst));                return;        }        sport = EXTRACT_16BITS(&tp->th_sport);        dport = EXTRACT_16BITS(&tp->th_dport);        hlen = TH_OFF(tp) * 4;        /*	 * If data present, header length valid, and NFS port used,	 * assume NFS.	 * Pass offset of data plus 4 bytes for RPC TCP msg length	 * to NFS print routines.	 */	if (!qflag && hlen >= sizeof(*tp) && hlen <= length &&	    (length - hlen) >= 4) {		u_char *fraglenp;		u_int32_t fraglen;		register struct sunrpc_msg *rp;		enum sunrpc_msg_type direction;		fraglenp = (u_char *)tp + hlen;		if (TTEST2(*fraglenp, 4)) {			fraglen = EXTRACT_32BITS(fraglenp) & 0x7FFFFFFF;			if (fraglen > (length - hlen) - 4)				fraglen = (length - hlen) - 4;			rp = (struct sunrpc_msg *)(fraglenp + 4);			if (TTEST(rp->rm_direction)) {				direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);				if (dport == NFS_PORT &&				    direction == SUNRPC_CALL) {					nfsreq_print((u_char *)rp, fraglen,					    (u_char *)ip);					return;				}				if (sport == NFS_PORT &&				    direction == SUNRPC_REPLY) {					nfsreply_print((u_char *)rp, fraglen,					    (u_char *)ip);					return;				}			}                }        }#ifdef INET6        if (ip6) {                if (ip6->ip6_nxt == IPPROTO_TCP) {                        (void)printf("%s.%s > %s.%s: ",                                     ip6addr_string(&ip6->ip6_src),                                     tcpport_string(sport),                                     ip6addr_string(&ip6->ip6_dst),                                     tcpport_string(dport));                } else {                        (void)printf("%s > %s: ",                                     tcpport_string(sport), tcpport_string(dport));                }        } else#endif /*INET6*/        {                if (ip->ip_p == IPPROTO_TCP) {                        (void)printf("%s.%s > %s.%s: ",                                     ipaddr_string(&ip->ip_src),                                     tcpport_string(sport),                                     ipaddr_string(&ip->ip_dst),                                     tcpport_string(dport));                } else {                        (void)printf("%s > %s: ",                                     tcpport_string(sport), tcpport_string(dport));                }        }        if (hlen < sizeof(*tp)) {                (void)printf(" tcp %d [bad hdr length %u - too short, < %lu]",                             length - hlen, hlen, (unsigned long)sizeof(*tp));                return;        }        TCHECK(*tp);        seq = EXTRACT_32BITS(&tp->th_seq);        ack = EXTRACT_32BITS(&tp->th_ack);        win = EXTRACT_16BITS(&tp->th_win);        urp = EXTRACT_16BITS(&tp->th_urp);        if (qflag) {                (void)printf("tcp %d", length - hlen);                if (hlen > length) {                        (void)printf(" [bad hdr length %u - too long, > %u]",                                     hlen, length);                }                return;        }        flags = tp->th_flags;        printf("Flags [%s]", bittok2str_nosep(tcp_flag_values, "none", flags));        if (!Sflag && (flags & TH_ACK)) {                register struct tcp_seq_hash *th;                const void *src, *dst;                register int rev;                struct tha tha;                /*                 * Find (or record) the initial sequence numbers for                 * this conversation.  (we pick an arbitrary                 * collating order so there's only one entry for                 * both directions).                 */#ifdef INET6                memset(&tha, 0, sizeof(tha));                rev = 0;                if (ip6) {                        src = &ip6->ip6_src;                        dst = &ip6->ip6_dst;                        if (sport > dport)                                rev = 1;                        else if (sport == dport) {                                if (memcmp(src, dst, sizeof ip6->ip6_dst) > 0)                                        rev = 1;                        }                        if (rev) {                                memcpy(&tha.src, dst, sizeof ip6->ip6_dst);                                memcpy(&tha.dst, src, sizeof ip6->ip6_src);                                tha.port = dport << 16 | sport;                        } else {                                memcpy(&tha.dst, dst, sizeof ip6->ip6_dst);                                memcpy(&tha.src, src, sizeof ip6->ip6_src);                                tha.port = sport << 16 | dport;                        }                } else {                        src = &ip->ip_src;                        dst = &ip->ip_dst;                        if (sport > dport)                                rev = 1;                        else if (sport == dport) {                                if (memcmp(src, dst, sizeof ip->ip_dst) > 0)                                        rev = 1;                        }                        if (rev) {                                memcpy(&tha.src, dst, sizeof ip->ip_dst);                                memcpy(&tha.dst, src, sizeof ip->ip_src);                                tha.port = dport << 16 | sport;                        } else {                                memcpy(&tha.dst, dst, sizeof ip->ip_dst);                                memcpy(&tha.src, src, sizeof ip->ip_src);                                tha.port = sport << 16 | dport;                        }                }#else                rev = 0;                src = &ip->ip_src;                dst = &ip->ip_dst;                if (sport > dport)                        rev = 1;                else if (sport == dport) {                        if (memcmp(src, dst, sizeof ip->ip_dst) > 0)                                rev = 1;                }                if (rev) {                        memcpy(&tha.src, dst, sizeof ip->ip_dst);                        memcpy(&tha.dst, src, sizeof ip->ip_src);                        tha.port = dport << 16 | sport;                } else {                        memcpy(&tha.dst, dst, sizeof ip->ip_dst);                        memcpy(&tha.src, src, sizeof ip->ip_src);                        tha.port = sport << 16 | dport;                }#endif                threv = rev;                for (th = &tcp_seq_hash[tha.port % TSEQ_HASHSIZE];                     th->nxt; th = th->nxt)                        if (memcmp((char *)&tha, (char *)&th->addr,                                   sizeof(th->addr)) == 0)                                break;                if (!th->nxt || (flags & TH_SYN)) {                        /* didn't find it or new conversation */                        if (th->nxt == NULL) {                                th->nxt = (struct tcp_seq_hash *)                                        calloc(1, sizeof(*th));                                if (th->nxt == NULL)                                        error("tcp_print: calloc");                        }                        th->addr = tha;                        if (rev)                                th->ack = seq, th->seq = ack - 1;                        else                                th->seq = seq, th->ack = ack - 1;                } else {                        if (rev)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产高清精品久久久久| 亚洲精品欧美激情| 国产一区中文字幕| 久久久久久免费毛片精品| 久久99国产精品免费| 久久久91精品国产一区二区三区| 国产精品一卡二| 国产精品久久三区| 色婷婷国产精品久久包臀| 一区二区久久久| 日韩欧美久久久| 成人免费精品视频| 有码一区二区三区| 欧美大片拔萝卜| 成人一区二区三区在线观看| 亚洲日本成人在线观看| 欧美日韩一区小说| 2020国产成人综合网| 本田岬高潮一区二区三区| 亚洲欧洲另类国产综合| 欧美影院午夜播放| 久久成人麻豆午夜电影| 亚洲国产成人在线| 欧美人妖巨大在线| 国产露脸91国语对白| 亚洲精品日韩一| 欧美电影精品一区二区| 99精品视频在线播放观看| 日本色综合中文字幕| 中文字幕中文字幕一区| 69p69国产精品| 91网址在线看| 伦理电影国产精品| 亚洲男人的天堂在线aⅴ视频| 欧美欧美欧美欧美| 色综合咪咪久久| 精品亚洲成a人在线观看| 中文成人综合网| 在线不卡免费av| aa级大片欧美| 国产米奇在线777精品观看| 亚洲一二三四在线| 国产精品久久久久久久蜜臀 | 欧美酷刑日本凌虐凌虐| 国产精品一二三区在线| 五月天亚洲精品| 中文字幕一区二区三区在线观看 | 91成人免费电影| 国产精品资源在线观看| 五月天激情综合网| 亚洲激情av在线| 国产精品无码永久免费888| 日韩三级.com| 欧美日韩的一区二区| 色一情一伦一子一伦一区| 国产成人免费视频网站| 免费的成人av| 亚洲aaa精品| 一区二区三区欧美日| 亚洲欧洲日韩av| 中文字幕一区在线| 日本一区二区三区四区| 久久精品一区二区三区不卡牛牛| 精品视频资源站| 91福利精品视频| 色婷婷综合五月| 色综合av在线| 91成人国产精品| 色综合久久久久综合| 97se亚洲国产综合自在线不卡| 国产激情一区二区三区四区| 国产乱子轮精品视频| 蜜乳av一区二区| 免费观看在线综合| 蜜臀精品久久久久久蜜臀| 奇米影视一区二区三区小说| 丝袜亚洲精品中文字幕一区| 一区二区三区免费观看| 亚洲一区二区综合| 五月激情丁香一区二区三区| 午夜精品一区在线观看| 日韩中文字幕91| 紧缚捆绑精品一区二区| 国产精品1024| 91小视频在线免费看| 日本久久一区二区三区| 欧美视频在线一区二区三区 | 精品国产麻豆免费人成网站| 日韩欧美亚洲国产另类| 久久亚区不卡日本| 国产精品欧美久久久久一区二区| 中文字幕色av一区二区三区| 最新欧美精品一区二区三区| 亚洲精品你懂的| 天天综合色天天综合色h| 蜜臀av亚洲一区中文字幕| 国产一区二区网址| 99久久伊人网影院| 欧美日韩成人高清| 久久亚洲综合色一区二区三区| 国产精品美女www爽爽爽| 又紧又大又爽精品一区二区| 免费成人深夜小野草| 国产高清亚洲一区| 欧美性高清videossexo| 26uuu国产电影一区二区| 国产精品妹子av| www.在线欧美| 欧美日韩国产三级| 久久久久久毛片| 一区二区免费看| 国产精品久久久久久妇女6080| 亚洲欧美一区二区三区极速播放| 欧洲一区在线观看| 亚洲欧洲一区二区在线播放| xnxx国产精品| 亚洲三级在线播放| 蜜臀av一级做a爰片久久| 欧美一区二区高清| 日韩一区二区三区四区五区六区| 欧美日韩美少妇| 91精品一区二区三区在线观看| 欧美日韩激情在线| 91精品国产免费| 欧美草草影院在线视频| 国产人成一区二区三区影院| 欧美国产成人精品| 一区二区三区在线观看欧美| 午夜精品久久久久| 美日韩一级片在线观看| 久久精品国产在热久久| 国产精品一品视频| 91高清视频免费看| 欧美一区二区网站| 久久久久久久网| 亚洲日穴在线视频| 日本美女一区二区| 国产在线不卡一区| 一区二区日韩av| 亚洲成人久久影院| 奇米色一区二区三区四区| 国产在线视频精品一区| 不卡一二三区首页| 欧美丝袜自拍制服另类| 精品欧美一区二区久久| 国产精品超碰97尤物18| 亚洲成人免费在线观看| 国产精品原创巨作av| 91日韩一区二区三区| 欧美一级国产精品| 亚洲图片激情小说| 久久99蜜桃精品| 色88888久久久久久影院野外| 日韩欧美成人一区二区| 亚洲丝袜自拍清纯另类| 蜜臀av一区二区| 日本韩国一区二区三区视频| 欧美成人bangbros| 一区二区三区不卡在线观看| 国产一区二区三区美女| 欧美三级三级三级| 欧美激情一区二区在线| 日日摸夜夜添夜夜添国产精品| 成人在线综合网| 欧美一区二区高清| 一二三区精品视频| av电影在线不卡| 久久蜜桃一区二区| 免费观看久久久4p| 日本高清成人免费播放| 国产亚洲精品aa| 日本成人在线电影网| 91麻豆swag| 日本一区二区久久| 国精产品一区一区三区mba桃花| 欧美影片第一页| 亚洲欧美激情插 | 一区二区三区免费| 9人人澡人人爽人人精品| 国产亚洲一区二区三区在线观看| 视频一区中文字幕| 欧美在线一二三| 亚洲日本一区二区| 99国产精品久久| 国产色产综合产在线视频| 精品一区二区综合| 日韩亚洲欧美一区二区三区| 亚洲成人第一页| 在线看国产日韩| 亚洲午夜免费福利视频| 91热门视频在线观看| 亚洲男人天堂av| 色先锋久久av资源部| 亚洲欧美日韩在线| 一本久久综合亚洲鲁鲁五月天| 综合激情成人伊人| 在线观看一区二区视频| 亚洲伊人色欲综合网| 欧美三级中文字幕在线观看| 亚洲va中文字幕|