亚洲欧美第一页_禁久久精品乱码_粉嫩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精品视频免费在线观看| 欧美不卡激情三级在线观看| 6080yy午夜一二三区久久| 国产三级精品视频| 日韩精品一二区| 色综合天天综合| 国产精品丝袜91| 国产裸体歌舞团一区二区| 欧美日韩精品系列| 亚洲丝袜另类动漫二区| 国产成人日日夜夜| 日韩欧美一级二级| 视频一区视频二区在线观看| 成人一道本在线| 久久久久久亚洲综合| 日韩和的一区二区| 欧美午夜视频网站| 亚洲欧美另类久久久精品 | 偷拍日韩校园综合在线| 99久久久国产精品免费蜜臀| 久久嫩草精品久久久久| 寂寞少妇一区二区三区| 日韩一区二区在线免费观看| 日本少妇一区二区| 欧美另类videos死尸| 亚洲一区二区欧美| 欧美日韩国产高清一区二区| 亚洲在线中文字幕| 在线看不卡av| 午夜精品国产更新| 欧美日韩不卡视频| 蜜桃视频第一区免费观看| 91麻豆精品国产自产在线观看一区 | 欧美夫妻性生活| 日韩电影在线看| 7777女厕盗摄久久久| 美女视频一区二区| 欧美videossexotv100| 日韩精品一区第一页| 欧美刺激午夜性久久久久久久| 日韩av二区在线播放| 3d动漫精品啪啪1区2区免费| 老汉av免费一区二区三区| 亚洲精品一区二区三区99| 国产白丝精品91爽爽久久| 国产精品色在线观看| 99久久亚洲一区二区三区青草| 亚洲天堂福利av| 欧美午夜精品免费| 麻豆精品一区二区三区| 久久美女高清视频| 97久久精品人人做人人爽 | 精品一区二区三区免费播放 | 韩国三级电影一区二区| 久久综合999| 99久久久国产精品免费蜜臀| 亚洲一区二区三区爽爽爽爽爽| 欧美日韩免费视频| 精品一区二区免费| 中文字幕佐山爱一区二区免费| 欧美一a一片一级一片| 六月婷婷色综合| 亚洲色图第一区| 日韩亚洲欧美成人一区| 丁香天五香天堂综合| 亚洲激情在线播放| 日韩精品一区二区三区在线播放| 国产成人鲁色资源国产91色综 | 日韩黄色片在线观看| 国产欧美日韩视频一区二区| 欧美日韩日日摸| 粉嫩在线一区二区三区视频| 亚洲电影在线免费观看| 日本一区二区三区国色天香 | 免费观看在线色综合| 中文字幕不卡三区| 91精品国产综合久久蜜臀| 国产一区不卡在线| 调教+趴+乳夹+国产+精品| 国产精品美女久久久久aⅴ| 欧美精品精品一区| 91在线视频官网| 精品一区二区三区免费毛片爱 | 日本久久一区二区三区| 久久99国内精品| 香蕉成人啪国产精品视频综合网 | 国产经典欧美精品| 性做久久久久久久免费看| 国产精品伦一区二区三级视频| 91精品国产综合久久婷婷香蕉| 色偷偷久久一区二区三区| 国产麻豆欧美日韩一区| 蜜桃传媒麻豆第一区在线观看| 亚洲综合区在线| 亚洲视频一区二区在线观看| 国产女同互慰高潮91漫画| 精品国产99国产精品| 91麻豆精品久久久久蜜臀| 欧美视频一区二区三区在线观看| 成人免费看的视频| 国产精品夜夜嗨| 免费成人在线观看| 青青草国产精品亚洲专区无| 亚洲国产精品一区二区久久 | 欧洲视频一区二区| av在线不卡网| 成人午夜精品一区二区三区| 国产精品中文字幕一区二区三区| 日韩电影在线一区二区| 五月婷婷久久综合| 日韩在线播放一区二区| 亚洲超丰满肉感bbw| 日韩和欧美的一区| 性久久久久久久久| 日日夜夜精品免费视频| 婷婷中文字幕综合| 日韩影院精彩在线| 老司机精品视频一区二区三区| 久久电影网站中文字幕| 精品一区二区成人精品| 国产综合色视频| 成人亚洲一区二区一| 成人av在线一区二区三区| 99久久精品情趣| 在线观看亚洲专区| 欧美一级日韩免费不卡| 日韩限制级电影在线观看| 精品国产乱码久久久久久免费| 久久新电视剧免费观看| 国产欧美一区二区三区在线老狼| 国产精品麻豆网站| 一区二区三区中文字幕精品精品 | 久久国产综合精品| 国产a级毛片一区| 色哟哟国产精品免费观看| 欧美天堂亚洲电影院在线播放| 3d成人h动漫网站入口| 久久免费的精品国产v∧| 亚洲欧洲成人精品av97| 亚洲va欧美va国产va天堂影院| 日韩国产欧美三级| 国产精品综合二区| 欧美性生交片4| 精品成人佐山爱一区二区| 国产精品国产精品国产专区不片| 亚洲一区二区偷拍精品| 国产又黄又大久久| 91免费视频网| 日韩视频免费观看高清在线视频| 中文字幕精品三区| 亚洲电影一区二区| 国产精品中文字幕欧美| 欧美视频一区在线观看| 国产午夜精品久久久久久久| 亚洲精品水蜜桃| 久久99久久久久| 色成人在线视频| 久久久精品黄色| 亚洲bt欧美bt精品| 成人av一区二区三区| 欧美一区二区三区性视频| 最新国产の精品合集bt伙计| 秋霞电影一区二区| 色综合久久久久综合体| 777久久久精品| 亚洲图片激情小说| 国产成人综合在线| 91精品国产欧美一区二区成人| 亚洲婷婷综合久久一本伊一区| 国内外精品视频| 777精品伊人久久久久大香线蕉| 中文字幕在线观看一区二区| 久久99久久99精品免视看婷婷| 在线观看免费亚洲| 国产精品毛片无遮挡高清| 精品一区二区久久| 日韩一区二区视频| 午夜精品影院在线观看| 色悠悠亚洲一区二区| 国产精品久久综合| 国产91清纯白嫩初高中在线观看 | 日韩一区二区电影网| 亚洲综合区在线| 91麻豆产精品久久久久久| 欧美激情一区二区三区全黄| 狠狠色丁香久久婷婷综合_中| 欧美区视频在线观看| 亚洲女子a中天字幕| 91视视频在线观看入口直接观看www| www激情久久| 国产中文字幕精品| 欧美精品一区视频| 精品一区二区三区免费观看| 日韩免费看的电影| 久久国产精品72免费观看| 精品国产亚洲一区二区三区在线观看| 日韩电影在线免费看| 日韩欧美一级二级三级| 极品瑜伽女神91| 久久久99精品久久|