VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/include/internal/sockets.h@ 99507

最後變更 在這個檔案從99507是 97984,由 vboxsync 提交於 2 年 前

libs/openssl-3.0.7: Shut up pragma once warnings for internal headers. Added sed script for doing that. bugref:10317

檔案大小: 5.4 KB
 
1/*
2 * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef OSSL_INTERNAL_SOCKETS_H
11# define OSSL_INTERNAL_SOCKETS_H
12# ifndef RT_WITHOUT_PRAGMA_ONCE /* VBOX */
13# pragma once
14# endif /* VBOX */
15
16# include <openssl/opensslconf.h>
17
18# if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
19# define NO_SYS_PARAM_H
20# endif
21# ifdef WIN32
22# define NO_SYS_UN_H
23# endif
24# ifdef OPENSSL_SYS_VMS
25# define NO_SYS_PARAM_H
26# define NO_SYS_UN_H
27# endif
28
29# ifdef OPENSSL_NO_SOCK
30
31# elif defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
32# if defined(__DJGPP__)
33# define WATT32
34# define WATT32_NO_OLDIES
35# include <sys/socket.h>
36# include <sys/un.h>
37# include <tcp.h>
38# include <netdb.h>
39# include <arpa/inet.h>
40# include <netinet/tcp.h>
41# elif defined(_WIN32_WCE) && _WIN32_WCE<410
42# define getservbyname _masked_declaration_getservbyname
43# endif
44# if !defined(IPPROTO_IP)
45 /* winsock[2].h was included already? */
46# include <winsock.h>
47# endif
48# ifdef getservbyname
49 /* this is used to be wcecompat/include/winsock_extras.h */
50# undef getservbyname
51struct servent *PASCAL getservbyname(const char *, const char *);
52# endif
53
54# ifdef _WIN64
55/*
56 * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because
57 * the value constitutes an index in per-process table of limited size
58 * and not a real pointer. And we also depend on fact that all processors
59 * Windows run on happen to be two's-complement, which allows to
60 * interchange INVALID_SOCKET and -1.
61 */
62# define socket(d,t,p) ((int)socket(d,t,p))
63# define accept(s,f,l) ((int)accept(s,f,l))
64# endif
65
66# else
67
68# ifndef NO_SYS_PARAM_H
69# include <sys/param.h>
70# endif
71# ifdef OPENSSL_SYS_VXWORKS
72# include <time.h>
73# endif
74
75# include <netdb.h>
76# if defined(OPENSSL_SYS_VMS_NODECC)
77# include <socket.h>
78# include <in.h>
79# include <inet.h>
80# else
81# include <sys/socket.h>
82# ifndef NO_SYS_UN_H
83# include <sys/un.h>
84# ifndef UNIX_PATH_MAX
85# define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)NULL)->sun_path)
86# endif
87# endif
88# ifdef FILIO_H
89# include <sys/filio.h> /* FIONBIO in some SVR4, e.g. unixware, solaris */
90# endif
91# include <netinet/in.h>
92# include <arpa/inet.h>
93# include <netinet/tcp.h>
94# endif
95
96# ifdef OPENSSL_SYS_AIX
97# include <sys/select.h>
98# endif
99
100# ifndef VMS
101# include <sys/ioctl.h>
102# else
103# if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000)
104 /* ioctl is only in VMS > 7.0 and when socketshr is not used */
105# include <sys/ioctl.h>
106# endif
107# include <unixio.h>
108# if defined(TCPIP_TYPE_SOCKETSHR)
109# include <socketshr.h>
110# endif
111# endif
112
113# ifndef INVALID_SOCKET
114# define INVALID_SOCKET (-1)
115# endif
116
117# ifdef RT_OS_OS2 /* VBOX */
118# define socklen_t int /* VBOX */
119# undef AF_INET6 /* VBOX */
120# endif /* VBOX */
121# endif
122
123/*
124 * Some IPv6 implementations are broken, you can disable them in known
125 * bad versions.
126 */
127# if !defined(OPENSSL_USE_IPV6)
128# if defined(AF_INET6)
129# define OPENSSL_USE_IPV6 1
130# else
131# define OPENSSL_USE_IPV6 0
132# endif
133# endif
134
135# define get_last_socket_error() errno
136# define clear_socket_error() errno=0
137
138# if defined(OPENSSL_SYS_WINDOWS)
139# undef get_last_socket_error
140# undef clear_socket_error
141# define get_last_socket_error() WSAGetLastError()
142# define clear_socket_error() WSASetLastError(0)
143# define readsocket(s,b,n) recv((s),(b),(n),0)
144# define writesocket(s,b,n) send((s),(b),(n),0)
145# elif defined(__DJGPP__)
146# define closesocket(s) close_s(s)
147# define readsocket(s,b,n) read_s(s,b,n)
148# define writesocket(s,b,n) send(s,b,n,0)
149# elif defined(OPENSSL_SYS_VMS)
150# define ioctlsocket(a,b,c) ioctl(a,b,c)
151# define closesocket(s) close(s)
152# define readsocket(s,b,n) recv((s),(b),(n),0)
153# define writesocket(s,b,n) send((s),(b),(n),0)
154# elif defined(OPENSSL_SYS_VXWORKS)
155# define ioctlsocket(a,b,c) ioctl((a),(b),(int)(c))
156# define closesocket(s) close(s)
157# define readsocket(s,b,n) read((s),(b),(n))
158# define writesocket(s,b,n) write((s),(char *)(b),(n))
159# elif defined(OPENSSL_SYS_TANDEM)
160# if defined(OPENSSL_TANDEM_FLOSS)
161# include <floss.h(floss_read, floss_write)>
162# define readsocket(s,b,n) floss_read((s),(b),(n))
163# define writesocket(s,b,n) floss_write((s),(b),(n))
164# else
165# define readsocket(s,b,n) read((s),(b),(n))
166# define writesocket(s,b,n) write((s),(b),(n))
167# endif
168# define ioctlsocket(a,b,c) ioctl(a,b,c)
169# define closesocket(s) close(s)
170# else
171# define ioctlsocket(a,b,c) ioctl(a,b,c)
172# define closesocket(s) close(s)
173# define readsocket(s,b,n) read((s),(b),(n))
174# define writesocket(s,b,n) write((s),(b),(n))
175# endif
176
177/* also in apps/include/apps.h */
178# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
179# define openssl_fdset(a, b) FD_SET((unsigned int)(a), b)
180# else
181# define openssl_fdset(a, b) FD_SET(a, b)
182# endif
183
184#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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