blob: a6a3227638c996b1d2c9ea2c23b6c9884a0df206 (
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
|
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef CRAS_DUMPER_H_
#define CRAS_DUMPER_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/* dumper is an interface to output some human-readable information */
struct dumper {
void (*vprintf)(struct dumper *dumper, const char *format, va_list ap);
void *data; /* private to each dumper */
};
/* a convenience function outputs to a dumper */
void dumpf(struct dumper *dumper, const char *format, ...);
/*
* a dumper outputs to syslog with the given priority
*/
struct dumper *syslog_dumper_create(int priority);
void syslog_dumper_free(struct dumper *dumper);
/*
* a dumper saves the output in a memory buffer
*/
struct dumper *mem_dumper_create();
void mem_dumper_free(struct dumper *dumper);
/* get the memory buffer of the output */
void mem_dumper_get(struct dumper *dumper, char **buf, int *size);
/* clear the memory buffer */
void mem_dumper_clear(struct dumper *dumper);
/* delete the first n characters in the memory buffer */
void mem_dumper_consume(struct dumper *dumper, int n);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* CRAS_DUMPER_H_ */
|