aboutsummaryrefslogtreecommitdiffstats
path: root/package/libs/libnl-tiny/src/include/netlink/utils.h
blob: 480bab61869c3889573422b9c5bfbb9537307cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * netlink/utils.h		Utility Functions
 *
 *	This library is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation version 2.1
 *	of the License.
 *
 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
 */

#ifndef NETLINK_UTILS_H_
#define NETLINK_UTILS_H_

#include <netlink/netlink.h>
#include <netlink/list.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @name Probability Constants
 * @{
 */

/**
 * Lower probability limit
 * @ingroup utils
 */
#define NL_PROB_MIN 0x0

/**
 * Upper probability limit
 * @ingroup utils
 */
#define NL_PROB_MAX 0xffffffff

/** @} */

/* unit pretty-printing */
extern double	nl_cancel_down_bytes(unsigned long long, char **);
extern double	nl_cancel_down_bits(unsigned long long, char **);
extern double	nl_cancel_down_us(uint32_t, char **);

/* generic unit translations */
extern long	nl_size2int(const char *);
extern long	nl_prob2int(const char *);

/* time translations */
extern int	nl_get_hz(void);
extern uint32_t	nl_us2ticks(uint32_t);
extern uint32_t	nl_ticks2us(uint32_t);
extern int	nl_str2msec(const char *, uint64_t *);
extern char *	nl_msec2str(uint64_t, char *, size_t);

/* link layer protocol translations */
extern char *	nl_llproto2str(int, char *, size_t);
extern int	nl_str2llproto(const char *);

/* ethernet protocol translations */
extern char *	nl_ether_proto2str(int, char *, size_t);
extern int	nl_str2ether_proto(const char *);

/* IP protocol translations */
extern char *	nl_ip_proto2str(int, char *, size_t);
extern int	nl_str2ip_proto(const char *);

/* Dumping helpers */
extern void	nl_new_line(struct nl_dump_params *);
extern void	nl_dump(struct nl_dump_params *, const char *, ...);
extern void	nl_dump_line(struct nl_dump_params *, const char *, ...);

#ifdef __cplusplus
}
#endif

#endif
="kd">procedure Error_Msg_Parse (Msg: String; Loc : Iir); procedure Error_Msg_Parse (Msg: String; Loc : Location_Type); -- Disp a message during semantic analysis. -- an_iir is used for location and current token. procedure Error_Msg_Sem (Msg: String; Loc: Iir); procedure Error_Msg_Sem (Msg: String; Loc: Location_Type); -- Disp a message during elaboration. procedure Error_Msg_Elab (Msg: String); procedure Error_Msg_Elab (Msg: String; Loc: Iir); -- Disp a message during execution. procedure Error_Msg_Exec (Msg: String; Loc: Iir); pragma No_Return (Error_Msg_Exec); procedure Warning_Msg_Exec (Msg: String; Loc: Iir); -- Disp a message for a constraint error. -- And raise the exception execution_constraint_error. procedure Error_Msg_Constraint (Expr: Iir); -- Disp a bug message. procedure Error_Internal (Expr: Iir; Msg: String := ""); pragma No_Return (Error_Internal); -- Disp a node. -- Used for output of message. function Disp_Node (Node: Iir) return String; -- Disp a node location. -- Used for output of message. function Disp_Location (Node: Iir) return String; function Get_Location_Str (Loc : Location_Type; Filename : Boolean := True) return String; -- Disp non-terminal name from KIND. function Disp_Name (Kind : Iir_Kind) return String; -- SUBPRG must be a subprogram declaration or an enumeration literal -- declaration. -- Returns: -- "enumeration literal XX [ return TYPE ]" -- "function XXX [ TYPE1, TYPE2 return TYPE ]" -- "procedure XXX [ TYPE1, TYPE2 ]" -- "implicit function XXX [ TYPE1, TYPE2 return TYPE ]" -- "implicit procedure XXX [ TYPE1, TYPE2 ]" function Disp_Subprg (Subprg : Iir) return String; -- Print element POS of discrete type DTYPE. function Disp_Discrete (Dtype : Iir; Pos : Iir_Int64) return String; -- Disp the name of the type of NODE if known. -- Disp "unknown" if it is not known. -- Disp all possible types if it is an overload list. function Disp_Type_Of (Node : Iir) return String; -- Disp an error message when a pure function CALLER calls impure CALLEE. procedure Error_Pure (Caller : Iir; Callee : Iir; Loc : Iir); -- Report an error message as type of EXPR does not match A_TYPE. -- Location is LOC. procedure Error_Not_Match (Expr: Iir; A_Type: Iir; Loc : Iir); end Errorout;