This commit is contained in:
2025-09-24 10:53:28 +08:00
commit f8e4df77fb
856 changed files with 140098 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
/*
* Copyright(c) 2006 to 2022 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef DDSRT_SOCKETS_POSIX_H
#define DDSRT_SOCKETS_POSIX_H
#if DDSRT_WITH_LWIP
#include <lwip/sockets.h>
#include <lwip/netdb.h>
#else
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/select.h>
#endif
#include "dds/ddsrt/iovec.h"
#if defined(__cplusplus)
extern "C" {
#endif
typedef int ddsrt_socket_t;
#define DDSRT_INVALID_SOCKET (-1)
#define PRIdSOCK "d"
#if LWIP_SOCKET
# define DDSRT_HAVE_SSM 0
# define IFF_UP 0x1
# define IFF_BROADCAST 0x2
# define IFF_LOOPBACK 0x8
# define IFF_POINTOPOINT 0x10
# define IFF_MULTICAST 0x1000
#elif __SunOS_5_6
# define DDSRT_HAVE_SSM 0
#else /* LWIP_SOCKET */
# define DDSRT_HAVE_SSM 1
#endif /* LWIP_SOCKET */
typedef struct msghdr ddsrt_msghdr_t;
#if (defined(__sun) && !defined(_XPG4_2)) || \
(defined(LWIP_SOCKET))
# define DDSRT_MSGHDR_FLAGS 0
#else
# define DDSRT_MSGHDR_FLAGS 1
#endif
#if defined(__cplusplus)
}
#endif
#endif /* DDSRT_SOCKETS_POSIX_H */

View File

@@ -0,0 +1,51 @@
#ifndef DDSRT_WINDOWS_SOCKET_H
#define DDSRT_WINDOWS_SOCKET_H
#include <winsock2.h>
#include <mswsock.h> // Required for MSG_TRUNC when compiling with mingw-w64.
#include <ws2tcpip.h>
#include "dds/ddsrt/iovec.h"
#if defined(__cplusplus)
extern "C" {
#endif
typedef SOCKET ddsrt_socket_t;
#define DDSRT_INVALID_SOCKET (INVALID_SOCKET)
#define PRIdSOCK PRIuPTR
#if defined(NTDDI_VERSION) && \
defined(_WIN32_WINNT_WS03) && \
(NTDDI_VERSION >= _WIN32_WINNT_WS03)
#define DDSRT_HAVE_SSM 1
#else
#define DDSRT_HAVE_SSM 0
#endif
#define IFF_POINTOPOINT IFF_POINTTOPOINT
// Required when compiling with mingw-w64.
#ifndef MCAST_JOIN_SOURCE_GROUP
#define MCAST_JOIN_SOURCE_GROUP 45
#endif
#ifndef MCAST_LEAVE_SOURCE_GROUP
#define MCAST_LEAVE_SOURCE_GROUP 46
#endif
typedef struct ddsrt_msghdr {
void *msg_name;
socklen_t msg_namelen;
ddsrt_iovec_t *msg_iov;
ddsrt_msg_iovlen_t msg_iovlen;
void *msg_control;
size_t msg_controllen;
int msg_flags;
} ddsrt_msghdr_t;
#define DDSRT_MSGHDR_FLAGS 1
#if defined(__cplusplus)
}
#endif
#endif /* DDSRT_WINDOWS_SOCKET_H */