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; }
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; }
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; }
static uint64_t dccp_seqno(netdissect_options *ndo, const u_char *bp) { const struct dccp_hdr *dh = (const struct dccp_hdr *)bp; uint64_t seqno; if (DCCPH_X(dh) != 0) { const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp; seqno = GET_BE_U_6(dhx->dccph_seq); } else { seqno = GET_BE_U_3(dh->dccph_seq); } return seqno; }
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; }
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(ndo, dh); uint64_t ackno; if (DCCPH_X(dh) != 0) { ND_TCHECK_8(ackp); ackno = GET_BE_U_6(ackp + 2); } else { ND_TCHECK_4(ackp); ackno = GET_BE_U_3(ackp + 1); } ND_PRINT("(ack=%" PRIu64 ") ", ackno); trunc: return; }
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; }
static inline unsigned int dccp_basic_hdr_len(const struct dccp_hdr *dh) { return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr); }
static unsigned int dccp_basic_hdr_len(netdissect_options *ndo, const struct dccp_hdr *dh) { return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr); }