Apache HTTPD
os2calls.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "apr_arch_networkio.h"
18#include "apr_network_io.h"
19#include "apr_portable.h"
20#include "apr_general.h"
21#include "apr_lib.h"
22
23static int os2_socket_init(int, int ,int);
24
28int (*apr_os2_accept)(int, struct sockaddr *, int *) = NULL;
31int (*apr_os2_getpeername)(int, struct sockaddr *, int *) = NULL;
32int (*apr_os2_getsockname)(int, struct sockaddr *, int *) = NULL;
33int (*apr_os2_getsockopt)(int, int, int, char *, int *) = NULL;
36int (*apr_os2_recv)(int, char *, int, int) = NULL;
37int (*apr_os2_send)(int, const char *, int, int) = NULL;
42int (*apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int);
43int (*apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *);
44
46
47static int os2_fn_link()
48{
49 DosEnterCritSec(); /* Stop two threads doing this at the same time */
50
52 ULONG rc;
53 char errorstr[200];
54
55 rc = DosLoadModule(errorstr, sizeof(errorstr), "SO32DLL", &hSO32DLL);
56
57 if (rc)
58 return APR_OS2_STATUS(rc);
59
61
62 if (!rc)
64
65 if (!rc)
66 rc = DosQueryProcAddr(hSO32DLL, 0, "SOCK_ERRNO", &apr_os2_sock_errno);
67
68 if (!rc)
70
71 if (!rc)
73
74 if (!rc)
76
77 if (!rc)
78 rc = DosQueryProcAddr(hSO32DLL, 0, "GETPEERNAME", &apr_os2_getpeername);
79
80 if (!rc)
81 rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKNAME", &apr_os2_getsockname);
82
83 if (!rc)
84 rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKOPT", &apr_os2_getsockopt);
85
86 if (!rc)
88
89 if (!rc)
91
92 if (!rc)
94
95 if (!rc)
97
98 if (!rc)
99 rc = DosQueryProcAddr(hSO32DLL, 0, "SETSOCKOPT", &apr_os2_setsockopt);
100
101 if (!rc)
102 rc = DosQueryProcAddr(hSO32DLL, 0, "SHUTDOWN", &apr_os2_shutdown);
103
104 if (!rc)
105 rc = DosQueryProcAddr(hSO32DLL, 0, "SOCLOSE", &apr_os2_soclose);
106
107 if (!rc)
108 rc = DosQueryProcAddr(hSO32DLL, 0, "WRITEV", &apr_os2_writev);
109
110 if (!rc)
111 rc = DosQueryProcAddr(hSO32DLL, 0, "SENDTO", &apr_os2_sendto);
112
113 if (!rc)
114 rc = DosQueryProcAddr(hSO32DLL, 0, "RECVFROM", &apr_os2_recvfrom);
115
116 if (rc)
117 return APR_OS2_STATUS(rc);
118 }
119
121 return APR_SUCCESS;
122}
123
124
125
126static int os2_socket_init(int domain, int type, int protocol)
127{
128 int rc = os2_fn_link();
129 if (rc == APR_SUCCESS)
130 return apr_os2_socket(domain, type, protocol);
131 return rc;
132}
APR Miscellaneous library routines.
APR general purpose library routines.
APR Network library.
APR Portability Routines.
apr_redis_t * rc
Definition apr_redis.h:173
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int type
apr_sockaddr_t * sockaddr
int int int protocol
return NULL
Definition mod_so.c:359
int(* apr_os2_setsockopt)(int, int, int, char *, int)
Definition os2calls.c:38
int(* apr_os2_connect)(int, struct sockaddr *, int)
Definition os2calls.c:30
int(* apr_os2_getsockname)(int, struct sockaddr *, int *)
Definition os2calls.c:32
int(* apr_os2_socket)(int, int, int)
Definition os2calls.c:25
int(* apr_os2_bind)(int, struct sockaddr *, int)
Definition os2calls.c:29
static HMODULE hSO32DLL
Definition os2calls.c:45
static int os2_socket_init(int, int, int)
Definition os2calls.c:126
int(* apr_os2_sock_errno)()
Definition os2calls.c:27
int(* apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int)
Definition os2calls.c:42
int(* apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *)
Definition os2calls.c:43
int(* apr_os2_send)(int, const char *, int, int)
Definition os2calls.c:37
int(* apr_os2_ioctl)(int, int, caddr_t, int)
Definition os2calls.c:34
int(* apr_os2_accept)(int, struct sockaddr *, int *)
Definition os2calls.c:28
int(* apr_os2_getpeername)(int, struct sockaddr *, int *)
Definition os2calls.c:31
int(* apr_os2_getsockopt)(int, int, int, char *, int *)
Definition os2calls.c:33
int(* apr_os2_listen)(int, int)
Definition os2calls.c:35
int(* apr_os2_soclose)(int)
Definition os2calls.c:40
int(* apr_os2_shutdown)(int, int)
Definition os2calls.c:39
int(* apr_os2_writev)(int, struct iovec *, int)
Definition os2calls.c:41
static int os2_fn_link()
Definition os2calls.c:47
int(* apr_os2_recv)(int, char *, int, int)
Definition os2calls.c:36
int(* apr_os2_select)(int *, int, int, int, long)
Definition os2calls.c:26
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray