1 /* -*- mode: c; tab-width: 3; c-basic-offset: 3; -*-
2 Alias_local.h contains the function prototypes for alias.c,
3 alias_db.c, alias_util.c and alias_ftp.c, alias_irc.c (as well
4 as any future add-ons). It also includes macros, globals and
5 struct definitions shared by more than one alias*.c file.
7 This include file is intended to be used only within the aliasing
8 software. Outside world interfaces are defined in alias.h
10 This software is placed into the public domain with no restrictions
13 Initial version: August, 1996 (cjm)
15 <updated several times by original author and Eivind Eiklund>
26 The following macro is used to update an
27 internet checksum. "delta" is a 32-bit
28 accumulation of all the changes to the
29 checksum (adding in new 16-bit words and
30 subtracting out old words), and "cksum"
31 is the checksum value to be updated.
33 #define ADJUST_CHECKSUM(acc, cksum) { \
38 acc = (acc >> 16) + (acc & 0xffff); \
40 cksum = (u_short) ~acc; \
44 acc = (acc >> 16) + (acc & 0xffff); \
46 cksum = (u_short) acc; \
55 extern int packetAliasMode
;
62 struct alias_link
; /* Incomplete structure */
69 /* General utilities */
70 u_short
IpChecksum(struct ip
*);
71 u_short
TcpChecksum(struct ip
*);
72 void DifferentialChecksum(u_short
*, u_short
*, u_short
*, int);
74 /* Internal data access */
76 FindIcmpIn(struct in_addr
, struct in_addr
, u_short
);
79 FindIcmpOut(struct in_addr
, struct in_addr
, u_short
);
82 FindFragmentIn1(struct in_addr
, struct in_addr
, u_short
);
85 FindFragmentIn2(struct in_addr
, struct in_addr
, u_short
);
88 AddFragmentPtrLink(struct in_addr
, u_short
);
91 FindFragmentPtr(struct in_addr
, u_short
);
94 FindUdpTcpIn (struct in_addr
, struct in_addr
, u_short
, u_short
, u_char
);
97 FindUdpTcpOut(struct in_addr
, struct in_addr
, u_short
, u_short
, u_char
);
100 FindOriginalAddress(struct in_addr
);
103 FindAliasAddress(struct in_addr
);
105 /* External data access/modification */
106 void GetFragmentAddr(struct alias_link
*, struct in_addr
*);
107 void SetFragmentAddr(struct alias_link
*, struct in_addr
);
108 void GetFragmentPtr(struct alias_link
*, char **);
109 void SetFragmentPtr(struct alias_link
*, char *);
110 void SetStateIn(struct alias_link
*, int);
111 void SetStateOut(struct alias_link
*, int);
112 int GetStateIn(struct alias_link
*);
113 int GetStateOut(struct alias_link
*);
114 struct in_addr
GetOriginalAddress(struct alias_link
*);
115 struct in_addr
GetDestAddress(struct alias_link
*);
116 struct in_addr
GetAliasAddress(struct alias_link
*);
117 struct in_addr
GetDefaultAliasAddress(void);
118 void SetDefaultAliasAddress(struct in_addr
);
119 u_short
GetOriginalPort(struct alias_link
*);
120 u_short
GetAliasPort(struct alias_link
*);
121 struct in_addr
GetProxyAddress(struct alias_link
*);
122 void SetProxyAddress(struct alias_link
*, struct in_addr
);
123 u_short
GetProxyPort(struct alias_link
*);
124 void SetProxyPort(struct alias_link
*, u_short
);
125 void SetAckModified(struct alias_link
*);
126 int GetAckModified(struct alias_link
*);
127 int GetDeltaAckIn(struct ip
*, struct alias_link
*);
128 int GetDeltaSeqOut(struct ip
*, struct alias_link
*);
129 void AddSeq(struct ip
*, struct alias_link
*, int);
130 void SetExpire(struct alias_link
*, int);
131 void ClearCheckNewLink(void);
133 void PunchFWHole(struct alias_link
*);
137 /* Housekeeping function */
138 void HouseKeeping(void);
140 /* Tcp specfic routines */
141 /*lint -save -library Suppress flexelint warnings */
144 void AliasHandleFtpOut(struct ip
*, struct alias_link
*, int);
147 void AliasHandleIrcOut(struct ip
*, struct alias_link
*, int);
149 /* NetBIOS routines */
150 int AliasHandleUdpNbt(struct ip
*, struct alias_link
*, struct in_addr
*, u_short
);
151 int AliasHandleUdpNbtNS(struct ip
*, struct alias_link
*, struct in_addr
*, u_short
*, struct in_addr
*, u_short
*);
153 /* CUSeeMe routines */
154 void AliasHandleCUSeeMeOut(struct ip
*, struct alias_link
*);
155 void AliasHandleCUSeeMeIn(struct ip
*, struct in_addr
);
157 /* Transparent proxy routines */
158 int ProxyCheck(struct ip
*, struct in_addr
*, u_short
*);
159 void ProxyModify(struct alias_link
*, struct ip
*, int, int);
162 enum alias_tcp_state
{
163 ALIAS_TCP_STATE_NOT_CONNECTED
,
164 ALIAS_TCP_STATE_CONNECTED
,
165 ALIAS_TCP_STATE_DISCONNECTED
168 int GetPptpAlias (struct in_addr
*);
170 #endif /* defined(ALIAS_LOCAL_H) */