GME
13
|
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more 00002 * contributor license agreements. See the NOTICE file distributed with 00003 * this work for additional information regarding copyright ownership. 00004 * The ASF licenses this file to You under the Apache License, Version 2.0 00005 * (the "License"); you may not use this file except in compliance with 00006 * the License. You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef NETWORK_IO_H 00018 #define NETWORK_IO_H 00019 00020 #include "apr_network_io.h" 00021 #include "apr_general.h" 00022 #include "apr_poll.h" 00023 00024 typedef struct sock_userdata_t sock_userdata_t; 00025 struct sock_userdata_t { 00026 sock_userdata_t *next; 00027 const char *key; 00028 void *data; 00029 }; 00030 00031 struct apr_socket_t { 00032 apr_pool_t *pool; 00033 SOCKET socketdes; 00034 int type; /* SOCK_STREAM, SOCK_DGRAM */ 00035 int protocol; 00036 apr_sockaddr_t *local_addr; 00037 apr_sockaddr_t *remote_addr; 00038 int timeout_ms; /* MUST MATCH if timeout > 0 */ 00039 apr_interval_time_t timeout; 00040 apr_int32_t disconnected; 00041 int local_port_unknown; 00042 int local_interface_unknown; 00043 int remote_addr_unknown; 00044 apr_int32_t options; 00045 apr_int32_t inherit; 00046 #if APR_HAS_SENDFILE 00047 /* As of 07.20.04, the overlapped structure is only used by 00048 * apr_socket_sendfile and that's where it will be allocated 00049 * and initialized. 00050 */ 00051 OVERLAPPED *overlapped; 00052 #endif 00053 sock_userdata_t *userdata; 00054 00055 /* if there is a timeout set, then this pollset is used */ 00056 apr_pollset_t *pollset; 00057 }; 00058 00059 #ifdef _WIN32_WCE 00060 #ifndef WSABUF 00061 typedef struct _WSABUF { 00062 u_long len; /* the length of the buffer */ 00063 char FAR * buf; /* the pointer to the buffer */ 00064 } WSABUF, FAR * LPWSABUF; 00065 #endif 00066 #else 00067 #ifdef _MSC_VER 00068 #define HAVE_STRUCT_IPMREQ 00069 #endif 00070 #endif 00071 00072 apr_status_t status_from_res_error(int); 00073 00074 const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size); 00075 int apr_inet_pton(int af, const char *src, void *dst); 00076 void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t); 00077 00078 #define apr_is_option_set(skt, option) \ 00079 (((skt)->options & (option)) == (option)) 00080 00081 #define apr_set_option(skt, option, on) \ 00082 do { \ 00083 if (on) \ 00084 (skt)->options |= (option); \ 00085 else \ 00086 (skt)->options &= ~(option); \ 00087 } while (0) 00088 00089 #endif /* ! NETWORK_IO_H */ 00090