1 /*lint -save -library Flexelint comment for external headers */ 2 3 /* 4 Alias.h defines the outside world interfaces for the packet 5 aliasing software. 6 7 This software is placed into the public domain with no restrictions 8 on its distribution. 9 */ 10 11 12 #ifndef _ALIAS_H_ 13 #define _ALIAS_H_ 14 15 /* Alias link representativei (incomplete struct) */ 16 struct alias_link; 17 18 /* External interfaces (API) to packet aliasing engine */ 19 extern int SaveFragmentPtr(char *); 20 extern char *GetNextFragmentPtr(char *); 21 extern void FragmentAliasIn(char *, char *); 22 extern int PacketAliasIn(char *, int maxpacketsize); 23 extern int PacketAliasOut(char *, int maxpacketsize); 24 extern int PacketAliasIn2(char *, struct in_addr, int maxpacketsize); 25 extern int PacketAliasOut2(char *, struct in_addr, int maxpacketsize); 26 extern void SetPacketAliasAddress(struct in_addr); 27 extern void InitPacketAlias(void); 28 extern void InitPacketAliasLog(void); 29 extern void UninitPacketAliasLog(void); 30 extern unsigned int SetPacketAliasMode(unsigned int, unsigned int); 31 extern struct alias_link * 32 PacketAliasRedirectPort(struct in_addr, u_short, 33 struct in_addr, u_short, 34 struct in_addr, u_short, 35 u_char); 36 extern int 37 PacketAliasPermanentLink(struct in_addr, u_short, 38 struct in_addr, u_short, 39 u_short, u_char); 40 extern struct alias_link * 41 PacketAliasRedirectAddr(struct in_addr, 42 struct in_addr); 43 void PacketAliasRedirectDelete(struct alias_link *); 44 45 46 /* InternetChecksum() is not specifically part of the 47 packet aliasing API, but is sometimes needed outside 48 the module. (~for instance, natd uses it to create 49 an ICMP error message when interface size is 50 exceeded.) */ 51 52 extern u_short InternetChecksum(u_short *, int); 53 54 55 /********************** Mode flags ********************/ 56 /* Set these flags using SetPacketAliasMode() */ 57 58 /* If PKT_ALIAS_LOG is set, a message will be printed to 59 /var/log/alias.log every time a link is created or deleted. This 60 is useful for debugging */ 61 #define PKT_ALIAS_LOG 1 62 63 /* If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g. 64 to ftp, telnet or web servers will be prevented by the aliasing 65 mechanism. */ 66 #define PKT_ALIAS_DENY_INCOMING 2 67 68 /* If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from 69 the same port as they originated on. This allow eg rsh to work 70 *99% of the time*, but _not_ 100%. (It will be slightly flakey 71 instead of not working at all.) */ 72 #define PKT_ALIAS_SAME_PORTS 4 73 74 /* If PKT_ALIAS_USE_SOCKETS is set, then when partially specified 75 links (e.g. destination port and/or address is zero), the packet 76 aliasing engine will attempt to allocate a socket for the aliasing 77 port it chooses. This will avoid interference with the host 78 machine. Fully specified links do not require this. */ 79 #define PKT_ALIAS_USE_SOCKETS 8 80 81 /* If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with with 82 unregistered source addresses will be aliased (along with those 83 of the ppp host maching itself. Private addresses are those 84 in the following ranges: 85 86 10.0.0.0 -> 10.255.255.255 87 172.16.0.0 -> 172.31.255.255 88 192.168.0.0 -> 192.168.255.255 */ 89 #define PKT_ALIAS_UNREGISTERED_ONLY 16 90 91 92 93 /* Return Codes */ 94 #define PKT_ALIAS_ERROR -1 95 #define PKT_ALIAS_OK 1 96 #define PKT_ALIAS_IGNORED 2 97 #define PKT_ALIAS_UNRESOLVED_FRAGMENT 3 98 #define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4 99 #define PKT_ALIAS_NEW_LINK 5 100 101 #endif 102 /*lint -restore */ 103