~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes, Felix Geyer, Michael Meskes
  • Date: 2009-10-13 13:46:44 UTC
  • mfrom: (0.2.8 upstream)
  • mto: (0.4.2 squeeze)
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20091013134644-d5rdsy3tb3dflshf
Tags: 3.0.8-dfsg-1
[ Felix Geyer ]
* New Upstream Version
  - Fixes security vulnerability in VBoxNetAdpCtl (SunSolve #268188)
* Conflict with upstream proprietary packages
* Install vboxapi python module, closes: #549542
* Use an own cleaned-up virtualbox-ose init script instead of
  patching the upstream script
* Only restart virtualbox-ose after upgrade if it's not running; do not
  restart virtualbox-ose-guest-utils at all
* Call notify-reboot-required after guest utils upgrade
* Remove vboxusers group as it's not needed anymore
* Don't statically link VBoxClient with libstdc++
  - Add patch 22-no-static-libstdcpp.dpatch from Fedora
* Pass more build options through the command line, which allows us to drop
  02-config-kmk.dpatch, 03-localconf-kmk.dpatch and
  14-disable-registration-request.dpatch
* No longer reload udev rules in postinst as they are reloaded automatically
* Add lintian overrides for non-PIC code in /usr/lib/virtualbox/*.so

[ Michael Meskes ]
* Made debug package also depend on guest utilities package.
* Added option to close down all active VMs from init script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
{
79
79
    kVBoxNetAdpState_Invalid,
80
80
    kVBoxNetAdpState_Transitional,
81
 
#ifdef VBOXANETADP_DO_NOT_USE_NETFLT
82
 
    kVBoxNetAdpState_Available,
83
 
    kVBoxNetAdpState_Connected,
84
 
#endif /* VBOXANETADP_DO_NOT_USE_NETFLT */
85
81
    kVBoxNetAdpState_Active,
86
82
    kVBoxNetAdpState_U32Hack = 0xFFFFFFFF
87
83
};
89
85
 
90
86
struct VBoxNetAdapter
91
87
{
92
 
#ifdef VBOXANETADP_DO_NOT_USE_NETFLT
93
 
    /** The spinlock protecting the state variables and host interface handle. */
94
 
    RTSPINLOCK        hSpinlock;
95
 
 
96
 
    /* --- Protected with spinlock. --- */
97
 
 
98
 
#endif /* !VBOXANETADP_DO_NOT_USE_NETFLT */
99
88
    /** Denotes availability of this slot in adapter array. */
100
89
    VBOXNETADPSTATE   enmState;
101
 
#ifdef VBOXANETADP_DO_NOT_USE_NETFLT
102
 
 
103
 
    /* --- Unprotected. Atomic access. --- */
104
 
 
105
 
    /** Reference count. */
106
 
    uint32_t volatile cRefs;
107
 
    /** The busy count.
108
 
     * This counts the number of current callers and pending packet. */
109
 
    uint32_t volatile cBusy;
110
 
 
111
 
    /* --- Unprotected. Do not modify when cBusy > 0. --- */
112
 
 
113
 
    /** Our RJ-45 port.
114
 
     * This is what the internal network plugs into. */
115
 
    INTNETTRUNKIFPORT MyPort;
116
 
    /** The RJ-45 port on the INTNET "switch".
117
 
     * This is what we're connected to. */
118
 
    PINTNETTRUNKSWPORT pSwitchPort;
119
 
    /** Pointer to the globals. */
120
 
    PVBOXNETADPGLOBALS pGlobals;
121
 
    /** The event that is signaled when we go idle and that pfnWaitForIdle blocks on. */
122
 
    RTSEMEVENT        hEventIdle;
123
 
#endif /* !VBOXANETADP_DO_NOT_USE_NETFLT */
124
90
    /** Corresponds to the digit at the end of device name. */
125
91
    uint32_t          uUnit;
126
92
 
176
142
DECLHIDDEN(int) vboxNetAdpCreate (PVBOXNETADP *ppNew);
177
143
DECLHIDDEN(int) vboxNetAdpDestroy(PVBOXNETADP pThis);
178
144
DECLHIDDEN(PVBOXNETADP) vboxNetAdpFindByName(const char *pszName);
179
 
 
180
 
#ifdef VBOXANETADP_DO_NOT_USE_NETFLT
181
 
/**
182
 
 * The global data of the VBox filter driver.
183
 
 *
184
 
 * This contains the bit required for communicating with support driver, VBoxDrv
185
 
 * (start out as SupDrv).
186
 
 */
187
 
typedef struct VBOXNETADPGLOBALS
188
 
{
189
 
    /** Mutex protecting the list of instances and state changes. */
190
 
    RTSEMFASTMUTEX hFastMtx;
191
 
    /** Array of adapter instances. */
192
 
    VBOXNETADP aAdapters[VBOXNETADP_MAX_INSTANCES];
193
 
 
194
 
    /** The INTNET trunk network interface factory. */
195
 
    INTNETTRUNKFACTORY TrunkFactory;
196
 
    /** The SUPDRV component factory registration. */
197
 
    SUPDRVFACTORY SupDrvFactory;
198
 
    /** The number of current factory references. */
199
 
    int32_t volatile cFactoryRefs;
200
 
    /** The SUPDRV IDC handle (opaque struct). */
201
 
    SUPDRVIDCHANDLE SupDrvIDC;
202
 
} VBOXNETADPGLOBALS;
203
 
 
204
 
 
205
145
DECLHIDDEN(void) vboxNetAdpComposeMACAddress(PVBOXNETADP pThis, PRTMAC pMac);
206
 
DECLHIDDEN(void) vboxNetAdpReceive(PVBOXNETADP pThis, PINTNETSG pSG);
207
 
DECLHIDDEN(bool) vboxNetAdpPrepareToReceive(PVBOXNETADP pThis);
208
 
DECLHIDDEN(void) vboxNetAdpCancelReceive(PVBOXNETADP pThis);
209
 
 
210
 
DECLHIDDEN(int) vboxNetAdpInitGlobals(PVBOXNETADPGLOBALS pGlobals);
211
 
DECLHIDDEN(int) vboxNetAdpTryDeleteGlobals(PVBOXNETADPGLOBALS pGlobals);
212
 
DECLHIDDEN(bool) vboxNetAdpCanUnload(PVBOXNETADPGLOBALS pGlobals);
213
 
 
214
 
DECLHIDDEN(void) vboxNetAdpRetain(PVBOXNETADP pThis);
215
 
DECLHIDDEN(void) vboxNetAdpRelease(PVBOXNETADP pThis);
216
 
DECLHIDDEN(void) vboxNetAdpBusy(PVBOXNETADP pThis);
217
 
DECLHIDDEN(void) vboxNetAdpIdle(PVBOXNETADP pThis);
218
 
 
219
 
DECLHIDDEN(int) vboxNetAdpInitGlobalsBase(PVBOXNETADPGLOBALS pGlobals);
220
 
DECLHIDDEN(int) vboxNetAdpInitIdc(PVBOXNETADPGLOBALS pGlobals);
221
 
DECLHIDDEN(void) vboxNetAdpDeleteGlobalsBase(PVBOXNETADPGLOBALS pGlobals);
222
 
DECLHIDDEN(int) vboxNetAdpTryDeleteIdc(PVBOXNETADPGLOBALS pGlobals);
223
 
 
224
 
 
225
 
 
226
 
/** @name The OS specific interface.
227
 
 * @{ */
228
 
/**
229
 
 * Transmits a frame.
230
 
 *
231
 
 * @return  IPRT status code.
232
 
 * @param   pThis           The new instance.
233
 
 * @param   pSG             The (scatter/)gather list.
234
 
 * @param   fDst            The destination mask. At least one bit will be set.
235
 
 *
236
 
 * @remarks Owns the out-bound trunk port semaphore.
237
 
 */
238
 
DECLHIDDEN(int) vboxNetAdpPortOsXmit(PVBOXNETADP pThis, PINTNETSG pSG, uint32_t fDst);
239
 
 
240
 
/**
241
 
 * Checks if the interface is in promiscuous mode from the host perspective.
242
 
 *
243
 
 * If it is, then the internal networking switch will send frames
244
 
 * heading for the wire to the host as well.
245
 
 *
246
 
 * @see INTNETTRUNKIFPORT::pfnIsPromiscuous for more details.
247
 
 *
248
 
 * @returns true / false accordingly.
249
 
 * @param   pThis           The instance.
250
 
 *
251
 
 * @remarks Owns the network lock and the out-bound trunk port semaphores.
252
 
 */
253
 
DECLHIDDEN(bool) vboxNetAdpPortOsIsPromiscuous(PVBOXNETADP pThis);
254
 
 
255
 
/**
256
 
 * Get the MAC address of the interface we're attached to.
257
 
 *
258
 
 * Used by the internal networking switch for implementing the
259
 
 * shared-MAC-on-the-wire mode.
260
 
 *
261
 
 * @param   pThis           The instance.
262
 
 * @param   pMac            Where to store the MAC address.
263
 
 *                          If you don't know, set all the bits except the first (the multicast one).
264
 
 *
265
 
 * @remarks Owns the network lock and the out-bound trunk port semaphores.
266
 
 */
267
 
DECLHIDDEN(void) vboxNetAdpPortOsGetMacAddress(PVBOXNETADP pThis, PRTMAC pMac);
268
 
 
269
 
/**
270
 
 * Checks if the specified MAC address is for any of the host interfaces.
271
 
 *
272
 
 * Used by the internal networking switch to decide the destination(s)
273
 
 * of a frame.
274
 
 *
275
 
 * @returns true / false accordingly.
276
 
 * @param   pThis           The instance.
277
 
 * @param   pMac            The MAC address.
278
 
 *
279
 
 * @remarks Owns the network lock and the out-bound trunk port semaphores.
280
 
 */
281
 
DECLHIDDEN(bool) vboxNetAdpPortOsIsHostMac(PVBOXNETADP pThis, PCRTMAC pMac);
282
 
 
283
 
/**
284
 
 * This is called to when disconnecting from a network.
285
 
 *
286
 
 * @return  IPRT status code.
287
 
 * @param   pThis           The new instance.
288
 
 *
289
 
 * @remarks May own the semaphores for the global list, the network lock and the out-bound trunk port.
290
 
 */
291
 
DECLHIDDEN(int) vboxNetAdpOsDisconnectIt(PVBOXNETADP pThis);
292
 
 
293
 
/**
294
 
 * This is called to when connecting to a network.
295
 
 *
296
 
 * @return  IPRT status code.
297
 
 * @param   pThis           The new instance.
298
 
 *
299
 
 * @remarks Owns the semaphores for the global list, the network lock and the out-bound trunk port.
300
 
 */
301
 
DECLHIDDEN(int) vboxNetAdpOsConnectIt(PVBOXNETADP pThis);
302
 
 
303
 
/** @} */
304
 
#endif /* !VBOXANETADP_DO_NOT_USE_NETFLT */
 
146
 
305
147
 
306
148
/**
307
149
 * This is called to perform OS-specific structure initializations.