src/dumpstats.c
static int stats_dump_table_entry_to_buffer(struct chunk *msg, struct stream_interface *si,
					    struct proxy *proxy, struct stksess *entry)
{
	int dt;

	chunk_appendf(msg, "%p:", entry);

	if (proxy->table.type == STKTABLE_TYPE_IP) {
		char addr[INET_ADDRSTRLEN];
		inet_ntop(AF_INET, (const void *)&entry->key.key, addr, sizeof(addr));
		chunk_appendf(msg, " key=%s", addr);
	}
	else if (proxy->table.type == STKTABLE_TYPE_IPV6) {
		char addr[INET6_ADDRSTRLEN];
		inet_ntop(AF_INET6, (const void *)&entry->key.key, addr, sizeof(addr));
		chunk_appendf(msg, " key=%s", addr);
	}
	else if (proxy->table.type == STKTABLE_TYPE_INTEGER) {
		chunk_appendf(msg, " key=%u", *(unsigned int *)entry->key.key);
	}
	else if (proxy->table.type == STKTABLE_TYPE_STRING) {
		chunk_appendf(msg, " key=");
		dump_text(msg, (const char *)entry->key.key, proxy->table.key_size);
	}
	else {
		chunk_appendf(msg, " key=");
		dump_binary(msg, (const char *)entry->key.key, proxy->table.key_size);
	}

	chunk_appendf(msg, " use=%d exp=%d", entry->ref_cnt - 1, tick_remain(now_ms, entry->expire));

	for (dt = 0; dt < STKTABLE_DATA_TYPES; dt++) {
		void *ptr;

		if (proxy->table.data_ofs[dt] == 0)
			continue;
		if (stktable_data_types[dt].arg_type == ARG_T_DELAY)
			chunk_appendf(msg, " %s(%d)=", stktable_data_types[dt].name, proxy->table.data_arg[dt].u);
		else
			chunk_appendf(msg, " %s=", stktable_data_types[dt].name);

		ptr = stktable_data_ptr(&proxy->table, entry, dt);
		switch (stktable_data_types[dt].std_type) {
		case STD_T_SINT:
			chunk_appendf(msg, "%d", stktable_data_cast(ptr, std_t_sint));
			break;
		case STD_T_UINT:
			chunk_appendf(msg, "%u", stktable_data_cast(ptr, std_t_uint));
			break;
		case STD_T_ULL:
			chunk_appendf(msg, "%lld", stktable_data_cast(ptr, std_t_ull));
			break;
		case STD_T_FRQP:
			chunk_appendf(msg, "%d",
				     read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
							  proxy->table.data_arg[dt].u));
			break;
		}
	}
	chunk_appendf(msg, "\n");

	if (bi_putchk(si->ib, msg) == -1)
		return 0;

	return 1;
}
/* Dump the a table entry to a stream interface's
 * read buffer. It returns 0 if the output buffer is full
 * and needs to be called again, otherwise non-zero.
 */
Dump the a table entry to a stream interface's
read buffer. It returns 0 if the output buffer is full
and needs to be called again, otherwise non-zero.
Dump the a table entry to a stream interface ' s read buffer . It returns 0 if the output buffer is full and needs to be called again otherwise non - zero .
static int stats_dump_table_entry_to_buffer(struct chunk *msg, struct stream_interface *si,
					    struct proxy *proxy, struct stksess *entry)
{
	int dt;
	chunk_appendf(msg, "%p:", entry);
	if (proxy->table.type == STKTABLE_TYPE_IP) {
		char addr[INET_ADDRSTRLEN];
		inet_ntop(AF_INET, (const void *)&entry->key.key, addr, sizeof(addr));
		chunk_appendf(msg, " key=%s", addr);
	}
	else if (proxy->table.type == STKTABLE_TYPE_IPV6) {
		char addr[INET6_ADDRSTRLEN];
		inet_ntop(AF_INET6, (const void *)&entry->key.key, addr, sizeof(addr));
		chunk_appendf(msg, " key=%s", addr);
	}
	else if (proxy->table.type == STKTABLE_TYPE_INTEGER) {
		chunk_appendf(msg, " key=%u", *(unsigned int *)entry->key.key);
	}
	else if (proxy->table.type == STKTABLE_TYPE_STRING) {
		chunk_appendf(msg, " key=");
		dump_text(msg, (const char *)entry->key.key, proxy->table.key_size);
	}
	else {
		chunk_appendf(msg, " key=");
		dump_binary(msg, (const char *)entry->key.key, proxy->table.key_size);
	}
	chunk_appendf(msg, " use=%d exp=%d", entry->ref_cnt - 1, tick_remain(now_ms, entry->expire));
	for (dt = 0; dt < STKTABLE_DATA_TYPES; dt++) {
		void *ptr;
		if (proxy->table.data_ofs[dt] == 0)
			continue;
		if (stktable_data_types[dt].arg_type == ARG_T_DELAY)
			chunk_appendf(msg, " %s(%d)=", stktable_data_types[dt].name, proxy->table.data_arg[dt].u);
		else
			chunk_appendf(msg, " %s=", stktable_data_types[dt].name);
		ptr = stktable_data_ptr(&proxy->table, entry, dt);
		switch (stktable_data_types[dt].std_type) {
		case STD_T_SINT:
			chunk_appendf(msg, "%d", stktable_data_cast(ptr, std_t_sint));
			break;
		case STD_T_UINT:
			chunk_appendf(msg, "%u", stktable_data_cast(ptr, std_t_uint));
			break;
		case STD_T_ULL:
			chunk_appendf(msg, "%lld", stktable_data_cast(ptr, std_t_ull));
			break;
		case STD_T_FRQP:
			chunk_appendf(msg, "%d",
				     read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
							  proxy->table.data_arg[dt].u));
			break;
		}
	}
	chunk_appendf(msg, "\n");
	if (bi_putchk(si->ib, msg) == -1)
		return 0;
	return 1;
}
static int stats_dump_table_entry_to_buffer ( struct chunk * msg , struct stream_interface * si , struct proxy * proxy , struct stksess * entry ) { int dt ; chunk_appendf ( msg , " " , entry ) ; if ( proxy -> table . type == STKTABLE_TYPE_IP ) { char addr [ INET_ADDRSTRLEN ] ; inet_ntop ( AF_INET , ( const void * ) & entry -> key . key , addr , sizeof ( addr ) ) ; chunk_appendf ( msg , " " , addr ) ; } else if ( proxy -> table . type == STKTABLE_TYPE_IPV6 ) { char addr [ INET6_ADDRSTRLEN ] ; inet_ntop ( AF_INET6 , ( const void * ) & entry -> key . key , addr , sizeof ( addr ) ) ; chunk_appendf ( msg , " " , addr ) ; } else if ( proxy -> table . type == STKTABLE_TYPE_INTEGER ) { chunk_appendf ( msg , " " , * ( unsigned int * ) entry -> key . key ) ; } else if ( proxy -> table . type == STKTABLE_TYPE_STRING ) { chunk_appendf ( msg , " " ) ; dump_text ( msg , ( const char * ) entry -> key . key , proxy -> table . key_size ) ; } else { chunk_appendf ( msg , " " ) ; dump_binary ( msg , ( const char * ) entry -> key . key , proxy -> table . key_size ) ; } chunk_appendf ( msg , " " , entry -> ref_cnt - 1 , tick_remain ( now_ms , entry -> expire ) ) ; for ( dt = 0 ; dt < STKTABLE_DATA_TYPES ; dt ++ ) { void * ptr ; if ( proxy -> table . data_ofs [ dt ] == 0 ) continue ; if ( stktable_data_types [ dt ] . arg_type == ARG_T_DELAY ) chunk_appendf ( msg , " " , stktable_data_types [ dt ] . name , proxy -> table . data_arg [ dt ] . u ) ; else chunk_appendf ( msg , " " , stktable_data_types [ dt ] . name ) ; ptr = stktable_data_ptr ( & proxy -> table , entry , dt ) ; switch ( stktable_data_types [ dt ] . std_type ) { case STD_T_SINT : chunk_appendf ( msg , " " , stktable_data_cast ( ptr , std_t_sint ) ) ; break ; case STD_T_UINT : chunk_appendf ( msg , " " , stktable_data_cast ( ptr , std_t_uint ) ) ; break ; case STD_T_ULL : chunk_appendf ( msg , " " , stktable_data_cast ( ptr , std_t_ull ) ) ; break ; case STD_T_FRQP : chunk_appendf ( msg , " " , read_freq_ctr_period ( & stktable_data_cast ( ptr , std_t_frqp ) , proxy -> table . data_arg [ dt ] . u ) ) ; break ; } } chunk_appendf ( msg , " \n " ) ; if ( bi_putchk ( si -> ib , msg ) == -1 ) return 0 ; return 1 ; }
Dump the a table entry to a stream interface's
 read buffer.
Dump the a table entry to a stream interface ' s read buffer .