Utilities


Modules

 Abstract Address
 
1) Transform character string to abstract address

 Caching
 
   Cache Management             |    | Type Specific Cache Operations
                                      
                                |    | +----------------+ +------------+
                                       | request update | | msg_parser |
                                |    | +----------------+ +------------+
                                     +- - - - -^- - - - - - - -^- -|- - - -
    nl_cache_update:            |              |               |   |
          1) --------- co_request_update ------+               |   |
                                |                              |   |
          2) destroy old cache     +----------- pp_cb ---------|---+
                                |  |                           |
          3) ---------- nl_recvmsgs ----------+   +- cb_valid -+
             +--------------+   |  |          |   |
             | nl_cache_add |<-----+   + - - -v- -|- - - - - - - - - - -
             +--------------+   |      | +-------------+
                                         | nl_recvmsgs |
                                |      | +-----|-^-----+
                                           +---v-|---+
                                |      |   | nl_recv |
                                           +---------+
                                |      |                 Core Netlink

 Cache Management
 Abstract Data

Data Structures

struct  nl_dump_params
 Dumping parameters. More...

Error Code Helpers

char * nl_geterror (void)
 Return error message for an error code.

Time Translations

int nl_get_hz (void)
 Return the value of HZ.
uint32_t nl_us2ticks (uint32_t us)
 Convert micro seconds to ticks.
uint32_t nl_ticks2us (uint32_t ticks)
 Convert ticks to micro seconds.
long nl_time2int (const char *str)
char * nl_msec2str (uint64_t msec, char *buf, size_t len)
 Convert milliseconds to a character string.

Link Layer Protocol Translations

char * nl_llproto2str (int llproto, char *buf, size_t len)
 Convert a link layer protocol to a character string (Reentrant).
int nl_str2llproto (const char *name)
 Convert a character string to a link layer protocol.

Ethernet Protocol Translations

char * nl_ether_proto2str (int eproto, char *buf, size_t len)
 Convert a ethernet protocol to a character string (Reentrant).
int nl_str2ether_proto (const char *name)
 Convert a character string to a ethernet protocol.

Unit Pretty-Printing

double nl_cancel_down_bytes (unsigned long long l, char **unit)
 Cancel down a byte counter.
double nl_cancel_down_bits (unsigned long long l, char **unit)
 Cancel down a bit counter.
double nl_cancel_down_us (uint32_t l, char **unit)
 Cancel down a micro second value.

Generic Unit Translations

long nl_size2int (const char *str)
 Convert a character string to a size.
long nl_prob2int (const char *str)
 Convert a character string to a probability.

Probability Constants

#define NL_PROB_MIN   0x0
 Lower probability limit.
#define NL_PROB_MAX   0xffffffff
 Upper probability limit.

Enumerations

enum  nl_dump_type {
  NL_DUMP_BRIEF, NL_DUMP_FULL, NL_DUMP_STATS, NL_DUMP_XML,
  NL_DUMP_ENV, NL_DUMP_EVENTS, __NL_DUMP_MAX
}
 Dumping types (dp_type). More...

Variables

int nl_debug = 0
 Debug level.


Define Documentation

#define NL_PROB_MIN   0x0

Lower probability limit.

Definition at line 27 of file utils.h.

#define NL_PROB_MAX   0xffffffff

Upper probability limit.

Definition at line 33 of file utils.h.

Referenced by nl_prob2int().


Enumeration Type Documentation

enum nl_dump_type

Dumping types (dp_type).

Enumerator:
NL_DUMP_BRIEF  Dump object in a brief one-liner.
NL_DUMP_FULL  Dump all attributes but no statistics.
NL_DUMP_STATS  Dump all attributes including statistics.
NL_DUMP_XML  Dump all attribtes in XML format.
NL_DUMP_ENV  Dump all attribtues as env variables.
NL_DUMP_EVENTS  Dump event.

Definition at line 21 of file types.h.


Function Documentation

char* nl_geterror ( void   ) 

Return error message for an error code.

Returns:
error message

Definition at line 80 of file utils.c.

Referenced by nl_cache_pickup().

double nl_cancel_down_bytes ( unsigned long long  l,
char **  unit 
)

Cancel down a byte counter.

Parameters:
l byte counter
unit destination unit pointer
Cancels down a byte counter until it reaches a reasonable unit. The chosen unit is assigned to unit.

Returns:
The cancelled down byte counter in the new unit.

Definition at line 108 of file utils.c.

double nl_cancel_down_bits ( unsigned long long  l,
char **  unit 
)

Cancel down a bit counter.

Parameters:
l bit counter
unit destination unit pointer
Cancels downa bit counter until it reaches a reasonable unit. The chosen unit is assigned to unit.

Returns:
The cancelled down bit counter in the new unit.

Definition at line 138 of file utils.c.

double nl_cancel_down_us ( uint32_t  l,
char **  unit 
)

Cancel down a micro second value.

Parameters:
l micro seconds
unit destination unit pointer
Cancels down a microsecond counter until it reaches a reasonable unit. The chosen unit is assigned to unit.

Returns:
The cancelled down microsecond in the new unit

Definition at line 169 of file utils.c.

long nl_size2int ( const char *  str  ) 

Convert a character string to a size.

Parameters:
str size encoded as character string
Converts the specified size as character to the corresponding number of bytes.

Supported formats are:

Returns:
The number of bytes or -1 if the string is unparseable

Definition at line 203 of file utils.c.

long nl_prob2int ( const char *  str  ) 

Convert a character string to a probability.

Parameters:
str probability encoded as character string
Converts the specified probability as character to the corresponding probability number.

Supported formats are:

Returns:
The probability relative to NL_PROB_MIN and NL_PROB_MAX

Definition at line 245 of file utils.c.

References NL_PROB_MAX.

int nl_get_hz ( void   ) 

Return the value of HZ.

Definition at line 338 of file utils.c.

uint32_t nl_us2ticks ( uint32_t  us  ) 

Convert micro seconds to ticks.

Parameters:
us micro seconds
Returns:
number of ticks

Definition at line 349 of file utils.c.

Referenced by rtnl_netem_set_delay(), and rtnl_netem_set_jitter().

uint32_t nl_ticks2us ( uint32_t  ticks  ) 

Convert ticks to micro seconds.

Parameters:
ticks number of ticks
Returns:
microseconds

Definition at line 360 of file utils.c.

Referenced by rtnl_netem_get_delay(), and rtnl_netem_get_jitter().

char* nl_msec2str ( uint64_t  msec,
char *  buf,
size_t  len 
)

Convert milliseconds to a character string.

Parameters:
msec number of milliseconds
buf destination buffer
len buffer length
Converts milliseconds to a character string split up in days, hours, minutes, seconds, and milliseconds and stores it in the specified destination buffer.

Returns:
The destination buffer.

Definition at line 398 of file utils.c.

char* nl_llproto2str ( int  llproto,
char *  buf,
size_t  len 
)

Convert a link layer protocol to a character string (Reentrant).

Parameters:
llproto link layer protocol
buf destination buffer
len buffer length
Converts a link layer protocol to a character string and stores it in the specified destination buffer.

Returns:
The destination buffer or the type encoded in hexidecimal form if no match was found.

Definition at line 520 of file utils.c.

int nl_str2llproto ( const char *  name  ) 

Convert a character string to a link layer protocol.

Parameters:
name name of link layer protocol
Converts the provided character string specifying a link layer protocl to the corresponding numeric value.

Returns:
link layer protocol or a negative value if none was found.

Definition at line 534 of file utils.c.

char* nl_ether_proto2str ( int  eproto,
char *  buf,
size_t  len 
)

Convert a ethernet protocol to a character string (Reentrant).

Parameters:
eproto ethernet protocol
buf destination buffer
len buffer length
Converts a ethernet protocol to a character string and stores it in the specified destination buffer.

Returns:
The destination buffer or the type encoded in hexidecimal form if no match was found.

Definition at line 613 of file utils.c.

int nl_str2ether_proto ( const char *  name  ) 

Convert a character string to a ethernet protocol.

Parameters:
name name of ethernet protocol
Converts the provided character string specifying a ethernet protocl to the corresponding numeric value.

Returns:
ethernet protocol or a negative value if none was found.

Definition at line 628 of file utils.c.


Variable Documentation

int nl_debug = 0

Debug level.

Definition at line 25 of file utils.c.


Generated on Fri Apr 27 14:14:08 2007 for libnl by  doxygen 1.5.1