misc.h revision 20bc99aa3ad84a338b7a9c1edc14682bce25d761
0N/A/* $Id$ */
2362N/A/** @file
0N/A * NAT - helpers (declarations/defines).
0N/A */
0N/A
0N/A/*
2362N/A * Copyright (C) 2006-2010 Sun Microsystems, Inc.
0N/A *
2362N/A * This file is part of VirtualBox Open Source Edition (OSE), as
0N/A * available from http://www.virtualbox.org. This file is free software;
0N/A * you can redistribute it and/or modify it under the terms of the GNU
0N/A * General Public License (GPL) as published by the Free Software
0N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
0N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
0N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
0N/A * additional information or have any questions.
0N/A */
2362N/A
2362N/A/*
2362N/A * This code is based on:
0N/A *
0N/A * Copyright (c) 1995 Danny Gasparovski.
0N/A *
0N/A * Please read the file COPYRIGHT for the
0N/A * terms and conditions of the copyright.
0N/A */
0N/A
0N/A#ifndef _MISC_H_
0N/A#define _MISC_H_
0N/A
0N/A#define EMU_NONE 0x0
0N/A
0N/A/* TCP emulations */
0N/A#define EMU_CTL 0x1
0N/A#define EMU_FTP 0x2
0N/A#define EMU_KSH 0x3
0N/A#define EMU_IRC 0x4
0N/A#define EMU_REALAUDIO 0x5
0N/A#define EMU_RLOGIN 0x6
0N/A#define EMU_IDENT 0x7
0N/A#define EMU_RSH 0x8
0N/A
0N/A#define EMU_NOCONNECT 0x10 /* Don't connect */
0N/A
0N/A/* UDP emulations */
0N/A#define EMU_TALK 0x1
0N/A#define EMU_NTALK 0x2
0N/A#define EMU_CUSEEME 0x3
0N/A
0N/Astruct tos_t
0N/A{
0N/A u_int16_t lport;
0N/A u_int16_t fport;
0N/A u_int8_t tos;
0N/A u_int8_t emu;
0N/A};
0N/A
0N/Astruct emu_t
0N/A{
0N/A u_int16_t lport;
0N/A u_int16_t fport;
0N/A u_int8_t tos;
0N/A u_int8_t emu;
0N/A struct emu_t *next;
0N/A};
0N/A
0N/Aextern struct emu_t *tcpemu;
0N/A
0N/Aextern int x_port, x_server, x_display;
0N/A
0N/Aint show_x (char *, struct socket *);
0N/Avoid redir_x (u_int32_t, int, int, int);
0N/Avoid getouraddr (PNATState);
0N/Avoid slirp_insque (PNATState, void *, void *);
0N/Avoid slirp_remque (PNATState, void *);
0N/Aint slirp_openpty (int *, int *);
0N/Aint fork_exec (PNATState, struct socket *, char *, int);
0N/Avoid snooze_hup (int);
0N/Avoid snooze (void);
0N/Avoid relay (int);
0N/Avoid add_emu (char *);
0N/Avoid fd_nonblock (int);
0N/Avoid fd_block (int);
0N/A
0N/A#ifdef VBOX_WITH_SLIRP_BSD_MBUF
0N/A/* UVM interface */
0N/A#define UMA_ALIGN_PTR (1 << 0)
0N/A#define UMA_ZONE_REFCNT (1 << 1)
0N/A#define UMA_ZONE_MAXBUCKET (1 << 2)
0N/A#define UMA_ZONE_ZINIT (1 << 3)
0N/A#define UMA_SLAB_KERNEL (1 << 4)
#define UMA_ZFLAG_FULL (1 << 5)
struct uma_zone;
typedef struct uma_zone *uma_zone_t;
typedef void *(*uma_alloc_t)(uma_zone_t, int, u_int8_t *, int);
typedef void (*uma_free_t)(void *, int, u_int8_t);
typedef int (*ctor_t)(PNATState, void *, int, void *, int);
typedef void (*dtor_t)(PNATState, void *, int, void *);
typedef int (*zinit_t)(PNATState, void *, int, int);
typedef void (*zfini_t)(PNATState, void *, int);
uma_zone_t uma_zcreate(PNATState, char *, size_t, ctor_t, dtor_t, zinit_t, zfini_t, int, int);
uma_zone_t uma_zsecond_create(char *, ctor_t, dtor_t, zinit_t, zfini_t, uma_zone_t);
void uma_zone_set_max(uma_zone_t, int);
void uma_zone_set_allocf(uma_zone_t, uma_alloc_t);
void uma_zone_set_freef(uma_zone_t, uma_free_t);
uint32_t *uma_find_refcnt(uma_zone_t, void *);
void *uma_zalloc(uma_zone_t, int);
void *uma_zalloc_arg(uma_zone_t, void *, int);
void uma_zfree(uma_zone_t, void *);
void uma_zfree_arg(uma_zone_t, void *, void *);
int uma_zone_exhausted_nolock(uma_zone_t);
void zone_drain(uma_zone_t);
void slirp_null_arg_free(void *, void *);
void m_fini(PNATState pData);
#endif /* VBOX_WITH_SLIRP_BSD_MBUF */
#endif