1 | /** $Id: ext.h 25352 2009-12-14 10:06:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * some externals helpers
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifdef VBOX_WITH_SLIRP_BSD_MBUF
|
---|
23 | # ifndef IN_BSD
|
---|
24 | # define zone_mbuf slirp_zone_mbuf(pData)
|
---|
25 | # define zone_clust slirp_zone_clust(pData)
|
---|
26 | # define zone_pack slirp_zone_pack(pData)
|
---|
27 | # define zone_jumbop slirp_zone_jumbop(pData)
|
---|
28 | # define zone_jumbo9 slirp_zone_jumbo9(pData)
|
---|
29 | # define zone_jumbo16 slirp_zone_jumbo16(pData)
|
---|
30 | # define zone_ext_refcnt slirp_zone_ext_refcnt(pData)
|
---|
31 | static inline uma_zone_t slirp_zone_mbuf(PNATState);
|
---|
32 | static inline uma_zone_t slirp_zone_clust(PNATState);
|
---|
33 | static inline uma_zone_t slirp_zone_pack(PNATState);
|
---|
34 | static inline uma_zone_t slirp_zone_jumbop(PNATState);
|
---|
35 | static inline uma_zone_t slirp_zone_jumbo9(PNATState);
|
---|
36 | static inline uma_zone_t slirp_zone_jumbo16(PNATState);
|
---|
37 | static inline uma_zone_t slirp_zone_ext_refcnt(PNATState);
|
---|
38 | # else
|
---|
39 | # undef zone_mbuf
|
---|
40 | # undef zone_clust
|
---|
41 | # undef zone_pack
|
---|
42 | # undef zone_jumbop
|
---|
43 | # undef zone_jumbo9
|
---|
44 | # undef zone_jumbo16
|
---|
45 | # undef zone_ext_refcnt
|
---|
46 |
|
---|
47 | # define zone_mbuf pData->zone_mbuf
|
---|
48 | # define zone_clust pData->zone_clust
|
---|
49 | # define zone_pack pData->zone_pack
|
---|
50 | # define zone_jumbop pData->zone_jumbop
|
---|
51 | # define zone_jumbo9 pData->zone_jumbo9
|
---|
52 | # define zone_jumbo16 pData->zone_jumbo16
|
---|
53 | # define zone_ext_refcnt pData->zone_ext_refcnt
|
---|
54 | # endif
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | #ifndef _EXT_H_
|
---|
58 | #define _EXT_H_
|
---|
59 | # define fprintf vbox_slirp_fprintf
|
---|
60 | # define printf vbox_slirp_printf
|
---|
61 | #ifndef vbox_slirp_printfV
|
---|
62 | static void vbox_slirp_printV(char *format, va_list args)
|
---|
63 | {
|
---|
64 | # ifdef LOG_ENABLED
|
---|
65 | char buffer[1024];
|
---|
66 | memset(buffer, 0, 1024);
|
---|
67 | RTStrPrintfV(buffer, 1024, format, args);
|
---|
68 |
|
---|
69 | Log2(("NAT:EXT: %s\n", buffer));
|
---|
70 | # endif
|
---|
71 | }
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | #ifndef vbox_slirp_printf
|
---|
75 | static void vbox_slirp_printf(char *format, ...)
|
---|
76 | {
|
---|
77 | # ifdef LOG_ENABLED
|
---|
78 | va_list args;
|
---|
79 | va_start(args, format);
|
---|
80 | vbox_slirp_printV(format, args);
|
---|
81 | va_end(args);
|
---|
82 | # endif
|
---|
83 | }
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #ifndef vbox_slirp_fprintf
|
---|
87 | static void vbox_slirp_fprintf(void *ignored, char *format, ...)
|
---|
88 | {
|
---|
89 | # ifdef LOG_ENABLED
|
---|
90 | va_list args;
|
---|
91 | va_start(args, format);
|
---|
92 | vbox_slirp_printV(format, args);
|
---|
93 | va_end(args);
|
---|
94 | # endif
|
---|
95 | }
|
---|
96 | #endif
|
---|
97 | #endif
|
---|