1 | /** $Id: ext.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - some externals helpers
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef IN_BSD
|
---|
29 | # define zone_mbuf slirp_zone_mbuf(pData)
|
---|
30 | # define zone_clust slirp_zone_clust(pData)
|
---|
31 | # define zone_pack slirp_zone_pack(pData)
|
---|
32 | # define zone_jumbop slirp_zone_jumbop(pData)
|
---|
33 | # define zone_jumbo9 slirp_zone_jumbo9(pData)
|
---|
34 | # define zone_jumbo16 slirp_zone_jumbo16(pData)
|
---|
35 | # define zone_ext_refcnt slirp_zone_ext_refcnt(pData)
|
---|
36 | static inline uma_zone_t slirp_zone_mbuf(PNATState);
|
---|
37 | static inline uma_zone_t slirp_zone_clust(PNATState);
|
---|
38 | static inline uma_zone_t slirp_zone_pack(PNATState);
|
---|
39 | static inline uma_zone_t slirp_zone_jumbop(PNATState);
|
---|
40 | static inline uma_zone_t slirp_zone_jumbo9(PNATState);
|
---|
41 | static inline uma_zone_t slirp_zone_jumbo16(PNATState);
|
---|
42 | static inline uma_zone_t slirp_zone_ext_refcnt(PNATState);
|
---|
43 | #else
|
---|
44 | # undef zone_mbuf
|
---|
45 | # undef zone_clust
|
---|
46 | # undef zone_pack
|
---|
47 | # undef zone_jumbop
|
---|
48 | # undef zone_jumbo9
|
---|
49 | # undef zone_jumbo16
|
---|
50 | # undef zone_ext_refcnt
|
---|
51 |
|
---|
52 | # define zone_mbuf pData->zone_mbuf
|
---|
53 | # define zone_clust pData->zone_clust
|
---|
54 | # define zone_pack pData->zone_pack
|
---|
55 | # define zone_jumbop pData->zone_jumbop
|
---|
56 | # define zone_jumbo9 pData->zone_jumbo9
|
---|
57 | # define zone_jumbo16 pData->zone_jumbo16
|
---|
58 | # define zone_ext_refcnt pData->zone_ext_refcnt
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #ifndef _EXT_H_
|
---|
62 | #define _EXT_H_
|
---|
63 |
|
---|
64 | # define fprintf vbox_slirp_fprintf
|
---|
65 | # define printf vbox_slirp_printf
|
---|
66 |
|
---|
67 | # ifndef vbox_slirp_printfV
|
---|
68 | DECLINLINE(void) vbox_slirp_printV(char *format, va_list args)
|
---|
69 | {
|
---|
70 | char buffer[1024];
|
---|
71 | memset(buffer, 0, 1024);
|
---|
72 | RTStrPrintfV(buffer, 1024, format, args);
|
---|
73 |
|
---|
74 | LogRel(("NAT:EXT: %s\n", buffer));
|
---|
75 | }
|
---|
76 | # endif
|
---|
77 |
|
---|
78 | # ifndef vbox_slirp_printf
|
---|
79 | DECLINLINE(void) vbox_slirp_printf(char *format, ...)
|
---|
80 | {
|
---|
81 | va_list args;
|
---|
82 | va_start(args, format);
|
---|
83 | vbox_slirp_printV(format, args);
|
---|
84 | va_end(args);
|
---|
85 | }
|
---|
86 | # endif
|
---|
87 |
|
---|
88 | # ifndef vbox_slirp_fprintf
|
---|
89 | DECLINLINE(void) vbox_slirp_fprintf(void *ignored, char *format, ...)
|
---|
90 | {
|
---|
91 | # ifdef LOG_ENABLED
|
---|
92 | va_list args;
|
---|
93 | NOREF(ignored);
|
---|
94 | va_start(args, format);
|
---|
95 | vbox_slirp_printV(format, args);
|
---|
96 | va_end(args);
|
---|
97 | # else
|
---|
98 | NOREF(format);
|
---|
99 | NOREF(ignored);
|
---|
100 | # endif
|
---|
101 | }
|
---|
102 | # endif
|
---|
103 |
|
---|
104 | #endif
|
---|
105 |
|
---|