diag.h 1.22 KB
Newer Older
1
/*
2
 * Alessandro Rubini for CERN, 2011 -- public domain
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 */
#ifndef __PTP_DIAG_H__
#define __PTP_DIAG_H__

/*
 * The diagnostic functions (diag-yes.c and diag-no.c).
 *
 * Use trace like "pp_diag_trace(ppi, __func__, __LINE__)".
 * error gets an integer, the other ones two strings (so we can
 * strerror(errno) together with the explanation. Avoid diag_printf if
 * possible, for size reasons, but here it is anyways.
 */
extern void pp_diag_fsm(struct pp_instance *ppi, int sequence, int plen);
extern void pp_diag_trace(struct pp_instance *ppi, const char *f, int line);
extern void pp_diag_error(struct pp_instance *ppi, int err);
extern void pp_diag_error_str2(struct pp_instance *ppi, char *s1, char *s2);
extern void pp_diag_fatal(struct pp_instance *ppi, char *s1, char *s2);
extern void pp_diag_printf(struct pp_instance *ppi, char *fmt, ...)
21
	__attribute__((format(printf, 2, 3)));
22

23 24
/* Our printf, that is implemented internally */
extern int pp_printf(const char *fmt, ...)
25
	__attribute__((format(printf, 1, 2)));
26 27
extern int pp_vprintf(const char *fmt, va_list args)
	__attribute__((format(printf, 1, 0)));
28
extern int pp_vsprintf(char *buf, const char *, va_list)
29
	__attribute__ ((format (printf, 2, 0)));
30 31


32
#endif /* __PTP_DIAG_H__ */