Functions

lib/kcore/statistics.h File Reference

Kamailio statistics handling. More...

#include "kstats_wrapper.h"
Include dependency graph for lib/kcore/statistics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions


Detailed Description

Definition in file lib/kcore/statistics.h.


Function Documentation

int get_socket_list_from_proto ( int **  ipList,
int  protocol 
)

The first parameter, ipList, is a pointer to a pointer. It will be assigned a new block of memory holding the IP Addresses and ports being listened to with respect to 'protocol'. The array maps a 2D array into a 1 dimensional space, and is layed out as follows:

The first NUM_IP_OCTETS indices will be the IP address, and the next index the port. So if NUM_IP_OCTETS is equal to 4 and there are two IP addresses found, then:

  • ipList[0] will be the first octet of the first ip address
  • ipList[3] will be the last octet of the first ip address.
  • iplist[4] will be the port of the first ip address
  • iplist[5] will be the first octet of the first ip address,
  • and so on.

The function will return the number of sockets which were found. This can be used to index into ipList.

Note:
This function assigns a block of memory equal to:

returnedValue * (NUM_IP_OCTETS + 1) * sizeof(int);

Therefore it is CRUCIAL that you free ipList when you are done with its contents, to avoid a nasty memory leak.

Definition at line 115 of file lib/kcore/statistics.c.

Referenced by get_total_bytes_waiting().

Here is the caller graph for this function:

int get_total_bytes_waiting ( void   ) 

Note: This currently only works on systems supporting the /proc/net/[tcp|udp] interface. On other systems, zero will always be returned. Details of why this is so can be found in network_stats.c

Note: This currently only works on systems supporting the /proc/net/[tcp|udp] interface. On other systems, zero will always be returned. To change this in the future, add an equivalent for get_used_waiting_queue().

Definition at line 395 of file lib/kcore/statistics.c.

References get_socket_list_from_proto(), and get_used_waiting_queue().

Referenced by check_msg_queue_alarm().

Here is the call graph for this function:

Here is the caller graph for this function: