VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/misc.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/* $Id: misc.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * NAT - helpers (declarations/defines).
4 */
5
6/*
7 * Copyright (C) 2006-2023 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
41typedef void *PNATState;
42#endif
43
44void slirp_insque (PNATState, void *, void *);
45void slirp_remque (PNATState, void *);
46# ifndef VBOX_NAT_TST_QUEUE
47void getouraddr (PNATState);
48void 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
58struct uma_zone;
59typedef struct uma_zone *uma_zone_t;
60
61typedef void *(*uma_alloc_t)(uma_zone_t, int, u_int8_t *, int);
62typedef void (*uma_free_t)(void *, int, u_int8_t);
63
64typedef int (*ctor_t)(PNATState, void *, int, void *, int);
65typedef void (*dtor_t)(PNATState, void *, int, void *);
66typedef int (*zinit_t)(PNATState, void *, int, int);
67typedef void (*zfini_t)(PNATState, void *, int);
68uma_zone_t uma_zcreate(PNATState, char *, size_t, ctor_t, dtor_t, zinit_t, zfini_t, int, int);
69uma_zone_t uma_zsecond_create(char *, ctor_t, dtor_t, zinit_t, zfini_t, uma_zone_t);
70void uma_zone_set_max(uma_zone_t, int);
71void uma_zone_set_allocf(uma_zone_t, uma_alloc_t);
72void uma_zone_set_freef(uma_zone_t, uma_free_t);
73
74uint32_t *uma_find_refcnt(uma_zone_t, void *);
75void *uma_zalloc(uma_zone_t, int);
76void *uma_zalloc_arg(uma_zone_t, void *, int);
77void uma_zfree(uma_zone_t, void *);
78void uma_zfree_arg(uma_zone_t, void *, void *);
79int uma_zone_exhausted_nolock(uma_zone_t);
80void zone_drain(uma_zone_t);
81
82void slirp_null_arg_free(void *, void *);
83void m_fini(PNATState pData);
84# else /* VBOX_NAT_TST_QUEUE */
85# define insque slirp_insque
86# define remque slirp_remque
87# endif
88#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use