man iptables_create () - iptables_create, iptables_add, iptables_append, iptables_destroy, iptables_commit - iptables batch processing.

NAME

iptables_create, iptables_add, iptables_append, iptables_destroy, iptables_commit - iptables batch processing.

LIBRARIES

Abz Library (-labz), Debug Library (-ldebug)

SYNOPSIS

#include <abz/iptables.h>

int iptables_create(struct batch *iptables, int flags, const char *fmt",...);
int iptables_add(struct batch *iptables,const char *fmt",...);
int iptables_append(struct batch *iptables,const char *fmt",...);
void iptables_destroy(struct batch *iptables");
int iptables_commit(struct batch *iptables");

DESCRIPTION

These functions enables the caller to construct a list of commands which are then piped to the specified program's stdin file descriptor. The called program's output is discarded.

iptables_create() creates an iptables batch. It should be called before any of the other functions. The specified arguments specify the command that should be executed. When executed, its output will be discarded and its stdin file descriptor will be a file containing the list of commands added with iptables_add() and iptables_append().

The flags argument to iptables_create() is an OR of any of these:

BATCH_TESTING
Don't execute iptables, rather log the commands that would have been executed. Useful for debugging.
BATCH_FORCE
Ignore iptables-restore's return code (i.e. do not return an error if the program fails).

iptables_add() adds a command to iptables. It takes a pointer to the iptables created with iptables_create() and a printf-style string as parameters.

iptables_append() appends parameters to the last command in iptables.

iptables_destroy() free resources allocated for iptables.

iptables_commit() executes the iptables command batch. This function automatically free resources allocated for the iptables, i.e. you should not call iptables_destroy() after calling this function, except if it fails.

RETURN VALUES

Except for iptables_destroy(), all of these functions returns 0 if successful or -1 if some error occurred. Call abz_get_error() to retrieve error messages.

NOTES

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

SEE ALSO

AUTHOR

Written by Abraham vd Merwe <abz@blio.com>

CETTE PAGE DOCUMENTE AUSSI :