[22894] | 1 | /** $Id: ext.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[28449] | 3 | * NAT - some externals helpers
|
---|
[22894] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2007-2023 Oracle and/or its affiliates.
|
---|
[22894] | 8 | *
|
---|
[96407] | 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
|
---|
[22894] | 26 | */
|
---|
| 27 |
|
---|
[63215] | 28 | #ifndef IN_BSD
|
---|
[30016] | 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)
|
---|
[22894] | 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);
|
---|
[30016] | 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
|
---|
[22894] | 51 |
|
---|
[30016] | 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
|
---|
[22894] | 59 | #endif
|
---|
| 60 |
|
---|
| 61 | #ifndef _EXT_H_
|
---|
| 62 | #define _EXT_H_
|
---|
[63215] | 63 |
|
---|
[23154] | 64 | # define fprintf vbox_slirp_fprintf
|
---|
| 65 | # define printf vbox_slirp_printf
|
---|
[63215] | 66 |
|
---|
| 67 | # ifndef vbox_slirp_printfV
|
---|
| 68 | DECLINLINE(void) vbox_slirp_printV(char *format, va_list args)
|
---|
[22894] | 69 | {
|
---|
| 70 | char buffer[1024];
|
---|
| 71 | memset(buffer, 0, 1024);
|
---|
| 72 | RTStrPrintfV(buffer, 1024, format, args);
|
---|
| 73 |
|
---|
[28787] | 74 | LogRel(("NAT:EXT: %s\n", buffer));
|
---|
[22894] | 75 | }
|
---|
[63215] | 76 | # endif
|
---|
[22894] | 77 |
|
---|
[39101] | 78 | # ifndef vbox_slirp_printf
|
---|
[63215] | 79 | DECLINLINE(void) vbox_slirp_printf(char *format, ...)
|
---|
[22894] | 80 | {
|
---|
| 81 | va_list args;
|
---|
| 82 | va_start(args, format);
|
---|
| 83 | vbox_slirp_printV(format, args);
|
---|
| 84 | va_end(args);
|
---|
| 85 | }
|
---|
[39101] | 86 | # endif
|
---|
[22894] | 87 |
|
---|
[39101] | 88 | # ifndef vbox_slirp_fprintf
|
---|
[63215] | 89 | DECLINLINE(void) vbox_slirp_fprintf(void *ignored, char *format, ...)
|
---|
[22894] | 90 | {
|
---|
[39101] | 91 | # ifdef LOG_ENABLED
|
---|
[22894] | 92 | va_list args;
|
---|
[39085] | 93 | NOREF(ignored);
|
---|
[22894] | 94 | va_start(args, format);
|
---|
| 95 | vbox_slirp_printV(format, args);
|
---|
| 96 | va_end(args);
|
---|
[39409] | 97 | # else
|
---|
| 98 | NOREF(format);
|
---|
| 99 | NOREF(ignored);
|
---|
[39101] | 100 | # endif
|
---|
| 101 | }
|
---|
[25352] | 102 | # endif
|
---|
[63215] | 103 |
|
---|
[22894] | 104 | #endif
|
---|
[63215] | 105 |
|
---|