libnl 2.0
|
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_ENV, /**< Dump all attribtues as env variables */ 00026 __NL_DUMP_MAX, 00027 }; 00028 #define NL_DUMP_MAX (__NL_DUMP_MAX - 1) 00029 00030 /** 00031 * Dumping parameters 00032 * @ingroup utils 00033 */ 00034 struct nl_dump_params 00035 { 00036 /** 00037 * Specifies the type of dump that is requested. 00038 */ 00039 enum nl_dump_type dp_type; 00040 00041 /** 00042 * Specifies the number of whitespaces to be put in front 00043 * of every new line (indentation). 00044 */ 00045 int dp_prefix; 00046 00047 /** 00048 * Causes the cache index to be printed for each element. 00049 */ 00050 int dp_print_index; 00051 00052 /** 00053 * Causes each element to be prefixed with the message type. 00054 */ 00055 int dp_dump_msgtype; 00056 00057 /** 00058 * A callback invoked for output 00059 * 00060 * Passed arguments are: 00061 * - dumping parameters 00062 * - string to append to the output 00063 */ 00064 void (*dp_cb)(struct nl_dump_params *, char *); 00065 00066 /** 00067 * A callback invoked for every new line, can be used to 00068 * customize the indentation. 00069 * 00070 * Passed arguments are: 00071 * - dumping parameters 00072 * - line number starting from 0 00073 */ 00074 void (*dp_nl_cb)(struct nl_dump_params *, int); 00075 00076 /** 00077 * User data pointer, can be used to pass data to callbacks. 00078 */ 00079 void *dp_data; 00080 00081 /** 00082 * File descriptor the dumping output should go to 00083 */ 00084 FILE * dp_fd; 00085 00086 /** 00087 * Alternatively the output may be redirected into a buffer 00088 */ 00089 char * dp_buf; 00090 00091 /** 00092 * Length of the buffer dp_buf 00093 */ 00094 size_t dp_buflen; 00095 00096 /** 00097 * PRIVATE 00098 * Set if a dump was performed prior to the actual dump handler. 00099 */ 00100 int dp_pre_dump; 00101 00102 /** 00103 * PRIVATE 00104 * Owned by the current caller 00105 */ 00106 int dp_ivar; 00107 00108 unsigned int dp_line; 00109 }; 00110 00111 #endif