]>
git.saurik.com Git - apple/network_cmds.git/blob - alias/alias.h
1 /*lint -save -library Flexelint comment for external headers */
4 Alias.h defines the outside world interfaces for the packet
7 This software is placed into the public domain with no restrictions
10 $Id: alias.h,v 1.1.1.1 2000/01/11 01:48:42 wsanchez Exp $
21 /* Alias link representative (incomplete struct) */
24 /* External interfaces (API) to packet aliasing engine */
26 /* Initialization and Control */
28 PacketAliasInit(void);
31 PacketAliasUninit(void);
34 PacketAliasSetAddress(struct in_addr
);
37 PacketAliasSetMode(unsigned int, unsigned int);
41 PacketAliasSetFWBase(unsigned int, unsigned int);
46 PacketAliasIn(char *, int maxpacketsize
);
49 PacketAliasOut(char *, int maxpacketsize
);
51 /* Port and Address Redirection */
52 extern struct alias_link
*
53 PacketAliasRedirectPort(struct in_addr
, u_short
,
54 struct in_addr
, u_short
,
55 struct in_addr
, u_short
,
59 PacketAliasPptp(struct in_addr
);
62 extern struct alias_link
*
63 PacketAliasRedirectAddr(struct in_addr
,
67 PacketAliasRedirectDelete(struct alias_link
*);
69 /* Fragment Handling */
71 PacketAliasSaveFragment(char *);
74 PacketAliasGetFragment(char *);
77 PacketAliasFragmentIn(char *, char *);
79 /* Miscellaneous Functions */
81 PacketAliasSetTarget(struct in_addr addr
);
84 PacketAliasCheckNewLink(void);
87 PacketAliasInternetChecksum(u_short
*, int);
89 /* Transparent Proxying */
91 PacketAliasProxyRule(const char *);
94 /********************** Mode flags ********************/
95 /* Set these flags using SetPacketAliasMode() */
97 /* If PKT_ALIAS_LOG is set, a message will be printed to
98 /var/log/alias.log every time a link is created or deleted. This
99 is useful for debugging */
100 #define PKT_ALIAS_LOG 0x01
102 /* If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g.
103 to ftp, telnet or web servers will be prevented by the aliasing
105 #define PKT_ALIAS_DENY_INCOMING 0x02
107 /* If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from
108 the same port as they originated on. This allows eg rsh to work
109 *99% of the time*, but _not_ 100%. (It will be slightly flakey
110 instead of not working at all.) This mode bit is set by
111 PacketAliasInit(), so it is a default mode of operation. */
112 #define PKT_ALIAS_SAME_PORTS 0x04
114 /* If PKT_ALIAS_USE_SOCKETS is set, then when partially specified
115 links (e.g. destination port and/or address is zero), the packet
116 aliasing engine will attempt to allocate a socket for the aliasing
117 port it chooses. This will avoid interference with the host
118 machine. Fully specified links do not require this. This bit
119 is set after a call to PacketAliasInit(), so it is a default
121 #define PKT_ALIAS_USE_SOCKETS 0x08
123 /* If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with with
124 unregistered source addresses will be aliased (along with those
125 of the ppp host maching itself. Private addresses are those
126 in the following ranges:
127 10.0.0.0 -> 10.255.255.255
128 172.16.0.0 -> 172.31.255.255
129 192.168.0.0 -> 192.168.255.255 */
130 #define PKT_ALIAS_UNREGISTERED_ONLY 0x10
132 /* If PKT_ALIAS_RESET_ON_ADDR_CHANGE is set, then the table of dynamic
133 aliasing links will be reset whenever PacketAliasSetAddress()
134 changes the default aliasing address. If the default aliasing
135 address is left unchanged by this functions call, then the
136 table of dynamic aliasing links will be left intact. This
137 bit is set after a call to PacketAliasInit(). */
138 #define PKT_ALIAS_RESET_ON_ADDR_CHANGE 0x20
141 /* If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections
142 will create a 'hole' in the firewall to allow the transfers to
143 work. Where (IPFW "line-numbers") the hole is created is
144 controlled by PacketAliasSetFWBase(base, size). The hole will be
145 attached to that particular alias_link, so when the link goes away
147 #define PKT_ALIAS_PUNCH_FW 0x40
150 /* If PKT_ALIAS_PROXY_ONLY is set, then NAT will be disabled and only
151 transparent proxying performed */
152 #define PKT_ALIAS_PROXY_ONLY 0x40
154 /* If PKT_ALIAS_REVERSE is set, the actions of PacketAliasIn()
155 and PacketAliasOut() are reversed */
156 #define PKT_ALIAS_REVERSE 0x80
159 #define PKT_ALIAS_ERROR -1
160 #define PKT_ALIAS_OK 1
161 #define PKT_ALIAS_IGNORED 2
162 #define PKT_ALIAS_UNRESOLVED_FRAGMENT 3
163 #define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4