]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/netinet/libalias/alias_old.c
This commit was generated by cvs2svn to compensate for changes in r161630,
[FreeBSD/FreeBSD.git] / sys / netinet / libalias / alias_old.c
1 /*-
2  * Copyright (c) 2004 Poul-Henning Kamp <phk@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
29
30 #ifdef _KERNEL
31 #include <sys/param.h>
32 #else
33 #include <sys/types.h>
34 #include <stdlib.h>
35 #endif
36
37 #include <netinet/in.h>
38
39 #ifdef _KERNEL
40 #include <netinet/libalias/alias.h>
41 #else
42 #include "alias.h"
43 #endif
44
45 /*
46  * These functions are for backwards compatibility and because apps may
47  * be linked against shlib versions, they have to be actual functions,
48  * we cannot inline them.
49  */
50
51 static struct libalias *la;
52
53 void
54 PacketAliasInit(void)
55 {
56
57         la = LibAliasInit(la);
58 }
59
60 void
61 PacketAliasSetAddress(struct in_addr _addr)
62 {
63
64         LibAliasSetAddress(la, _addr);
65 }
66
67 void
68 PacketAliasSetFWBase(unsigned int _base, unsigned int _num)
69 {
70
71         LibAliasSetFWBase(la, _base, _num);
72 }
73
74 void
75 PacketAliasSetSkinnyPort(unsigned int _port)
76 {
77
78         LibAliasSetSkinnyPort(la, _port);
79 }
80
81 unsigned int
82 PacketAliasSetMode(unsigned int _flags, unsigned int _mask)
83 {
84
85         return LibAliasSetMode(la, _flags, _mask);
86 }
87
88 void
89 PacketAliasUninit(void)
90 {
91
92         LibAliasUninit(la);
93         la = NULL;
94 }
95
96 int
97 PacketAliasIn(char *_ptr, int _maxpacketsize)
98 {
99         return LibAliasIn(la, _ptr, _maxpacketsize);
100 }
101
102 int
103 PacketAliasOut(char *_ptr, int _maxpacketsize)
104 {
105
106         return LibAliasOut(la, _ptr, _maxpacketsize);
107 }
108
109 int
110 PacketUnaliasOut(char *_ptr, int _maxpacketsize)
111 {
112
113         return LibAliasUnaliasOut(la, _ptr, _maxpacketsize);
114 }
115
116 int
117 PacketAliasAddServer(struct alias_link *_lnk,
118     struct in_addr _addr, unsigned short _port)
119 {
120
121         return LibAliasAddServer(la, _lnk, _addr, _port);
122 }
123
124 struct alias_link *
125 PacketAliasRedirectAddr(struct in_addr _src_addr,
126     struct in_addr _alias_addr)
127 {
128
129         return LibAliasRedirectAddr(la, _src_addr, _alias_addr);
130 }
131
132
133 int
134 PacketAliasRedirectDynamic(struct alias_link *_lnk)
135 {
136
137         return LibAliasRedirectDynamic(la, _lnk);
138 }
139
140 void
141 PacketAliasRedirectDelete(struct alias_link *_lnk)
142 {
143
144         LibAliasRedirectDelete(la, _lnk);
145 }
146
147 struct alias_link *
148 PacketAliasRedirectPort(struct in_addr _src_addr,
149     unsigned short _src_port, struct in_addr _dst_addr,
150     unsigned short _dst_port, struct in_addr _alias_addr,
151     unsigned short _alias_port, unsigned char _proto)
152 {
153
154         return LibAliasRedirectPort(la, _src_addr, _src_port, _dst_addr,
155             _dst_port, _alias_addr, _alias_port, _proto);
156 }
157
158 struct alias_link *
159 PacketAliasRedirectProto(struct in_addr _src_addr,
160     struct in_addr _dst_addr, struct in_addr _alias_addr,
161     unsigned char _proto)
162 {
163
164         return LibAliasRedirectProto(la, _src_addr, _dst_addr, _alias_addr,
165             _proto);
166 }
167
168 void
169 PacketAliasFragmentIn(char *_ptr, char *_ptr_fragment)
170 {
171
172         LibAliasFragmentIn(la, _ptr, _ptr_fragment);
173 }
174
175 char           *
176 PacketAliasGetFragment(char *_ptr)
177 {
178
179         return LibAliasGetFragment(la, _ptr);
180 }
181
182 int
183 PacketAliasSaveFragment(char *_ptr)
184 {
185         return LibAliasSaveFragment(la, _ptr);
186 }
187
188 int
189 PacketAliasCheckNewLink(void)
190 {
191
192         return LibAliasCheckNewLink(la);
193 }
194
195 unsigned short
196 PacketAliasInternetChecksum(unsigned short *_ptr, int _nbytes)
197 {
198
199         return LibAliasInternetChecksum(la, _ptr, _nbytes);
200 }
201
202 void
203 PacketAliasSetTarget(struct in_addr _target_addr)
204 {
205
206         LibAliasSetTarget(la, _target_addr);
207 }
208
209 /* Transparent proxying routines. */
210 int
211 PacketAliasProxyRule(const char *_cmd)
212 {
213
214         return LibAliasProxyRule(la, _cmd);
215 }