libnl
1.1
|
Modules | |
Abstract Address | |
Abstract Data | |
Data Structures | |
struct | nl_dump_params |
Dumping parameters. More... | |
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. | |
struct nl_dump_params | nl_debug_dp |
Error Code Helpers | |
int | nl_get_errno (void) |
char * | nl_geterror (void) |
Return error message for an error code. More... | |
void | nl_perror (const char *s) |
Print a libnl error message. More... | |
Unit Pretty-Printing | |
double | nl_cancel_down_bytes (unsigned long long l, char **unit) |
Cancel down a byte counter. More... | |
double | nl_cancel_down_bits (unsigned long long l, char **unit) |
Cancel down a bit counter. More... | |
double | nl_cancel_down_us (uint32_t l, char **unit) |
Cancel down a micro second value. More... | |
Generic Unit Translations | |
long | nl_size2int (const char *str) |
Convert a character string to a size. More... | |
long | nl_prob2int (const char *str) |
Convert a character string to a probability. More... | |
Time Translations | |
int | nl_get_hz (void) |
Return the value of HZ. | |
uint32_t | nl_us2ticks (uint32_t us) |
Convert micro seconds to ticks. More... | |
uint32_t | nl_ticks2us (uint32_t ticks) |
Convert ticks to micro seconds. More... | |
long | nl_time2int (const char *str) |
char * | nl_msec2str (uint64_t msec, char *buf, size_t len) |
Convert milliseconds to a character string. More... | |
Link Layer Protocol Translations | |
char * | nl_llproto2str (int llproto, char *buf, size_t len) |
int | nl_str2llproto (const char *name) |
Ethernet Protocol Translations | |
char * | nl_ether_proto2str (int eproto, char *buf, size_t len) |
int | nl_str2ether_proto (const char *name) |
IP Protocol Translations | |
char * | nl_ip_proto2str (int proto, char *buf, size_t len) |
int | nl_str2ip_proto (const char *name) |
Dumping Helpers | |
void | nl_new_line (struct nl_dump_params *params, int line) |
Handle a new line while dumping. More... | |
void | nl_dump (struct nl_dump_params *params, const char *fmt,...) |
Dump a formatted character string. More... | |
Probability Constants | |
#define | NL_PROB_MIN 0x0 |
Lower probability limit. | |
#define | NL_PROB_MAX 0xffffffff |
Upper probability limit. | |
enum nl_dump_type |
char* nl_geterror | ( | void | ) |
void nl_perror | ( | const char * | s | ) |
s | error message prefix |
Prints the error message of the call that failed last.
If s is not NULL and *s is not a null byte the argument string is printed, followed by a colon and a blank. Then the error message and a new-line.
Definition at line 163 of file utils.c.
References nl_geterror().
double nl_cancel_down_bytes | ( | unsigned long long | l, |
char ** | unit | ||
) |
double nl_cancel_down_bits | ( | unsigned long long | l, |
char ** | unit | ||
) |
double nl_cancel_down_us | ( | uint32_t | l, |
char ** | unit | ||
) |
long nl_size2int | ( | const char * | str | ) |
long nl_prob2int | ( | const char * | str | ) |
str | probability encoded as character string |
Converts the specified probability as character to the corresponding probability number.
Supported formats are:
Definition at line 325 of file utils.c.
References NL_PROB_MAX.
uint32_t nl_us2ticks | ( | uint32_t | us | ) |
us | micro seconds |
Definition at line 429 of file utils.c.
Referenced by rtnl_netem_set_delay(), and rtnl_netem_set_jitter().
uint32_t nl_ticks2us | ( | uint32_t | ticks | ) |
ticks | number of ticks |
Definition at line 440 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 | ||
) |
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.
void nl_new_line | ( | struct nl_dump_params * | params, |
int | line | ||
) |
params | Dumping parameters |
line | Number of lines dumped already. |
This function must be called before dumping any onto a new line. It will ensure proper prefixing as specified by the dumping parameters.
Definition at line 725 of file utils.c.
References nl_dump_params::dp_buf, nl_dump_params::dp_buflen, nl_dump_params::dp_fd, nl_dump_params::dp_nl_cb, and nl_dump_params::dp_prefix.
void nl_dump | ( | struct nl_dump_params * | params, |
const char * | fmt, | ||
... | |||
) |
struct nl_dump_params nl_debug_dp |