VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.1/include/internal/sockets.h@ 94102

最後變更 在這個檔案從94102是 94082,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.1: started applying and adjusting our OpenSSL changes to 3.0.1. bugref:10128

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

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