summaryrefslogtreecommitdiff
path: root/h64e/core.h
blob: 703c3aa7dadabaa737a9d543e78debd5fc9a2494 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __H64E_CORE_H
#define __H64E_CORE_H

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>

#define H64E_G_NONE   0
#define H64E_G_BYTE   1
#define H64E_G_WORD   2
#define H64E_G_DWORD  3
#define H64E_G_QWORD  4


#define H64E_O_START   0
#define H64E_O_NONE    0
#define H64E_O_STRING  1
#define H64E_O_INT8    2
#define H64E_O_UINT8   3
#define H64E_O_INT16   4
#define H64E_O_UINT16  5
#define H64E_O_INT32   6
#define H64E_O_UINT32  7
#define H64E_O_INT64   8
#define H64E_O_UINT64  9
#define H64E_O_END     H64E_O_UINT64

#define H64E_OK     0
#define H64E_OESIZE 1 /*size mistmatch*/

typedef int (*trnf_clb)(char*);
typedef int (*output_clb)(char*);

typedef struct h64e_t
{
	int flag_offset; /* output offset */
	uint64_t offset_addr; /* offset postion */
	uint8_t column_size; /* size of column to operate with */
	int flag_no_group; /* dont output hex values */
	uint8_t group;   /* if there is need transdorm to specific type */
	int flag_output; /* output convereted types */
	uint8_t output_type; /* output in many different ways */
} h64e_t; 

/* set default values */
int h64e_set_default( h64e_t *fmt );
/* check if all parametrs work well with each other */
int h64e_check_param( h64e_t *fmt );
int h64e_output( uint8_t *buf, size_t size );
/* feed output to be printed out line by line  */
int h64e_output_line( h64e_t *fmt, uint8_t *buf, size_t size );
/* feed output to be printed out as buffer */
int h64e_output_buffer( h64e_t *fmt, uint8_t *buf, size_t size);
int h64e_transform_sz( h64e_t *fmt );
int h64e_outpt_sz( h64e_t *fmt );
int h64e_space_sz( h64e_t *fmt );
int h64e_outputf( h64e_t *fmt, uint8_t *buf, size_t nsize );
int h64e_read_req( h64e_t *fmt, uint8_t *buf, size_t size );
trnf_clb h64e_trnf_fun( h64e_t *fmt );
output_clb h64e_outpt_fun( h64e_t *fmt );
int h64e_outputf_padding( h64e_t *fmt, uint8_t *buf, size_t nsize, int column );

int trnf_byte( char *buf );
int trnf_word( char *buf );
int trnf_dword( char *buf );
int trnf_qword( char *buf );

int outpt_str( char *buf );
int outpt_int8( char *buf );
int outpt_uint8( char *buf );
int outpt_int16( char *buf );
int outpt_uint16( char *buf );
int outpt_int32( char *buf );
int outpt_uint32( char *buf );
int outpt_int64( char *buf );
int outpt_uint64( char *buf );
#endif