Miscellaneous cleanups
cover Miscellaneous cleanups
These are similar to what we did for libnfq.
Doxygen is still emitting 9 warnings which should be addressed before any move to generate man pages.
Duncan Roe (3):
src: whitespace: Remove trailing whitespace and fix inconsistent indents
build: doc: reduce doxygen.cfg.in to non-default entries only
build: doc: remove trailing whitespace from doxygen.cfg.in
doxygen.cfg.in | 174 +------------------- include/libnetfilter_log/libipulog.h | 4 +- include/libnetfilter_log/libnetfilter_log.h | 2 +- src/libipulog_compat.c | 8 +- src/libnetfilter_log.c | 24 +-- utils/nfulnl_test.c | 4 +- utils/ulog_test.c | 8 +- 7 files changed, 32 insertions(+), 192 deletions(-)
Signature · 1 line
2.17.5
PATCH 1/3 src: whitespace: Remove trailing whitespace and inconsistent indents
All .c and .h files now have no lines with trailing whitespace. All .c and .h files now indent with tabs followed by <8 spaces.
--- include/libnetfilter_log/libipulog.h | 4 ++-- include/libnetfilter_log/libnetfilter_log.h | 2 +- src/libipulog_compat.c | 8 +++---- src/libnetfilter_log.c | 24 ++++++++++----------- utils/nfulnl_test.c | 4 ++-- utils/ulog_test.c | 8 +++---- 6 files changed, 25 insertions(+), 25 deletions(-)
include/libnetfilter_log/libipulog.h +2 -2
@@ -12,7 +12,7 @@ extern "C" {#endif /* FIXME: glibc sucks */ -#ifndef MSG_TRUNC +#ifndef MSG_TRUNC #define MSG_TRUNC 0x20#endif
@@ -55,7 +55,7 @@ const char *ipulog_strerror(int errcode);void ipulog_perror (const char *s); -enum +enum {IPULOG_ERR_NONE =0 ,IPULOG_ERR_IMPL ,
include/libnetfilter_log/libnetfilter_log.h +1 -1
@@ -49,7 +49,7 @@ extern int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags);extern int nflog_set_qthresh (struct nflog_g_handle *gh,uint32_t qthresh);extern int nflog_set_nlbufsiz (struct nflog_g_handle *gh,uint32_t nlbufsiz); -extern int nflog_callback_register (struct nflog_g_handle *gh, +extern int nflog_callback_register (struct nflog_g_handle *gh,nflog_callback *cb,void *data);extern int nflog_handle_packet (struct nflog_handle *h,char *buf,int len);
src/libipulog_compat.c +4 -4
@@ -32,7 +32,7 @@ static const struct ipulog_errmap_t {int errcode;const char *message; -} ipulog_errmap[] = +} ipulog_errmap[] = { { IPULOG_ERR_NONE, "No error" }, { IPULOG_ERR_IMPL, "Not implemented yet" },
@@ -99,7 +99,7 @@ struct ipulog_handle *ipulog_create_handle(uint32_t gmask, h->nfulh =nflog_open ();if (!h->nfulh) goto out_free; - +/* bind_pf returns EEXIST if we are already registered */ rv =nflog_bind_pf (h->nfulh,AF_INET );if (rv <0 && rv != -EEXIST )
@@ -146,7 +146,7 @@ next_msg: printf("next\n");nfnl_parse_attr (tb,NFULA_MAX ,NFM_NFA (NLMSG_DATA (nlh)),NFM_PAYLOAD (nlh)); - +if (!tb[NFULA_PACKET_HDR -1 ]) goto next_msg;
@@ -207,7 +207,7 @@ next_msg: printf("next\n"); h->upmsg.data_len =NFA_PAYLOAD (tb[NFULA_PAYLOAD -1 ]); }else h->upmsg.data_len =0 ; - +return &h->upmsg; }
src/libnetfilter_log.c +12 -12
@@ -4,7 +4,7 @@* (C) 2005, 2008-2010 by Pablo Neira Ayuso <[email protected]> * * This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 +* it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation (or any later at your option) * * This program is distributed in the hope that it will be useful,
@@ -82,7 +82,7 @@ struct nflog_g_handleint nflog_errno;/*********************************************************************** -* low level stuff +* low level stuff ***********************************************************************/ static void del_gh (struct nflog_g_handle *gh)
@@ -244,7 +244,7 @@ struct nflog_handle *nflog_open_nfnl(struct nfnl_handle *nfnlh) h->nfnlh = nfnlh; - h->nfnlssh =nfnl_subsys_open (h->nfnlh,NFNL_SUBSYS_ULOG , + h->nfnlssh =nfnl_subsys_open (h->nfnlh,NFNL_SUBSYS_ULOG ,NFULNL_MSG_MAX ,0 );if (!h->nfnlssh) {/* FIXME: nflog_errno */
@@ -393,10 +393,10 @@ struct nflog_g_handle * nflog_bind_group(struct nflog_handle *h, uint16_t num) {struct nflog_g_handle *gh; - +if (find_gh (h, num))return NULL ; - + gh =calloc (1 ,sizeof (*gh));if (!gh)return NULL ;
@@ -610,8 +610,8 @@ int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags) * The nfulnl_msg_packet_hdr structure is defined in libnetfilter_log.h as: *\verbatimstruct nfulnl_msg_packet_hdr { -uint16_t hw_protocol;// hw protocol (network order) -uint8_t hook;// netfilter hook +uint16_t hw_protocol;// hw protocol (network order) +uint8_t hook;// netfilter hook uint8_t _pad; } __attribute__ ((packed)); \endverbatim
@@ -760,11 +760,11 @@ uint32_t nflog_get_physoutdev(struct nflog_data *nfad)* * The nfulnl_msg_packet_hw structure is defined in libnetfilter_log.h as: * \verbatim -struct nfulnl_msg_packet_hw { -uint16_t hw_addrlen; -uint16_t _pad; -uint8_t hw_addr[8]; -} __attribute__ ((packed)); +struct nfulnl_msg_packet_hw { +uint16_t hw_addrlen; +uint16_t _pad; +uint8_t hw_addr[8]; +} __attribute__ ((packed)); \endverbatim */ struct nfulnl_msg_packet_hw *nflog_get_packet_hw (struct nflog_data *nfad)
utils/nfulnl_test.c +2 -2
@@ -15,9 +15,9 @@ static int print_pkt(struct nflog_data *ldata)char *prefix =nflog_get_prefix (ldata);char *payload;int payload_len =nflog_get_payload (ldata, &payload); - +if (ph) { -printf ("hw_protocol=0x%04x hook=%u " , +printf ("hw_protocol=0x%04x hook=%u " ,ntohs (ph->hw_protocol), ph->hook); }
utils/ulog_test.c +4 -4
@@ -22,7 +22,7 @@ void handle_packet(ulog_packet_msg_t *pkt) {unsigned char *p;int i; - +printf ("Hook=%u Mark=%lu len=%zu " , pkt->hook, pkt->mark, pkt->data_len);if (strlen (pkt->prefix))
@@ -34,7 +34,7 @@ void handle_packet(ulog_packet_msg_t *pkt)if (pkt->timestamp_sec || pkt->timestamp_usec)printf ("Timestamp=%ld.%06lds " , pkt->timestamp_sec, pkt->timestamp_usec); - +if (pkt->mac_len) {printf ("mac=" );
@@ -63,7 +63,7 @@ int main(int argc, char *argv[]) buf =malloc (MYBUFSIZ );if (!buf)exit (1 ); - +/* create ipulog handle */ h =ipulog_create_handle (ipulog_group2gmask (atoi (argv[2 ])),65535 );if (!h)
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])handle_packet (upkt); } } - +/* just to give it a cleaner look */ ipulog_destroy_handle (h);return 0 ;
Signature · 1 line
2.17.5
PATCH 2/3 build: doc: reduce doxygen.cfg.in to non-default entries only
In reply to Duncan RoeAlso add EXCLUDE_SYMBOLS for structs that are undocumented (otherwise doxygen makes html pages for them but warns they and their members are not documented).
This formerly 5KB file is reduced almost down to 1/8th original size.
In the interests of a clean diff, the new file still has lines with trailing spaces.
--- doxygen.cfg.in | 170 ++----------------------------------------------- 1 file changed, 5 insertions(+), 165 deletions(-)
doxygen.cfg.in +5 -165
@@ -1,184 +1,24 @@ -DOXYFILE_ENCODING = UTF-8 +# Difference with default Doxyfile 1.8.20 PROJECT_NAME = @PACKAGE@ PROJECT_NUMBER = @VERSION@ OUTPUT_DIRECTORY = doxygen -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 -ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -TYPEDEF_HIDES_STRUCT = NO -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = INPUT = . -INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = +EXCLUDE_SYMBOLS = nflog_g_handle \ + nflog_handle \ + ipulog_errmap_t \ + ipulog_handle EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -HTML_DYNAMIC_SECTIONS = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 GENERATE_LATEX = NO -LATEX_OUTPUT = latex LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = GENERATE_MAN = YES -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -GENERATE_AUTOGEN_DEF = NO -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = YES -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES SEARCHENGINE = NO
Signature · 1 line
2.17.5
PATCH 3/3 build: doc: remove trailing whitespace from doxygen.cfg.in
In reply to Duncan Roe--- doxygen.cfg.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
doxygen.cfg.in +2 -2
@@ -2,7 +2,7 @@ PROJECT_NAME = @PACKAGE@ PROJECT_NUMBER = @VERSION@ OUTPUT_DIRECTORY = doxygen -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = FULL_PATH_NAMES = NO TAB_SIZE = 8 OPTIMIZE_OUTPUT_FOR_C = YES
@@ -13,7 +13,7 @@ EXCLUDE_SYMBOLS = nflog_g_handle \ nflog_handle \ ipulog_errmap_t \ ipulog_handle -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = SOURCE_BROWSER = YES ALPHABETICAL_INDEX = NO GENERATE_LATEX = NO
Signature · 1 line
2.17.5
Pablo Neira Ayuso
maintainerQuoted 3 lines · Duncan Roe
These are similar to what we did for libnfq.
Doxygen is still emitting 9 warnings which should be addressed before any move to generate man pages.
Series applied.