1 /*****************************************************************************\
3 \*****************************************************************************/
11 * David S. Peterson. All rights reserved.
13 * Author: David S. Peterson <dave_peterson@pobox.com>
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are
18 * 1. Redistributions of source code must retain the above copyright notice,
19 * this list of conditions, and the entire permission notice, including
20 * the following disclaimer of warranties.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions, and the entire permission notice,
23 * including the following disclaimer in the documentation and/or other
24 * materials provided with the distribution.
25 * 3. The name(s) of the author(s) may not be used to endorse or promote
26 * products derived from this software without specific prior written
29 * ALTERNATIVELY, this product may be distributed under the terms of the GNU
30 * General Public License, in which case the provisions of the GPL are
31 * required INSTEAD OF the above restrictions. (This clause is necessary due
32 * to a potential bad interaction between the GPL and the restrictions
33 * contained in a BSD-style copyright.)
35 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
36 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
38 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
40 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
44 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 #include <sys/types.h>
51 /*--------------------------------------------------------------------------
54 * This specifies how the output of the 'hexdump' function should look.
57 * bytes_per_line: the number of data bytes to display per line of
59 * addrprint_width: Each line of output begins with the address of the
60 * first data byte displayed on that line. This
61 * specifies the number of bytes wide the address
62 * should be displayed as. This value must be from 1
64 * indent: This is a string to display at the start of each
65 * output line. Its purpose is to indent the output.
66 * sep1: This is a string to display between the address and
67 * the bytes of data displayed in hex. It serves as a
69 * sep2: This is a string to display between individual hex
70 * values. It serves as a separator.
71 * sep3: This is a string to display between the bytes of
72 * data in hex and the bytes of data displayed as
73 * characters. It serves as a separator.
74 * nonprintable: This is a substitute character to display in place
75 * of nonprintable characters.
76 *--------------------------------------------------------------------------*/
84 unsigned char nonprintable
;
87 /*--------------------------------------------------------------------------
90 * Write a hex dump of 'mem' to 'outfile'.
93 * mem: a pointer to the memory to display
94 * bytes: the number of bytes of data to display
95 * addrprint_start: The address to associate with the first byte of
96 * data. For instance, a value of 0 indicates that the
97 * first byte displayed should be labeled as byte 0.
98 * outfile: The place where the hex dump should be written.
99 * For instance, stdout or stderr may be passed here.
100 * format: A structure specifying how the hex dump should be
102 *--------------------------------------------------------------------------*/
103 void hexdump(const void *mem
, int bytes
, uint64_t addrprint_start
,
104 FILE * outfile
, const hexdump_format_t
* format
);
106 #endif /* _HEXDUMP_H */