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
| 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) */
| 15#ifndef NULL 16#define NULL 0 17#endif 18 19/* Alias link representative (incomplete struct) */
|
16struct alias_link; 17 18/* External interfaces (API) to packet aliasing engine */
| 20struct alias_link; 21 22/* External interfaces (API) to packet aliasing engine */
|
| 23 24/* Initialization and Control */ 25 extern void 26 PacketAliasInit(void); 27 28 extern void 29 PacketAliasSetAddress(struct in_addr); 30 31 extern unsigned int 32 PacketAliasSetMode(unsigned int, unsigned int); 33 34/* Packet Handling */ 35 extern int 36 PacketAliasIn(char *, int maxpacketsize); 37 38 extern int 39 PacketAliasOut(char *, int maxpacketsize); 40 41/* Port and Address Redirection */ 42 extern struct alias_link * 43 PacketAliasRedirectPort(struct in_addr, u_short, 44 struct in_addr, u_short, 45 struct in_addr, u_short, 46 u_char); 47 48 extern struct alias_link * 49 PacketAliasRedirectAddr(struct in_addr, 50 struct in_addr); 51 52 extern void 53 PacketAliasRedirectDelete(struct alias_link *); 54 55/* Fragment Handling */ 56 extern int 57 PacketAliasSaveFragment(char *); 58 59 extern char * 60 PacketAliasGetFragment(char *); 61 62 extern void 63 PacketAliasFragmentIn(char *, char *); 64 65/* Miscellaneous Functions */ 66 extern u_short 67 PacketAliasInternetChecksum(u_short *, int); 68 69 70/* 71 In version 2.2, the function names were rationalized 72 to all be of the form PacketAlias... These are the 73 old function names for backwards compatibility 74*/
|
19extern int SaveFragmentPtr(char *); 20extern char *GetNextFragmentPtr(char *); 21extern void FragmentAliasIn(char *, char *);
| 75extern int SaveFragmentPtr(char *); 76extern char *GetNextFragmentPtr(char *); 77extern void FragmentAliasIn(char *, char *);
|
22extern int PacketAliasIn(char *, int maxpacketsize); 23extern int PacketAliasOut(char *, int maxpacketsize); 24extern int PacketAliasIn2(char *, struct in_addr, int maxpacketsize); 25extern int PacketAliasOut2(char *, struct in_addr, int maxpacketsize);
| |
26extern void SetPacketAliasAddress(struct in_addr); 27extern void InitPacketAlias(void);
| 78extern void SetPacketAliasAddress(struct in_addr); 79extern void InitPacketAlias(void);
|
28extern void InitPacketAliasLog(void); 29extern void UninitPacketAliasLog(void);
| |
30extern unsigned int SetPacketAliasMode(unsigned int, unsigned int);
| 80extern unsigned int SetPacketAliasMode(unsigned int, unsigned int);
|
31extern struct alias_link * 32PacketAliasRedirectPort(struct in_addr, u_short, 33 struct in_addr, u_short, 34 struct in_addr, u_short, 35 u_char);
| 81extern int PacketAliasIn2(char *, struct in_addr, int maxpacketsize); 82extern int PacketAliasOut2(char *, struct in_addr, int maxpacketsize);
|
36extern int 37PacketAliasPermanentLink(struct in_addr, u_short, 38 struct in_addr, u_short, 39 u_short, u_char);
| 83extern int 84PacketAliasPermanentLink(struct in_addr, u_short, 85 struct in_addr, u_short, 86 u_short, u_char);
|
40extern struct alias_link * 41PacketAliasRedirectAddr(struct in_addr, 42 struct in_addr); 43void 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
| |
52extern u_short InternetChecksum(u_short *, int); 53
| 87extern u_short InternetChecksum(u_short *, int); 88
|
| 89/* Obsolete constant */ 90#define PKT_ALIAS_NEW_LINK 5
|
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 */
| 91 92/********************** Mode flags ********************/ 93/* Set these flags using SetPacketAliasMode() */ 94 95/* If PKT_ALIAS_LOG is set, a message will be printed to 96 /var/log/alias.log every time a link is created or deleted. This 97 is useful for debugging */
|
61#define PKT_ALIAS_LOG 1
| 98#define PKT_ALIAS_LOG 0x01
|
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. */
| 99 100/* If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g. 101 to ftp, telnet or web servers will be prevented by the aliasing 102 mechanism. */
|
66#define PKT_ALIAS_DENY_INCOMING 2
| 103#define PKT_ALIAS_DENY_INCOMING 0x02
|
67 68/* If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from
| 104 105/* 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
| 106 the same port as they originated on. This allows eg rsh to work
|
70 *99% of the time*, but _not_ 100%. (It will be slightly flakey
| 107 *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
| 108 instead of not working at all.) This mode bit is set by 109 PacketAliasInit(), so it is a default mode of operation. */ 110#define PKT_ALIAS_SAME_PORTS 0x04
|
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
| 111 112/* If PKT_ALIAS_USE_SOCKETS is set, then when partially specified 113 links (e.g. destination port and/or address is zero), the packet 114 aliasing engine will attempt to allocate a socket for the aliasing 115 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
| 116 machine. Fully specified links do not require this. This bit 117 is set after a call to PacketAliasInit(), so it is a default 118 mode of operation.*/ 119#define PKT_ALIAS_USE_SOCKETS 0x08
|
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 */
| 120 121/* If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with with 122 unregistered source addresses will be aliased (along with those 123 of the ppp host maching itself. Private addresses are those 124 in the following ranges: 125 126 10.0.0.0 -> 10.255.255.255 127 172.16.0.0 -> 172.31.255.255 128 192.168.0.0 -> 192.168.255.255 */
|
89#define PKT_ALIAS_UNREGISTERED_ONLY 16
| 129#define PKT_ALIAS_UNREGISTERED_ONLY 0x10
|
90
| 130
|
| 131/* If PKT_ALIAS_RESET_ON_ADDR_CHANGE is set, then the table of dynamic 132 aliasing links will be reset whenever PacketAliasSetAddress() 133 changes the default aliasing address. If the default aliasing 134 address is left unchanged by this functions call, then the 135 table of dynamic aliasing links will be left intact. This 136 bit is set after a call to PacketAliasInit(). */ 137#define PKT_ALIAS_RESET_ON_ADDR_CHANGE 0x20
|
91
| 138
|
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
| 139/* Return Codes */ 140#define PKT_ALIAS_ERROR -1 141#define PKT_ALIAS_OK 1 142#define PKT_ALIAS_IGNORED 2 143#define PKT_ALIAS_UNRESOLVED_FRAGMENT 3 144#define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4
|
99#define PKT_ALIAS_NEW_LINK 5
| |
100 101#endif 102/*lint -restore */
| 145 146#endif 147/*lint -restore */
|