add a way to dump packet as K12 format for debug
authorHanoh Haim <[email protected]>
Thu, 29 Sep 2016 13:35:26 +0000 (16:35 +0300)
committerHanoh Haim <[email protected]>
Thu, 29 Sep 2016 13:50:29 +0000 (16:50 +0300)
src/common/basic_utils.cpp
src/common/basic_utils.h

index b227769..f169c29 100755 (executable)
@@ -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;
index 1884e89..f6250a2 100755 (executable)
@@ -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);