1997-05-23 04:41:31 +00:00
|
|
|
/*lint -save -library Flexelint comment for external headers */
|
|
|
|
|
|
|
|
/*
|
|
|
|
Alias.h defines the outside world interfaces for the packet
|
|
|
|
aliasing software.
|
|
|
|
|
|
|
|
This software is placed into the public domain with no restrictions
|
|
|
|
on its distribution.
|
1998-01-16 12:56:07 +00:00
|
|
|
|
1999-08-28 00:22:10 +00:00
|
|
|
$FreeBSD$
|
1997-05-23 04:41:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _ALIAS_H_
|
|
|
|
#define _ALIAS_H_
|
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
/* Alias link representative (incomplete struct) */
|
1997-05-23 04:41:31 +00:00
|
|
|
struct alias_link;
|
|
|
|
|
|
|
|
/* External interfaces (API) to packet aliasing engine */
|
1997-08-03 18:20:03 +00:00
|
|
|
|
|
|
|
/* Initialization and Control */
|
|
|
|
extern void
|
|
|
|
PacketAliasInit(void);
|
|
|
|
|
1998-01-09 21:13:35 +00:00
|
|
|
extern void
|
|
|
|
PacketAliasUninit(void);
|
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
extern void
|
|
|
|
PacketAliasSetAddress(struct in_addr);
|
|
|
|
|
|
|
|
extern unsigned int
|
|
|
|
PacketAliasSetMode(unsigned int, unsigned int);
|
|
|
|
|
1998-04-19 21:42:07 +00:00
|
|
|
#ifndef NO_FW_PUNCH
|
1998-01-09 21:13:35 +00:00
|
|
|
extern void
|
|
|
|
PacketAliasSetFWBase(unsigned int, unsigned int);
|
1998-04-19 21:42:07 +00:00
|
|
|
#endif
|
1998-01-09 21:13:35 +00:00
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
/* Packet Handling */
|
|
|
|
extern int
|
2001-03-22 11:55:26 +00:00
|
|
|
PacketAliasIn(char *, int);
|
1997-08-03 18:20:03 +00:00
|
|
|
|
|
|
|
extern int
|
2001-03-22 11:55:26 +00:00
|
|
|
PacketAliasOut(char *, int);
|
1997-08-03 18:20:03 +00:00
|
|
|
|
2000-07-26 23:15:46 +00:00
|
|
|
extern int
|
2001-03-22 11:55:26 +00:00
|
|
|
PacketUnaliasOut(char *, int);
|
2000-07-26 23:15:46 +00:00
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
/* Port and Address Redirection */
|
|
|
|
extern struct alias_link *
|
|
|
|
PacketAliasRedirectPort(struct in_addr, u_short,
|
|
|
|
struct in_addr, u_short,
|
|
|
|
struct in_addr, u_short,
|
|
|
|
u_char);
|
|
|
|
|
2000-04-27 17:37:03 +00:00
|
|
|
extern int
|
2001-03-22 11:55:26 +00:00
|
|
|
PacketAliasAddServer(struct alias_link *, struct in_addr, u_short);
|
2000-04-27 17:37:03 +00:00
|
|
|
|
2000-04-18 10:18:21 +00:00
|
|
|
extern struct alias_link *
|
2000-04-28 13:44:49 +00:00
|
|
|
PacketAliasRedirectProto(struct in_addr,
|
|
|
|
struct in_addr,
|
|
|
|
struct in_addr,
|
|
|
|
u_char);
|
1999-02-27 02:16:01 +00:00
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
extern struct alias_link *
|
|
|
|
PacketAliasRedirectAddr(struct in_addr,
|
|
|
|
struct in_addr);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
PacketAliasRedirectDelete(struct alias_link *);
|
|
|
|
|
|
|
|
/* Fragment Handling */
|
|
|
|
extern int
|
|
|
|
PacketAliasSaveFragment(char *);
|
|
|
|
|
|
|
|
extern char *
|
|
|
|
PacketAliasGetFragment(char *);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
PacketAliasFragmentIn(char *, char *);
|
|
|
|
|
|
|
|
/* Miscellaneous Functions */
|
1998-01-16 12:56:07 +00:00
|
|
|
extern void
|
2001-03-22 11:55:26 +00:00
|
|
|
PacketAliasSetTarget(struct in_addr);
|
1998-01-16 12:56:07 +00:00
|
|
|
|
|
|
|
extern int
|
|
|
|
PacketAliasCheckNewLink(void);
|
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
extern u_short
|
|
|
|
PacketAliasInternetChecksum(u_short *, int);
|
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
/* Transparent Proxying */
|
|
|
|
extern int
|
1999-03-24 20:28:58 +00:00
|
|
|
PacketAliasProxyRule(const char *);
|
1997-08-03 18:20:03 +00:00
|
|
|
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/********************** Mode flags ********************/
|
2000-04-05 14:23:42 +00:00
|
|
|
/* Set these flags using PacketAliasSetMode() */
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* If PKT_ALIAS_LOG is set, a message will be printed to
|
|
|
|
/var/log/alias.log every time a link is created or deleted. This
|
|
|
|
is useful for debugging */
|
1997-08-03 18:20:03 +00:00
|
|
|
#define PKT_ALIAS_LOG 0x01
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g.
|
|
|
|
to ftp, telnet or web servers will be prevented by the aliasing
|
|
|
|
mechanism. */
|
1997-08-03 18:20:03 +00:00
|
|
|
#define PKT_ALIAS_DENY_INCOMING 0x02
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from
|
2000-04-05 14:23:42 +00:00
|
|
|
the same port as they originated on. This allows e.g. rsh to work
|
1997-05-23 04:41:31 +00:00
|
|
|
*99% of the time*, but _not_ 100%. (It will be slightly flakey
|
1997-08-03 18:20:03 +00:00
|
|
|
instead of not working at all.) This mode bit is set by
|
|
|
|
PacketAliasInit(), so it is a default mode of operation. */
|
|
|
|
#define PKT_ALIAS_SAME_PORTS 0x04
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* If PKT_ALIAS_USE_SOCKETS is set, then when partially specified
|
|
|
|
links (e.g. destination port and/or address is zero), the packet
|
|
|
|
aliasing engine will attempt to allocate a socket for the aliasing
|
|
|
|
port it chooses. This will avoid interference with the host
|
1997-08-03 18:20:03 +00:00
|
|
|
machine. Fully specified links do not require this. This bit
|
|
|
|
is set after a call to PacketAliasInit(), so it is a default
|
2000-04-18 10:18:21 +00:00
|
|
|
mode of operation. */
|
1997-08-03 18:20:03 +00:00
|
|
|
#define PKT_ALIAS_USE_SOCKETS 0x08
|
1997-05-23 04:41:31 +00:00
|
|
|
|
2000-04-05 14:23:42 +00:00
|
|
|
/* If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with
|
2000-04-18 10:18:21 +00:00
|
|
|
unregistered source addresses will be aliased. Private
|
|
|
|
addresses are those in the following ranges:
|
1997-05-23 04:41:31 +00:00
|
|
|
10.0.0.0 -> 10.255.255.255
|
|
|
|
172.16.0.0 -> 172.31.255.255
|
|
|
|
192.168.0.0 -> 192.168.255.255 */
|
1997-08-03 18:20:03 +00:00
|
|
|
#define PKT_ALIAS_UNREGISTERED_ONLY 0x10
|
1997-05-23 04:41:31 +00:00
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
/* If PKT_ALIAS_RESET_ON_ADDR_CHANGE is set, then the table of dynamic
|
|
|
|
aliasing links will be reset whenever PacketAliasSetAddress()
|
|
|
|
changes the default aliasing address. If the default aliasing
|
2000-04-18 10:18:21 +00:00
|
|
|
address is left unchanged by this function call, then the
|
1997-08-03 18:20:03 +00:00
|
|
|
table of dynamic aliasing links will be left intact. This
|
|
|
|
bit is set after a call to PacketAliasInit(). */
|
|
|
|
#define PKT_ALIAS_RESET_ON_ADDR_CHANGE 0x20
|
1997-05-23 04:41:31 +00:00
|
|
|
|
1998-04-19 21:42:07 +00:00
|
|
|
#ifndef NO_FW_PUNCH
|
1998-01-09 21:13:35 +00:00
|
|
|
/* If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections
|
|
|
|
will create a 'hole' in the firewall to allow the transfers to
|
|
|
|
work. Where (IPFW "line-numbers") the hole is created is
|
|
|
|
controlled by PacketAliasSetFWBase(base, size). The hole will be
|
|
|
|
attached to that particular alias_link, so when the link goes away
|
|
|
|
so do the hole. */
|
2000-02-02 23:49:32 +00:00
|
|
|
#define PKT_ALIAS_PUNCH_FW 0x100
|
1998-04-19 21:42:07 +00:00
|
|
|
#endif
|
1998-01-09 21:13:35 +00:00
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
/* If PKT_ALIAS_PROXY_ONLY is set, then NAT will be disabled and only
|
|
|
|
transparent proxying performed */
|
|
|
|
#define PKT_ALIAS_PROXY_ONLY 0x40
|
|
|
|
|
|
|
|
/* If PKT_ALIAS_REVERSE is set, the actions of PacketAliasIn()
|
|
|
|
and PacketAliasOut() are reversed */
|
|
|
|
#define PKT_ALIAS_REVERSE 0x80
|
|
|
|
|
1997-05-23 04:41:31 +00:00
|
|
|
/* Return Codes */
|
|
|
|
#define PKT_ALIAS_ERROR -1
|
|
|
|
#define PKT_ALIAS_OK 1
|
|
|
|
#define PKT_ALIAS_IGNORED 2
|
|
|
|
#define PKT_ALIAS_UNRESOLVED_FRAGMENT 3
|
|
|
|
#define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4
|
|
|
|
|
|
|
|
#endif
|
|
|
|
/*lint -restore */
|