From e773028f9636ecc388d68dee13fbe3057513f905 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 19 Apr 2005 19:58:15 +0000 Subject: =?UTF-8?q?add=20userspace=20library=20(Jens=20G=C3=B6tze)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- userspace/libebtc/include/Makefile.am | 43 ++ userspace/libebtc/include/Makefile.in | 450 ++++++++++++++++++ userspace/libebtc/include/config.h.in | 93 ++++ userspace/libebtc/include/libebtc.h | 838 ++++++++++++++++++++++++++++++++++ 4 files changed, 1424 insertions(+) create mode 100644 userspace/libebtc/include/Makefile.am create mode 100644 userspace/libebtc/include/Makefile.in create mode 100644 userspace/libebtc/include/config.h.in create mode 100644 userspace/libebtc/include/libebtc.h (limited to 'userspace/libebtc/include') diff --git a/userspace/libebtc/include/Makefile.am b/userspace/libebtc/include/Makefile.am new file mode 100644 index 0000000..1a9972c --- /dev/null +++ b/userspace/libebtc/include/Makefile.am @@ -0,0 +1,43 @@ +# +# ==[ Makefile ]================================================================ +# +# Project +# +# Library for ethernet bridge tables. +# +# +# Description +# +# Process this file with automake to create Makefile.in +# +# +# Copyright +# +# Copyright 2005 by Jens Götze +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, +# USA. +# +# +# ============================================================================== +# + + +MAINTAINERCLEANFILES = Makefile.in + +include_HEADERS = libebtc.h + + diff --git a/userspace/libebtc/include/Makefile.in b/userspace/libebtc/include/Makefile.in new file mode 100644 index 0000000..4d65b8a --- /dev/null +++ b/userspace/libebtc/include/Makefile.in @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.9.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# ==[ Makefile ]================================================================ +# +# Project +# +# Library for ethernet bridge tables. +# +# +# Description +# +# Process this file with automake to create Makefile.in +# +# +# Copyright +# +# Copyright 2005 by Jens Götze +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, +# USA. +# +# +# ============================================================================== +# + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = include +DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(includedir)" +includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +EBTC_LT_AGE = @EBTC_LT_AGE@ +EBTC_LT_CURRENT = @EBTC_LT_CURRENT@ +EBTC_LT_REVISION = @EBTC_LT_REVISION@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +MAINTAINERCLEANFILES = Makefile.in +include_HEADERS = libebtc.h +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status include/config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am \ + install-includeHEADERS install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/userspace/libebtc/include/config.h.in b/userspace/libebtc/include/config.h.in new file mode 100644 index 0000000..6bb299b --- /dev/null +++ b/userspace/libebtc/include/config.h.in @@ -0,0 +1,93 @@ +/* include/config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the `close' function. */ +#undef HAVE_CLOSE + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `free' function. */ +#undef HAVE_FREE + +/* Define to 1 if you have the `getsockopt' function. */ +#undef HAVE_GETSOCKOPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header + file. */ +#undef HAVE_LINUX_NETFILTER_BRIDGE_EBTABLES_H + +/* Define to 1 if you have the `malloc' function. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the `setsockopt' function. */ +#undef HAVE_SETSOCKOPT + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcmp' function. */ +#undef HAVE_STRCMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN diff --git a/userspace/libebtc/include/libebtc.h b/userspace/libebtc/include/libebtc.h new file mode 100644 index 0000000..7c12b14 --- /dev/null +++ b/userspace/libebtc/include/libebtc.h @@ -0,0 +1,838 @@ +/* + * ==[ FILENAME: libebtc.h ]==================================================== + * + * Project + * + * Library for ethernet bridge tables. + * + * + * Description + * + * See project. + * + * + * Copyright + * + * Copyright 2005 by Jens Götze + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, + * USA. + * + * + * ============================================================================= + */ + + +#ifndef __LIB_EBTC_H__ +#define __LIB_EBTC_H__ 1 + + +#include +#include +#include + + +/* Macros */ + +#ifndef EBTC_MIN_ALIGN +# define EBTC_MIN_ALIGN (__alignof__(struct ebt_entry_target)) +#endif +#define EBTC_ALIGN(s) (((s) + (EBTC_MIN_ALIGN - 1)) & \ + ~(EBTC_MIN_ALIGN - 1)) + +#define EBTC_SIZEOF(a) EBTC_ALIGN(sizeof(a)) +#define EBTC_NEXT(a) ((char *)(a) + EBTC_ALIGN(sizeof(*(a)))) +#define EBTC_ADDOFFSET(a, b) ((char *)(a) + (b)) + +#define EBTC_INIT 0x0000 +#define EBTC_INIT_WITHFLUSH 0x0001 + +#define EBTC_FALSE -1 +#define EBTC_TRUE 0 + + +/* Types */ + +typedef struct ebtc_handle_st *ebtc_handle_t; + +typedef struct ebt_replace ebt_replace_t; + +typedef struct ebt_entries ebt_entries_t; + +typedef struct ebt_entry ebt_entry_t; + +typedef struct ebt_counter ebt_counter_t; + +typedef struct ebt_entry_target ebt_entry_target_t; + +typedef struct ebt_standard_target ebt_standard_target_t; + + +/* Functions */ + +/* + * ==[ FUNCTION: ebtc_is_chain ]================================================ + * + * Description + * + * ebtc_is_chain checks chainname for exist. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_is_chain (const char *chainname, const ebtc_handle_t handle); + + +/* + * ==[ FUNCTION: ebtc_first_chain ]============================================= + * + * Description + * + * ebtc_first_chain returns the first chain. + * + * + * Parameter + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if it end of list, or non-zero for pointer of chainname. + * + * + * ============================================================================= + */ +extern const char *ebtc_first_chain (ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_next_chain ]============================================== + * + * Description + * + * ebtc_next_chain returns the next chain. + * + * + * Parameter + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if it end of list, or non-zero for pointer of chainname. + * + * + * ============================================================================= + */ +extern const char *ebtc_next_chain (ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_first_rule ]============================================== + * + * Description + * + * ebtc_first_rule returns the first rule in chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if it end of list, or non-zero for pointer of entry. + * + * + * ============================================================================= + */ +extern const struct ebt_entry *ebtc_first_rule (const char *chainname, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_next_rule ]=============================================== + * + * Description + * + * ebtc_next_rule returns the next rule in chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if it end of list, or non-zero for pointer of entry. + * + * + * ============================================================================= + */ +extern const struct ebt_entry *ebtc_next_rule (const char *chainname, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_get_target ]============================================== + * + * Description + * + * ebtc_get_target returns target of an rule. + * + * + * Parameter + * + * I entry + * Pointer to an ebt_entry object with target. + * + * I handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if it end of list, or non-zero for pointer of entry. + * + * + * ============================================================================= + */ +extern const char *ebtc_get_target (const struct ebt_entry *entry, + const ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_is_builtin ]============================================== + * + * Description + * + * ebtc_is_builtin checks a chainname for built-in chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it's a built-in chain, or non-zero for a non built-in + * chain. + * + * + * ============================================================================= + */ +extern int ebtc_is_builtin (const char *chainname, const ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_set_policy ]============================================== + * + * Description + * + * ebtc_set_policy set policy of a chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I policy + * C-String with policy (ACCEPT, DROP, CONTINUE or RETURN). + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_set_policy (const char *chainname, const char *policy, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_get_policy ]============================================== + * + * Description + * + * ebtc_get_policy get policy of a chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I handle + * EBTables handle + * + * + * Return value + * + * Returns a c-ctring with policy (ACCEPT, DROP, CONTINUE or RETURN). + * + * + * ============================================================================= + */ +extern const char *ebtc_get_policy (const char *chainname, + const ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_insert_entry ]============================================ + * + * Description + * + * ebtc_insert_entry insert a entry. You find details for the entry-object + * in linux/netfilter_bridge/ebtables.h. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I entry + * Pointer for a entry-object. + * + * I rulenum + * Position of new rule. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_insert_entry (const char *chainname, + const struct ebt_entry *entry, + unsigned int rulenum, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_replace_entry ]=========================================== + * + * Description + * + * ebtc_replace_entry replace a entry. You find details for the entry-object + * in linux/netfilter_bridge/ebtables.h. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I entry + * Pointer for the new entry-object. + * + * I rulenum + * Position of new rule. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_replace_entry (const char *chainname, + const struct ebt_entry *entry, + unsigned int rulenum, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_append_entry ]============================================ + * + * Description + * + * ebtc_append_entry append a entry. You find details for the entry-object + * in linux/netfilter_bridge/ebtables.h. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I entry + * Pointer for a entry-object. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_append_entry (const char *chainname, + const struct ebt_entry *entry, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_delete_entry ]============================================ + * + * Description + * + * ebtc_append_entry delete a entry. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I rulenum + * Position of rule. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_delete_entry (const char *chainname, unsigned int rulenum, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_target_jumptochain ]====================================== + * + * Description + * + * ebtc_target_jumptochain initialize standard target for jump to a chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_target_jumptochain (ebt_standard_target_t *target, + char *chainname, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_flush_entries ]=========================================== + * + * Description + * + * ebtc_flush_entries flush all entries in a chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_flush_entries (const char *chainname, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_zero_entries ]============================================ + * + * Description + * + * ebtc_zero_entries set all counter in a chain to zero. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_zero_entries (const char *chainname, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_rename_chain ]============================================ + * + * Description + * + * ebtc_rename_chain rename a chain. A built-in chain returns an error. + * + * + * Parameter + * + * I chainname_old + * C-String with chainname. + * + * I chainname_new + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_rename_chain (const char *chainname_old, + const char *chainname_new, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_create_chain ]============================================ + * + * Description + * + * ebtc_create_chain create a chain. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_create_chain (const char *chainname, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_delete_chain ]============================================ + * + * Description + * + * ebtc_delete_chain delete a chain. A built-in chain returns a error. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_delete_chain (const char *chainname, ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_read_counter ]============================================ + * + * Description + * + * ebtc_read_counter returns the current counter for packet and bytes. + * + * + * Parameter + * + * I chainname + * C-String with name of chain. + * + * I rulenum + * Position of rule. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns NULL for an error, or non-zero for the counter. + * + * + * ============================================================================= + */ +extern const struct ebt_counter *ebtc_read_counter (const char *chainname, + unsigned int rulenum, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_zero_counter ]============================================ + * + * Description + * + * ebtc_zero_counter set counter of a rule to zero. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I rulenum + * Postion of rule. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_zero_counter (const char *chainname, unsigned int rulenum, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_set_counter ]============================================= + * + * Description + * + * ebtc_set_counter set counter to a specific value. + * + * + * Parameter + * + * I chainname + * C-String with chainname. + * + * I rulenum + * Postion of rule. + * + * I counters + * New counter value. + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_set_counter (const char *chainname, unsigned int rulenum, + const struct ebt_counter *counters, + ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_init ]==================================================== + * + * Description + * + * ebtc_init create a new handle for the tablename. + * + * + * Parameter + * + * I tablename + * C-String with name of table. + * + * I options + * Options, look at macros with the prefix "EBTC_INIT". + * + * + * Return value + * + * Returns NULL for an error, or non-zero for the handle. + * + * + * ============================================================================= + */ +extern ebtc_handle_t ebtc_init (const char *tablename, int options); + + +/* + * ==[ FUNCTION: ebtc_commit ]================================================== + * + * Description + * + * ebtc_commit submit all changes to kernel. After the submit, handle is + * freed. + * + * + * Parameter + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns 0 if it succeeds, or non-zero for an error. + * + * + * ============================================================================= + */ +extern int ebtc_commit (ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_free ]==================================================== + * + * Description + * + * ebtc_free free a handle. + * + * + * Parameter + * + * IO handle + * EBTables handle + * + * + * Return value + * + * Returns nothing. + * + * + * ============================================================================= + */ +extern void ebtc_free (ebtc_handle_t *handle); + + +/* + * ==[ FUNCTION: ebtc_strerror ]================================================ + * + * Description + * + * ebtc_strerror translate error id to a human readable message. If no + * handle exist (ebtc_init or ebtc_free return an error), use NULL. With + * option used ebtc_strerror an global variable. hint, in a + * multi-threading environment can return this method a wrong message. + * + * + * Parameter + * + * I handle + * EBTables handle + * + * + * Return value + * + * Returns NULL if message not exist, or non-zero for the message. + * + * + * ============================================================================= + */ +extern const char *ebtc_strerror (const ebtc_handle_t *handle); + + +#endif + + -- cgit v1.2.3