1 | /* $Id: VBoxNetLib.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxNetUDP - IntNet Client Library.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h
|
---|
29 | #define VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <iprt/net.h>
|
---|
35 | #include <VBox/intnet.h>
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Header pointers optionally returned by VBoxNetUDPMatch.
|
---|
42 | */
|
---|
43 | typedef struct VBOXNETUDPHDRS
|
---|
44 | {
|
---|
45 | PCRTNETETHERHDR pEth; /**< Pointer to the ethernet header. */
|
---|
46 | PCRTNETIPV4 pIpv4; /**< Pointer to the IPV4 header if IPV4 packet. */
|
---|
47 | PCRTNETUDP pUdp; /**< Pointer to the UDP header. */
|
---|
48 | } VBOXNETUDPHDRS;
|
---|
49 | /** Pointer to a VBOXNETUDPHDRS structure. */
|
---|
50 | typedef VBOXNETUDPHDRS *PVBOXNETUDPHDRS;
|
---|
51 |
|
---|
52 |
|
---|
53 | /** @name VBoxNetUDPMatch flags.
|
---|
54 | * @{ */
|
---|
55 | #define VBOXNETUDP_MATCH_UNICAST RT_BIT_32(0)
|
---|
56 | #define VBOXNETUDP_MATCH_BROADCAST RT_BIT_32(1)
|
---|
57 | #define VBOXNETUDP_MATCH_CHECKSUM RT_BIT_32(2)
|
---|
58 | #define VBOXNETUDP_MATCH_REQUIRE_CHECKSUM RT_BIT_32(3)
|
---|
59 | #define VBOXNETUDP_MATCH_PRINT_STDERR RT_BIT_32(31)
|
---|
60 | /** @} */
|
---|
61 |
|
---|
62 | void * VBoxNetUDPMatch(PINTNETBUF pBuf, unsigned uDstPort, PCRTMAC pDstMac, uint32_t fFlags, PVBOXNETUDPHDRS pHdrs, size_t *pcb);
|
---|
63 | int VBoxNetUDPUnicast(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf,
|
---|
64 | RTNETADDRIPV4 SrcIPv4Addr, PCRTMAC SrcMacAddr, unsigned uSrcPort,
|
---|
65 | RTNETADDRIPV4 DstIPv4Addr, PCRTMAC DstMacAddr, unsigned uDstPort,
|
---|
66 | void const *pvData, size_t cbData);
|
---|
67 | int VBoxNetUDPBroadcast(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf,
|
---|
68 | RTNETADDRIPV4 SrcIPv4Addr, PCRTMAC SrcMacAddr, unsigned uSrcPort,
|
---|
69 | unsigned uDstPort,
|
---|
70 | void const *pvData, size_t cbData);
|
---|
71 |
|
---|
72 | bool VBoxNetArpHandleIt(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf, PCRTMAC pMacAddr, RTNETADDRIPV4 IPv4Addr);
|
---|
73 |
|
---|
74 | int VBoxNetIntIfFlush(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf);
|
---|
75 | int VBoxNetIntIfRingWriteFrame(PINTNETBUF pBuf, PINTNETRINGBUF pRingBuf, size_t cSegs, PCINTNETSEG paSegs);
|
---|
76 | int VBoxNetIntIfSend(PSUPDRVSESSION pSession, INTNETIFHANDLE hIf, PINTNETBUF pBuf, size_t cSegs, PCINTNETSEG paSegs, bool fFlush);
|
---|
77 |
|
---|
78 |
|
---|
79 | RT_C_DECLS_END
|
---|
80 |
|
---|
81 | #endif /* !VBOX_INCLUDED_SRC_NetLib_VBoxNetLib_h */
|
---|
82 |
|
---|