1 | /* $Id: socket.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Internal Header for RTSocket.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-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 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef IPRT_INCLUDED_INTERNAL_socket_h
|
---|
38 | #define IPRT_INCLUDED_INTERNAL_socket_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <iprt/cdefs.h>
|
---|
44 | #include <iprt/types.h>
|
---|
45 | #include <iprt/net.h>
|
---|
46 | /* Currently requires a bunch of socket headers. */
|
---|
47 |
|
---|
48 |
|
---|
49 | /** Native socket handle type. */
|
---|
50 | #ifdef RT_OS_WINDOWS
|
---|
51 | # define RTSOCKETNATIVE SOCKET
|
---|
52 | #else
|
---|
53 | # define RTSOCKETNATIVE int
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /** NIL value for native socket handles. */
|
---|
57 | #ifdef RT_OS_WINDOWS
|
---|
58 | # define NIL_RTSOCKETNATIVE INVALID_SOCKET
|
---|
59 | #else
|
---|
60 | # define NIL_RTSOCKETNATIVE (-1)
|
---|
61 | #endif
|
---|
62 |
|
---|
63 |
|
---|
64 | RT_C_DECLS_BEGIN
|
---|
65 |
|
---|
66 | #ifndef IPRT_INTERNAL_SOCKET_POLLING_ONLY
|
---|
67 | DECLHIDDEN(int) rtSocketResolverError(void);
|
---|
68 | DECLHIDDEN(int) rtSocketCreateForNative(RTSOCKETINT **ppSocket, RTSOCKETNATIVE hNative, bool fLeaveOpen);
|
---|
69 | DECLHIDDEN(int) rtSocketCreate(PRTSOCKET phSocket, int iDomain, int iType, int iProtocol, bool fInheritable);
|
---|
70 | DECLHIDDEN(int) rtSocketCreateTcpPair(RTSOCKET *phServer, RTSOCKET *phClient);
|
---|
71 | DECLHIDDEN(int) rtSocketBind(RTSOCKET hSocket, PCRTNETADDR pAddr);
|
---|
72 | DECLHIDDEN(int) rtSocketBindRawAddr(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr);
|
---|
73 | DECLHIDDEN(int) rtSocketListen(RTSOCKET hSocket, int cMaxPending);
|
---|
74 | DECLHIDDEN(int) rtSocketAccept(RTSOCKET hSocket, PRTSOCKET phClient, struct sockaddr *pAddr, size_t *pcbAddr);
|
---|
75 | DECLHIDDEN(int) rtSocketConnect(RTSOCKET hSocket, PCRTNETADDR pAddr, RTMSINTERVAL cMillies);
|
---|
76 | DECLHIDDEN(int) rtSocketConnectRaw(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr);
|
---|
77 | DECLHIDDEN(int) rtSocketSetOpt(RTSOCKET hSocket, int iLevel, int iOption, void const *pvValue, int cbValue);
|
---|
78 | #endif /* IPRT_INTERNAL_SOCKET_POLLING_ONLY */
|
---|
79 |
|
---|
80 | DECLHIDDEN(int) rtSocketPollGetHandle(RTSOCKET hSocket, uint32_t fEvents, PRTHCINTPTR phNative);
|
---|
81 | DECLHIDDEN(uint32_t) rtSocketPollStart(RTSOCKET hSocket, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait);
|
---|
82 | DECLHIDDEN(uint32_t) rtSocketPollDone(RTSOCKET hSocket, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents);
|
---|
83 |
|
---|
84 | RT_C_DECLS_END
|
---|
85 |
|
---|
86 | #endif /* !IPRT_INCLUDED_INTERNAL_socket_h */
|
---|
87 |
|
---|