VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/libalias/alias_old.c@ 88128

最後變更 在這個檔案從88128是 20958,由 vboxsync 提交於 15 年 前

NAT: export of libalias

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.6 KB
 
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp <[email protected]>
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: src/sys/netinet/libalias/alias_old.c,v 1.8.8.1 2009/04/15 03:14:26 kensmith Exp $");
29
30#ifdef _KERNEL
31#include <sys/param.h>
32#include <sys/proc.h>
33#else
34#include <sys/types.h>
35#include <stdlib.h>
36#endif
37
38#include <netinet/in.h>
39
40#ifdef _KERNEL
41#include <netinet/libalias/alias.h>
42#else
43#include "alias.h"
44#endif
45
46/*
47 * These functions are for backwards compatibility and because apps may
48 * be linked against shlib versions, they have to be actual functions,
49 * we cannot inline them.
50 */
51
52static struct libalias *la;
53
54void
55PacketAliasInit(void)
56{
57
58 la = LibAliasInit(la);
59}
60
61void
62PacketAliasSetAddress(struct in_addr _addr)
63{
64
65 LibAliasSetAddress(la, _addr);
66}
67
68void
69PacketAliasSetFWBase(unsigned int _base, unsigned int _num)
70{
71
72 LibAliasSetFWBase(la, _base, _num);
73}
74
75void
76PacketAliasSetSkinnyPort(unsigned int _port)
77{
78
79 LibAliasSetSkinnyPort(la, _port);
80}
81
82unsigned int
83PacketAliasSetMode(unsigned int _flags, unsigned int _mask)
84{
85
86 return LibAliasSetMode(la, _flags, _mask);
87}
88
89void
90PacketAliasUninit(void)
91{
92
93 LibAliasUninit(la);
94 la = NULL;
95}
96
97int
98PacketAliasIn(char *_ptr, int _maxpacketsize)
99{
100 return LibAliasIn(la, _ptr, _maxpacketsize);
101}
102
103int
104PacketAliasOut(char *_ptr, int _maxpacketsize)
105{
106
107 return LibAliasOut(la, _ptr, _maxpacketsize);
108}
109
110int
111PacketUnaliasOut(char *_ptr, int _maxpacketsize)
112{
113
114 return LibAliasUnaliasOut(la, _ptr, _maxpacketsize);
115}
116
117int
118PacketAliasAddServer(struct alias_link *_lnk,
119 struct in_addr _addr, unsigned short _port)
120{
121
122 return LibAliasAddServer(la, _lnk, _addr, _port);
123}
124
125struct alias_link *
126PacketAliasRedirectAddr(struct in_addr _src_addr,
127 struct in_addr _alias_addr)
128{
129
130 return LibAliasRedirectAddr(la, _src_addr, _alias_addr);
131}
132
133
134int
135PacketAliasRedirectDynamic(struct alias_link *_lnk)
136{
137
138 return LibAliasRedirectDynamic(la, _lnk);
139}
140
141void
142PacketAliasRedirectDelete(struct alias_link *_lnk)
143{
144
145 LibAliasRedirectDelete(la, _lnk);
146}
147
148struct alias_link *
149PacketAliasRedirectPort(struct in_addr _src_addr,
150 unsigned short _src_port, struct in_addr _dst_addr,
151 unsigned short _dst_port, struct in_addr _alias_addr,
152 unsigned short _alias_port, unsigned char _proto)
153{
154
155 return LibAliasRedirectPort(la, _src_addr, _src_port, _dst_addr,
156 _dst_port, _alias_addr, _alias_port, _proto);
157}
158
159struct alias_link *
160PacketAliasRedirectProto(struct in_addr _src_addr,
161 struct in_addr _dst_addr, struct in_addr _alias_addr,
162 unsigned char _proto)
163{
164
165 return LibAliasRedirectProto(la, _src_addr, _dst_addr, _alias_addr,
166 _proto);
167}
168
169void
170PacketAliasFragmentIn(char *_ptr, char *_ptr_fragment)
171{
172
173 LibAliasFragmentIn(la, _ptr, _ptr_fragment);
174}
175
176char *
177PacketAliasGetFragment(char *_ptr)
178{
179
180 return LibAliasGetFragment(la, _ptr);
181}
182
183int
184PacketAliasSaveFragment(char *_ptr)
185{
186 return LibAliasSaveFragment(la, _ptr);
187}
188
189int
190PacketAliasCheckNewLink(void)
191{
192
193 return LibAliasCheckNewLink(la);
194}
195
196unsigned short
197PacketAliasInternetChecksum(unsigned short *_ptr, int _nbytes)
198{
199
200 return LibAliasInternetChecksum(la, _ptr, _nbytes);
201}
202
203void
204PacketAliasSetTarget(struct in_addr _target_addr)
205{
206
207 LibAliasSetTarget(la, _target_addr);
208}
209
210/* Transparent proxying routines. */
211int
212PacketAliasProxyRule(const char *_cmd)
213{
214
215 return LibAliasProxyRule(la, _cmd);
216}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette