diff options
author | Roland McGrath <roland@gnu.org> | 2000-02-04 03:21:18 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2000-02-04 03:21:18 +0000 |
commit | 9fd51e9b0ad33a89a83fdbbb66bd20d85f7893fb (patch) | |
tree | 8845b79f170028cb4380045c50277bbf075b5b7d /pfinet/linux-src/include/net/ip_masq_mod.h | |
download | hurd-9fd51e9b0ad33a89a83fdbbb66bd20d85f7893fb.tar.gz hurd-9fd51e9b0ad33a89a83fdbbb66bd20d85f7893fb.tar.bz2 hurd-9fd51e9b0ad33a89a83fdbbb66bd20d85f7893fb.zip |
Import of Linux 2.2.12 subset (ipv4 stack and related)
Diffstat (limited to 'pfinet/linux-src/include/net/ip_masq_mod.h')
-rw-r--r-- | pfinet/linux-src/include/net/ip_masq_mod.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/pfinet/linux-src/include/net/ip_masq_mod.h b/pfinet/linux-src/include/net/ip_masq_mod.h new file mode 100644 index 00000000..a7a67d6f --- /dev/null +++ b/pfinet/linux-src/include/net/ip_masq_mod.h @@ -0,0 +1,86 @@ +/* + * IP Masquerading Modules Support + * + * Version: @(#)ip_masq_mod.h 0.01 97/10/30 + * + * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> + * + */ + + +#ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/ip_fw.h> +#include <linux/proc_fs.h> +#include <net/ip_masq.h> + +#define IP_MASQ_MOD_NOP 0 +#define IP_MASQ_MOD_ACCEPT 1 +#define IP_MASQ_MOD_REJECT -1 + +struct ip_masq_mod { + struct ip_masq_mod *next; /* next mod for addrs. lookups */ + struct ip_masq_mod *next_reg; /* next mod for configuration ctls */ + char *mmod_name; + atomic_t refcnt; + atomic_t mmod_nent; /* number of entries */ + struct proc_dir_entry *mmod_proc_ent; + int (*mmod_ctl) (int optname, struct ip_masq_ctl *, int optlen); + int (*mmod_init) (void); + int (*mmod_done) (void); + int (*mmod_in_rule) (const struct sk_buff *, const struct iphdr *); + int (*mmod_in_update) (const struct sk_buff *, const struct iphdr *, + struct ip_masq *); + struct ip_masq * (*mmod_in_create) (const struct sk_buff *, const struct iphdr *, __u32); + int (*mmod_out_rule) (const struct sk_buff *, const struct iphdr *); + int (*mmod_out_update) (const struct sk_buff *, const struct iphdr *, + struct ip_masq *); + struct ip_masq * (*mmod_out_create) (const struct sk_buff *, const struct iphdr *, __u32); +}; + +/* + * Service routines (called from ip_masq.c) + */ + +int ip_masq_mod_out_rule(const struct sk_buff *, const struct iphdr *); +int ip_masq_mod_out_update(const struct sk_buff *, const struct iphdr *, struct ip_masq *ms); +struct ip_masq * ip_masq_mod_out_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr); + +int ip_masq_mod_in_rule(const struct sk_buff *, const struct iphdr *iph); +int ip_masq_mod_in_update(const struct sk_buff *, const struct iphdr *iph, struct ip_masq *ms); +struct ip_masq * ip_masq_mod_in_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr); + +extern int ip_masq_mod_ctl(int optname, struct ip_masq_ctl *, int len); + +/* + * ip_masq_mod registration functions + */ +extern int register_ip_masq_mod(struct ip_masq_mod *mmod); +extern int unregister_ip_masq_mod(struct ip_masq_mod *mmod); +extern int ip_masq_mod_lkp_unlink(struct ip_masq_mod *mmod); +extern int ip_masq_mod_lkp_link(struct ip_masq_mod *mmod); + +/* + * init functions protos + */ +extern int ip_portfw_init(void); +extern int ip_mfw_init(void); +extern int ip_autofw_init(void); + +/* + * Utility ... + */ +static __inline__ void ip_masq_mod_dec_nent(struct ip_masq_mod *mmod) +{ + if (atomic_dec_and_test(&mmod->mmod_nent)) { + ip_masq_mod_lkp_unlink(mmod); + } +} +static __inline__ void ip_masq_mod_inc_nent(struct ip_masq_mod *mmod) +{ + atomic_inc(&mmod->mmod_nent); + if (atomic_read(&mmod->mmod_nent)==1) + ip_masq_mod_lkp_link(mmod); +} + +#endif /* __KERNEL__ */ |