libnl  3.2.24-rc1
Inet Diag library (libnl-idiag)

Modules

 Inet Diag Memory Info
 
 Inet Diag Messages
 
 Inet Diag Requests
 
 Inet Diag TCP Vegas Info
 

Macros

#define IDIAG_SS_ALL   ((1<<IDIAG_SS_MAX)-1)
 Macro to represent all socket states.
 
#define IDIAG_ATTR_ALL   ((1<<IDIAG_ATTR_MAX)-1)
 Macro to represent all socket attributes.
 

Enumerations

enum  {
  IDIAG_SS_UNKNOWN,
  IDIAG_SS_ESTABLISHED,
  IDIAG_SS_SYN_SENT,
  IDIAG_SS_SYN_RECV,
  IDIAG_SS_FIN_WAIT1,
  IDIAG_SS_FIN_WAIT2,
  IDIAG_SS_TIME_WAIT,
  IDIAG_SS_CLOSE,
  IDIAG_SS_CLOSE_WAIT,
  IDIAG_SS_LAST_ACK,
  IDIAG_SS_LISTEN,
  IDIAG_SS_CLOSING,
  IDIAG_SS_MAX
}
 Socket state identifiers.
 
enum  {
  IDIAG_ATTR_NONE,
  IDIAG_ATTR_MEMINFO,
  IDIAG_ATTR_INFO,
  IDIAG_ATTR_VEGASINFO,
  IDIAG_ATTR_CONG,
  IDIAG_ATTR_TOS,
  IDIAG_ATTR_TCLASS,
  IDIAG_ATTR_SKMEMINFO,
  IDIAG_ATTR_SHUTDOWN,
  IDIAG_ATTR_MAX
}
 Inet Diag extended attributes.
 
enum  {
  IDIAG_SK_MEMINFO_RMEM_ALLOC,
  IDIAG_SK_MEMINFO_RCVBUF,
  IDIAG_SK_MEMINFO_WMEM_ALLOC,
  IDIAG_SK_MEMINFO_SNDBUF,
  IDIAG_SK_MEMINFO_FWD_ALLOC,
  IDIAG_SK_MEMINFO_WMEM_QUEUED,
  IDIAG_SK_MEMINFO_OPTMEM,
  IDIAG_SK_MEMINFO_BACKLOG,
  IDIAG_SK_MEMINFO_VARS
}
 Socket memory info identifiers.
 

Socket Creation

int idiagnl_connect (struct nl_sock *sk)
 Create and connect idiag netlink socket. More...
 

Sending

int idiagnl_send_simple (struct nl_sock *sk, int flags, uint8_t family, uint16_t states, uint16_t ext)
 Send trivial idiag netlink message. More...
 

Inet Diag flag and attribute conversions

char * idiagnl_state2str (int state, char *buf, size_t len)
 Convert inet diag socket states to strings. More...
 
int idiagnl_str2state (const char *name)
 Convert inet diag socket state string to int. More...
 
char * idiagnl_timer2str (int timer, char *buf, size_t len)
 Convert inet diag timer types to strings. More...
 
int idiagnl_str2timer (const char *name)
 Convert inet diag timer string to int. More...
 
char * idiagnl_attrs2str (int attrs, char *buf, size_t len)
 Convert inetdiag extended attributes to strings. More...
 
char * idiagnl_tcpstate2str (uint8_t state, char *buf, size_t len)
 Convert inetdiag tcp states to strings. More...
 
char * idiagnl_tcpopts2str (uint8_t attrs, char *buf, size_t len)
 Convert TCP option attributes to string. More...
 
char * idiagnl_shutdown2str (uint8_t shutdown, char *buf, size_t len)
 Convert shutdown state to string. More...
 
char * idiagnl_exts2str (uint8_t attrs, char *buf, size_t len)
 Convert inet diag extension flags to a string. More...
 

Detailed Description

Function Documentation

int idiagnl_connect ( struct nl_sock *  sk)

Create and connect idiag netlink socket.

Parameters
skNetlink socket.

Creates a NETLINK_INET_DIAG socket, binds the socket, and issues a connection attemp.

See Also
nl_connect()
Returns
0 on success or a negative error code.

Definition at line 40 of file idiag.c.

References nl_connect().

+ Here is the call graph for this function:

int idiagnl_send_simple ( struct nl_sock *  sk,
int  flags,
uint8_t  family,
uint16_t  states,
uint16_t  ext 
)

Send trivial idiag netlink message.

Parameters
skNetlink socket.
flagsMessage flags
familyAddress family
statesSocket states to query
extInet Diag attribute extensions to query
Returns
Newly allocated netlink message or NULL.

Definition at line 62 of file idiag.c.

References nl_send_simple().

+ Here is the call graph for this function:

char* idiagnl_state2str ( int  state,
char *  buf,
size_t  len 
)

Convert inet diag socket states to strings.

Parameters
stateinetdiag socket state (e.g., IDIAG_SS_ESTABLISHED)
bufoutput buffer which will hold string result
lenlength in bytes of the output buffer
Returns
string representation of the inetdiag socket state or an empty string.

Definition at line 110 of file idiag.c.

int idiagnl_str2state ( const char *  name)

Convert inet diag socket state string to int.

Parameters
nameinetdiag socket state string
Returns
the int representation of the socket state strign or a negative error code.

Definition at line 123 of file idiag.c.

char* idiagnl_timer2str ( int  timer,
char *  buf,
size_t  len 
)

Convert inet diag timer types to strings.

Parameters
timerinetdiag timer (e.g., IDIAG_TIMER_ON)
bufoutput buffer which will hold string result
lenlength in bytes of the output buffer
Returns
string representation of the inetdiag timer type or an empty string.

Definition at line 145 of file idiag.c.

int idiagnl_str2timer ( const char *  name)

Convert inet diag timer string to int.

Parameters
nameinetdiag timer string
Returns
the int representation of the timer string or a negative error code.

Definition at line 157 of file idiag.c.

char* idiagnl_attrs2str ( int  attrs,
char *  buf,
size_t  len 
)

Convert inetdiag extended attributes to strings.

Parameters
attrsinetdiag attribute (e.g., IDIAG_ATTR_MEMINFO)
bufoutput buffer which will hold string result
lenlength in bytes of the output buffer
Returns
string representation of attrs or an empty string.

Definition at line 180 of file idiag.c.

char* idiagnl_tcpstate2str ( uint8_t  state,
char *  buf,
size_t  len 
)

Convert inetdiag tcp states to strings.

Parameters
stateTCP state (e.g., TCP_CA_Open)
bufoutput buffer which will hold string result
lenlength in bytes of the output buffer

Definition at line 199 of file idiag.c.

char* idiagnl_tcpopts2str ( uint8_t  attrs,
char *  buf,
size_t  len 
)

Convert TCP option attributes to string.

Parameters
attrsTCP option attributes to convert (e.g., TCPI_OPT_SACK | TCPI_OPT_WSCALE)
bufOutput buffer for string
lenLength in bytes of output buffer
Returns
buffer with string representation or empty string

Definition at line 221 of file idiag.c.

char* idiagnl_shutdown2str ( uint8_t  shutdown,
char *  buf,
size_t  len 
)

Convert shutdown state to string.

Parameters
shutdownShutdown state (e.g., idiag_msg->shutdown)
bufOuput buffer to hold string representation
lenLength in bytes of output buffer
Returns
string representation of shutdown state or NULL

Definition at line 235 of file idiag.c.

char* idiagnl_exts2str ( uint8_t  attrs,
char *  buf,
size_t  len 
)

Convert inet diag extension flags to a string.

Parameters
attrsinet diag extension flags (e.g., (IDIAG_ATTR_MEMINFO | IDIAG_ATTR_CONG | IDIAG_ATTR_TOS))
bufOutput buffer to hold string representation
lenlength in bytes of the output buffer

Definition at line 268 of file idiag.c.