/*
* FILE : ipfw_wrap.c
*
* This file was automatically generated by :
* Simplified Wrapper and Interface Generator (SWIG)
* Version 1.1 (Patch 5)
*
* Portions Copyright (c) 1995-1998
* The University of Utah and The Regents of the University of California.
* Permission is granted to distribute this file in any manner provided
* this notice remains intact.
*
* Do not make changes to this file--changes will be lost!
*
*/
#define SWIGCODE
/* Implementation : PERL 5 */
#define SWIGPERL
#define SWIGPERL5
#ifdef __cplusplus
#include <math.h>
#include <stdlib.h>
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#undef free
#undef malloc
#include <string.h>
#ifdef __cplusplus
}
#endif
/* Definitions for compiling Perl extensions on a variety of machines */
#if defined(WIN32) || defined(__WIN32__)
# if defined(_MSC_VER)
# define SWIGEXPORT(a,b) __declspec(dllexport) a b
# else
# if defined(__BORLANDC__)
# define SWIGEXPORT(a,b) a _export b
# else
# define SWIGEXPORT(a,b) a b
# endif
# endif
#else
# define SWIGEXPORT(a,b) a b
#endif
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerl *pPerl = (CPerl *) this;
#define MAGIC_CAST (int (CPerl::*)(SV *, MAGIC *))
#define SWIGCLASS_STATIC
#else
#define MAGIC_PPERL
#define MAGIC_CAST
#define SWIGCLASS_STATIC static
#endif
/*****************************************************************************
* $Header: /usr/local/cvsroot/j/IPChainsc/ipfw.c,v 1.1 1999/01/21 08:31:10 j Exp $
*
* perl5ptr.swg
*
* This file contains supporting code for the SWIG run-time type checking
* mechanism. The following functions are available :
*
* SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *));
*
* Registers a new type-mapping with the type-checker. origtype is the
* original datatype and newtype is an equivalent type. cast is optional
* pointer to a function to cast pointer values between types (this
* is only used to cast pointers from derived classes to base classes in C++)
*
* SWIG_MakePtr(char *buffer, void *ptr, char *typestring);
*
* Makes a pointer string from a pointer and typestring. The result is returned
* in buffer.
*
* char * SWIG_GetPtr(SV *obj, void **ptr, char *type)
*
* Gets a pointer value from a Perl5 scalar value. If there is a
* type-mismatch, returns a character string to the received type.
* On success, returns NULL.
*
*
* You can remap these functions by making a file called "swigptr.swg" in
* your the same directory as the interface file you are wrapping.
*
* These functions are normally declared static, but this file can be
* can be used in a multi-module environment by redefining the symbol
* SWIGSTATIC.
*
* $Log: ipfw.c,v $
* Revision 1.1 1999/01/21 08:31:10 j
* Added files to cvs tree
*
* Revision 1.2 1999/01/16 09:17:02 j
* All working, seperate interface functions for each command. Just needs Perl module work now.
*
* Revision 1.1 1996/12/26 22:17:29 beazley
* Initial revision
*
*****************************************************************************/
#include <stdlib.h>
#ifdef SWIG_GLOBAL
#ifdef __cplusplus
#define SWIGSTATIC extern "C"
#else
#define SWIGSTATIC
#endif
#endif
#ifndef SWIGSTATIC
#define SWIGSTATIC static
#endif
/* These are internal variables. Should be static */
typedef struct SwigPtrType {
char *name;
int len;
void *(*cast)(void *);
struct SwigPtrType *next;
} SwigPtrType;
/* Pointer cache structure */
typedef struct {
int stat; /* Status (valid) bit */
SwigPtrType *tp; /* Pointer to type structure */
char name[256]; /* Given datatype name */
char mapped[256]; /* Equivalent name */
} SwigCacheType;
static int SwigPtrMax = 64; /* Max entries that can be currently held */
static int SwigPtrN = 0; /* Current number of entries */
static int SwigPtrSort = 0; /* Status flag indicating sort */
static SwigPtrType *SwigPtrTable = 0; /* Table containing pointer equivalences */
static int SwigStart[256]; /* Table containing starting positions */
/* Cached values */
#define SWIG_CACHESIZE 8
#define SWIG_CACHEMASK 0x7
static SwigCacheType SwigCache[SWIG_CACHESIZE];
static int SwigCacheIndex = 0;
static int SwigLastCache = 0;
/* Sort comparison function */
static int swigsort(const void *data1, const void *data2) {
SwigPtrType *d1 = (SwigPtrType *) data1;
SwigPtrType *d2 = (SwigPtrType *) data2;
return strcmp(d1->name,d2->name);
}
/* Binary Search function */
static int swigcmp(const void *key, const void *data) {
char *k = (char *) key;
SwigPtrType *d = (SwigPtrType *) data;
return strncmp(k,d->name,d->len);
}
/* Register a new datatype with the type-checker */
#ifndef PERL_OBJECT
SWIGSTATIC
void SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
#else
SWIGSTATIC
#define SWIG_RegisterMapping(a,b,c) _SWIG_RegisterMapping(pPerl, a,b,c)
void _SWIG_RegisterMapping(CPerl *pPerl, char *origtype, char *newtype, void *(*cast)(void *)) {
#endif
int i;
SwigPtrType *t = 0, *t1;
if (!SwigPtrTable) {
SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
SwigPtrN = 0;
}
if (SwigPtrN >= SwigPtrMax) {
SwigPtrMax = 2*SwigPtrMax;
SwigPtrTable = (SwigPtrType *) realloc(SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
}
for (i = 0; i < SwigPtrN; i++)
if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
t = &SwigPtrTable[i];
break;
}
if (!t) {
t = &SwigPtrTable[SwigPtrN];
t->name = origtype;
t->len = strlen(t->name);
t->cast = 0;
t->next = 0;
SwigPtrN++;
}
while (t->next) {
if (strcmp(t->name,newtype) == 0) {
if (cast) t->cast = cast;
return;
}
t = t->next;
}
t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
t1->name = newtype;
t1->len = strlen(t1->name);
t1->cast = cast;
t1->next = 0;
t->next = t1;
SwigPtrSort = 0;
}
/* Make a pointer value string */
SWIGSTATIC
void SWIG_MakePtr(char *_c, const void *_ptr, char *type) {
static char _hex[16] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'};
unsigned long _p, _s;
char _result[20], *_r; /* Note : a 64-bit hex number = 16 digits */
_r = _result;
_p = (unsigned long) _ptr;
if (_p > 0) {
while (_p > 0) {
_s = _p & 0xf;
*(_r++) = _hex[_s];
_p = _p >> 4;
}
*_r = '_';
while (_r >= _result)
*(_c++) = *(_r--);
} else {
strcpy (_c, "NULL");
}
if (_ptr)
strcpy (_c, type);
}
/* Define for backwards compatibility */
#define _swig_make_hex SWIG_MakePtr
/* Function for getting a pointer value */
#ifndef PERL_OBJECT
SWIGSTATIC
char *SWIG_GetPtr(SV *sv, void **ptr, char *_t)
#else
SWIGSTATIC
#define SWIG_GetPtr(a,b,c) _SWIG_GetPtr(pPerl,a,b,c)
char *_SWIG_GetPtr(CPerl *pPerl, SV *sv, void **ptr, char *_t)
#endif
{
char temp_type[256];
char *name,*_c;
int len,i,start,end;
IV tmp;
SwigPtrType *sp,*tp;
SwigCacheType *cache;
/* If magical, apply more magic */
if (SvGMAGICAL(sv))
mg_get(sv);
/* Check to see if this is an object */
if (sv_isobject(sv)) {
SV *tsv = (SV*) SvRV(sv);
if ((SvTYPE(tsv) == SVt_PVHV)) {
MAGIC *mg;
if (SvMAGICAL(tsv)) {
mg = mg_find(tsv,'P');
if (mg) {
SV *rsv = mg->mg_obj;
if (sv_isobject(rsv)) {
tmp = SvIV((SV*)SvRV(rsv));
}
}
} else {
return "Not a valid pointer value";
}
} else {
tmp = SvIV((SV*)SvRV(sv));
}
if (!_t) {
*(ptr) = (void *) tmp;
return (char *) 0;
}
} else if (sv == &sv_undef) { /* Check for undef */
*(ptr) = (void *) 0;
return (char *) 0;
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
*(ptr) = (void *) 0;
if (!SvROK(sv))
return (char *) 0;
else
return "Not a valid pointer value";
} else { /* Don't know what it is */
*(ptr) = (void *) 0;
return "Not a valid pointer value";
}
if (_t) {
/* Now see if the types match */
if (!sv_isa(sv,_t)) {
_c = HvNAME(SvSTASH(SvRV(sv)));
if (!SwigPtrSort) {
qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort);
for (i = 0; i < 256; i++) {
SwigStart[i] = SwigPtrN;
}
for (i = SwigPtrN-1; i >= 0; i--) {
SwigStart[SwigPtrTable[i].name[0]] = i;
}
for (i = 255; i >= 1; i--) {
if (SwigStart[i-1] > SwigStart[i])
SwigStart[i-1] = SwigStart[i];
}
SwigPtrSort = 1;
for (i = 0; i < SWIG_CACHESIZE; i++)
SwigCache[i].stat = 0;
}
/* First check cache for matches. Uses last cache value as starting point */
cache = &SwigCache[SwigLastCache];
for (i = 0; i < SWIG_CACHESIZE; i++) {
if (cache->stat) {
if (strcmp(_t,cache->name) == 0) {
if (strcmp(_c,cache->mapped) == 0) {
cache->stat++;
*ptr = (void *) tmp;
if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
return (char *) 0;
}
}
}
SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
if (!SwigLastCache) cache = SwigCache;
else cache++;
}
start = SwigStart[_t[0]];
end = SwigStart[_t[0]+1];
sp = &SwigPtrTable[start];
while (start < end) {
if (swigcmp(_t,sp) == 0) break;
sp++;
start++;
}
if (start >= end) sp = 0;
if (sp) {
while (swigcmp(_t,sp) == 0) {
name = sp->name;
len = sp->len;
tp = sp->next;
while(tp) {
if (tp->len >= 255) {
return _c;
}
strcpy(temp_type,tp->name);
strncat(temp_type,_t+len,255-tp->len);
if (sv_isa(sv,temp_type)) {
/* Get pointer value */
*ptr = (void *) tmp;
if (tp->cast) *ptr = (*(tp->cast))(*ptr);
strcpy(SwigCache[SwigCacheIndex].mapped,_c);
strcpy(SwigCache[SwigCacheIndex].name,_t);
SwigCache[SwigCacheIndex].stat = 1;
SwigCache[SwigCacheIndex].tp = tp;
SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
return (char *) 0;
}
tp = tp->next;
}
/* Hmmm. Didn't find it this time */
sp++;
}
}
/* Didn't find any sort of match for this data.
Get the pointer value and return the received type */
*ptr = (void *) tmp;
return _c;
} else {
/* Found a match on the first try. Return pointer value */
*ptr = (void *) tmp;
return (char *) 0;
}
}
*ptr = (void *) tmp;
return (char *) 0;
}
/* Compatibility mode */
#define _swig_get_hex SWIG_GetPtr
/* Magic variable code */
#ifndef PERL_OBJECT
#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) {
#else
#define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
static void _swig_create_magic(CPerl *pPerl, SV *sv, char *name, int (CPerl::*set)(SV *, MAGIC *), int (CPerl::*get)(SV *, MAGIC *)) {
#endif
MAGIC *mg;
sv_magic(sv,sv,'U',name,strlen(name));
mg = mg_find(sv,'U');
mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
mg->mg_virtual->svt_get = get;
mg->mg_virtual->svt_set = set;
mg->mg_virtual->svt_len = 0;
mg->mg_virtual->svt_clear = 0;
mg->mg_virtual->svt_free = 0;
}
#define SWIG_init boot_IPChains
#define SWIG_name "IPChainsc::boot_IPChains"
#define SWIG_varinit "IPChainsc::var_IPChains_init();"
#ifdef __cplusplus
extern "C"
#endif
#ifndef PERL_OBJECT
SWIGEXPORT(void,boot_IPChains)(CV* cv);
#else
SWIGEXPORT(void,boot_IPChains)(CPerl *, CV *cv);
#endif
#include "include/libipfwc.h"
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_IPChains_var::
class _wrap_IPChains_var : public CPerl {
public:
#else
#define MAGIC_CLASS
#endif
SWIGCLASS_STATIC int swig_magic_readonly(SV *sv, MAGIC *mg) {
MAGIC_PPERL
sv = sv; mg = mg;
croak("Value is read-only.");
return 0;
}
#ifdef PERL_OBJECT
};
#endif
XS(_wrap_ipfwc_get_chainnames) {
struct ipfwc_fwchain * _result;
unsigned int * _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_get_chainnames(num_chains);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"unsigned intPtr")) {
croak("Type error in argument 1 of ipfwc_get_chainnames. Expected unsigned intPtr.");
XSRETURN(1);
}
_result = (struct ipfwc_fwchain *)ipfwc_get_chainnames(_arg0);
ST(argvi) = sv_newmortal();
sv_setref_pv(ST(argvi++),"struct ipfwc_fwchainPtr", (void *) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_get_rules) {
struct ipfwc_fwrule * _result;
unsigned int * _arg0;
int _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_get_rules(num_rules,zero);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"unsigned intPtr")) {
croak("Type error in argument 1 of ipfwc_get_rules. Expected unsigned intPtr.");
XSRETURN(1);
}
_arg1 = (int )SvIV(ST(1));
_result = (struct ipfwc_fwrule *)ipfwc_get_rules(_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setref_pv(ST(argvi++),"struct ipfwc_fwrulePtr", (void *) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_insert_entry) {
int _result;
ip_chainlabel * _arg0;
struct ip_fwuser * _arg1;
unsigned int _arg2;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfwc_insert_entry(chain,fw,rulenum);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_insert_entry. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"struct ip_fwuserPtr")) {
croak("Type error in argument 2 of ipfwc_insert_entry. Expected struct ip_fwuserPtr.");
XSRETURN(1);
}
_arg2 = (unsigned int )SvIV(ST(2));
_result = (int )ipfwc_insert_entry(*_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_replace_entry) {
int _result;
ip_chainlabel * _arg0;
struct ip_fwuser * _arg1;
unsigned int _arg2;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfwc_replace_entry(chain,fw,rulenum);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_replace_entry. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"struct ip_fwuserPtr")) {
croak("Type error in argument 2 of ipfwc_replace_entry. Expected struct ip_fwuserPtr.");
XSRETURN(1);
}
_arg2 = (unsigned int )SvIV(ST(2));
_result = (int )ipfwc_replace_entry(*_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_append_entry) {
int _result;
ip_chainlabel * _arg0;
struct ip_fwuser * _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_append_entry(chain,fw);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_append_entry. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"struct ip_fwuserPtr")) {
croak("Type error in argument 2 of ipfwc_append_entry. Expected struct ip_fwuserPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_append_entry(*_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_delete_entry) {
int _result;
ip_chainlabel * _arg0;
struct ip_fwuser * _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_delete_entry(chain,fw);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_delete_entry. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"struct ip_fwuserPtr")) {
croak("Type error in argument 2 of ipfwc_delete_entry. Expected struct ip_fwuserPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_delete_entry(*_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_delete_num_entry) {
int _result;
ip_chainlabel * _arg0;
unsigned int _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_delete_num_entry(chain,rulenum);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_delete_num_entry. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_arg1 = (unsigned int )SvIV(ST(1));
_result = (int )ipfwc_delete_num_entry(*_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_check_packet) {
char * _result;
ip_chainlabel * _arg0;
struct ip_fw * _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_check_packet(chain,fw);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_check_packet. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"struct ip_fwPtr")) {
croak("Type error in argument 2 of ipfwc_check_packet. Expected struct ip_fwPtr.");
XSRETURN(1);
}
_result = (char *)ipfwc_check_packet(*_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setpv((SV*)ST(argvi++),(char *) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_flush_entries) {
int _result;
ip_chainlabel * _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_flush_entries(chain);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_flush_entries. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_flush_entries(*_arg0);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_zero_entries) {
int _result;
ip_chainlabel * _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_zero_entries(chain);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_zero_entries. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_zero_entries(*_arg0);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_create_chain) {
int _result;
ip_chainlabel * _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_create_chain(chain);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_create_chain. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_create_chain(*_arg0);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_delete_chain) {
int _result;
ip_chainlabel * _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_delete_chain(chain);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_delete_chain. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_delete_chain(*_arg0);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_set_policy) {
int _result;
ip_chainlabel * _arg0;
ip_chainlabel * _arg1;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfwc_set_policy(chain,policy);");
if (SWIG_GetPtr(ST(0),(void **) &_arg0,"ip_chainlabelPtr")) {
croak("Type error in argument 1 of ipfwc_set_policy. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
if (SWIG_GetPtr(ST(1),(void **) &_arg1,"ip_chainlabelPtr")) {
croak("Type error in argument 2 of ipfwc_set_policy. Expected ip_chainlabelPtr.");
XSRETURN(1);
}
_result = (int )ipfwc_set_policy(*_arg0,*_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfwc_strerror) {
char * _result;
int _arg0;
int argvi = 0;
dXSARGS ;
cv = cv;
if ((items < 1) || (items > 1))
croak("Usage: ipfwc_strerror(err);");
_arg0 = (int )SvIV(ST(0));
_result = (char *)ipfwc_strerror(_arg0);
ST(argvi) = sv_newmortal();
sv_setpv((SV*)ST(argvi++),(char *) _result);
XSRETURN(argvi);
}
XS(_wrap_ipfw_init) {
int _result;
int _arg0;
char ** _arg1;
unsigned int _arg2;
char * _arg3;
unsigned int _arg4;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 5) || (items > 5))
croak("Usage: ipfw_init(args,arglist,command,chain,rulenum);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (unsigned int )SvIV(ST(2));
_arg3 = (char *) SvPV(ST(3),na);
_arg4 = (unsigned int )SvIV(ST(4));
_result = (int )ipfw_init(_arg0,_arg1,_arg2,_arg3,_arg4);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_append) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_append(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_append(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_delete) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
unsigned int _arg3;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 4) || (items > 4))
croak("Usage: ipfw_delete(args,arglist,chain,rulenum);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_arg3 = (unsigned int )SvIV(ST(3));
_result = (int )ipfw_delete(_arg0,_arg1,_arg2,_arg3);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_check) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_check(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_check(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_replace) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
unsigned int _arg3;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 4) || (items > 4))
croak("Usage: ipfw_replace(args,arglist,chain,rulenum);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_arg3 = (unsigned int )SvIV(ST(3));
_result = (int )ipfw_replace(_arg0,_arg1,_arg2,_arg3);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_insert) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
unsigned int _arg3;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 4) || (items > 4))
croak("Usage: ipfw_insert(args,arglist,chain,rulenum);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_arg3 = (unsigned int )SvIV(ST(3));
_result = (int )ipfw_insert(_arg0,_arg1,_arg2,_arg3);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_list) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_list(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_list(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_flush) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_flush(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_flush(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_zero) {
int _result;
int _arg0;
char ** _arg1;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfw_zero(args,arglist);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_result = (int )ipfw_zero(_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_masq) {
int _result;
int _arg0;
char ** _arg1;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 2) || (items > 2))
croak("Usage: ipfw_masq(args,arglist);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_result = (int )ipfw_masq(_arg0,_arg1);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_new_chain) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_new_chain(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_new_chain(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_del_chain) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_del_chain(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_del_chain(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_ipfw_set_policy) {
int _result;
int _arg0;
char ** _arg1;
char * _arg2;
int argvi = 0;
SV * _saved[1];
dXSARGS ;
cv = cv;
if ((items < 3) || (items > 3))
croak("Usage: ipfw_set_policy(args,arglist,chain);");
_arg0 = (int )SvIV(ST(0));
{
AV *tempav;
I32 len;
int i;
SV **tv;
if (!SvROK(ST(1)))
croak("ST(1) is not an array.");
if (SvTYPE(SvRV(ST(1))) != SVt_PVAV)
croak("ST(1) is not an array.");
tempav = (AV*)SvRV(ST(1));
len = av_len(tempav);
_arg1 = (char **) malloc((len+2)*sizeof(char *));
for (i = 0; i <= len; i++) {
tv = av_fetch(tempav, i, 0);
_arg1[i] = (char *) SvPV(*tv,na);
}
_arg1[i] = 0;
}
_saved[0] = ST(1);
_arg2 = (char *) SvPV(ST(2),na);
_result = (int )ipfw_set_policy(_arg0,_arg1,_arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++),(IV) _result);
{
free(_arg1);
}
XSRETURN(argvi);
}
XS(_wrap_perl5_IPChains_var_init) {
dXSARGS;
SV *sv;
cv = cv; items = items;
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_IPChains) {
dXSARGS;
char *file = __FILE__;
cv = cv; items = items;
newXS("IPChainsc::var_IPChains_init", _wrap_perl5_IPChains_var_init, file);
newXS("IPChainsc::ipfwc_get_chainnames", _wrap_ipfwc_get_chainnames, file);
newXS("IPChainsc::ipfwc_get_rules", _wrap_ipfwc_get_rules, file);
newXS("IPChainsc::ipfwc_insert_entry", _wrap_ipfwc_insert_entry, file);
newXS("IPChainsc::ipfwc_replace_entry", _wrap_ipfwc_replace_entry, file);
newXS("IPChainsc::ipfwc_append_entry", _wrap_ipfwc_append_entry, file);
newXS("IPChainsc::ipfwc_delete_entry", _wrap_ipfwc_delete_entry, file);
newXS("IPChainsc::ipfwc_delete_num_entry", _wrap_ipfwc_delete_num_entry, file);
newXS("IPChainsc::ipfwc_check_packet", _wrap_ipfwc_check_packet, file);
newXS("IPChainsc::ipfwc_flush_entries", _wrap_ipfwc_flush_entries, file);
newXS("IPChainsc::ipfwc_zero_entries", _wrap_ipfwc_zero_entries, file);
newXS("IPChainsc::ipfwc_create_chain", _wrap_ipfwc_create_chain, file);
newXS("IPChainsc::ipfwc_delete_chain", _wrap_ipfwc_delete_chain, file);
newXS("IPChainsc::ipfwc_set_policy", _wrap_ipfwc_set_policy, file);
newXS("IPChainsc::ipfwc_strerror", _wrap_ipfwc_strerror, file);
newXS("IPChainsc::ipfw_init", _wrap_ipfw_init, file);
newXS("IPChainsc::ipfw_append", _wrap_ipfw_append, file);
newXS("IPChainsc::ipfw_delete", _wrap_ipfw_delete, file);
newXS("IPChainsc::ipfw_check", _wrap_ipfw_check, file);
newXS("IPChainsc::ipfw_replace", _wrap_ipfw_replace, file);
newXS("IPChainsc::ipfw_insert", _wrap_ipfw_insert, file);
newXS("IPChainsc::ipfw_list", _wrap_ipfw_list, file);
newXS("IPChainsc::ipfw_flush", _wrap_ipfw_flush, file);
newXS("IPChainsc::ipfw_zero", _wrap_ipfw_zero, file);
newXS("IPChainsc::ipfw_masq", _wrap_ipfw_masq, file);
newXS("IPChainsc::ipfw_new_chain", _wrap_ipfw_new_chain, file);
newXS("IPChainsc::ipfw_del_chain", _wrap_ipfw_del_chain, file);
newXS("IPChainsc::ipfw_set_policy", _wrap_ipfw_set_policy, file);
/*
* These are the pointer type-equivalency mappings.
* (Used by the SWIG pointer type-checker).
*/
SWIG_RegisterMapping("unsigned short","short",0);
SWIG_RegisterMapping("long","unsigned long",0);
SWIG_RegisterMapping("long","signed long",0);
SWIG_RegisterMapping("signed short","short",0);
SWIG_RegisterMapping("signed int","int",0);
SWIG_RegisterMapping("short","unsigned short",0);
SWIG_RegisterMapping("short","signed short",0);
SWIG_RegisterMapping("unsigned long","long",0);
SWIG_RegisterMapping("int","unsigned int",0);
SWIG_RegisterMapping("int","signed int",0);
SWIG_RegisterMapping("unsigned int","int",0);
SWIG_RegisterMapping("signed long","long",0);
ST(0) = &sv_yes;
XSRETURN(1);
}