oops
[libnl.git] / include / netlink / utils.h
1 /*
2  * netlink/utils.h              Utility Functions
3  *
4  *      This library is free software; you can redistribute it and/or
5  *      modify it under the terms of the GNU Lesser General Public
6  *      License as published by the Free Software Foundation version 2.1
7  *      of the License.
8  *
9  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10  */
11
12 #ifndef NETLINK_UTILS_H_
13 #define NETLINK_UTILS_H_
14
15 #include <netlink/netlink.h>
16 #include <netlink/list.h>
17
18 /**
19  * @name Probability Constants
20  * @{
21  */
22
23 /**
24  * Lower probability limit
25  * @ingroup utils
26  */
27 #define NL_PROB_MIN 0x0
28
29 /**
30  * Upper probability limit
31  * @ingroup utils
32  */
33 #define NL_PROB_MAX 0xffffffff
34
35 /** @} */
36
37 extern char *   nl_geterror(void);
38 extern int      nl_get_errno(void);
39
40 /* unit pretty-printing */
41 extern double   nl_cancel_down_bytes(unsigned long long, char **);
42 extern double   nl_cancel_down_bits(unsigned long long, char **);
43 extern double   nl_cancel_down_us(uint32_t, char **);
44
45 /* generic unit translations */
46 extern long     nl_size2int(const char *);
47 extern long     nl_prob2int(const char *);
48
49 /* time translations */
50 extern int      nl_get_hz(void);
51 extern uint32_t nl_us2ticks(uint32_t);
52 extern uint32_t nl_ticks2us(uint32_t);
53 extern char *   nl_msec2str(uint64_t, char *, size_t);
54
55 /* link layer protocol translations */
56 extern char *   nl_llproto2str(int, char *, size_t);
57 extern int      nl_str2llproto(const char *);
58
59 /* ethernet protocol translations */
60 extern char *   nl_ether_proto2str(int, char *, size_t);
61 extern int      nl_str2ether_proto(const char *);
62
63
64 #endif