xref: /freebsd/sys/netinet/libalias/alias_local.h (revision 8ddc51bc8b74b4809150b3129d16f8c63517fd84)
13b160b8bSBrian Somers /* -*- mode: c; tab-width: 3; c-basic-offset: 3; -*-
23b160b8bSBrian Somers     Alias_local.h contains the function prototypes for alias.c,
33b160b8bSBrian Somers     alias_db.c, alias_util.c and alias_ftp.c, alias_irc.c (as well
43b160b8bSBrian Somers     as any future add-ons).  It is intended to be used only within
53b160b8bSBrian Somers     the aliasing software.  Outside world interfaces are defined
63b160b8bSBrian Somers     in alias.h
73b160b8bSBrian Somers 
83b160b8bSBrian Somers     This software is placed into the public domain with no restrictions
93b160b8bSBrian Somers     on its distribution.
103b160b8bSBrian Somers 
113b160b8bSBrian Somers     Initial version:  August, 1996  (cjm)
123b160b8bSBrian Somers 
133b160b8bSBrian Somers      <updated several times by original author and Eivind Eiklund>
143b160b8bSBrian Somers */
158ddc51bcSEivind Eklund #ifndef ALIAS_LOCAL_H
168ddc51bcSEivind Eklund #define ALIAS_LOCAL_H
173b160b8bSBrian Somers 
183b160b8bSBrian Somers extern int packetAliasMode;
193b160b8bSBrian Somers 
203b160b8bSBrian Somers struct alias_link;
213b160b8bSBrian Somers 
223b160b8bSBrian Somers /* General utilities */
233b160b8bSBrian Somers u_short IpChecksum(struct ip *);
243b160b8bSBrian Somers u_short TcpChecksum(struct ip *);
253b160b8bSBrian Somers void DifferentialChecksum(u_short *, u_short *, u_short *, int);
263b160b8bSBrian Somers 
273b160b8bSBrian Somers /* Internal data access */
283b160b8bSBrian Somers struct alias_link *
293b160b8bSBrian Somers FindIcmpIn(struct in_addr, struct in_addr, u_short);
303b160b8bSBrian Somers 
313b160b8bSBrian Somers struct alias_link *
323b160b8bSBrian Somers FindIcmpOut(struct in_addr, struct in_addr, u_short);
333b160b8bSBrian Somers 
343b160b8bSBrian Somers struct alias_link *
353b160b8bSBrian Somers FindFragmentIn1(struct in_addr, struct in_addr, u_short);
363b160b8bSBrian Somers 
373b160b8bSBrian Somers struct alias_link *
383b160b8bSBrian Somers FindFragmentIn2(struct in_addr, struct in_addr, u_short);
393b160b8bSBrian Somers 
403b160b8bSBrian Somers struct alias_link *
413b160b8bSBrian Somers AddFragmentPtrLink(struct in_addr, u_short);
423b160b8bSBrian Somers 
433b160b8bSBrian Somers struct alias_link *
443b160b8bSBrian Somers FindFragmentPtr(struct in_addr, u_short);
453b160b8bSBrian Somers 
463b160b8bSBrian Somers struct alias_link *
473b160b8bSBrian Somers FindUdpTcpIn (struct in_addr, struct in_addr, u_short, u_short, u_char);
483b160b8bSBrian Somers 
493b160b8bSBrian Somers struct alias_link *
503b160b8bSBrian Somers FindUdpTcpOut(struct in_addr, struct in_addr, u_short, u_short, u_char);
513b160b8bSBrian Somers 
523b160b8bSBrian Somers struct in_addr
533b160b8bSBrian Somers FindOriginalAddress(struct in_addr);
543b160b8bSBrian Somers 
553b160b8bSBrian Somers struct in_addr
563b160b8bSBrian Somers FindAliasAddress(struct in_addr);
573b160b8bSBrian Somers 
583b160b8bSBrian Somers /* External data access/modification */
593b160b8bSBrian Somers void GetFragmentAddr(struct alias_link *, struct in_addr *);
603b160b8bSBrian Somers void SetFragmentAddr(struct alias_link *, struct in_addr);
613b160b8bSBrian Somers void GetFragmentPtr(struct alias_link *, char **);
623b160b8bSBrian Somers void SetFragmentPtr(struct alias_link *, char *);
633b160b8bSBrian Somers void SetStateIn(struct alias_link *, int);
643b160b8bSBrian Somers void SetStateOut(struct alias_link *, int);
653b160b8bSBrian Somers int GetStateIn(struct alias_link *);
663b160b8bSBrian Somers int GetStateOut(struct alias_link *);
673b160b8bSBrian Somers struct in_addr GetOriginalAddress(struct alias_link *);
683b160b8bSBrian Somers struct in_addr GetDestAddress(struct alias_link *);
693b160b8bSBrian Somers struct in_addr GetAliasAddress(struct alias_link *);
703b160b8bSBrian Somers struct in_addr GetDefaultAliasAddress(void);
713b160b8bSBrian Somers void SetDefaultAliasAddress(struct in_addr);
723b160b8bSBrian Somers u_short GetOriginalPort(struct alias_link *);
733b160b8bSBrian Somers u_short GetAliasPort(struct alias_link *);
743b160b8bSBrian Somers void SetAckModified(struct alias_link *);
753b160b8bSBrian Somers int GetAckModified(struct alias_link *);
763b160b8bSBrian Somers int GetDeltaAckIn(struct ip *, struct alias_link *);
773b160b8bSBrian Somers int GetDeltaSeqOut(struct ip *, struct alias_link *);
783b160b8bSBrian Somers void AddSeq(struct ip *, struct alias_link *, int);
793b160b8bSBrian Somers void SetExpire(struct alias_link *, int);
803efa11bbSBrian Somers void ClearCheckNewLink(void);
818ddc51bcSEivind Eklund void PunchFWHole(struct alias_link *);
828ddc51bcSEivind Eklund 
833b160b8bSBrian Somers 
843b160b8bSBrian Somers /* Housekeeping function */
853b160b8bSBrian Somers void HouseKeeping(void);
863b160b8bSBrian Somers 
873b160b8bSBrian Somers /* Tcp specfic routines */
883b160b8bSBrian Somers /*lint -save -library Suppress flexelint warnings */
893b160b8bSBrian Somers void AliasHandleFtpOut(struct ip *, struct alias_link *, int);
903b160b8bSBrian Somers void AliasHandleIrcOut(struct ip *pip, struct alias_link *link, int maxsize );
913efa11bbSBrian Somers 
928ddc51bcSEivind Eklund enum alias_tcp_state {
938ddc51bcSEivind Eklund     ALIAS_TCP_STATE_NOT_CONNECTED,
948ddc51bcSEivind Eklund     ALIAS_TCP_STATE_CONNECTED,
958ddc51bcSEivind Eklund     ALIAS_TCP_STATE_DISCONNECTED
968ddc51bcSEivind Eklund };
973efa11bbSBrian Somers 
983b160b8bSBrian Somers /*lint -restore */
998ddc51bcSEivind Eklund #endif /* defined(ALIAS_LOCAL_H) */
100