Пример #1
0
/** helper function for some stats (which are kept internally inside sctp).
 */
static counter_val_t sctp_info(counter_handle_t h, void* what)
{
	enum sctp_info_req w;
	struct sctp_gen_info i;

	if (sctp_disable)
		return 0;
	w = (int)(long)what;
	sctp_get_info(&i);
	switch(w) {
		case SCTP_INFO_CONN_NO:
			return i.sctp_connections_no;
		case SCTP_INFO_TRACKED_NO:
			return i.sctp_tracked_no;
		case SCTP_INFO_NONE:
			break;
	};
	return 0;
}
Пример #2
0
static void core_sctpinfo(rpc_t *rpc, void *c)
{
#ifdef USE_SCTP
	void *handle;
	struct sctp_gen_info i;

	if(!sctp_disable) {
		sctp_get_info(&i);
		rpc->add(c, "{", &handle);
		rpc->struct_add(handle, "ddd", "opened_connections",
				i.sctp_connections_no, "tracked_connections", i.sctp_tracked_no,
				"total_connections", i.sctp_total_connections);
	} else {
		rpc->fault(c, 500, "sctp support disabled");
	}
#else
	rpc->fault(c, 500, "sctp support not compiled");
#endif
}