libnl  1.1
types.h
1 /*
2  * netlink/netlink-types.h Netlink Types
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_TYPES_H_
13 #define __NETLINK_TYPES_H_
14 
15 #include <stdio.h>
16 
17 /**
18  * Dumping types (dp_type)
19  * @ingroup utils
20  */
22  NL_DUMP_BRIEF, /**< Dump object in a brief one-liner */
23  NL_DUMP_FULL, /**< Dump all attributes but no statistics */
24  NL_DUMP_STATS, /**< Dump all attributes including statistics */
25  NL_DUMP_XML, /**< Dump all attribtes in XML format */
26  NL_DUMP_ENV, /**< Dump all attribtues as env variables */
27  NL_DUMP_EVENTS, /**< Dump event */
28  __NL_DUMP_MAX,
29 };
30 #define NL_DUMP_MAX (__NL_DUMP_MAX - 1)
31 
32 /**
33  * Dumping parameters
34  * @ingroup utils
35  */
37 {
38  /**
39  * Specifies the type of dump that is requested.
40  */
42 
43  /**
44  * Specifies the number of whitespaces to be put in front
45  * of every new line (indentation).
46  */
47  int dp_prefix;
48 
49  /**
50  * Causes the cache index to be printed for each element.
51  */
53 
54  /**
55  * Causes each element to be prefixed with the message type.
56  */
58 
59  /**
60  * A callback invoked for output
61  *
62  * Passed arguments are:
63  * - dumping parameters
64  * - string to append to the output
65  */
66  void (*dp_cb)(struct nl_dump_params *, char *);
67 
68  /**
69  * A callback invoked for every new line, can be used to
70  * customize the indentation.
71  *
72  * Passed arguments are:
73  * - dumping parameters
74  * - line number starting from 0
75  */
76  void (*dp_nl_cb)(struct nl_dump_params *, int);
77 
78  /**
79  * User data pointer, can be used to pass data to callbacks.
80  */
81  void *dp_data;
82 
83  /**
84  * File descriptor the dumping output should go to
85  */
86  FILE * dp_fd;
87 
88  /**
89  * Alternatively the output may be redirected into a buffer
90  */
91  char * dp_buf;
92 
93  /**
94  * Length of the buffer dp_buf
95  */
96  size_t dp_buflen;
97 
98  /**
99  * PRIVATE
100  * Set if a dump was performed prior to the actual dump handler.
101  */
103 };
104 
105 #endif
Dump object in a brief one-liner.
Definition: types.h:22
char * dp_buf
Alternatively the output may be redirected into a buffer.
Definition: types.h:91
FILE * dp_fd
File descriptor the dumping output should go to.
Definition: types.h:86
int dp_print_index
Causes the cache index to be printed for each element.
Definition: types.h:52
enum nl_dump_type dp_type
Specifies the type of dump that is requested.
Definition: types.h:41
void(* dp_cb)(struct nl_dump_params *, char *)
A callback invoked for output.
Definition: types.h:66
nl_dump_type
Dumping types (dp_type)
Definition: types.h:21
Dump all attribtes in XML format.
Definition: types.h:25
void(* dp_nl_cb)(struct nl_dump_params *, int)
A callback invoked for every new line, can be used to customize the indentation.
Definition: types.h:76
int dp_pre_dump
PRIVATE Set if a dump was performed prior to the actual dump handler.
Definition: types.h:102
void * dp_data
User data pointer, can be used to pass data to callbacks.
Definition: types.h:81
int dp_prefix
Specifies the number of whitespaces to be put in front of every new line (indentation).
Definition: types.h:47
Dumping parameters.
Definition: types.h:36
size_t dp_buflen
Length of the buffer dp_buf.
Definition: types.h:96
Dump event.
Definition: types.h:27
Dump all attributes but no statistics.
Definition: types.h:23
Dump all attributes including statistics.
Definition: types.h:24
int dp_dump_msgtype
Causes each element to be prefixed with the message type.
Definition: types.h:57
Dump all attribtues as env variables.
Definition: types.h:26