Lines Matching refs:buf
30 static uint32_t get_be16(const uint8_t *buf) { in get_be16() argument
31 return buf[0] << 8 | buf[1]; in get_be16()
34 static uint32_t get_be32(const uint8_t *buf) { in get_be32() argument
35 return buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; in get_be32()
38 static void dump_hex_bytes(const mp_print_t *print, size_t len, const uint8_t *buf) { in dump_hex_bytes() argument
40 mp_printf(print, " %02x", buf[i]); in dump_hex_bytes()
58 void netutils_ethernet_trace(const mp_print_t *print, size_t len, const uint8_t *buf, unsigned int … in netutils_ethernet_trace() argument
60 …mp_printf(print, " dst=%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf… in netutils_ethernet_trace()
61 …p_printf(print, " src=%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8], buf[9], buf[10], buf… in netutils_ethernet_trace()
63 const char *ethertype = ethertype_str(buf[12] << 8 | buf[13]); in netutils_ethernet_trace()
67 mp_printf(print, " type=0x%04x", buf[12] << 8 | buf[13]); in netutils_ethernet_trace()
71 buf += 14; in netutils_ethernet_trace()
72 if (buf[-2] == 0x08 && buf[-1] == 0x00 && buf[0] == 0x45) { in netutils_ethernet_trace()
74 len = get_be16(buf + 2); in netutils_ethernet_trace()
76 buf[12], buf[13], buf[14], buf[15], in netutils_ethernet_trace()
77 buf[16], buf[17], buf[18], buf[19]); in netutils_ethernet_trace()
78 uint8_t prot = buf[9]; in netutils_ethernet_trace()
79 buf += 20; in netutils_ethernet_trace()
83 uint16_t srcport = get_be16(buf); in netutils_ethernet_trace()
84 uint16_t dstport = get_be16(buf + 2); in netutils_ethernet_trace()
85 uint32_t seqnum = get_be32(buf + 4); in netutils_ethernet_trace()
86 uint32_t acknum = get_be32(buf + 8); in netutils_ethernet_trace()
87 uint16_t dataoff_flags = get_be16(buf + 12); in netutils_ethernet_trace()
88 uint16_t winsz = get_be16(buf + 14); in netutils_ethernet_trace()
91 buf += 20; in netutils_ethernet_trace()
96 dump_hex_bytes(print, opts_len, buf); in netutils_ethernet_trace()
97 buf += opts_len; in netutils_ethernet_trace()
102 uint16_t srcport = get_be16(buf); in netutils_ethernet_trace()
103 uint16_t dstport = get_be16(buf + 2); in netutils_ethernet_trace()
105 len = get_be16(buf + 4); in netutils_ethernet_trace()
106 buf += 8; in netutils_ethernet_trace()
114 dump_hex_bytes(print, 12 + 16 + 16 + 64, buf); in netutils_ethernet_trace()
117 buf += n; in netutils_ethernet_trace()
119 switch (buf[6]) { in netutils_ethernet_trace()
150 } else if (buf[-2] == 0x86 && buf[-1] == 0xdd && (buf[0] >> 4) == 6) { in netutils_ethernet_trace()
152 uint32_t h = get_be32(buf); in netutils_ethernet_trace()
153 uint16_t l = get_be16(buf + 4); in netutils_ethernet_trace()
154 …nexthdr=%u hoplimit=%u", (unsigned)((h >> 20) & 0xff), (unsigned)(h & 0xfffff), l, buf[6], buf[7]); in netutils_ethernet_trace()
156 dump_hex_bytes(print, 16, buf + 8); in netutils_ethernet_trace()
158 dump_hex_bytes(print, 16, buf + 24); in netutils_ethernet_trace()
159 buf += 40; in netutils_ethernet_trace()
164 dump_hex_bytes(print, len, buf); in netutils_ethernet_trace()