Minor comment and documentation tweaks. Add the python directory which contains my first cut at a libfko Python wrapper module.

git-svn-id: file:///home/mbr/svn/fwknop/trunk@302 510a4753-2344-4c79-9c09-4d669213fbeb
This commit is contained in:
Damien Stuart
2010-11-26 15:51:00 +00:00
parent 04ebf6c2ad
commit 00bc99a966
9 changed files with 1514 additions and 11 deletions
+3
View File
@@ -37,6 +37,9 @@ EXTRA_DIST = \
perl/FKO/lib/FKO.pm \
perl/FKO/lib/FKO_Constants.pl \
perl/FKO/Changes \
python/README \
python/setup.py \
python/fkomodule.c \
win32/config.h \
win32/fwknop-client.vcproj \
win32/getopt.c \
+7 -7
View File
@@ -796,12 +796,12 @@ For example:
Set the random value portion of the spa data to the given value (@var{val}).
The given value must be a pointer to a 16-character decimal numeric string
or NULL. If the value is NULL, the function generate a new random value.
If a string value is provided, it must not a 16-character decimal string,
the function will return @code{FKO_ERROR_INVALID_DATA}.
If a string value is provided, it must be a 16-character decimal string.
Otherwise, the function will return @code{FKO_ERROR_INVALID_DATA}.
@end deftypefun
@deftypefun int fko_set_username (@w{fko_ctx_t @var{ctx}, const char @var{*spoof_user}});
Set the username field of the @acronym{SPA} data. If @var{spoof_user} is NULL,
@deftypefun int fko_set_username (@w{fko_ctx_t @var{ctx}, const char @var{*username}});
Set the username field of the @acronym{SPA} data. If @var{username} is NULL,
libfko will first look for the environment variable @env{SPOOF_USER}
and use its value if found. Otherwise, it will try to determine the username
itself using various methods starting with @code{cuser} or @code{getlogin},
@@ -941,7 +941,7 @@ current context to the address @var{rand_val} is pointing to. The return value
is an FKO error status.
@end deftypefun
@deftypefun int fko_get_timestamp (@w{fko_ctx_t @var{ctx}, unsigned int @var{*timestamp}});
@deftypefun int fko_get_timestamp (@w{fko_ctx_t @var{ctx}, time_t @var{*timestamp}});
Sets the value of the @var{timestamp} variable to the timestamp value
associated with the current context. The return value is an FKO error
status.
@@ -1078,13 +1078,13 @@ fingerprint associated with the current context to the address @var{sig_fpr}
is pointing to. The return value is an FKO error status.
@end deftypefun
@deftypefun int fko_get_gpg_signature_summary (@w{fko_ctx_t @var{ctx}, unsigned char @var{*sig_sum}});
@deftypefun int fko_get_gpg_signature_summary (@w{fko_ctx_t @var{ctx}, int @var{*sig_sum}});
Sets the value of the @var{sig_sum} variable to the @acronym{GPG} signature
summary value associated with the current context. The return value is an FKO
error status.
@end deftypefun
@deftypefun int fko_get_gpg_signature_status (@w{fko_ctx_t @var{ctx}, unsigned char @var{*sig_stat}});
@deftypefun int fko_get_gpg_signature_status (@w{fko_ctx_t @var{ctx}, int @var{*sig_stat}});
Sets the value of the @var{sig_stat} variable to the @acronym{GPG} signature
error status value associated with the current context. The return value is an
FKO error status.
+19
View File
@@ -0,0 +1,19 @@
fko python module version 1.0
==============================
This module is essentially a Python wrapper for the Firewall Knock
Operator library, "libfko". See the "libfko" documentation for
additional information on the functionality provided by "libfko"
and usage overview.
Before attempting to build this module, libfko needs to be installed on
the system.
To build and install the module:
* Build with "python setup.py build"
* Install with "python setup.py install"
Note: This version is just a plain wrapper around libfko. I do plan to
make a more complete OO Python module that wraps this one. --DSS
+1444
View File
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
#
##############################################################################
#
# File: setup.py
#
# Author: Damien S. Stuart <dstuart@dstuart.org>
#
# Purpose: Driver script for the fko module.
#
##############################################################################
#
from distutils.core import setup, Extension
module1 = Extension(
'fko',
define_macros = [('MAJOR_VERSION', '1'), ('MINOR_VERSION', '0')],
libraries = ['fko'],
sources = ['fkomodule.c']
)
setup (
name = 'fko',
version = '1.0',
description = 'Wrapper for Fwknop library (libfko)',
author = 'Damien S. Stuart',
author_email = 'dstuart@dstuart.org',
license = 'GPL',
long_description = '''
Python module that wraps the fwknop library to provide the ability to
generate, decode, parse, and process SPA formatted messages.
''',
ext_modules = [module1]
)
+5 -1
View File
@@ -48,7 +48,11 @@
#include <time.h>
#endif
/* Function prototypes
/* Function prototypes.
*
* Note: These are the public functions for managing firewall rules.
* They should be implemented in each of the corresponding
* fw_util_<fw-type>.c files.
*/
void fw_config_init(fko_srv_options_t *opts);
void fw_initialize(fko_srv_options_t *opts);
+1 -1
View File
@@ -629,7 +629,7 @@ check_firewall_rules(fko_srv_options_t *opts)
* corresponding dynamic rules.
*/
void
purge_expired_rules(fko_srv_options_t *opts)
ipfw_purge_expired_rules(fko_srv_options_t *opts)
{
char exp_str[12];
char rule_num_str[6];
+1 -1
View File
@@ -52,7 +52,7 @@ enum {
#define IPFW_LIST_EXP_SET_RULES_ARGS "-S set %u list"
#define IPFW_LIST_SET_DYN_RULES_ARGS "-d set %u list"
void purge_expired_rules(fko_srv_options_t *opts);
void ipfw_purge_expired_rules(fko_srv_options_t *opts);
#endif /* FW_UTIL_IPFW_H */
+1 -1
View File
@@ -281,7 +281,7 @@ pcap_capture(fko_srv_options_t *opts)
time(&now);
if(opts->fw_config->last_purge < (now - opts->fw_config->purge_interval))
{
purge_expired_rules(opts);
ipfw_purge_expired_rules(opts);
opts->fw_config->last_purge = now;
}
}