static int parse_traffic ( char * buf , int len , char * port , uint64_t * traffic ) {
 char * data = get_data ( buf , len ) ;
 char error_buf [ 512 ] ;
 json_settings settings = {
 0 }
 ;
 if ( data == NULL ) {
 LOGE ( "No data found" ) ;
 return - 1 ;
 }
 json_value * obj = json_parse_ex ( & settings , data , strlen ( data ) , error_buf ) ;
 if ( obj == NULL ) {
 LOGE ( "%s" , error_buf ) ;
 return - 1 ;
 }
 if ( obj -> type == json_object ) {
 int i = 0 ;
 for ( i = 0 ;
 i < obj -> u . object . length ;
 i ++ ) {
 char * name = obj -> u . object . values [ i ] . name ;
 json_value * value = obj -> u . object . values [ i ] . value ;
 if ( value -> type == json_integer ) {
 strncpy ( port , name , 8 ) ;
 * traffic = value -> u . integer ;
 }
 }
 }
 json_value_free ( obj ) ;
 return 0 ;
 }
static int parse_traffic ( char * buf , int len , char * port , uint64_t * traffic ) {
 char * data = get_data ( buf , len ) ;
 char error_buf [ 512 ] ;
 json_settings settings = {
 0 }
 ;
 if ( data == NULL ) {
 LOGE ( "No data found" ) ;
 return - 1 ;
 }
 json_value * obj = json_parse_ex ( & settings , data , strlen ( data ) , error_buf ) ;
 if ( obj == NULL ) {
 LOGE ( "%s" , error_buf ) ;
 return - 1 ;
 }
 if ( obj -> type == json_object ) {
 int i = 0 ;
 for ( i = 0 ;
 i < obj -> u . object . length ;
 i ++ ) {
 char * name = obj -> u . object . values [ i ] . name ;
 json_value * value = obj -> u . object . values [ i ] . value ;
 if ( value -> type == json_integer ) {
 strncpy ( port , name , 8 ) ;
 * traffic = value -> u . integer ;
 }
 }
 }
 json_value_free ( obj ) ;
 return 0 ;
 }