diff options
author | piso <piso@FreeBSD.org> | 2006-09-26 23:26:53 +0000 |
---|---|---|
committer | piso <piso@FreeBSD.org> | 2006-09-26 23:26:53 +0000 |
commit | 5582e56d9d09f5f753111b270859af3d97ffd499 (patch) | |
tree | 5e258090de6b0498a8722ea100fedca736af05b6 /sys/netinet/libalias/alias_local.h | |
parent | e502090edb1afbf157ab5a195f23b62ac65279e1 (diff) | |
download | FreeBSD-src-5582e56d9d09f5f753111b270859af3d97ffd499.zip FreeBSD-src-5582e56d9d09f5f753111b270859af3d97ffd499.tar.gz |
Summer of Code 2005: improve libalias - part 1 of 2
With the first part of my previous Summer of Code work, we get:
-made libalias modular:
-support for 'particular' protocols (like ftp/irc/etcetc) is no more
hardcoded inside libalias, but it's available through external
modules loadable at runtime
-modules are available both in kernel (/boot/kernel/alias_*.ko) and
user land (/lib/libalias_*)
-protocols/applications modularized are: cuseeme, ftp, irc, nbt, pptp,
skinny and smedia
-added logging support for kernel side
-cleanup
After a buildworld, do a 'mergemaster -i' to install the file libalias.conf
in /etc or manually copy it.
During startup (and after every HUP signal) user land applications running
the new libalias will try to read a file in /etc called libalias.conf:
that file contains the list of modules to load.
User land applications affected by this commit are ppp and natd:
if libalias.conf is present in /etc you won't notice any difference.
The only kernel land bit affected by this commit is ng_nat:
if you are using ng_nat, and it doesn't correctly handle
ftp/irc/etcetc sessions anymore, remember to kldload
the correspondent module (i.e. kldload alias_ftp).
General information and details about the inner working are available
in the libalias man page under the section 'MODULAR ARCHITECTURE
(AND ipfw(4) SUPPORT)'.
NOTA BENE: this commit affects _ONLY_ libalias, ipfw in-kernel nat
support will be part of the next libalias-related commit.
Approved by: glebius
Reviewed by: glebius, ru
Diffstat (limited to 'sys/netinet/libalias/alias_local.h')
-rw-r--r-- | sys/netinet/libalias/alias_local.h | 64 |
1 files changed, 12 insertions, 52 deletions
diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 4dc2e0a..1dc50c8 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -46,18 +46,13 @@ #ifndef _ALIAS_LOCAL_H_ #define _ALIAS_LOCAL_H_ -#include <sys/queue.h> - -/* Use kernel allocator. */ -#if defined(_KERNEL) && defined(_SYS_MALLOC_H_) -MALLOC_DECLARE(M_ALIAS); -#define malloc(x) malloc(x, M_ALIAS, M_NOWAIT|M_ZERO) -#define calloc(x, n) malloc(x*n) -#define free(x) free(x, M_ALIAS) -#endif +#include <sys/types.h> +#include <sys/sysctl.h> -/* XXX: LibAliasSetTarget() uses this constant. */ #ifdef _KERNEL +#include <sys/malloc.h> +#include <sys/lock.h> +/* XXX: LibAliasSetTarget() uses this constant. */ #define INADDR_NONE 0xffffffff #endif @@ -116,10 +111,14 @@ struct libalias { int deleteAllLinks; /* If equal to zero, DeleteLink() */ /* will not remove permanent links */ -#ifndef NO_LOGGING - FILE *monitorFile; /* File descriptor for link */ + + /* log descriptor */ +#ifdef _KERNEL + char *logDesc; +#else + FILE *logDesc; #endif - /* statistics monitoring file */ + /* statistics monitoring */ int newDefaultLink; /* Indicates if a new aliasing */ /* link has been created after a */ @@ -296,43 +295,6 @@ void HouseKeeping(struct libalias *); /* Tcp specfic routines */ /* lint -save -library Suppress flexelint warnings */ -/* FTP routines */ -void -AliasHandleFtpOut(struct libalias *la, struct ip *_pip, struct alias_link *_lnk, - int _maxpacketsize); - -/* IRC routines */ -void -AliasHandleIrcOut(struct libalias *la, struct ip *_pip, struct alias_link *_lnk, - int _maxsize); - -/* RTSP routines */ -void -AliasHandleRtspOut(struct libalias *la, struct ip *_pip, struct alias_link *_lnk, - int _maxpacketsize); - -/* PPTP routines */ -void AliasHandlePptpOut(struct libalias *la, struct ip *_pip, struct alias_link *_lnk); -void AliasHandlePptpIn(struct libalias *la, struct ip *_pip, struct alias_link *_lnk); -int AliasHandlePptpGreOut(struct libalias *la, struct ip *_pip); -int AliasHandlePptpGreIn(struct libalias *la, struct ip *_pip); - -/* NetBIOS routines */ -int -AliasHandleUdpNbt(struct libalias *la, struct ip *_pip, struct alias_link *_lnk, - struct in_addr *_alias_address, u_short _alias_port); -int -AliasHandleUdpNbtNS(struct libalias *la, struct ip *_pip, struct alias_link *_lnk, - struct in_addr *_alias_address, u_short * _alias_port, - struct in_addr *_original_address, u_short * _original_port); - -/* CUSeeMe routines */ -void AliasHandleCUSeeMeOut(struct libalias *la, struct ip *_pip, struct alias_link *_lnk); -void AliasHandleCUSeeMeIn(struct libalias *la, struct ip *_pip, struct in_addr _original_addr); - -/* Skinny routines */ -void AliasHandleSkinny(struct libalias *la, struct ip *_pip, struct alias_link *_lnk); - /* Transparent proxy routines */ int ProxyCheck(struct libalias *la, struct ip *_pip, struct in_addr *_proxy_server_addr, @@ -373,6 +335,4 @@ udp_next(struct udphdr *udphdr) } #endif -/*lint -restore */ - #endif /* !_ALIAS_LOCAL_H_ */ |