xref: /freebsd/sys/netinet/libalias/alias_local.h (revision 2ad872c5794e4c26fdf6ed219ad3f09ca0d5304a)
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 is intended to be used only within
5     the aliasing software.  Outside world interfaces are defined
6     in alias.h
7 
8     This software is placed into the public domain with no restrictions
9     on its distribution.
10 
11     Initial version:  August, 1996  (cjm)
12 
13      <updated several times by original author and Eivind Eiklund>
14 */
15 #ifndef ALIAS_LOCAL_H
16 #define ALIAS_LOCAL_H
17 
18 extern int packetAliasMode;
19 
20 struct alias_link;
21 
22 /* General utilities */
23 u_short IpChecksum(struct ip *);
24 u_short TcpChecksum(struct ip *);
25 void DifferentialChecksum(u_short *, u_short *, u_short *, int);
26 
27 /* Internal data access */
28 struct alias_link *
29 FindIcmpIn(struct in_addr, struct in_addr, u_short);
30 
31 struct alias_link *
32 FindIcmpOut(struct in_addr, struct in_addr, u_short);
33 
34 struct alias_link *
35 FindFragmentIn1(struct in_addr, struct in_addr, u_short);
36 
37 struct alias_link *
38 FindFragmentIn2(struct in_addr, struct in_addr, u_short);
39 
40 struct alias_link *
41 AddFragmentPtrLink(struct in_addr, u_short);
42 
43 struct alias_link *
44 FindFragmentPtr(struct in_addr, u_short);
45 
46 struct alias_link *
47 FindUdpTcpIn (struct in_addr, struct in_addr, u_short, u_short, u_char);
48 
49 struct alias_link *
50 FindUdpTcpOut(struct in_addr, struct in_addr, u_short, u_short, u_char);
51 
52 struct in_addr
53 FindOriginalAddress(struct in_addr);
54 
55 struct in_addr
56 FindAliasAddress(struct in_addr);
57 
58 /* External data access/modification */
59 void GetFragmentAddr(struct alias_link *, struct in_addr *);
60 void SetFragmentAddr(struct alias_link *, struct in_addr);
61 void GetFragmentPtr(struct alias_link *, char **);
62 void SetFragmentPtr(struct alias_link *, char *);
63 void SetStateIn(struct alias_link *, int);
64 void SetStateOut(struct alias_link *, int);
65 int GetStateIn(struct alias_link *);
66 int GetStateOut(struct alias_link *);
67 struct in_addr GetOriginalAddress(struct alias_link *);
68 struct in_addr GetDestAddress(struct alias_link *);
69 struct in_addr GetAliasAddress(struct alias_link *);
70 struct in_addr GetDefaultAliasAddress(void);
71 void SetDefaultAliasAddress(struct in_addr);
72 u_short GetOriginalPort(struct alias_link *);
73 u_short GetAliasPort(struct alias_link *);
74 void SetAckModified(struct alias_link *);
75 int GetAckModified(struct alias_link *);
76 int GetDeltaAckIn(struct ip *, struct alias_link *);
77 int GetDeltaSeqOut(struct ip *, struct alias_link *);
78 void AddSeq(struct ip *, struct alias_link *, int);
79 void SetExpire(struct alias_link *, int);
80 void ClearCheckNewLink(void);
81 #ifndef NO_FW_PUNCH
82 void PunchFWHole(struct alias_link *);
83 #endif
84 
85 
86 /* Housekeeping function */
87 void HouseKeeping(void);
88 
89 /* Tcp specfic routines */
90 /*lint -save -library Suppress flexelint warnings */
91 void AliasHandleFtpOut(struct ip *, struct alias_link *, int);
92 void AliasHandleIrcOut(struct ip *pip, struct alias_link *link, int maxsize );
93 int AliasHandleUdpNbt(struct ip *, struct alias_link *, struct in_addr *, u_short);
94 int AliasHandleUdpNbtNS(struct ip *, struct alias_link *, struct in_addr *, u_short *, struct in_addr *, u_short *);
95 void AliasHandleCUSeeMeOut(struct ip *, struct alias_link *);
96 void AliasHandleCUSeeMeIn(struct ip *, struct in_addr);
97 
98 
99 
100 enum alias_tcp_state {
101     ALIAS_TCP_STATE_NOT_CONNECTED,
102     ALIAS_TCP_STATE_CONNECTED,
103     ALIAS_TCP_STATE_DISCONNECTED
104 };
105 
106 /*lint -restore */
107 #endif /* defined(ALIAS_LOCAL_H) */
108