summaryrefslogtreecommitdiffstats
path: root/lib/libalias/alias.h
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-08-03 18:20:03 +0000
committerbrian <brian@FreeBSD.org>1997-08-03 18:20:03 +0000
commite7c02535af1562d83c5da123145906b1f3052ea8 (patch)
tree33547ba3ecdb3d721b25e6b37f689c588e1578b3 /lib/libalias/alias.h
parent18f2d2147c1f106b540853963b606553f9c14e19 (diff)
downloadFreeBSD-src-e7c02535af1562d83c5da123145906b1f3052ea8.zip
FreeBSD-src-e7c02535af1562d83c5da123145906b1f3052ea8.tar.gz
Update to version 2.2. Only the PacketAlias*()
functions should now be used. The old 2.1 stuff is there for backwards compatability. Submitted by: Charles Mott <cmott@snake.srv.net>
Diffstat (limited to 'lib/libalias/alias.h')
-rw-r--r--lib/libalias/alias.h113
1 files changed, 79 insertions, 34 deletions
diff --git a/lib/libalias/alias.h b/lib/libalias/alias.h
index 0063802..f574017 100644
--- a/lib/libalias/alias.h
+++ b/lib/libalias/alias.h
@@ -12,45 +12,82 @@
#ifndef _ALIAS_H_
#define _ALIAS_H_
-/* Alias link representativei (incomplete struct) */
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* Alias link representative (incomplete struct) */
struct alias_link;
/* External interfaces (API) to packet aliasing engine */
+
+/* Initialization and Control */
+ extern void
+ PacketAliasInit(void);
+
+ extern void
+ PacketAliasSetAddress(struct in_addr);
+
+ extern unsigned int
+ PacketAliasSetMode(unsigned int, unsigned int);
+
+/* Packet Handling */
+ extern int
+ PacketAliasIn(char *, int maxpacketsize);
+
+ extern int
+ PacketAliasOut(char *, int maxpacketsize);
+
+/* 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);
+
+ 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 */
+ extern u_short
+ PacketAliasInternetChecksum(u_short *, int);
+
+
+/*
+ In version 2.2, the function names were rationalized
+ to all be of the form PacketAlias... These are the
+ old function names for backwards compatibility
+*/
extern int SaveFragmentPtr(char *);
extern char *GetNextFragmentPtr(char *);
extern void FragmentAliasIn(char *, char *);
-extern int PacketAliasIn(char *, int maxpacketsize);
-extern int PacketAliasOut(char *, int maxpacketsize);
-extern int PacketAliasIn2(char *, struct in_addr, int maxpacketsize);
-extern int PacketAliasOut2(char *, struct in_addr, int maxpacketsize);
extern void SetPacketAliasAddress(struct in_addr);
extern void InitPacketAlias(void);
-extern void InitPacketAliasLog(void);
-extern void UninitPacketAliasLog(void);
extern unsigned int SetPacketAliasMode(unsigned int, unsigned int);
-extern struct alias_link *
-PacketAliasRedirectPort(struct in_addr, u_short,
- struct in_addr, u_short,
- struct in_addr, u_short,
- u_char);
+extern int PacketAliasIn2(char *, struct in_addr, int maxpacketsize);
+extern int PacketAliasOut2(char *, struct in_addr, int maxpacketsize);
extern int
PacketAliasPermanentLink(struct in_addr, u_short,
struct in_addr, u_short,
u_short, u_char);
-extern struct alias_link *
-PacketAliasRedirectAddr(struct in_addr,
- struct in_addr);
-void PacketAliasRedirectDelete(struct alias_link *);
-
-
-/* InternetChecksum() is not specifically part of the
- packet aliasing API, but is sometimes needed outside
- the module. (~for instance, natd uses it to create
- an ICMP error message when interface size is
- exceeded.) */
-
extern u_short InternetChecksum(u_short *, int);
+/* Obsolete constant */
+#define PKT_ALIAS_NEW_LINK 5
/********************** Mode flags ********************/
/* Set these flags using SetPacketAliasMode() */
@@ -58,25 +95,28 @@ extern u_short InternetChecksum(u_short *, int);
/* 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 */
-#define PKT_ALIAS_LOG 1
+#define PKT_ALIAS_LOG 0x01
/* 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. */
-#define PKT_ALIAS_DENY_INCOMING 2
+#define PKT_ALIAS_DENY_INCOMING 0x02
/* If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from
- the same port as they originated on. This allow eg rsh to work
+ the same port as they originated on. This allows eg rsh to work
*99% of the time*, but _not_ 100%. (It will be slightly flakey
- instead of not working at all.) */
-#define PKT_ALIAS_SAME_PORTS 4
+ 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
/* 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
- machine. Fully specified links do not require this. */
-#define PKT_ALIAS_USE_SOCKETS 8
+ machine. Fully specified links do not require this. This bit
+ is set after a call to PacketAliasInit(), so it is a default
+ mode of operation.*/
+#define PKT_ALIAS_USE_SOCKETS 0x08
/* If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with with
unregistered source addresses will be aliased (along with those
@@ -86,9 +126,15 @@ extern u_short InternetChecksum(u_short *, int);
10.0.0.0 -> 10.255.255.255
172.16.0.0 -> 172.31.255.255
192.168.0.0 -> 192.168.255.255 */
-#define PKT_ALIAS_UNREGISTERED_ONLY 16
-
+#define PKT_ALIAS_UNREGISTERED_ONLY 0x10
+/* 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
+ address is left unchanged by this functions call, then the
+ 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
/* Return Codes */
#define PKT_ALIAS_ERROR -1
@@ -96,7 +142,6 @@ extern u_short InternetChecksum(u_short *, int);
#define PKT_ALIAS_IGNORED 2
#define PKT_ALIAS_UNRESOLVED_FRAGMENT 3
#define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4
-#define PKT_ALIAS_NEW_LINK 5
#endif
/*lint -restore */
OpenPOWER on IntegriCloud