1 | /* $Id: VBoxNetLib.h 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxNetUDP - IntNet Client Library.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2020 Oracle Corporation
|
---|
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 |
|
---|
18 | #ifndef VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h
|
---|
19 | #define VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include <iprt/net.h>
|
---|
25 | #include <VBox/intnet.h>
|
---|
26 |
|
---|
27 | RT_C_DECLS_BEGIN
|
---|
28 |
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Header pointers optionally returned by VBoxNetUDPMatch.
|
---|
32 | */
|
---|
33 | typedef struct VBOXNETUDPHDRS
|
---|
34 | {
|
---|
35 | PCRTNETETHERHDR pEth; /**< Pointer to the ethernet header. */
|
---|
36 | PCRTNETIPV4 pIpv4; /**< Pointer to the IPV4 header if IPV4 packet. */
|
---|
37 | PCRTNETUDP pUdp; /**< Pointer to the UDP header. */
|
---|
38 | } VBOXNETUDPHDRS;
|
---|
39 | /** Pointer to a VBOXNETUDPHDRS structure. */
|
---|
40 | typedef VBOXNETUDPHDRS *PVBOXNETUDPHDRS;
|
---|
41 |
|
---|
42 |
|
---|
43 | /** @name VBoxNetUDPMatch flags.
|
---|
44 | * @{ */
|
---|
45 | #define VBOXNETUDP_MATCH_UNICAST RT_BIT_32(0)
|
---|
46 | #define VBOXNETUDP_MATCH_BROADCAST RT_BIT_32(1)
|
---|
47 | #define VBOXNETUDP_MATCH_CHECKSUM RT_BIT_32(2)
|
---|
48 | #define VBOXNETUDP_MATCH_REQUIRE_CHECKSUM RT_BIT_32(3)
|
---|
49 | #define VBOXNETUDP_MATCH_PRINT_STDERR RT_BIT_32(31)
|
---|
50 | /** @} */
|
---|
51 |
|
---|
52 | void * VBoxNetUDPMatch(PINTNETBUF pBuf, unsigned uDstPort, PCRTMAC pDstMac, uint32_t fFlags, PVBOXNETUDPHDRS pHdrs, size_t *pcb);
|
---|
53 | int VBoxNetUDPUnicast(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf,
|
---|
54 | RTNETADDRIPV4 SrcIPv4Addr, PCRTMAC SrcMacAddr, unsigned uSrcPort,
|
---|
55 | RTNETADDRIPV4 DstIPv4Addr, PCRTMAC DstMacAddr, unsigned uDstPort,
|
---|
56 | void const *pvData, size_t cbData);
|
---|
57 | int VBoxNetUDPBroadcast(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf,
|
---|
58 | RTNETADDRIPV4 SrcIPv4Addr, PCRTMAC SrcMacAddr, unsigned uSrcPort,
|
---|
59 | unsigned uDstPort,
|
---|
60 | void const *pvData, size_t cbData);
|
---|
61 |
|
---|
62 | bool VBoxNetArpHandleIt(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf, PCRTMAC pMacAddr, RTNETADDRIPV4 IPv4Addr);
|
---|
63 |
|
---|
64 | int VBoxNetIntIfFlush(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf);
|
---|
65 | int VBoxNetIntIfRingWriteFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf, size_t cSegs, PCINTNETSEG paSegs);
|
---|
66 | int VBoxNetIntIfSend(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf, size_t cSegs, PCINTNETSEG paSegs, bool fFlush);
|
---|
67 |
|
---|
68 |
|
---|
69 | RT_C_DECLS_END
|
---|
70 |
|
---|
71 | #endif /* !VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h */
|
---|
72 |
|
---|