Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
hexdump.c File Reference
#include <linux/types.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/export.h>

Go to the source code of this file.

Functions

 EXPORT_SYMBOL (hex_asc)
 
int hex_to_bin (char ch)
 
 EXPORT_SYMBOL (hex_to_bin)
 
int hex2bin (u8 *dst, const char *src, size_t count)
 
 EXPORT_SYMBOL (hex2bin)
 
void hex_dump_to_buffer (const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii)
 
 EXPORT_SYMBOL (hex_dump_to_buffer)
 

Variables

const char hex_asc [] = "0123456789abcdef"
 

Function Documentation

EXPORT_SYMBOL ( hex_asc  )
EXPORT_SYMBOL ( hex_to_bin  )
EXPORT_SYMBOL ( hex2bin  )
EXPORT_SYMBOL ( hex_dump_to_buffer  )
int hex2bin ( u8 dst,
const char src,
size_t  count 
)

hex2bin - convert an ascii hexadecimal string to its binary representation : binary result : ascii hexadecimal string : result length

Return 0 on success, -1 in case of bad input.

Definition at line 44 of file hexdump.c.

void hex_dump_to_buffer ( const void buf,
size_t  len,
int  rowsize,
int  groupsize,
char linebuf,
size_t  linebuflen,
bool  ascii 
)

hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory : data blob to dump : number of bytes in the : number of bytes to print per line; must be 16 or 32 : number of bytes to print at a time (1, 2, 4, 8; default = 1) : where to put the converted data : total size of , including space for terminating NUL : include ASCII after the hex output

hex_dump_to_buffer() works on one "line" of output at a time, i.e., 16 or 32 bytes of input data converted to hex + ASCII output.

Given a buffer of u8 data, hex_dump_to_buffer() converts the input data to a hex + ASCII dump at the supplied memory location. The converted output is always NUL-terminated.

E.g.: hex_dump_to_buffer(frame->data, frame->len, 16, 1, linebuf, sizeof(linebuf), true);

example output buffer: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f

Definition at line 83 of file hexdump.c.

int hex_to_bin ( char  ch)

hex_to_bin - convert a hex digit to its real value : ascii character represents hex digit

hex_to_bin() converts one hex digit to its actual value or -1 in case of bad input.

Definition at line 25 of file hexdump.c.

Variable Documentation

const char hex_asc[] = "0123456789abcdef"

Definition at line 15 of file hexdump.c.