1 | /* $Id: misc.h 28449 2010-04-19 09:52:59Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT - helpers (declarations/defines).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * This code is based on:
|
---|
24 | *
|
---|
25 | * Copyright (c) 1995 Danny Gasparovski.
|
---|
26 | *
|
---|
27 | * Please read the file COPYRIGHT for the
|
---|
28 | * terms and conditions of the copyright.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #ifndef _MISC_H_
|
---|
32 | #define _MISC_H_
|
---|
33 |
|
---|
34 | #define EMU_NONE 0x0
|
---|
35 |
|
---|
36 | /* TCP emulations */
|
---|
37 | #define EMU_CTL 0x1
|
---|
38 | #define EMU_FTP 0x2
|
---|
39 | #define EMU_KSH 0x3
|
---|
40 | #define EMU_IRC 0x4
|
---|
41 | #define EMU_REALAUDIO 0x5
|
---|
42 | #define EMU_RLOGIN 0x6
|
---|
43 | #define EMU_IDENT 0x7
|
---|
44 | #define EMU_RSH 0x8
|
---|
45 |
|
---|
46 | #define EMU_NOCONNECT 0x10 /* Don't connect */
|
---|
47 |
|
---|
48 | /* UDP emulations */
|
---|
49 | #define EMU_TALK 0x1
|
---|
50 | #define EMU_NTALK 0x2
|
---|
51 | #define EMU_CUSEEME 0x3
|
---|
52 |
|
---|
53 | struct tos_t
|
---|
54 | {
|
---|
55 | u_int16_t lport;
|
---|
56 | u_int16_t fport;
|
---|
57 | u_int8_t tos;
|
---|
58 | u_int8_t emu;
|
---|
59 | };
|
---|
60 |
|
---|
61 | struct emu_t
|
---|
62 | {
|
---|
63 | u_int16_t lport;
|
---|
64 | u_int16_t fport;
|
---|
65 | u_int8_t tos;
|
---|
66 | u_int8_t emu;
|
---|
67 | struct emu_t *next;
|
---|
68 | };
|
---|
69 |
|
---|
70 | extern struct emu_t *tcpemu;
|
---|
71 |
|
---|
72 | extern int x_port, x_server, x_display;
|
---|
73 |
|
---|
74 | int show_x (char *, struct socket *);
|
---|
75 | void redir_x (u_int32_t, int, int, int);
|
---|
76 | void getouraddr (PNATState);
|
---|
77 | void slirp_insque (PNATState, void *, void *);
|
---|
78 | void slirp_remque (PNATState, void *);
|
---|
79 | int slirp_openpty (int *, int *);
|
---|
80 | int fork_exec (PNATState, struct socket *, char *, int);
|
---|
81 | void snooze_hup (int);
|
---|
82 | void snooze (void);
|
---|
83 | void relay (int);
|
---|
84 | void add_emu (char *);
|
---|
85 | void fd_nonblock (int);
|
---|
86 | void fd_block (int);
|
---|
87 |
|
---|
88 | #ifdef VBOX_WITH_SLIRP_BSD_MBUF
|
---|
89 | /* UVM interface */
|
---|
90 | #define UMA_ALIGN_PTR (1 << 0)
|
---|
91 | #define UMA_ZONE_REFCNT (1 << 1)
|
---|
92 | #define UMA_ZONE_MAXBUCKET (1 << 2)
|
---|
93 | #define UMA_ZONE_ZINIT (1 << 3)
|
---|
94 | #define UMA_SLAB_KERNEL (1 << 4)
|
---|
95 | #define UMA_ZFLAG_FULL (1 << 5)
|
---|
96 |
|
---|
97 | struct uma_zone;
|
---|
98 | typedef struct uma_zone *uma_zone_t;
|
---|
99 | typedef void *(*uma_alloc_t)(uma_zone_t, int, u_int8_t *, int);
|
---|
100 | typedef void (*uma_free_t)(void *, int, u_int8_t);
|
---|
101 |
|
---|
102 | typedef int (*ctor_t)(PNATState, void *, int, void *, int);
|
---|
103 | typedef void (*dtor_t)(PNATState, void *, int, void *);
|
---|
104 | typedef int (*zinit_t)(PNATState, void *, int, int);
|
---|
105 | typedef void (*zfini_t)(PNATState, void *, int);
|
---|
106 | uma_zone_t uma_zcreate(PNATState, char *, size_t, ctor_t, dtor_t, zinit_t, zfini_t, int, int);
|
---|
107 | uma_zone_t uma_zsecond_create(char *, ctor_t, dtor_t, zinit_t, zfini_t, uma_zone_t);
|
---|
108 | void uma_zone_set_max(uma_zone_t, int);
|
---|
109 | void uma_zone_set_allocf(uma_zone_t, uma_alloc_t);
|
---|
110 | void uma_zone_set_freef(uma_zone_t, uma_free_t);
|
---|
111 |
|
---|
112 | uint32_t *uma_find_refcnt(uma_zone_t, void *);
|
---|
113 | void *uma_zalloc(uma_zone_t, int);
|
---|
114 | void *uma_zalloc_arg(uma_zone_t, void *, int);
|
---|
115 | void uma_zfree(uma_zone_t, void *);
|
---|
116 | void uma_zfree_arg(uma_zone_t, void *, void *);
|
---|
117 | int uma_zone_exhausted_nolock(uma_zone_t);
|
---|
118 | void zone_drain(uma_zone_t);
|
---|
119 |
|
---|
120 | void slirp_null_arg_free(void *, void *);
|
---|
121 | void m_fini(PNATState pData);
|
---|
122 | #endif /* VBOX_WITH_SLIRP_BSD_MBUF */
|
---|
123 |
|
---|
124 | #endif
|
---|