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
|
/* vim:ts=8:sts=4:sw=4:noai:noexpandtab
*
* basic message reporting.
*
* Copyright (c) 2010 Miru Limited.
*
* 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; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PGM_MESSAGES_H__
#define __PGM_MESSAGES_H__
#include <pgm/types.h>
PGM_BEGIN_DECLS
/* Set bitmask of log roles in environmental variable PGM_LOG_MASK,
* borrowed from SmartPGM.
*/
enum {
PGM_LOG_ROLE_MEMORY = 0x001,
PGM_LOG_ROLE_NETWORK = 0x002,
PGM_LOG_ROLE_CONFIGURATION = 0x004,
PGM_LOG_ROLE_SESSION = 0x010,
PGM_LOG_ROLE_NAK = 0x020,
PGM_LOG_ROLE_RATE_CONTROL = 0x040,
PGM_LOG_ROLE_TX_WINDOW = 0x080,
PGM_LOG_ROLE_RX_WINDOW = 0x100,
PGM_LOG_ROLE_FEC = 0x400,
PGM_LOG_ROLE_CONGESTION_CONTROL = 0x800
};
enum {
PGM_LOG_LEVEL_DEBUG = 0,
PGM_LOG_LEVEL_TRACE = 1,
PGM_LOG_LEVEL_MINOR = 2,
PGM_LOG_LEVEL_NORMAL = 3,
PGM_LOG_LEVEL_WARNING = 4,
PGM_LOG_LEVEL_ERROR = 5,
PGM_LOG_LEVEL_FATAL = 6
};
extern int pgm_log_mask;
extern int pgm_min_log_level;
typedef void (*pgm_log_func_t) (const int, const char*restrict, void*restrict);
pgm_log_func_t pgm_log_set_handler (pgm_log_func_t, void*);
void pgm_messages_init (void);
void pgm_messages_shutdown (void);
PGM_END_DECLS
#endif /* __PGM_MESSAGES_H__ */
|