您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EXTRACT_24BITS函数代码示例

51自学网 2021-06-01 20:36:35
  C++
这篇教程C++ EXTRACT_24BITS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中EXTRACT_24BITS函数的典型用法代码示例。如果您正苦于以下问题:C++ EXTRACT_24BITS函数的具体用法?C++ EXTRACT_24BITS怎么用?C++ EXTRACT_24BITS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了EXTRACT_24BITS函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: otv_print

voidotv_print(netdissect_options *ndo, const u_char *bp, u_int len){    uint8_t flags;    ND_PRINT((ndo, "OTV, "));    if (len < 8)        goto trunc;    ND_TCHECK(*bp);    flags = *bp;    ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags));    bp += 1;    ND_TCHECK2(*bp, 3);    ND_PRINT((ndo, "overlay %u, ", EXTRACT_24BITS(bp)));    bp += 3;    ND_TCHECK2(*bp, 3);    ND_PRINT((ndo, "instance %u/n", EXTRACT_24BITS(bp)));    bp += 3;    /* Reserved */    ND_TCHECK(*bp);    bp += 1;    ether_print(ndo, bp, len - 8, ndo->ndo_snapend - bp, NULL, NULL);    return;trunc:    ND_PRINT((ndo, " [|OTV]"));}
开发者ID:RTEMS,项目名称:rtems-libbsd,代码行数:32,


示例2: igrp_entry_print

static voidigrp_entry_print(register struct igrprte *igr, register int is_interior,    register int is_exterior){	register u_int delay, bandwidth;	u_int metric, mtu;	if (is_interior)		printf(" *.%d.%d.%d", igr->igr_net[0],		    igr->igr_net[1], igr->igr_net[2]);	else if (is_exterior)		printf(" X%d.%d.%d.0", igr->igr_net[0],		    igr->igr_net[1], igr->igr_net[2]);	else		printf(" %d.%d.%d.0", igr->igr_net[0],		    igr->igr_net[1], igr->igr_net[2]);	delay = EXTRACT_24BITS(igr->igr_dly);	bandwidth = EXTRACT_24BITS(igr->igr_bw);	metric = bandwidth + delay;	if (metric > 0xffffff)		metric = 0xffffff;	mtu = EXTRACT_16BITS(igr->igr_mtu);	printf(" d=%d b=%d r=%d l=%d M=%d mtu=%d in %d hops",	    10 * delay, bandwidth == 0 ? 0 : 10000000 / bandwidth,	    igr->igr_rel, igr->igr_ld, metric,	    mtu, igr->igr_hct);}
开发者ID:hsluoyz,项目名称:WinDump,代码行数:29,


示例3: juniper_services_print

u_intjuniper_services_print(const struct pcap_pkthdr *h, register const u_char *p){        struct juniper_l2info_t l2info;        struct juniper_services_header {            u_int8_t svc_id;            u_int8_t flags_len;            u_int8_t svc_set_id[2];            u_int8_t dir_iif[4];        };        const struct juniper_services_header *sh;        l2info.pictype = DLT_JUNIPER_SERVICES;        if(juniper_parse_header(p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        sh = (struct juniper_services_header *)p;        if (eflag)            printf("service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",                   sh->svc_id,                   sh->flags_len,                   EXTRACT_16BITS(&sh->svc_set_id),                   EXTRACT_24BITS(&sh->dir_iif[1]));                ip_heuristic_guess(p, l2info.length);        return l2info.header_len;}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:31,


示例4: juniper_services_print

u_intjuniper_services_print(netdissect_options *ndo,                       const struct pcap_pkthdr *h, register const u_char *p){        struct juniper_l2info_t l2info;        struct juniper_services_header {            uint8_t svc_id;            uint8_t flags_len;            uint8_t svc_set_id[2];            uint8_t dir_iif[4];        };        const struct juniper_services_header *sh;        l2info.pictype = DLT_JUNIPER_SERVICES;        if (juniper_parse_header(ndo, p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        sh = (struct juniper_services_header *)p;        if (ndo->ndo_eflag)            ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",                   sh->svc_id,                   sh->flags_len,                   EXTRACT_16BITS(&sh->svc_set_id),                   EXTRACT_24BITS(&sh->dir_iif[1])));        /* no proto field - lets guess by first byte of IP header*/        ip_heuristic_guess (ndo, p, l2info.length);        return l2info.header_len;}
开发者ID:bdrewery,项目名称:tcpdump,代码行数:32,


示例5: dccp_print_ack_no

static void dccp_print_ack_no(const u_char *bp){	const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;	const struct dccp_hdr_ack_bits *dh_ack =		(struct dccp_hdr_ack_bits *)(bp + dccp_basic_hdr_len(dh));	u_int32_t ack_high;	u_int64_t ackno;	TCHECK2(*dh_ack,4);	ack_high = DCCPH_ACK(dh_ack);	ackno = EXTRACT_24BITS(&ack_high) & 0xFFFFFF;	if (DCCPH_X(dh) != 0) {		u_int32_t ack_low;		TCHECK2(*dh_ack,8);		ack_low = dh_ack->dccph_ack_nr_low;		ackno &= 0x00FFFF;  /* clear reserved field */		ackno = (ackno << 32) + EXTRACT_32BITS(&ack_low);	}	(void)printf("(ack=%" PRIu64 ") ", ackno);trunc:	return;}
开发者ID:IAmAnubhavSaini,项目名称:tcpdump,代码行数:26,


示例6: sig_print

static voidsig_print(const u_char *p, int caplen){	bpf_u_int32 call_ref;	if (caplen < PROTO_POS) {		printf("[|atm]");		return;	}	if (p[PROTO_POS] == Q2931) {		/*		 * protocol:Q.2931 for User to Network Interface 		 * (UNI 3.1) signalling		 */		printf("Q.2931");		if (caplen < MSG_TYPE_POS) {			printf(" [|atm]");			return;		}		printf(":%s ",		    tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS]));		/*		 * The call reference comes before the message type,		 * so if we know we have the message type, which we		 * do from the caplen test above, we also know we have		 * the call reference.		 */		call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);		printf("CALL_REF:0x%06x", call_ref);	} else {		/* SCCOP with some unknown protocol atop it */		printf("SSCOP, proto %d ", p[PROTO_POS]);	}}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:35,


示例7: vxlan_print

voidvxlan_print(netdissect_options *ndo, const u_char *bp, u_int len){    uint8_t flags;    uint32_t vni;    if (len < VXLAN_HDR_LEN)        goto trunc;    ND_TCHECK2(*bp, VXLAN_HDR_LEN);    flags = *bp;    bp += 4;    vni = EXTRACT_24BITS(bp);    bp += 4;    ND_PRINT((ndo, "VXLAN, "));    ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags));    ND_PRINT((ndo, "vni %u/n", vni));    ether_print(ndo, bp, len - VXLAN_HDR_LEN, len - VXLAN_HDR_LEN, NULL, NULL);    return;trunc:    ND_PRINT((ndo, "%s", tstr));}
开发者ID:GerardGarcia,项目名称:tcpdump,代码行数:28,


示例8: sig_print

static voidsig_print(const u_char *p, int caplen){	bpf_u_int32 call_ref;	if (caplen < PROTO_POS) {		printf("[|atm]");		return;	}	if (p[PROTO_POS] == Q2931) {		/*		 * protocol:Q.2931 for User to Network Interface 		 * (UNI 3.1) signalling		 */		printf("Q.2931");		if (caplen < MSG_TYPE_POS) {			printf(" [|atm]");			return;		}		printf(":%s ",		    tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS]));		if (caplen < CALL_REF_POS+3) {			printf("[|atm]");			return;		}		call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);		printf("CALL_REF:0x%06x", call_ref);	} else {		/* SCCOP with some unknown protocol atop it */		printf("SSCOP, proto %d ", p[PROTO_POS]);	}}
开发者ID:gosudream,项目名称:netbsd-src,代码行数:33,


示例9: handle_llc_packet

static void handle_llc_packet(const struct llc* llc, int dir) {    struct ip* ip = (struct ip*)((void*)llc + sizeof(struct llc));    /* Taken from tcpdump/print-llc.c */    if(llc->ssap == LLCSAP_SNAP && llc->dsap == LLCSAP_SNAP       && llc->llcui == LLC_UI) {        u_int32_t orgcode;        register u_short et;        orgcode = EXTRACT_24BITS(&llc->llc_orgcode[0]);        et = EXTRACT_16BITS(&llc->llc_ethertype[0]);        switch(orgcode) {          case OUI_ENCAP_ETHER:          case OUI_CISCO_90:            handle_ip_packet(ip, dir);            break;          case OUI_APPLETALK:            if(et == ETHERTYPE_ATALK) {              handle_ip_packet(ip, dir);            }            break;          default:;            /* Not a lot we can do */        }    }}
开发者ID:dove0rz,项目名称:iftop-android,代码行数:26,


示例10: juniper_atm2_print

u_intjuniper_atm2_print(netdissect_options *ndo,                   const struct pcap_pkthdr *h, register const u_char *p){        uint16_t extracted_ethertype;        struct juniper_l2info_t l2info;        l2info.pictype = DLT_JUNIPER_ATM2;        if (juniper_parse_header(ndo, p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */            oam_print(ndo, p, l2info.length, ATM_OAM_NOHEC);            return l2info.header_len;        }        if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */            EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */            if (llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL,                          &extracted_ethertype) != 0)                return l2info.header_len;        }        if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */            (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {            ether_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);            return l2info.header_len;        }        if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */            isoclns_print(ndo, p + 1, l2info.length - 1, l2info.caplen - 1);            /* FIXME check if frame was recognized */            return l2info.header_len;        }        if(juniper_ppp_heuristic_guess(ndo, p, l2info.length) != 0) /* PPPoA vcmux encaps ? */            return l2info.header_len;        if (ip_heuristic_guess(ndo, p, l2info.length) != 0) /* last try - vcmux encaps ? */            return l2info.header_len;	return l2info.header_len;}
开发者ID:bdrewery,项目名称:tcpdump,代码行数:47,


示例11: juniper_atm2_print

u_intjuniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p){        u_int16_t extracted_ethertype;        struct juniper_l2info_t l2info;        l2info.pictype = DLT_JUNIPER_ATM2;        if(juniper_parse_header(p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) {             oam_print(p,l2info.length,ATM_OAM_NOHEC);            return l2info.header_len;        }        if (EXTRACT_24BITS(p) == 0xfefe03 ||             EXTRACT_24BITS(p) == 0xaaaa03) {             if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL,                          &extracted_ethertype) != 0)                return l2info.header_len;        }        if (l2info.direction != JUNIPER_BPF_PKT_IN &&             (EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {            ether_print(p, l2info.length, l2info.caplen);            return l2info.header_len;        }        if (p[0] == 0x03) {             isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1);                        return l2info.header_len;        }        if(juniper_ppp_heuristic_guess(p, l2info.length) != 0)             return l2info.header_len;        if(ip_heuristic_guess(p, l2info.length) != 0)             return l2info.header_len;	return l2info.header_len;}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:46,


示例12: ospf_print_lshdr

static intospf_print_lshdr(register const struct lsa_hdr *lshp){        u_int ls_length;        TCHECK(lshp->ls_length);        ls_length = EXTRACT_16BITS(&lshp->ls_length);        if (ls_length < sizeof(struct lsa_hdr)) {                printf("/n/t    Bogus length %u < %lu", ls_length,                    (unsigned long)sizeof(struct lsa_hdr));                return(-1);        }        TCHECK(lshp->ls_seq);	/* XXX - ls_length check checked this */	printf("/n/t  Advertising Router: %s, seq 0x%08x, age %us, length: %u",	       ipaddr_string(&lshp->ls_router),	       EXTRACT_32BITS(&lshp->ls_seq),	       EXTRACT_16BITS(&lshp->ls_age),               ls_length-(u_int)sizeof(struct lsa_hdr));	TCHECK(lshp->ls_type);	/* XXX - ls_length check checked this */        switch (lshp->ls_type) {	/* the LSA header for opaque LSAs was slightly changed */        case LS_TYPE_OPAQUE_LL:        case LS_TYPE_OPAQUE_AL:        case LS_TYPE_OPAQUE_DW:            printf("/n/t    %s LSA (%d), Opaque-Type: %s LSA (%u), Opaque-ID: %u",                   tok2str(lsa_values,"unknown",lshp->ls_type),                   lshp->ls_type,		   tok2str(lsa_opaque_values,			   "unknown",			   *(&lshp->un_lsa_id.opaque_field.opaque_type)),		   *(&lshp->un_lsa_id.opaque_field.opaque_type),		   EXTRACT_24BITS(&lshp->un_lsa_id.opaque_field.opaque_id)                                      );            break;	/* all other LSA types use regular style LSA headers */	default:            printf("/n/t    %s LSA (%d), LSA-ID: %s",                   tok2str(lsa_values,"unknown",lshp->ls_type),                   lshp->ls_type,                   ipaddr_string(&lshp->un_lsa_id.lsa_id));            break;        }	TCHECK(lshp->ls_options);	/* XXX - ls_length check checked this */        printf("/n/t    Options: [%s]", bittok2str(ospf_option_values,"none",lshp->ls_options));        return (ls_length);trunc:	return (-1);}
开发者ID:hsluoyz,项目名称:WinDump,代码行数:55,


示例13: vxlan_gpe_print

voidvxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len){    uint8_t flags;    uint8_t next_protocol;    uint32_t vni;    if (len < VXLAN_GPE_HDR_LEN)        goto trunc;    ND_TCHECK2(*bp, VXLAN_GPE_HDR_LEN);    flags = *bp;    bp += 3;    next_protocol = *bp;    bp += 1;    vni = EXTRACT_24BITS(bp);    bp += 4;    ND_PRINT((ndo, "VXLAN-GPE, "));    ND_PRINT((ndo, "flags [%s], ",              bittok2str_nosep(vxlan_gpe_flags, "none", flags)));    ND_PRINT((ndo, "vni %u", vni));    ND_PRINT((ndo, ndo->ndo_vflag ? "/n    " : ": "));    switch (next_protocol) {    case 0x1:        ip_print(ndo, bp, len - 8);        break;    case 0x2:        ip6_print(ndo, bp, len - 8);        break;    case 0x3:        ether_print(ndo, bp, len - 8, len - 8, NULL, NULL);        break;    case 0x4:        nsh_print(ndo, bp, len - 8);        break;    case 0x5:        mpls_print(ndo, bp, len - 8);        break;    default:        ND_PRINT((ndo, "ERROR: unknown-next-protocol"));        return;    }	return;trunc:	ND_PRINT((ndo, "%s", tstr));}
开发者ID:GerardGarcia,项目名称:tcpdump,代码行数:53,


示例14: dccp_seqno

static u_int64_t dccp_seqno(const struct dccp_hdr *dh){	u_int32_t seq_high = DCCPH_SEQ(dh);	u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;	if (DCCPH_X(dh) != 0) {		const struct dccp_hdr_ext *dhx = (void *)(dh + 1);		u_int32_t seq_low = dhx->dccph_seq_low;		seqno &= 0x00FFFF;  /* clear reserved field */		seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);	}	return seqno;}
开发者ID:IAmAnubhavSaini,项目名称:tcpdump,代码行数:14,


示例15: dccp_seqno

static u_int64_t dccp_seqno(const u_char *bp){	const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;	u_int64_t seqno;	if (DCCPH_X(dh) != 0) {		const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp;		seqno = EXTRACT_48BITS(dhx->dccph_seq);	} else {		seqno = EXTRACT_24BITS(dh->dccph_seq);	}	return seqno;}
开发者ID:rwdxll,项目名称:tcpdump,代码行数:14,


示例16: juniper_atm1_print

u_intjuniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p){        u_int16_t extracted_ethertype;        struct juniper_l2info_t l2info;        l2info.pictype = DLT_JUNIPER_ATM1;        if(juniper_parse_header(p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        if (l2info.cookie[0] == 0x80) {             oam_print(p,l2info.length,ATM_OAM_NOHEC);            return l2info.header_len;        }        if (EXTRACT_24BITS(p) == 0xfefe03 ||             EXTRACT_24BITS(p) == 0xaaaa03) {             if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL,                          &extracted_ethertype) != 0)                return l2info.header_len;        }        if (p[0] == 0x03) {             isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1);                        return l2info.header_len;        }        if(ip_heuristic_guess(p, l2info.length) != 0)             return l2info.header_len;	return l2info.header_len;}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:37,


示例17: juniper_atm1_print

u_intjuniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p){        u_int16_t extracted_ethertype;        struct juniper_l2info_t l2info;        l2info.pictype = DLT_JUNIPER_ATM1;        if(juniper_parse_header(p, h, &l2info) == 0)            return l2info.header_len;        p+=l2info.header_len;        if (l2info.cookie[0] == 0x80) { /* OAM cell ? */            oam_print(p,l2info.length,ATM_OAM_NOHEC);            return l2info.header_len;        }        if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */            EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */            if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL,                          &extracted_ethertype) != 0)                return l2info.header_len;        }        if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */            isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1);            /* FIXME check if frame was recognized */            return l2info.header_len;        }        if(ip_heuristic_guess(p, l2info.length) != 0) /* last try - vcmux encaps ? */            return l2info.header_len;	return l2info.header_len;}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:37,


示例18: dccp_print_ack_no

static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp){	const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;	const u_char *ackp = bp + dccp_basic_hdr_len(dh);	u_int64_t ackno;	if (DCCPH_X(dh) != 0) {		ND_TCHECK2(*ackp, 8);		ackno = EXTRACT_48BITS(ackp + 2);	} else {		ND_TCHECK2(*ackp, 4);		ackno = EXTRACT_24BITS(ackp + 1);	}	ND_PRINT((ndo, "(ack=%" PRIu64 ") ", ackno));trunc:	return;}
开发者ID:rwdxll,项目名称:tcpdump,代码行数:18,


示例19: dccp_print_ack_no

static void dccp_print_ack_no(const u_char *bp){	const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;	const u_char *ackp = bp + dccp_basic_hdr_len(dh);	u_int64_t ackno;	if (DCCPH_X(dh) != 0) {		TCHECK2(*ackp, 8);		ackno = EXTRACT_48BITS(ackp + 2);	} else {		TCHECK2(*ackp, 4);		ackno = EXTRACT_24BITS(ackp + 1);	}	(void)printf("(ack=%" PRIu64 ") ", ackno);trunc:	return;}
开发者ID:supermartian,项目名称:tcpdump,代码行数:18,


示例20: geneve_print

voidgeneve_print(netdissect_options *ndo, const u_char *bp, u_int len){    uint8_t ver_opt;    u_int version;    uint8_t flags;    uint16_t prot;    uint32_t vni;    uint8_t reserved;    u_int opts_len;    ND_PRINT((ndo, "Geneve"));    ND_TCHECK2(*bp, 8);    ver_opt = *bp;    bp += 1;    len -= 1;    version = ver_opt >> VER_SHIFT;    if (version != 0) {        ND_PRINT((ndo, " ERROR: unknown-version %u", version));        return;    }    flags = *bp;    bp += 1;    len -= 1;    prot = EXTRACT_16BITS(bp);    bp += 2;    len -= 2;    vni = EXTRACT_24BITS(bp);    bp += 3;    len -= 3;    reserved = *bp;    bp += 1;    len -= 1;    ND_PRINT((ndo, ", Flags [%s]",              bittok2str_nosep(geneve_flag_values, "none", flags)));    ND_PRINT((ndo, ", vni 0x%x", vni));    if (reserved)        ND_PRINT((ndo, ", rsvd 0x%x", reserved));    if (ndo->ndo_eflag)        ND_PRINT((ndo, ", proto %s (0x%04x)",                  tok2str(ethertype_values, "unknown", prot), prot));    opts_len = (ver_opt & HDR_OPTS_LEN_MASK) * 4;    if (len < opts_len) {        ND_PRINT((ndo, " truncated-geneve - %u bytes missing",                  opts_len - len));        return;    }    ND_TCHECK2(*bp, opts_len);    if (opts_len > 0) {        ND_PRINT((ndo, ", options ["));        if (ndo->ndo_vflag)            geneve_opts_print(ndo, bp, opts_len);        else            ND_PRINT((ndo, "%u bytes", opts_len));        ND_PRINT((ndo, "]"));    }    bp += opts_len;    len -= opts_len;    if (ndo->ndo_vflag < 1)        ND_PRINT((ndo, ": "));    else        ND_PRINT((ndo, "/n/t"));    if (ethertype_print(ndo, prot, bp, len, len) == 0) {        if (prot == ETHERTYPE_TEB)            ether_print(ndo, bp, len, len, NULL, NULL);        else            ND_PRINT((ndo, "geneve-proto-0x%x", prot));    }    return;trunc:    ND_PRINT((ndo, " [|geneve]"));}
开发者ID:LXiong,项目名称:tcpdump,代码行数:93,


示例21: eigrp_print

//.........这里部分代码省略.........        case EIGRP_TLV_SW_VERSION:            tlv_ptr.eigrp_tlv_sw_version = (const struct eigrp_tlv_sw_version_t *)tlv_tptr;            ND_PRINT((ndo, "/n/t    IOS version: %u.%u, EIGRP version %u.%u",                   tlv_ptr.eigrp_tlv_sw_version->ios_major,                   tlv_ptr.eigrp_tlv_sw_version->ios_minor,                   tlv_ptr.eigrp_tlv_sw_version->eigrp_major,                   tlv_ptr.eigrp_tlv_sw_version->eigrp_minor));            break;        case EIGRP_TLV_IP_INT:            tlv_ptr.eigrp_tlv_ip_int = (const struct eigrp_tlv_ip_int_t *)tlv_tptr;            bit_length = tlv_ptr.eigrp_tlv_ip_int->plen;            if (bit_length > 32) {                ND_PRINT((ndo, "/n/t    illegal prefix length %u",bit_length));                break;            }            byte_length = (bit_length + 7) / 8; /* variable length encoding */            memset(prefix, 0, 4);            memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_int->destination,byte_length);            ND_PRINT((ndo, "/n/t    IPv4 prefix: %15s/%u, nexthop: ",                   ipaddr_string(ndo, prefix),                   bit_length));            if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)                ND_PRINT((ndo, "self"));            else                ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop)));            ND_PRINT((ndo, "/n/t      delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",                   (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),                   EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),                   EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),                   tlv_ptr.eigrp_tlv_ip_int->hopcount,                   tlv_ptr.eigrp_tlv_ip_int->reliability,                   tlv_ptr.eigrp_tlv_ip_int->load));            break;        case EIGRP_TLV_IP_EXT:            tlv_ptr.eigrp_tlv_ip_ext = (const struct eigrp_tlv_ip_ext_t *)tlv_tptr;            bit_length = tlv_ptr.eigrp_tlv_ip_ext->plen;            if (bit_length > 32) {                ND_PRINT((ndo, "/n/t    illegal prefix length %u",bit_length));                break;            }            byte_length = (bit_length + 7) / 8; /* variable length encoding */            memset(prefix, 0, 4);            memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_ext->destination,byte_length);            ND_PRINT((ndo, "/n/t    IPv4 prefix: %15s/%u, nexthop: ",                   ipaddr_string(ndo, prefix),                   bit_length));            if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)                ND_PRINT((ndo, "self"));            else                ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop)));            ND_PRINT((ndo, "/n/t      origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",                   ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router),                   EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),                   tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id),                   tlv_ptr.eigrp_tlv_ip_ext->flags,                   EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),                   EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric)));
开发者ID:Danielweber7624,项目名称:tcpdump,代码行数:67,


示例22: slow_oam_print

void slow_oam_print(register const u_char *tptr, register u_int tlen) {    u_int hexdump;    struct slow_oam_common_header_t {        u_int8_t flags[2];        u_int8_t code;    };    struct slow_oam_tlv_header_t {        u_int8_t type;        u_int8_t length;    };    union {        const struct slow_oam_common_header_t *slow_oam_common_header;        const struct slow_oam_tlv_header_t *slow_oam_tlv_header;    } ptr;    union {	const struct slow_oam_info_t *slow_oam_info;        const struct slow_oam_link_event_t *slow_oam_link_event;        const struct slow_oam_variablerequest_t *slow_oam_variablerequest;        const struct slow_oam_variableresponse_t *slow_oam_variableresponse;        const struct slow_oam_loopbackctrl_t *slow_oam_loopbackctrl;    } tlv;        ptr.slow_oam_common_header = (struct slow_oam_common_header_t *)tptr;    tptr += sizeof(struct slow_oam_common_header_t);    tlen -= sizeof(struct slow_oam_common_header_t);    printf("/n/tCode %s OAM PDU, Flags [%s]",           tok2str(slow_oam_code_values, "Unknown (%u)", ptr.slow_oam_common_header->code),           bittok2str(slow_oam_flag_values,                      "none",                      EXTRACT_16BITS(&ptr.slow_oam_common_header->flags)));    switch (ptr.slow_oam_common_header->code) {    case SLOW_OAM_CODE_INFO:        while (tlen > 0) {            ptr.slow_oam_tlv_header = (const struct slow_oam_tlv_header_t *)tptr;            printf("/n/t  %s Information Type (%u), length %u",                   tok2str(slow_oam_info_type_values, "Reserved",                           ptr.slow_oam_tlv_header->type),                   ptr.slow_oam_tlv_header->type,                   ptr.slow_oam_tlv_header->length);            hexdump = FALSE;            switch (ptr.slow_oam_tlv_header->type) {            case SLOW_OAM_INFO_TYPE_END_OF_TLV:                if (ptr.slow_oam_tlv_header->length != 0) {                    printf("/n/t    ERROR: illegal length - should be 0");                }                return;                            case SLOW_OAM_INFO_TYPE_LOCAL: /* identical format - fall through */            case SLOW_OAM_INFO_TYPE_REMOTE:                tlv.slow_oam_info = (const struct slow_oam_info_t *)tptr;                                if (tlv.slow_oam_info->info_length !=                    sizeof(struct slow_oam_info_t)) {                    printf("/n/t    ERROR: illegal length - should be %lu",                           (unsigned long) sizeof(struct slow_oam_info_t));                    return;                }                printf("/n/t    OAM-Version %u, Revision %u",                       tlv.slow_oam_info->oam_version,                       EXTRACT_16BITS(&tlv.slow_oam_info->revision));                printf("/n/t    State-Parser-Action %s, State-MUX-Action %s",                       tok2str(slow_oam_info_type_state_parser_values, "Reserved",                               tlv.slow_oam_info->state & OAM_INFO_TYPE_PARSER_MASK),                       tok2str(slow_oam_info_type_state_mux_values, "Reserved",                               tlv.slow_oam_info->state & OAM_INFO_TYPE_MUX_MASK));                printf("/n/t    OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u",                       bittok2str(slow_oam_info_type_oam_config_values, "none",                                  tlv.slow_oam_info->oam_config),                       EXTRACT_16BITS(&tlv.slow_oam_info->oam_pdu_config) &                       OAM_INFO_TYPE_PDU_SIZE_MASK);                printf("/n/t    OUI %s (0x%06x), Vendor-Private 0x%08x",                       tok2str(oui_values, "Unknown",                               EXTRACT_24BITS(&tlv.slow_oam_info->oui)),                       EXTRACT_24BITS(&tlv.slow_oam_info->oui),                       EXTRACT_32BITS(&tlv.slow_oam_info->vendor_private));                break;                            case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC:                hexdump = TRUE;                break;                            default:                hexdump = TRUE;                break;            }            /* infinite loop check */            if (!ptr.slow_oam_tlv_header->length) {                return;            }//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例23: atm_if_print

/* * This is the top level routine of the printer.  'p' points * to the LLC/SNAP header of the packet, 'h->ts' is the timestamp, * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */u_intatm_if_print(const struct pcap_pkthdr *h, const u_char *p){	u_int caplen = h->caplen;	u_int length = h->len;	u_int32_t llchdr;	u_int hdrlen = 0;	if (caplen < 8) {		printf("[|atm]");		return (caplen);	}        /* Cisco Style NLPID ? */        if (*p == LLC_UI) {            if (eflag)                printf("CNLPID ");            isoclns_print(p+1, length-1, caplen-1);            return hdrlen;        }	/*	 * Extract the presumed LLC header into a variable, for quick	 * testing.	 * Then check for a header that's neither a header for a SNAP	 * packet nor an RFC 2684 routed NLPID-formatted PDU nor	 * an 802.2-but-no-SNAP IP packet.	 */	llchdr = EXTRACT_24BITS(p);	if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) &&	    llchdr != LLC_UI_HDR(LLCSAP_ISONS) &&	    llchdr != LLC_UI_HDR(LLCSAP_IP)) {		/*		 * XXX - assume 802.6 MAC header from Fore driver.		 *		 * Unfortunately, the above list doesn't check for		 * all known SAPs, doesn't check for headers where		 * the source and destination SAP aren't the same,		 * and doesn't check for non-UI frames.  It also		 * runs the risk of an 802.6 MAC header that happens		 * to begin with one of those values being		 * incorrectly treated as an 802.2 header.		 *		 * So is that Fore driver still around?  And, if so,		 * is it still putting 802.6 MAC headers on ATM		 * packets?  If so, could it be changed to use a		 * new DLT_IEEE802_6 value if we added it?		 */		if (eflag)			printf("%08x%08x %08x%08x ",			       EXTRACT_32BITS(p),			       EXTRACT_32BITS(p+4),			       EXTRACT_32BITS(p+8),			       EXTRACT_32BITS(p+12));		p += 20;		length -= 20;		caplen -= 20;		hdrlen += 20;	}	atm_llc_print(p, length, caplen);	return (hdrlen);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:68,


示例24: juniper_parse_header

static intjuniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) {    struct juniper_cookie_table_t *lp = juniper_cookie_table;    u_int idx, offset;#ifdef DLT_JUNIPER_ATM2    u_int32_t control_word;#endif    l2info->header_len = 0;    l2info->cookie_len = 0;    l2info->proto = 0;    l2info->length = h->len;    l2info->caplen = h->caplen;    l2info->direction = p[3]&JUNIPER_BPF_PKT_IN;        TCHECK2(p[0],4);    if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) {         printf("no magic-number found!");        return 0;    }     if (eflag)         printf("%3s ",tok2str(juniper_direction_values,"---",l2info->direction));        if ((p[3] & JUNIPER_BPF_EXT ) == JUNIPER_BPF_EXT ) {        offset = 6 + EXTRACT_16BITS(p+4);        if (eflag>1)            printf("ext-len %u, ",EXTRACT_16BITS(p+4));    } else        offset = 4;    if ((p[3] & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) {                    if (eflag)            printf("no-L2-hdr, ");        TCHECK2(p[offset+4],1);        if(ip_heuristic_guess(p+offset+4,l2info->length-(offset+4)) == 0)            printf("no IP-hdr found!");        l2info->header_len=offset+4;        return 0;             }    l2info->header_len = offset;    p+=l2info->header_len;    l2info->length -= l2info->header_len;    l2info->caplen -= l2info->header_len;        while (lp->s != NULL) {        if (lp->pictype == l2info->pictype) {            l2info->cookie_len += lp->cookie_len;            switch (p[0]) {            case LS_COOKIE_ID:                l2info->cookie_type = LS_COOKIE_ID;                l2info->cookie_len += 2;                break;            case AS_COOKIE_ID:                l2info->cookie_type = AS_COOKIE_ID;                l2info->cookie_len = 8;                break;                        default:                l2info->bundle = l2info->cookie[0];                break;            }#ifdef DLT_JUNIPER_MFR                        if (l2info->pictype == DLT_JUNIPER_MFR &&                (p[0] & MFR_BE_MASK) == MFR_BE_MASK) {                l2info->cookie_len = 0;            }#endif            l2info->header_len += l2info->cookie_len;            l2info->length -= l2info->cookie_len;            l2info->caplen -= l2info->cookie_len;            if (eflag)                printf("%s-PIC, cookie-len %u",                       lp->s,                       l2info->cookie_len);            if (l2info->cookie_len > 0) {                TCHECK2(p[0],l2info->cookie_len);                if (eflag)                    printf(", cookie 0x");                for (idx = 0; idx < l2info->cookie_len; idx++) {                    l2info->cookie[idx] = p[idx];                     if (eflag) printf("%02x",p[idx]);                }            }//.........这里部分代码省略.........
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:101,


示例25: juniper_parse_header

static intjuniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) {    struct juniper_cookie_table_t *lp = juniper_cookie_table;    u_int idx, offset;#ifdef DLT_JUNIPER_ATM2    u_int32_t control_word;#endif    l2info->header_len = 0;    l2info->cookie_len = 0;    l2info->proto = 0;    l2info->length = h->len;    l2info->caplen = h->caplen;    l2info->direction = p[3]&JUNIPER_BPF_PKT_IN;        TCHECK2(p[0],4);    if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */        printf("no magic-number found!");        return 0;    }     if (eflag) /* print direction */        printf("%3s ",tok2str(juniper_direction_values,"---",l2info->direction));    /* extensions present ?  - calculate how much bytes to skip */    if ((p[3] & JUNIPER_BPF_EXT ) == JUNIPER_BPF_EXT ) {        offset = 6 + EXTRACT_16BITS(p+4);        if (eflag>1)            printf("ext-len %u, ",EXTRACT_16BITS(p+4));    } else        offset = 4;    if ((p[3] & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) {                    if (eflag)            printf("no-L2-hdr, ");        /* there is no link-layer present -         * perform the v4/v6 heuristics         * to figure out what it is         */        TCHECK2(p[offset+4],1);        if(ip_heuristic_guess(p+offset+4,l2info->length-(offset+4)) == 0)            printf("no IP-hdr found!");        l2info->header_len=offset+4;        return 0; /* stop parsing the output further */            }    l2info->header_len = offset;    p+=l2info->header_len;    l2info->length -= l2info->header_len;    l2info->caplen -= l2info->header_len;    /* search through the cookie table and copy values matching for our PIC type */    while (lp->s != NULL) {        if (lp->pictype == l2info->pictype) {            l2info->cookie_len += lp->cookie_len;            switch (p[0]) {            case LS_COOKIE_ID:                l2info->cookie_type = LS_COOKIE_ID;                l2info->cookie_len += 2;                break;            case AS_COOKIE_ID:                l2info->cookie_type = AS_COOKIE_ID;                l2info->cookie_len = 8;                break;                        default:                l2info->bundle = l2info->cookie[0];                break;            }#ifdef DLT_JUNIPER_MFR            /* MFR child links don't carry cookies */            if (l2info->pictype == DLT_JUNIPER_MFR &&                (p[0] & MFR_BE_MASK) == MFR_BE_MASK) {                l2info->cookie_len = 0;            }#endif            l2info->header_len += l2info->cookie_len;            l2info->length -= l2info->cookie_len;            l2info->caplen -= l2info->cookie_len;            if (eflag)                printf("%s-PIC, cookie-len %u",                       lp->s,                       l2info->cookie_len);            if (l2info->cookie_len > 0) {                TCHECK2(p[0],l2info->cookie_len);                if (eflag)                    printf(", cookie 0x");                for (idx = 0; idx < l2info->cookie_len; idx++) {//.........这里部分代码省略.........
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:101,


示例26: print_attr_num

static voidprint_attr_num(netdissect_options *ndo,               register u_char *data, u_int length, u_short attr_code){   uint32_t timeout;   if (length != 4)   {       ND_PRINT((ndo, "ERROR: length %u != 4", length));       return;   }   ND_TCHECK2(data[0],4);                          /* This attribute has standard values */   if (attr_type[attr_code].siz_subtypes)   {      static const char **table;      uint32_t data_value;      table = attr_type[attr_code].subtypes;      if ( (attr_code == TUNNEL_TYPE) || (attr_code == TUNNEL_MEDIUM) )      {         if (!*data)            ND_PRINT((ndo, "Tag[Unused] "));         else            ND_PRINT((ndo, "Tag[%d] ", *data));         data++;         data_value = EXTRACT_24BITS(data);      }      else      {         data_value = EXTRACT_32BITS(data);      }      if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 +            attr_type[attr_code].first_subtype) &&	   data_value >= attr_type[attr_code].first_subtype )         ND_PRINT((ndo, "%s", table[data_value]));      else         ND_PRINT((ndo, "#%u", data_value));   }   else   {      switch(attr_code) /* Be aware of special cases... */      {        case FRM_IPX:             if (EXTRACT_32BITS( data) == 0xFFFFFFFE )                ND_PRINT((ndo, "NAS Select"));             else                ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));          break;        case SESSION_TIMEOUT:        case IDLE_TIMEOUT:        case ACCT_DELAY:        case ACCT_SESSION_TIME:        case ACCT_INT_INTERVAL:             timeout = EXTRACT_32BITS( data);             if ( timeout < 60 )                ND_PRINT((ndo,  "%02d secs", timeout));             else             {                if ( timeout < 3600 )                   ND_PRINT((ndo,  "%02d:%02d min",                          timeout / 60, timeout % 60));                else                   ND_PRINT((ndo, "%02d:%02d:%02d hours",                          timeout / 3600, (timeout % 3600) / 60,                          timeout % 60));             }          break;        case FRM_ATALK_LINK:             if (EXTRACT_32BITS(data) )                ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));             else                ND_PRINT((ndo, "Unnumbered"));          break;        case FRM_ATALK_NETWORK:             if (EXTRACT_32BITS(data) )                ND_PRINT((ndo, "%d", EXTRACT_32BITS(data)));             else                ND_PRINT((ndo, "NAS assigned"));          break;        case TUNNEL_PREFERENCE:            if (*data)               ND_PRINT((ndo, "Tag[%d] ", *data));            else               ND_PRINT((ndo, "Tag[Unused] "));            data++;            ND_PRINT((ndo, "%d", EXTRACT_24BITS(data)));          break;        case EGRESS_VLAN_ID:            ND_PRINT((ndo, "%s (0x%02x) ",                   tok2str(rfc4675_tagged,"Unknown tag",*data),                   *data));            data++;            ND_PRINT((ndo, "%d", EXTRACT_24BITS(data)));//.........这里部分代码省略.........
开发者ID:0-kaladin,项目名称:ad-away,代码行数:101,



注:本文中的EXTRACT_24BITS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ EXTRACT_32BITS函数代码示例
C++ EXTRACT_16BITS函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。