예제 #1
0
void log_hex(LogType type, const void *data, unsigned long length, unsigned char padding) {
    char buffer[80];
    uint32 offset;
    for(offset=0;offset<length;offset+=16) {
        build_hex_line((const uint8 *)data,length,offset,buffer,padding);
        log_message(type, "%s", buffer);    //%s is to prevent % escapes in the ascii
    }
}
예제 #2
0
void log_phex(LogType type, const void *data, unsigned long length, unsigned char padding) {
    if(length <= 1024)
        log_hex(type, data, length, padding);
    else {
        char buffer[80];
        log_hex(type, data, 1024-32, padding);
        log_message(type, " ... truncated ...");
        build_hex_line((const uint8 *)data,length,length-16,buffer,padding);
        log_message(type, "%s", buffer);
    }
}
예제 #3
0
void pfxHexDump( const char* pfx, LogType type, const uint8* data, uint32 length )
{
    char buffer[80];

    for( uint32 offset = 0; offset < length; offset += 16 )
    {
        build_hex_line( data, length, offset, buffer, 4 );

        _log( type, "%s%s", pfx, buffer );
    }
}
예제 #4
0
void pfxHexDump( const char* pfx, FILE* into, const uint8* data, uint32 length )
{
    char buffer[80];

    for( uint32 offset = 0; offset < length; offset += 16 )
    {
        build_hex_line( data, length, offset, buffer, 4 );

        fprintf( into, "%s%s\n", pfx, buffer );
    }
}
예제 #5
0
void pfxHexDumpPreview( const char* pfx, FILE* into, const uint8* data, uint32 length )
{
    char buffer[80];

    if( length > HEX_DUMP_PREVIEW_LIMIT )
    {
        pfxHexDump( pfx, into, data, HEX_DUMP_PREVIEW_LIMIT - 32 );
        fprintf( into, "%s ... truncated ...\n", pfx );

        build_hex_line( data, length, length - 16, buffer, 4 );
        fprintf( into, "%s%s\n", pfx, buffer );
    }
    else
        pfxHexDump( pfx, into, data, length );
}
예제 #6
0
void pfxHexDumpPreview( const char* pfx, LogType type, const uint8* data, uint32 length )
{
    char buffer[80];

    if( length > HEX_DUMP_PREVIEW_LIMIT )
    {
        pfxHexDump( pfx, type, data, HEX_DUMP_PREVIEW_LIMIT - 32 );
        _log( type, "%s ... truncated ...", pfx );

        build_hex_line( data, length, length - 16, buffer, 4 );
        _log( type, "%s%s", pfx, buffer );
    }
    else
        pfxHexDump( pfx, type, data, length );
}