diff --git a/examples/pcapread.c b/examples/pcapread.c index 13f3e3a..cdd50f8 100644 --- a/examples/pcapread.c +++ b/examples/pcapread.c @@ -144,10 +144,16 @@ static ssize_t handle_block_packet(hexagram_pcapng_stream *stream, data->last_time = (useconds_t)header.timestamp[1]; - + ((struct can_frame *)body)->can_id = be32toh(((struct can_frame *)body)->can_id); - printf("Read packet %"PRIu32" bytes time hi %"PRIu32" lo %"PRIu32"\n", - header.caplen, header.timestamp[0], header.timestamp[1]); + printf("Read packet %"PRIu32" bytes time hi %"PRIu32" lo %"PRIu32" id %8"PRIx32" payload %d\n", + header.caplen, header.timestamp[0], header.timestamp[1], + ((struct can_frame *)&body)->can_id, + ((struct can_frame *)&body)->can_dlc); + + if (write(data->sock, (struct can_frame *)body, sizeof(struct can_frame)) < 0) { + goto error_io; + } if (header.caplen % sizeof(uint32_t)) { size_t padding = sizeof(uint32_t) - (header.caplen % sizeof(uint32_t));