diff options
author | Patrick McHardy <kaber@trash.net> | 2009-03-18 04:55:00 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-18 04:55:00 +0100 |
commit | fac10ea799fe9b6158d74f66d6ad46536d38a545 (patch) | |
tree | 8c093bcbb2144aab54c70103e6ed438456ae0d48 /include/nftables.h |
Initial commitv0.01-alpha1
Diffstat (limited to 'include/nftables.h')
-rw-r--r-- | include/nftables.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/include/nftables.h b/include/nftables.h new file mode 100644 index 00000000..7e4a2fc8 --- /dev/null +++ b/include/nftables.h @@ -0,0 +1,96 @@ +#ifndef _NFTABLES_H +#define _NFTABLES_H + +#include <stdbool.h> +#include <stdarg.h> +#include <utils.h> + +enum numeric_level { + NUMERIC_NONE, + NUMERIC_ADDR, + NUMERIC_ALL, +}; + +#define INCLUDE_PATHS_MAX 16 + +extern unsigned int numeric_output; +extern const char *include_paths[INCLUDE_PATHS_MAX]; + +struct parser_state; +extern int cli_init(void *scanner, struct parser_state *state); +extern void cli_exit(void); +extern void cli_display(const char *fmt, va_list ap) __fmtstring(1, 0); + +enum nftables_exit_codes { + NFT_EXIT_SUCCESS = 0, + NFT_EXIT_FAILURE = 1, + NFT_EXIT_NOMEM = 2, +}; + +struct input_descriptor; +struct location { + const struct input_descriptor *indesc; + union { + struct { + off_t token_offset; + off_t line_offset; + + unsigned int first_line; + unsigned int last_line; + unsigned int first_column; + unsigned int last_column; + }; + struct { + struct nl_object *nl_obj; + }; + }; +}; + +extern const struct location internal_location; + +/** + * enum input_descriptor_types + * + * @INDESC_INVALID: invalid + * @INDESC_INTERNAL: dummy type for internally generated messages + * @INDESC_BUFFER: buffer (command line arguments) + * @INDESC_FILE: file + * @INDESC_CLI: command line interface + * @INDESC_NETLINK: received from netlink + */ +enum input_descriptor_types { + INDESC_INVALID, + INDESC_INTERNAL, + INDESC_BUFFER, + INDESC_FILE, + INDESC_CLI, + INDESC_NETLINK, +}; + +/** + * struct input_descriptor + * + * @location: location, used for include statements + * @type: input descriptor type + * @name: name describing the input + * @union: buffer or file descriptor, depending on type + * @lineno: current line number in the input + * @column: current column in the input + * @token_offset: offset of the current token to the beginning + * @line_offset: offset of the current line to the beginning + */ +struct input_descriptor { + struct location location; + enum input_descriptor_types type; + const char *name; + union { + const char *data; + int fd; + }; + unsigned int lineno; + unsigned int column; + off_t token_offset; + off_t line_offset; +}; + +#endif /* _NFTABLES_H */ |