=head1 NAME

nbdkit_debug_hexdump,
nbdkit_debug_hexdiff - display buffer in hexdump format

=head1 SYNOPSIS

 #include <nbdkit-plugin.h>

 void nbdkit_debug_hexdump (const void *buf, size_t len,
                            const char *prefix, uint64_t start);

 void nbdkit_debug_hexdiff (const void *buf1, const void *buf2,
                            size_t len,
                            const char *prefix, uint64_t start);

=head1 DESCRIPTION

B<nbdkit_debug_hexdump> displays a buffer of binary data in canonical
hexdump format, sending the output to the same place as
L<nbdkit_debug(3)>.  For example:

 char buf[33] = "12345678123456781234567812345678";
 nbdkit_debug_hexdump (buf, 32, "data: ", 0);

would produce output similar to this:

 data: 00000000: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|
 data: 00000010: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|

An optional C<prefix> may be given which prefixes the string on each
line of output.  (This may be C<NULL> or C<""> for no prefix).

An optional C<start> may be given which changes the first offset
displayed in the output.

B<nbdkit_debug_hexdiff> displays the differences between two binary
buffers (of the same length).

For rows which are the same in both buffers, the output is the same as
above.  For rows which are different it shows the first buffer in the
first row (prefixed with C<->) and the differences in the second
buffer in the second row (prefixed with C<+>):

 -00000000: 31 32 33 34 35 36 37 38  31 32 33 34 35 36 37 38  |1234567812345678|
 +00000000:                          39 38 37 36    34 33 32  |        9876 432|

=head1 LANGUAGE BINDINGS

In L<nbdkit-ocaml-plugin(3)>:

 NBDKit.debug_hexdump : NBDKit.buf -> string option -> int64 -> unit
 NBDKit.debug_hexdiff : NBDKit.buf -> NBDKit.buf -> string option ->
                        int64 -> unit

In L<nbdkit-python-plugin(3)>:

 import nbdkit
 nbdkit.debug_hexdump(bytes, prefix, start)
 nbdkit.debug_hexdiff(bytes, bytes, prefix, start)

In L<nbdkit-rust-plugin(3)>:

 use nbdkit::*;
 debug_hexdump(buf, prefix, start);
 debug_hexdiff(buf1, buf2, prefix, start);

=head1 HISTORY

C<nbdkit_debug_hexdump> was added in nbdkit 1.46.

C<nbdkit_debug_hexdiff> was added in nbdkit 1.48.

=head1 SEE ALSO

L<nbdkit(1)>,
L<nbdkit_debug(3)>,
L<nbdkit-plugin(3)>,
L<nbdkit-filter(3)>,
L<nbdkit-checkwrite-filter(1)>,
L<nbdkit-evil-filter(1)>,
L<nbddump(1)>,
L<hexdump(1)>.

=head1 AUTHORS

Richard W.M. Jones

=head1 COPYRIGHT

Copyright Red Hat
