VirtualBox

source: vbox/trunk/src/VBox/Runtime/include/internal/socket.h@ 104465

Last change on this file since 104465 was 100171, checked in by vboxsync, 18 months ago

IPRT: tcp.h+tcp.cpp,socket.h+socket.cpp: Add RTTcpSetKeepAlive() which
allows one to enable or disable sending periodic keep-alive messages on
a socket (SO_KEEPALIVE) as described in RFC 1122. RTTcpSetKeepAlive()
also allows one to adjust several keep-alive options on a per-socket
basis: the idle time before keep-alive probes are sent (TCP_KEEPIDLE
(TCP_KEEPALIVE on macOS)), the amount of time between keep-alive probes
(TCP_KEEPINTVL), and the number of keep-alive probes to send before
closing the connection (TCP_KEEPCNT).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: socket.h 100171 2023-06-13 21:07:56Z 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
64RT_C_DECLS_BEGIN
65
66#ifndef IPRT_INTERNAL_SOCKET_POLLING_ONLY
67DECLHIDDEN(int) rtSocketResolverError(void);
68DECLHIDDEN(int) rtSocketCreateForNative(RTSOCKETINT **ppSocket, RTSOCKETNATIVE hNative, bool fLeaveOpen);
69DECLHIDDEN(int) rtSocketCreate(PRTSOCKET phSocket, int iDomain, int iType, int iProtocol, bool fInheritable);
70DECLHIDDEN(int) rtSocketCreateTcpPair(RTSOCKET *phServer, RTSOCKET *phClient);
71DECLHIDDEN(int) rtSocketBind(RTSOCKET hSocket, PCRTNETADDR pAddr);
72DECLHIDDEN(int) rtSocketBindRawAddr(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr);
73DECLHIDDEN(int) rtSocketListen(RTSOCKET hSocket, int cMaxPending);
74DECLHIDDEN(int) rtSocketAccept(RTSOCKET hSocket, PRTSOCKET phClient, struct sockaddr *pAddr, size_t *pcbAddr);
75DECLHIDDEN(int) rtSocketConnect(RTSOCKET hSocket, PCRTNETADDR pAddr, RTMSINTERVAL cMillies);
76DECLHIDDEN(int) rtSocketConnectRaw(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr);
77DECLHIDDEN(int) rtSocketSetOpt(RTSOCKET hSocket, int iLevel, int iOption, void const *pvValue, int cbValue);
78#endif /* IPRT_INTERNAL_SOCKET_POLLING_ONLY */
79
80DECLHIDDEN(int) rtSocketPollGetHandle(RTSOCKET hSocket, uint32_t fEvents, PRTHCINTPTR phNative);
81DECLHIDDEN(int) rtSocketSetKeepAlive(RTSOCKET hSocket, bool fEnable, uint32_t cSecsIdle, uint32_t cSecsInterval);
82DECLHIDDEN(uint32_t) rtSocketPollStart(RTSOCKET hSocket, RTPOLLSET hPollSet, uint32_t fEvents, bool fFinalEntry, bool fNoWait);
83DECLHIDDEN(uint32_t) rtSocketPollDone(RTSOCKET hSocket, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents);
84
85RT_C_DECLS_END
86
87#endif /* !IPRT_INCLUDED_INTERNAL_socket_h */
88
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette