1 | /* $Id: misc.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - helpers (declarations/defines).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-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 | /*
|
---|
29 | * This code is based on:
|
---|
30 | *
|
---|
31 | * Copyright (c) 1995 Danny Gasparovski.
|
---|
32 | *
|
---|
33 | * Please read the file COPYRIGHT for the
|
---|
34 | * terms and conditions of the copyright.
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef _MISC_H_
|
---|
38 | #define _MISC_H_
|
---|
39 |
|
---|
40 | #ifdef VBOX_NAT_TST_QUEUE
|
---|
41 | typedef void *PNATState;
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | void slirp_insque (PNATState, void *, void *);
|
---|
45 | void slirp_remque (PNATState, void *);
|
---|
46 | # ifndef VBOX_NAT_TST_QUEUE
|
---|
47 | void getouraddr (PNATState);
|
---|
48 | void fd_nonblock (int);
|
---|
49 |
|
---|
50 | /* UVM interface */
|
---|
51 | #define UMA_ALIGN_PTR (1 << 0)
|
---|
52 | #define UMA_ZONE_REFCNT (1 << 1)
|
---|
53 | #define UMA_ZONE_MAXBUCKET (1 << 2)
|
---|
54 | #define UMA_ZONE_ZINIT (1 << 3)
|
---|
55 | #define UMA_SLAB_KERNEL (1 << 4)
|
---|
56 | #define UMA_ZFLAG_FULL (1 << 5)
|
---|
57 |
|
---|
58 | struct uma_zone;
|
---|
59 | typedef struct uma_zone *uma_zone_t;
|
---|
60 |
|
---|
61 | typedef void *(*uma_alloc_t)(uma_zone_t, int, u_int8_t *, int);
|
---|
62 | typedef void (*uma_free_t)(void *, int, u_int8_t);
|
---|
63 |
|
---|
64 | typedef int (*ctor_t)(PNATState, void *, int, void *, int);
|
---|
65 | typedef void (*dtor_t)(PNATState, void *, int, void *);
|
---|
66 | typedef int (*zinit_t)(PNATState, void *, int, int);
|
---|
67 | typedef void (*zfini_t)(PNATState, void *, int);
|
---|
68 | uma_zone_t uma_zcreate(PNATState, char *, size_t, ctor_t, dtor_t, zinit_t, zfini_t, int, int);
|
---|
69 | uma_zone_t uma_zsecond_create(char *, ctor_t, dtor_t, zinit_t, zfini_t, uma_zone_t);
|
---|
70 | void uma_zone_set_max(uma_zone_t, int);
|
---|
71 | void uma_zone_set_allocf(uma_zone_t, uma_alloc_t);
|
---|
72 | void uma_zone_set_freef(uma_zone_t, uma_free_t);
|
---|
73 |
|
---|
74 | uint32_t *uma_find_refcnt(uma_zone_t, void *);
|
---|
75 | void *uma_zalloc(uma_zone_t, int);
|
---|
76 | void *uma_zalloc_arg(uma_zone_t, void *, int);
|
---|
77 | void uma_zfree(uma_zone_t, void *);
|
---|
78 | void uma_zfree_arg(uma_zone_t, void *, void *);
|
---|
79 | int uma_zone_exhausted_nolock(uma_zone_t);
|
---|
80 | void zone_drain(uma_zone_t);
|
---|
81 |
|
---|
82 | void slirp_null_arg_free(void *, void *);
|
---|
83 | void m_fini(PNATState pData);
|
---|
84 | # else /* VBOX_NAT_TST_QUEUE */
|
---|
85 | # define insque slirp_insque
|
---|
86 | # define remque slirp_remque
|
---|
87 | # endif
|
---|
88 | #endif
|
---|