1997-05-23 04:41:31 +00:00
|
|
|
/* -*- mode: c; tab-width: 3; c-basic-offset: 3; -*-
|
|
|
|
Alias_local.h contains the function prototypes for alias.c,
|
|
|
|
alias_db.c, alias_util.c and alias_ftp.c, alias_irc.c (as well
|
1999-02-27 02:16:01 +00:00
|
|
|
as any future add-ons). It also includes macros, globals and
|
|
|
|
struct definitions shared by more than one alias*.c file.
|
|
|
|
|
|
|
|
This include file is intended to be used only within the aliasing
|
|
|
|
software. Outside world interfaces are defined in alias.h
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
This software is placed into the public domain with no restrictions
|
|
|
|
on its distribution.
|
|
|
|
|
|
|
|
Initial version: August, 1996 (cjm)
|
|
|
|
|
1999-08-29 23:17:04 +00:00
|
|
|
<updated several times by original author and Eivind Eklund>
|
|
|
|
|
|
|
|
$FreeBSD$
|
1997-05-23 04:41:31 +00:00
|
|
|
*/
|
1998-01-09 21:13:35 +00:00
|
|
|
#ifndef ALIAS_LOCAL_H
|
|
|
|
#define ALIAS_LOCAL_H
|
1997-05-23 04:41:31 +00:00
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Macros
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
The following macro is used to update an
|
|
|
|
internet checksum. "delta" is a 32-bit
|
|
|
|
accumulation of all the changes to the
|
|
|
|
checksum (adding in new 16-bit words and
|
|
|
|
subtracting out old words), and "cksum"
|
|
|
|
is the checksum value to be updated.
|
|
|
|
*/
|
|
|
|
#define ADJUST_CHECKSUM(acc, cksum) { \
|
|
|
|
acc += cksum; \
|
|
|
|
if (acc < 0) \
|
|
|
|
{ \
|
|
|
|
acc = -acc; \
|
|
|
|
acc = (acc >> 16) + (acc & 0xffff); \
|
|
|
|
acc += acc >> 16; \
|
|
|
|
cksum = (u_short) ~acc; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
acc = (acc >> 16) + (acc & 0xffff); \
|
|
|
|
acc += acc >> 16; \
|
|
|
|
cksum = (u_short) acc; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Globals
|
|
|
|
*/
|
|
|
|
|
1997-05-23 04:41:31 +00:00
|
|
|
extern int packetAliasMode;
|
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Structs
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct alias_link; /* Incomplete structure */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Prototypes
|
|
|
|
*/
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* General utilities */
|
|
|
|
u_short IpChecksum(struct ip *);
|
|
|
|
u_short TcpChecksum(struct ip *);
|
|
|
|
void DifferentialChecksum(u_short *, u_short *, u_short *, int);
|
|
|
|
|
|
|
|
/* Internal data access */
|
|
|
|
struct alias_link *
|
|
|
|
FindIcmpIn(struct in_addr, struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindIcmpOut(struct in_addr, struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindFragmentIn1(struct in_addr, struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindFragmentIn2(struct in_addr, struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
AddFragmentPtrLink(struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindFragmentPtr(struct in_addr, u_short);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindUdpTcpIn (struct in_addr, struct in_addr, u_short, u_short, u_char);
|
|
|
|
|
|
|
|
struct alias_link *
|
|
|
|
FindUdpTcpOut(struct in_addr, struct in_addr, u_short, u_short, u_char);
|
|
|
|
|
|
|
|
struct in_addr
|
|
|
|
FindOriginalAddress(struct in_addr);
|
|
|
|
|
|
|
|
struct in_addr
|
|
|
|
FindAliasAddress(struct in_addr);
|
|
|
|
|
|
|
|
/* External data access/modification */
|
|
|
|
void GetFragmentAddr(struct alias_link *, struct in_addr *);
|
|
|
|
void SetFragmentAddr(struct alias_link *, struct in_addr);
|
|
|
|
void GetFragmentPtr(struct alias_link *, char **);
|
|
|
|
void SetFragmentPtr(struct alias_link *, char *);
|
|
|
|
void SetStateIn(struct alias_link *, int);
|
|
|
|
void SetStateOut(struct alias_link *, int);
|
|
|
|
int GetStateIn(struct alias_link *);
|
|
|
|
int GetStateOut(struct alias_link *);
|
|
|
|
struct in_addr GetOriginalAddress(struct alias_link *);
|
|
|
|
struct in_addr GetDestAddress(struct alias_link *);
|
|
|
|
struct in_addr GetAliasAddress(struct alias_link *);
|
|
|
|
struct in_addr GetDefaultAliasAddress(void);
|
|
|
|
void SetDefaultAliasAddress(struct in_addr);
|
|
|
|
u_short GetOriginalPort(struct alias_link *);
|
|
|
|
u_short GetAliasPort(struct alias_link *);
|
1999-02-27 02:16:01 +00:00
|
|
|
struct in_addr GetProxyAddress(struct alias_link *);
|
|
|
|
void SetProxyAddress(struct alias_link *, struct in_addr);
|
|
|
|
u_short GetProxyPort(struct alias_link *);
|
|
|
|
void SetProxyPort(struct alias_link *, u_short);
|
1997-05-23 04:41:31 +00:00
|
|
|
void SetAckModified(struct alias_link *);
|
|
|
|
int GetAckModified(struct alias_link *);
|
|
|
|
int GetDeltaAckIn(struct ip *, struct alias_link *);
|
|
|
|
int GetDeltaSeqOut(struct ip *, struct alias_link *);
|
|
|
|
void AddSeq(struct ip *, struct alias_link *, int);
|
|
|
|
void SetExpire(struct alias_link *, int);
|
1997-08-03 18:20:03 +00:00
|
|
|
void ClearCheckNewLink(void);
|
1998-06-06 21:52:37 +00:00
|
|
|
#ifndef NO_FW_PUNCH
|
1998-01-09 21:13:35 +00:00
|
|
|
void PunchFWHole(struct alias_link *);
|
1998-06-06 21:52:37 +00:00
|
|
|
#endif
|
1998-01-09 21:13:35 +00:00
|
|
|
|
1997-05-23 04:41:31 +00:00
|
|
|
|
|
|
|
/* Housekeeping function */
|
|
|
|
void HouseKeeping(void);
|
|
|
|
|
|
|
|
/* Tcp specfic routines */
|
|
|
|
/*lint -save -library Suppress flexelint warnings */
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/* FTP routines */
|
1997-05-23 04:41:31 +00:00
|
|
|
void AliasHandleFtpOut(struct ip *, struct alias_link *, int);
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/* IRC routines */
|
1999-03-24 20:28:58 +00:00
|
|
|
void AliasHandleIrcOut(struct ip *, struct alias_link *, int);
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/* NetBIOS routines */
|
1998-12-14 02:25:32 +00:00
|
|
|
int AliasHandleUdpNbt(struct ip *, struct alias_link *, struct in_addr *, u_short);
|
|
|
|
int AliasHandleUdpNbtNS(struct ip *, struct alias_link *, struct in_addr *, u_short *, struct in_addr *, u_short *);
|
1999-02-27 02:16:01 +00:00
|
|
|
|
|
|
|
/* CUSeeMe routines */
|
1998-06-24 06:58:00 +00:00
|
|
|
void AliasHandleCUSeeMeOut(struct ip *, struct alias_link *);
|
|
|
|
void AliasHandleCUSeeMeIn(struct ip *, struct in_addr);
|
1998-05-24 03:03:10 +00:00
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
/* Transparent proxy routines */
|
|
|
|
int ProxyCheck(struct ip *, struct in_addr *, u_short *);
|
|
|
|
void ProxyModify(struct alias_link *, struct ip *, int, int);
|
1998-05-24 03:03:10 +00:00
|
|
|
|
1997-08-03 18:20:03 +00:00
|
|
|
|
1998-01-09 21:13:35 +00:00
|
|
|
enum alias_tcp_state {
|
|
|
|
ALIAS_TCP_STATE_NOT_CONNECTED,
|
|
|
|
ALIAS_TCP_STATE_CONNECTED,
|
|
|
|
ALIAS_TCP_STATE_DISCONNECTED
|
|
|
|
};
|
1997-08-03 18:20:03 +00:00
|
|
|
|
1999-02-27 02:16:01 +00:00
|
|
|
int GetPptpAlias (struct in_addr*);
|
1997-05-23 04:41:31 +00:00
|
|
|
/*lint -restore */
|
1998-01-09 21:13:35 +00:00
|
|
|
#endif /* defined(ALIAS_LOCAL_H) */
|