[1] | 1 | /** @file
|
---|
| 2 | * INETNET - Internal Networking.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[8155] | 6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
[1] | 7 | *
|
---|
| 8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
[5999] | 11 | * General Public License (GPL) as published by the Free Software
|
---|
| 12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
| 15 | *
|
---|
| 16 | * The contents of this file may alternatively be used under the terms
|
---|
| 17 | * of the Common Development and Distribution License Version 1.0
|
---|
| 18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
| 19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
| 20 | * CDDL are applicable instead of those of the GPL.
|
---|
| 21 | *
|
---|
| 22 | * You may elect to license modified versions of this file under the
|
---|
| 23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[8155] | 24 | *
|
---|
| 25 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
| 26 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
| 27 | * additional information or have any questions.
|
---|
[1] | 28 | */
|
---|
| 29 |
|
---|
[3632] | 30 | #ifndef ___VBox_intnet_h
|
---|
| 31 | #define ___VBox_intnet_h
|
---|
[1] | 32 |
|
---|
| 33 | #include <VBox/types.h>
|
---|
| 34 | #include <VBox/stam.h>
|
---|
[5283] | 35 | #include <VBox/sup.h>
|
---|
[1] | 36 | #include <iprt/assert.h>
|
---|
| 37 | #include <iprt/asm.h>
|
---|
| 38 |
|
---|
| 39 | __BEGIN_DECLS
|
---|
| 40 |
|
---|
| 41 |
|
---|
[5283] | 42 | /** Pointer to an internal network ring-0 instance. */
|
---|
| 43 | typedef struct INTNET *PINTNET;
|
---|
| 44 |
|
---|
[1] | 45 | /**
|
---|
| 46 | * Generic two-sided ring buffer.
|
---|
| 47 | *
|
---|
| 48 | * The deal is that there is exactly one writer and one reader.
|
---|
| 49 | * When offRead equals offWrite the buffer is empty. In the other
|
---|
| 50 | * extreme the writer will not use the last free byte in the buffer.
|
---|
| 51 | */
|
---|
| 52 | typedef struct INTNETRINGBUF
|
---|
| 53 | {
|
---|
| 54 | /** The start of the buffer offset relative to the. (inclusive) */
|
---|
| 55 | uint32_t offStart;
|
---|
| 56 | /** The offset to the end of the buffer. (exclusive) */
|
---|
| 57 | uint32_t offEnd;
|
---|
| 58 | /** The current read offset. */
|
---|
| 59 | uint32_t volatile offRead;
|
---|
| 60 | /** The current write offset. */
|
---|
| 61 | uint32_t volatile offWrite;
|
---|
| 62 | } INTNETRINGBUF;
|
---|
| 63 | /** Pointer to a ring buffer. */
|
---|
| 64 | typedef INTNETRINGBUF *PINTNETRINGBUF;
|
---|
| 65 |
|
---|
| 66 | /**
|
---|
| 67 | * Get the amount of space available for writing.
|
---|
| 68 | *
|
---|
| 69 | * @returns Number of available bytes.
|
---|
| 70 | * @param pRingBuf The ring buffer.
|
---|
| 71 | */
|
---|
| 72 | DECLINLINE(uint32_t) INTNETRingGetWritable(PINTNETRINGBUF pRingBuf)
|
---|
| 73 | {
|
---|
| 74 | return pRingBuf->offRead <= pRingBuf->offWrite
|
---|
| 75 | ? pRingBuf->offEnd - pRingBuf->offWrite + pRingBuf->offRead - pRingBuf->offStart - 1
|
---|
| 76 | : pRingBuf->offRead - pRingBuf->offWrite - 1;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | /**
|
---|
| 81 | * Get the amount of data ready for reading.
|
---|
| 82 | *
|
---|
| 83 | * @returns Number of ready bytes.
|
---|
| 84 | * @param pRingBuf The ring buffer.
|
---|
| 85 | */
|
---|
| 86 | DECLINLINE(uint32_t) INTNETRingGetReadable(PINTNETRINGBUF pRingBuf)
|
---|
| 87 | {
|
---|
| 88 | return pRingBuf->offRead <= pRingBuf->offWrite
|
---|
| 89 | ? pRingBuf->offWrite - pRingBuf->offRead
|
---|
| 90 | : pRingBuf->offEnd - pRingBuf->offRead + pRingBuf->offWrite - pRingBuf->offStart;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | /**
|
---|
| 95 | * A interface buffer.
|
---|
| 96 | */
|
---|
| 97 | typedef struct INTNETBUF
|
---|
| 98 | {
|
---|
| 99 | /** The size of the entire buffer. */
|
---|
| 100 | uint32_t cbBuf;
|
---|
| 101 | /** The size of the send area. */
|
---|
| 102 | uint32_t cbSend;
|
---|
| 103 | /** The size of the receive area. */
|
---|
| 104 | uint32_t cbRecv;
|
---|
| 105 | /** The receive buffer. */
|
---|
| 106 | INTNETRINGBUF Recv;
|
---|
| 107 | /** The send buffer. */
|
---|
| 108 | INTNETRINGBUF Send;
|
---|
| 109 | /** Number of times yields help solve an overflow. */
|
---|
| 110 | STAMCOUNTER cStatYieldsOk;
|
---|
| 111 | /** Number of times yields didn't help solve an overflow. */
|
---|
| 112 | STAMCOUNTER cStatYieldsNok;
|
---|
| 113 | /** Number of lost packets due to overflows. */
|
---|
| 114 | STAMCOUNTER cStatLost;
|
---|
| 115 | /** Number of packets received (not counting lost ones). */
|
---|
| 116 | STAMCOUNTER cStatRecvs;
|
---|
| 117 | /** Number of frame bytes received (not couting lost frames). */
|
---|
| 118 | STAMCOUNTER cbStatRecv;
|
---|
| 119 | /** Number of packets received. */
|
---|
| 120 | STAMCOUNTER cStatSends;
|
---|
| 121 | /** Number of frame bytes sent. */
|
---|
| 122 | STAMCOUNTER cbStatSend;
|
---|
| 123 | } INTNETBUF;
|
---|
| 124 | typedef INTNETBUF *PINTNETBUF;
|
---|
| 125 |
|
---|
| 126 | /** Internal networking interface handle. */
|
---|
| 127 | typedef uint32_t INTNETIFHANDLE;
|
---|
| 128 | /** Pointer to an internal networking interface handle. */
|
---|
| 129 | typedef INTNETIFHANDLE *PINTNETIFHANDLE;
|
---|
| 130 |
|
---|
| 131 | /** Or mask to obscure the handle index. */
|
---|
| 132 | #define INTNET_HANDLE_MAGIC 0x88880000
|
---|
| 133 | /** Mask to extract the handle index. */
|
---|
| 134 | #define INTNET_HANDLE_INDEX_MASK 0xffff
|
---|
| 135 | /** The maximum number of handles (exclusive) */
|
---|
| 136 | #define INTNET_HANDLE_MAX 0xffff
|
---|
| 137 | /** Invalid handle. */
|
---|
| 138 | #define INTNET_HANDLE_INVALID (0)
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 | /**
|
---|
| 142 | * The packet header.
|
---|
| 143 | *
|
---|
| 144 | * The header is intentionally 8 bytes long. It will always
|
---|
| 145 | * start at an 8 byte aligned address. Assuming that the buffer
|
---|
| 146 | * size is a multiple of 8 bytes, that means that we can guarantee
|
---|
| 147 | * that the entire header is contiguous in both virtual and physical
|
---|
| 148 | * memory.
|
---|
| 149 | */
|
---|
| 150 | #pragma pack(1)
|
---|
| 151 | typedef struct INTNETHDR
|
---|
| 152 | {
|
---|
| 153 | /** Header type. This is currently serving as a magic, it
|
---|
| 154 | * can be extended later to encode special command packets and stuff.. */
|
---|
| 155 | uint16_t u16Type;
|
---|
| 156 | /** The size of the frame. */
|
---|
| 157 | uint16_t cbFrame;
|
---|
| 158 | /** The offset from the start of this header to where the actual frame starts.
|
---|
| 159 | * This is used to keep the frame it self continguous in virtual memory and
|
---|
| 160 | * thereby both simplify reading and */
|
---|
| 161 | int32_t offFrame;
|
---|
| 162 | } INTNETHDR, *PINTNETHDR;
|
---|
| 163 | #pragma pack()
|
---|
| 164 |
|
---|
| 165 | /** INTNETHDR::u16Type value for normal frames. */
|
---|
| 166 | #define INTNETHDR_TYPE_FRAME 0x2442
|
---|
| 167 |
|
---|
| 168 |
|
---|
| 169 | /**
|
---|
| 170 | * Calculates the pointer to the frame.
|
---|
| 171 | *
|
---|
| 172 | * @returns Pointer to the start of the frame.
|
---|
| 173 | * @param pHdr Pointer to the packet header
|
---|
| 174 | * @param pBuf The buffer the header is within. Only used in strict builds.
|
---|
| 175 | */
|
---|
| 176 | DECLINLINE(void *) INTNETHdrGetFramePtr(PINTNETHDR pHdr, PINTNETBUF pBuf)
|
---|
| 177 | {
|
---|
| 178 | uint8_t *pu8 = (uint8_t *)pHdr + pHdr->offFrame;
|
---|
| 179 | #ifdef VBOX_STRICT
|
---|
| 180 | const uintptr_t off = (uintptr_t)pu8 - (uintptr_t)pBuf;
|
---|
| 181 | Assert(pHdr->u16Type == INTNETHDR_TYPE_FRAME);
|
---|
| 182 | Assert(off < pBuf->cbBuf);
|
---|
[5283] | 183 | Assert(off + pHdr->cbFrame <= pBuf->cbBuf);
|
---|
[1] | 184 | #endif
|
---|
| 185 | NOREF(pBuf);
|
---|
| 186 | return pu8;
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | /**
|
---|
| 191 | * Skips to the next (read) frame in the buffer.
|
---|
| 192 | *
|
---|
| 193 | * @param pBuf The buffer.
|
---|
| 194 | * @param pRingBuf The ring buffer in question.
|
---|
| 195 | */
|
---|
| 196 | DECLINLINE(void) INTNETRingSkipFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf)
|
---|
| 197 | {
|
---|
| 198 | Assert(pRingBuf->offRead < pBuf->cbBuf);
|
---|
| 199 | Assert(pRingBuf->offRead >= pRingBuf->offStart);
|
---|
| 200 | Assert(pRingBuf->offRead < pRingBuf->offEnd);
|
---|
| 201 | uint32_t offRead = pRingBuf->offRead;
|
---|
| 202 | PINTNETHDR pHdr = (PINTNETHDR)((uint8_t *)pBuf + offRead);
|
---|
| 203 |
|
---|
| 204 | /* skip the frame */
|
---|
| 205 | offRead += pHdr->offFrame + pHdr->cbFrame;
|
---|
| 206 | offRead = RT_ALIGN_32(offRead, sizeof(INTNETHDR));
|
---|
| 207 | Assert(offRead <= pRingBuf->offEnd && offRead >= pRingBuf->offStart);
|
---|
| 208 | if (offRead >= pRingBuf->offEnd)
|
---|
| 209 | offRead = pRingBuf->offStart;
|
---|
| 210 | ASMAtomicXchgU32(&pRingBuf->offRead, offRead);
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | /** The maximum length of a network name. */
|
---|
| 214 | #define INTNET_MAX_NETWORK_NAME 128
|
---|
| 215 |
|
---|
| 216 |
|
---|
| 217 | /**
|
---|
[5283] | 218 | * Request buffer for INTNETR0OpenReq / VMMR0_DO_INTNET_OPEN.
|
---|
| 219 | * @see INTNETR0Open.
|
---|
[1] | 220 | */
|
---|
[5283] | 221 | typedef struct INTNETOPENREQ
|
---|
[1] | 222 | {
|
---|
[5283] | 223 | /** The request header. */
|
---|
| 224 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 225 | /** The network name. (input) */
|
---|
| 226 | char szNetwork[INTNET_MAX_NETWORK_NAME];
|
---|
| 227 | /** The size of the send buffer. (input) */
|
---|
| 228 | uint32_t cbSend;
|
---|
| 229 | /** The size of the receive buffer. (input) */
|
---|
| 230 | uint32_t cbRecv;
|
---|
[1606] | 231 | /** Whether new participants should be subjected to access check or not. */
|
---|
[1599] | 232 | bool fRestrictAccess;
|
---|
[1] | 233 | /** The handle to the network interface. (output) */
|
---|
| 234 | INTNETIFHANDLE hIf;
|
---|
[5283] | 235 | } INTNETOPENREQ;
|
---|
| 236 | /** Pointer to an INTNETR0OpenReq / VMMR0_DO_INTNET_OPEN request buffer. */
|
---|
| 237 | typedef INTNETOPENREQ *PINTNETOPENREQ;
|
---|
[1] | 238 |
|
---|
[5283] | 239 | INTNETR0DECL(int) INTNETR0OpenReq(PINTNET pIntNet, PSUPDRVSESSION pSession, PINTNETOPENREQ pReq);
|
---|
[1] | 240 |
|
---|
[5283] | 241 |
|
---|
[1] | 242 | /**
|
---|
[5283] | 243 | * Request buffer for INTNETR0IfCloseReq / VMMR0_DO_INTNET_IF_CLOSE.
|
---|
| 244 | * @see INTNETR0IfClose.
|
---|
[1] | 245 | */
|
---|
[5283] | 246 | typedef struct INTNETIFCLOSEREQ
|
---|
[1] | 247 | {
|
---|
[5283] | 248 | /** The request header. */
|
---|
| 249 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 250 | /** The handle to the network interface. */
|
---|
| 251 | INTNETIFHANDLE hIf;
|
---|
[5283] | 252 | } INTNETIFCLOSEREQ;
|
---|
| 253 | /** Pointer to an INTNETR0IfCloseReq / VMMR0_DO_INTNET_IF_CLOSE request buffer. */
|
---|
| 254 | typedef INTNETIFCLOSEREQ *PINTNETIFCLOSEREQ;
|
---|
[1] | 255 |
|
---|
[5283] | 256 | INTNETR0DECL(int) INTNETR0IfCloseReq(PINTNET pIntNet, PINTNETIFCLOSEREQ pReq);
|
---|
[1] | 257 |
|
---|
[5283] | 258 |
|
---|
[1] | 259 | /**
|
---|
[5283] | 260 | * Request buffer for INTNETR0IfGetRing3BufferReq / VMMR0_DO_INTNET_IF_GET_RING3_BUFFER.
|
---|
| 261 | * @see INTNETR0IfGetRing3Buffer.
|
---|
[1] | 262 | */
|
---|
[5283] | 263 | typedef struct INTNETIFGETRING3BUFFERREQ
|
---|
[1] | 264 | {
|
---|
[5283] | 265 | /** The request header. */
|
---|
| 266 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 267 | /** Handle to the interface. */
|
---|
[5283] | 268 | INTNETIFHANDLE hIf;
|
---|
[1] | 269 | /** The pointer to the ring3 buffer. (output) */
|
---|
[5283] | 270 | R3PTRTYPE(PINTNETBUF) pRing3Buf;
|
---|
| 271 | } INTNETIFGETRING3BUFFERREQ;
|
---|
| 272 | /** Pointer to an INTNETR0IfGetRing3BufferReq / VMMR0_DO_INTNET_IF_GET_RING3_BUFFER request buffer. */
|
---|
| 273 | typedef INTNETIFGETRING3BUFFERREQ *PINTNETIFGETRING3BUFFERREQ;
|
---|
[1] | 274 |
|
---|
[5283] | 275 | INTNETR0DECL(int) INTNETR0IfGetRing3BufferReq(PINTNET pIntNet, PINTNETIFGETRING3BUFFERREQ pReq);
|
---|
| 276 |
|
---|
| 277 |
|
---|
[1] | 278 | /**
|
---|
[5283] | 279 | * Request buffer for INTNETR0IfSetPromiscuousModeReq / VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE.
|
---|
| 280 | * @see INTNETR0IfSetPromiscuousMode.
|
---|
[1] | 281 | */
|
---|
[5283] | 282 | typedef struct INTNETIFSETPROMISCUOUSMODEREQ
|
---|
[1] | 283 | {
|
---|
[5283] | 284 | /** The request header. */
|
---|
| 285 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 286 | /** Handle to the interface. */
|
---|
| 287 | INTNETIFHANDLE hIf;
|
---|
| 288 | /** The new promiscuous mode. */
|
---|
| 289 | bool fPromiscuous;
|
---|
[5283] | 290 | } INTNETIFSETPROMISCUOUSMODEREQ;
|
---|
| 291 | /** Pointer to an INTNETR0IfSetPromiscuousModeReq / VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE request buffer. */
|
---|
| 292 | typedef INTNETIFSETPROMISCUOUSMODEREQ *PINTNETIFSETPROMISCUOUSMODEREQ;
|
---|
[1] | 293 |
|
---|
[5283] | 294 | INTNETR0DECL(int) INTNETR0IfSetPromiscuousModeReq(PINTNET pIntNet, PINTNETIFSETPROMISCUOUSMODEREQ pReq);
|
---|
[1] | 295 |
|
---|
[5283] | 296 |
|
---|
[1] | 297 | /**
|
---|
[5283] | 298 | * Request buffer for INTNETR0IfSendReq / VMMR0_DO_INTNET_IF_SEND.
|
---|
| 299 | * @see INTNETR0IfSend.
|
---|
[1] | 300 | */
|
---|
[5283] | 301 | typedef struct INTNETIFSENDREQ
|
---|
[1] | 302 | {
|
---|
[5283] | 303 | /** The request header. */
|
---|
| 304 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 305 | /** Handle to the interface. */
|
---|
| 306 | INTNETIFHANDLE hIf;
|
---|
[5283] | 307 | } INTNETIFSENDREQ;
|
---|
[1] | 308 | /** Pointer to an INTNETR0IfSend() argument package. */
|
---|
[5283] | 309 | typedef INTNETIFSENDREQ *PINTNETIFSENDREQ;
|
---|
[1] | 310 |
|
---|
[5283] | 311 | INTNETR0DECL(int) INTNETR0IfSendReq(PINTNET pIntNet, PINTNETIFSENDREQ pReq);
|
---|
[1] | 312 |
|
---|
[5283] | 313 |
|
---|
[1] | 314 | /**
|
---|
[5283] | 315 | * Request buffer for INTNETR0IfWaitReq / VMMR0_DO_INTNET_IF_WAIT.
|
---|
| 316 | * @see INTNETR0IfWait.
|
---|
[1] | 317 | */
|
---|
[5283] | 318 | typedef struct INTNETIFWAITREQ
|
---|
[1] | 319 | {
|
---|
[5283] | 320 | /** The request header. */
|
---|
| 321 | SUPVMMR0REQHDR Hdr;
|
---|
[1] | 322 | /** Handle to the interface. */
|
---|
| 323 | INTNETIFHANDLE hIf;
|
---|
| 324 | /** The number of milliseconds to wait. */
|
---|
[5283] | 325 | uint32_t cMillies;
|
---|
| 326 | } INTNETIFWAITREQ;
|
---|
| 327 | /** Pointer to an INTNETR0IfWaitReq / VMMR0_DO_INTNET_IF_WAIT request buffer. */
|
---|
| 328 | typedef INTNETIFWAITREQ *PINTNETIFWAITREQ;
|
---|
[1] | 329 |
|
---|
[5283] | 330 | INTNETR0DECL(int) INTNETR0IfWaitReq(PINTNET pIntNet, PINTNETIFWAITREQ pReq);
|
---|
[1] | 331 |
|
---|
[5283] | 332 |
|
---|
[1] | 333 | #if defined(IN_RING0) || defined(IN_INTNET_TESTCASE)
|
---|
| 334 | /** @name
|
---|
| 335 | * @{
|
---|
| 336 | */
|
---|
| 337 |
|
---|
| 338 | /**
|
---|
| 339 | * Create an instance of the Ring-0 internal networking service.
|
---|
| 340 | *
|
---|
| 341 | * @returns VBox status code.
|
---|
| 342 | * @param ppIntNet Where to store the instance pointer.
|
---|
| 343 | */
|
---|
| 344 | INTNETR0DECL(int) INTNETR0Create(PINTNET *ppIntNet);
|
---|
| 345 |
|
---|
| 346 | /**
|
---|
| 347 | * Destroys an instance of the Ring-0 internal networking service.
|
---|
| 348 | *
|
---|
| 349 | * @param pIntNet Pointer to the instance data.
|
---|
| 350 | */
|
---|
| 351 | INTNETR0DECL(void) INTNETR0Destroy(PINTNET pIntNet);
|
---|
| 352 |
|
---|
| 353 | /**
|
---|
| 354 | * Opens a network interface and attaches it to the specified network.
|
---|
| 355 | *
|
---|
| 356 | * @returns VBox status code.
|
---|
[1606] | 357 | * @param pIntNet The internal network instance.
|
---|
| 358 | * @param pSession The session handle.
|
---|
| 359 | * @param pszNetwork The network name.
|
---|
| 360 | * @param cbSend The send buffer size.
|
---|
| 361 | * @param cbRecv The receive buffer size.
|
---|
| 362 | * @param fRestrictAccess Whether new participants should be subjected to access check or not.
|
---|
| 363 | * @param phIf Where to store the handle to the network interface.
|
---|
[1] | 364 | */
|
---|
[1599] | 365 | INTNETR0DECL(int) INTNETR0Open(PINTNET pIntNet, PSUPDRVSESSION pSession, const char *pszNetwork, unsigned cbSend, unsigned cbRecv, bool fRestrictAccess, PINTNETIFHANDLE phIf);
|
---|
[1] | 366 |
|
---|
| 367 | /**
|
---|
| 368 | * Close an interface.
|
---|
| 369 | *
|
---|
| 370 | * @returns VBox status code.
|
---|
| 371 | * @param pIntNet The instance handle.
|
---|
| 372 | * @param hIf The interface handle.
|
---|
| 373 | */
|
---|
| 374 | INTNETR0DECL(int) INTNETR0IfClose(PINTNET pIntNet, INTNETIFHANDLE hIf);
|
---|
| 375 |
|
---|
| 376 | /**
|
---|
| 377 | * Gets the ring-0 address of the current buffer.
|
---|
| 378 | *
|
---|
| 379 | * @returns VBox status code.
|
---|
| 380 | * @param pIntNet The instance data.
|
---|
| 381 | * @param hIF The interface handle.
|
---|
| 382 | * @param ppRing0Buf Where to store the address of the ring-3 mapping.
|
---|
| 383 | */
|
---|
| 384 | INTNETR0DECL(int) INTNETR0IfGetRing0Buffer(PINTNET pIntNet, INTNETIFHANDLE hIf, PINTNETBUF *ppRing0Buf);
|
---|
| 385 |
|
---|
| 386 | /**
|
---|
| 387 | * Maps the default buffer into ring 3.
|
---|
| 388 | *
|
---|
| 389 | * @returns VBox status code.
|
---|
| 390 | * @param pIntNet The instance data.
|
---|
| 391 | * @param hIF The interface handle.
|
---|
| 392 | * @param ppRing3Buf Where to store the address of the ring-3 mapping.
|
---|
| 393 | */
|
---|
[5283] | 394 | INTNETR0DECL(int) INTNETR0IfGetRing3Buffer(PINTNET pIntNet, INTNETIFHANDLE hIf, R3PTRTYPE(PINTNETBUF) *ppRing3Buf);
|
---|
[1] | 395 |
|
---|
| 396 | /**
|
---|
| 397 | * Sets the promiscuous mode property of an interface.
|
---|
| 398 | *
|
---|
| 399 | * @returns VBox status code.
|
---|
| 400 | * @param pIntNet The instance handle.
|
---|
| 401 | * @param hIf The interface handle.
|
---|
| 402 | * @param fPromiscuous Set if the interface should be in promiscuous mode, clear if not.
|
---|
| 403 | */
|
---|
| 404 | INTNETR0DECL(int) INTNETR0IfSetPromiscuousMode(PINTNET pIntNet, INTNETIFHANDLE hIf, bool fPromiscuous);
|
---|
| 405 |
|
---|
| 406 | /**
|
---|
| 407 | * Sends one or more frames.
|
---|
| 408 | *
|
---|
| 409 | * The function will first the frame which is passed as the optional
|
---|
| 410 | * arguments pvFrame and cbFrame. These are optional since it also
|
---|
| 411 | * possible to chain together one or more frames in the send buffer
|
---|
| 412 | * which the function will process after considering it's arguments.
|
---|
| 413 | *
|
---|
| 414 | * @returns VBox status code.
|
---|
| 415 | * @param pIntNet The instance data.
|
---|
| 416 | * @param hIF The interface handle.
|
---|
| 417 | * @param pvFrame Pointer to the frame.
|
---|
| 418 | * @param cbFrame Size of the frame.
|
---|
| 419 | */
|
---|
| 420 | INTNETR0DECL(int) INTNETR0IfSend(PINTNET pIntNet, INTNETIFHANDLE hIf, const void *pvFrame, unsigned cbFrame);
|
---|
| 421 |
|
---|
| 422 | /**
|
---|
| 423 | * Wait for the interface to get signaled.
|
---|
| 424 | * The interface will be signaled when is put into the receive buffer.
|
---|
| 425 | *
|
---|
| 426 | * @returns VBox status code.
|
---|
| 427 | * @param pIntNet The instance handle.
|
---|
| 428 | * @param hIf The interface handle.
|
---|
| 429 | * @param cMillies Number of milliseconds to wait. RT_INDEFINITE_WAIT should be
|
---|
| 430 | * used if indefinite wait is desired.
|
---|
| 431 | */
|
---|
[5283] | 432 | INTNETR0DECL(int) INTNETR0IfWait(PINTNET pIntNet, INTNETIFHANDLE hIf, uint32_t cMillies);
|
---|
[1] | 433 |
|
---|
| 434 | /** @} */
|
---|
| 435 | #endif /* IN_RING0 */
|
---|
| 436 |
|
---|
| 437 | __END_DECLS
|
---|
| 438 |
|
---|
| 439 | #endif
|
---|