diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-09-29 16:35:26 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-09-29 16:50:29 +0300 |
commit | 567fe4bc797c01e23e93c2d342fa5590d3f7b96e (patch) | |
tree | fadcc35a1e111deaa4c80d53416521d8954df6f2 /src/common | |
parent | 1c53876353af39ddfb0d60196c2a3ac26ecd30c8 (diff) |
add a way to dump packet as K12 format for debug
Diffstat (limited to 'src/common')
-rwxr-xr-x | src/common/basic_utils.cpp | 12 | ||||
-rwxr-xr-x | src/common/basic_utils.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/common/basic_utils.cpp b/src/common/basic_utils.cpp index b2277697..f169c29f 100755 --- a/src/common/basic_utils.cpp +++ b/src/common/basic_utils.cpp @@ -29,6 +29,18 @@ bool utl_is_file_exists (const std::string& name) { } } +void utl_k12_pkt_format(FILE* fp,void * src, unsigned int size) { + unsigned int i; + fprintf(fp,"\n"); + fprintf(fp,"+---------+---------------+----------+\n"); + fprintf(fp,"00:00:00,000,000 ETHER \n"); + fprintf(fp,"|0 |"); + for ( i=0; i<size;i++ ) { + fprintf(fp,"%02x|",((unsigned char *)src)[i]); + } + fprintf(fp,"\n");; +} + void utl_DumpBuffer(FILE* fp,void * src, unsigned int size,int offset) { unsigned int i; diff --git a/src/common/basic_utils.h b/src/common/basic_utils.h index 1884e896..f6250a2b 100755 --- a/src/common/basic_utils.h +++ b/src/common/basic_utils.h @@ -40,6 +40,7 @@ inline uint utl_align_down(uint num,uint round){ return( (num) & (~(round-1)) ); } +void utl_k12_pkt_format(FILE* fp,void * src, unsigned int size) ; void utl_DumpBuffer(FILE* fp,void * src, unsigned int size,int offset=0); |