}
sniffer_print_hexdump(stdout, packet->llcp.data, packet->llcp.data_len,
- " ", TRUE);
+ 2, TRUE);
return 0;
}
default:
sniffer_print_hexdump(stdout, packet.llcp.data,
- packet.llcp.data_len, " ", TRUE);
+ packet.llcp.data_len, 2, TRUE);
break;
}
snep_printf("End of fragmented message\n");
sniffer_print_hexdump(stdout, frag->buffer, frag->buffer_size,
- MSG_INDENT, TRUE);
+ 6, TRUE);
snep_frag_delete(frag->index);
}
if (packet->snep.data_len <= packet->snep.real_len) {
/* Message is not fragmented */
sniffer_print_hexdump(stdout, packet->snep.data,
- packet->snep.data_len, MSG_INDENT, TRUE);
+ packet->snep.data_len, 6, TRUE);
return 0;
}
*
*/
void sniffer_print_hexdump(FILE *file, guint8 *data, guint32 len,
- gchar *line_prefix, gboolean print_len)
+ guint8 indent, gboolean print_len)
{
guint8 digits;
guint32 offset;
output_len = len;
if (print_len) {
- if (line_prefix)
- fprintf(file, "%s", line_prefix);
+ if (indent)
+ fprintf(file, "%*c", indent, ' ');
fprintf(file, "Total length: %u bytes\n", len);
}
if (++digits >= 16) {
*hexa = ' ';
strcpy(human, "|");
- if (line_prefix)
- fprintf(file, "%s", line_prefix);
+ if (indent)
+ fprintf(file, "%*c", indent, ' ');
fprintf(file, "%s\n", line);
digits = 0;
if ((output_len & 0xF) != 0) {
*hexa = ' ';
strcpy(human, "|");
- if (line_prefix)
- fprintf(file, "%s", line_prefix);
+ if (indent)
+ fprintf(file, "%*c", indent, ' ');
fprintf(file, "%s\n", line);
}
if (output_len != len) {
- if (line_prefix)
- fprintf(file, "%s", line_prefix);
+ if (indent)
+ fprintf(file, "%*c", indent, ' ');
fprintf(file, "--- truncated ---\n");
}
}
void sniffer_cleanup(void);
void sniffer_print_hexdump(FILE *file, guint8 *data, guint32 len,
- gchar *line_prefix, gboolean print_len);
+ guint8 indent, gboolean print_len);
#endif /* __SNIFFER_H */