libnl: /data/src/libnl/include/netlink/types.h Source File

libnl 3.12.0

types.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef __NETLINK_TYPES_H_
7#define __NETLINK_TYPES_H_
8
9#include <stdio.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/**
16 * @ingroup utils
17 * Enumeration of dumping variations (dp_type)
18 */
19 enum nl_dump_type {
20 NL_DUMP_LINE, /**< Dump object briefly on one line */
21 NL_DUMP_DETAILS, /**< Dump all attributes but no statistics */
22 NL_DUMP_STATS, /**< Dump all attributes including statistics */
23 __NL_DUMP_MAX,
24};
25#define NL_DUMP_MAX (__NL_DUMP_MAX - 1)
26
27/**
28 * @ingroup utils
29 * Dumping parameters
30 */
31 struct nl_dump_params
32{
33 /**
34 * Specifies the type of dump that is requested.
35 */
36 enum nl_dump_type dp_type;
37
38 /**
39 * Specifies the number of whitespaces to be put in front
40 * of every new line (indentation).
41 */
42 int dp_prefix;
43
44 /**
45 * Causes the cache index to be printed for each element.
46 */
47 int dp_print_index;
48
49 /**
50 * Causes each element to be prefixed with the message type.
51 */
52 int dp_dump_msgtype;
53
54 /**
55 * A callback invoked for output
56 *
57 * Passed arguments are:
58 * - dumping parameters
59 * - string to append to the output
60 */
61 void (*dp_cb)(struct nl_dump_params *, char *);
62
63 /**
64 * A callback invoked for every new line, can be used to
65 * customize the indentation.
66 *
67 * Passed arguments are:
68 * - dumping parameters
69 * - line number starting from 0
70 */
71 void (*dp_nl_cb)(struct nl_dump_params *, int);
72
73 /**
74 * User data pointer, can be used to pass data to callbacks.
75 */
76 void *dp_data;
77
78 /**
79 * File descriptor the dumping output should go to
80 */
81 FILE * dp_fd;
82
83 /**
84 * Alternatively the output may be redirected into a buffer
85 */
86 char * dp_buf;
87
88 /**
89 * Length of the buffer dp_buf
90 */
91 size_t dp_buflen;
92
93 /**
94 * PRIVATE
95 * Set if a dump was performed prior to the actual dump handler.
96 */
97 int dp_pre_dump;
98
99 /**
100 * PRIVATE
101 * Owned by the current caller
102 */
103 int dp_ivar;
104
105 unsigned int dp_line;
106};
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif
nl_dump_type
nl_dump_type
Enumeration of dumping variations (dp_type)
Definition types.h:19
NL_DUMP_STATS
@ NL_DUMP_STATS
Dump all attributes including statistics.
Definition types.h:22
NL_DUMP_LINE
@ NL_DUMP_LINE
Dump object briefly on one line.
Definition types.h:20
NL_DUMP_DETAILS
@ NL_DUMP_DETAILS
Dump all attributes but no statistics.
Definition types.h:21
nl_dump_params
Dumping parameters.
Definition types.h:32
nl_dump_params::dp_pre_dump
int dp_pre_dump
PRIVATE Set if a dump was performed prior to the actual dump handler.
Definition types.h:97
nl_dump_params::dp_data
void * dp_data
User data pointer, can be used to pass data to callbacks.
Definition types.h:76
nl_dump_params::dp_print_index
int dp_print_index
Causes the cache index to be printed for each element.
Definition types.h:47
nl_dump_params::dp_cb
void(* dp_cb)(struct nl_dump_params *, char *)
A callback invoked for output.
Definition types.h:61
nl_dump_params::dp_buflen
size_t dp_buflen
Length of the buffer dp_buf.
Definition types.h:91
nl_dump_params::dp_prefix
int dp_prefix
Specifies the number of whitespaces to be put in front of every new line (indentation).
Definition types.h:42
nl_dump_params::dp_dump_msgtype
int dp_dump_msgtype
Causes each element to be prefixed with the message type.
Definition types.h:52
nl_dump_params::dp_buf
char * dp_buf
Alternatively the output may be redirected into a buffer.
Definition types.h:86
nl_dump_params::dp_type
enum nl_dump_type dp_type
Specifies the type of dump that is requested.
Definition types.h:36
nl_dump_params::dp_ivar
int dp_ivar
PRIVATE Owned by the current caller.
Definition types.h:103
nl_dump_params::dp_fd
FILE * dp_fd
File descriptor the dumping output should go to.
Definition types.h:81
nl_dump_params::dp_nl_cb
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:71