GME  13
apr_arch_networkio.h
Go to the documentation of this file.
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_private.h"
00021 #include "apr_network_io.h"
00022 #include "apr_general.h"
00023 #include "apr_arch_os2calls.h"
00024 #include "apr_poll.h"
00025 
00026 #if APR_HAVE_NETDB_H
00027 #include <netdb.h>
00028 #endif
00029 
00030 typedef struct sock_userdata_t sock_userdata_t;
00031 struct sock_userdata_t {
00032     sock_userdata_t *next;
00033     const char *key;
00034     void *data;
00035 };
00036 
00037 struct apr_socket_t {
00038     apr_pool_t *pool;
00039     int socketdes;
00040     int type;
00041     int protocol;
00042     apr_sockaddr_t *local_addr;
00043     apr_sockaddr_t *remote_addr;
00044     apr_interval_time_t timeout;
00045     int nonblock;
00046     int local_port_unknown;
00047     int local_interface_unknown;
00048     int remote_addr_unknown;
00049     apr_int32_t options;
00050     apr_int32_t inherit;
00051     sock_userdata_t *userdata;
00052 
00053     /* if there is a timeout set, then this pollset is used */
00054     apr_pollset_t *pollset;
00055 };
00056 
00057 /* Error codes returned from sock_errno() */
00058 #define SOCBASEERR              10000
00059 #define SOCEPERM                (SOCBASEERR+1)             /* Not owner */
00060 #define SOCESRCH                (SOCBASEERR+3)             /* No such process */
00061 #define SOCEINTR                (SOCBASEERR+4)             /* Interrupted system call */
00062 #define SOCENXIO                (SOCBASEERR+6)             /* No such device or address */
00063 #define SOCEBADF                (SOCBASEERR+9)             /* Bad file number */
00064 #define SOCEACCES               (SOCBASEERR+13)            /* Permission denied */
00065 #define SOCEFAULT               (SOCBASEERR+14)            /* Bad address */
00066 #define SOCEINVAL               (SOCBASEERR+22)            /* Invalid argument */
00067 #define SOCEMFILE               (SOCBASEERR+24)            /* Too many open files */
00068 #define SOCEPIPE                (SOCBASEERR+32)            /* Broken pipe */
00069 #define SOCEOS2ERR              (SOCBASEERR+100)            /* OS/2 Error */
00070 
00071 const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
00072 int apr_inet_pton(int af, const char *src, void *dst);
00073 void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
00074 
00075 #endif  /* ! NETWORK_IO_H */
00076