libnl
3.2.3
|
00001 /* 00002 * netlink/netlink-types.h Netlink Types 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation version 2.1 00007 * of the License. 00008 * 00009 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch> 00010 */ 00011 00012 #ifndef __NETLINK_TYPES_H_ 00013 #define __NETLINK_TYPES_H_ 00014 00015 #include <stdio.h> 00016 00017 /** 00018 * Dumping types (dp_type) 00019 * @ingroup utils 00020 */ 00021 enum nl_dump_type { 00022 NL_DUMP_LINE, /**< Dump object briefly on one line */ 00023 NL_DUMP_DETAILS, /**< Dump all attributes but no statistics */ 00024 NL_DUMP_STATS, /**< Dump all attributes including statistics */ 00025 __NL_DUMP_MAX, 00026 }; 00027 #define NL_DUMP_MAX (__NL_DUMP_MAX - 1) 00028 00029 /** 00030 * Dumping parameters 00031 * @ingroup utils 00032 */ 00033 struct nl_dump_params 00034 { 00035 /** 00036 * Specifies the type of dump that is requested. 00037 */ 00038 enum nl_dump_type dp_type; 00039 00040 /** 00041 * Specifies the number of whitespaces to be put in front 00042 * of every new line (indentation). 00043 */ 00044 int dp_prefix; 00045 00046 /** 00047 * Causes the cache index to be printed for each element. 00048 */ 00049 int dp_print_index; 00050 00051 /** 00052 * Causes each element to be prefixed with the message type. 00053 */ 00054 int dp_dump_msgtype; 00055 00056 /** 00057 * A callback invoked for output 00058 * 00059 * Passed arguments are: 00060 * - dumping parameters 00061 * - string to append to the output 00062 */ 00063 void (*dp_cb)(struct nl_dump_params *, char *); 00064 00065 /** 00066 * A callback invoked for every new line, can be used to 00067 * customize the indentation. 00068 * 00069 * Passed arguments are: 00070 * - dumping parameters 00071 * - line number starting from 0 00072 */ 00073 void (*dp_nl_cb)(struct nl_dump_params *, int); 00074 00075 /** 00076 * User data pointer, can be used to pass data to callbacks. 00077 */ 00078 void *dp_data; 00079 00080 /** 00081 * File descriptor the dumping output should go to 00082 */ 00083 FILE * dp_fd; 00084 00085 /** 00086 * Alternatively the output may be redirected into a buffer 00087 */ 00088 char * dp_buf; 00089 00090 /** 00091 * Length of the buffer dp_buf 00092 */ 00093 size_t dp_buflen; 00094 00095 /** 00096 * PRIVATE 00097 * Set if a dump was performed prior to the actual dump handler. 00098 */ 00099 int dp_pre_dump; 00100 00101 /** 00102 * PRIVATE 00103 * Owned by the current caller 00104 */ 00105 int dp_ivar; 00106 00107 unsigned int dp_line; 00108 }; 00109 00110 #endif