diff options
author | dreid <dreid@13f79535-47bb-0310-9956-ffa450edef68> | 2001-01-02 01:38:23 +0000 |
---|---|---|
committer | dreid <dreid@13f79535-47bb-0310-9956-ffa450edef68> | 2001-01-02 01:38:23 +0000 |
commit | 6eb54b95f709598bf9c6084b041728e76aed2ac3 (patch) | |
tree | 517a22c0898066bc0f76b023178584b2f0ae3563 /network_io | |
parent | 75357f27197f4a59c6412064761c709492a41312 (diff) | |
download | libapr-6eb54b95f709598bf9c6084b041728e76aed2ac3.tar.gz |
Remove some old files that we no longer use. Should have been done a while
back really. Spring cleaning time again!
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61003 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/beos/sockaddr.c | 78 | ||||
-rw-r--r-- | network_io/beos/sockets.c | 228 | ||||
-rw-r--r-- | network_io/beos/sockopt.c | 184 |
3 files changed, 0 insertions, 490 deletions
diff --git a/network_io/beos/sockaddr.c b/network_io/beos/sockaddr.c deleted file mode 100644 index bd61f574a..000000000 --- a/network_io/beos/sockaddr.c +++ /dev/null @@ -1,78 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "apr_private.h" -#if BEOS_BONE /* BONE uses the unix code - woohoo */ -#include "../unix/sockaddr.c" -#else -#include "networkio.h" - -static apr_status_t get_local_addr(apr_socket_t *sock) -{ - apr_socklen_t namelen = sizeof(*sock->local_addr); - - if (getsockname(sock->socketdes, (struct sockaddr *)sock->local_addr, - &namelen) < 0) { - return errno; - } - else { - sock->local_port_unknown = sock->local_interface_unknown = 0; - return APR_SUCCESS; - } -} - -/* Include this here so we already have get_local_addr... */ -#include "../unix/sa_common.c" - -#endif diff --git a/network_io/beos/sockets.c b/network_io/beos/sockets.c deleted file mode 100644 index a168e7a39..000000000 --- a/network_io/beos/sockets.c +++ /dev/null @@ -1,228 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "apr_private.h" -#if BEOS_BONE /* BONE uses the unix code - woohoo */ -#include "../unix/sockets.c" -#else -#include "networkio.h" - -apr_status_t socket_cleanup(void *sock) -{ - apr_socket_t *thesocket = sock; - if (closesocket(thesocket->socketdes) == 0) { - thesocket->socketdes = -1; - return APR_SUCCESS; - } - else { - return errno; - } -} - -apr_status_t apr_create_tcp_socket(apr_socket_t **new, apr_pool_t *cont) -{ - (*new) = (apr_socket_t *)apr_palloc(cont,sizeof(apr_socket_t)); - - if ((*new) == NULL){ - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->local_addr = (struct sockaddr_in *) apr_palloc((*new)->cntxt, - sizeof (struct sockaddr_in)); - (*new)->remote_addr = (struct sockaddr_in *) apr_palloc((*new)->cntxt, - sizeof (struct sockaddr_in)); - if ((*new)->local_addr == NULL || (*new)->remote_addr==NULL){ - return APR_ENOMEM; - } - - (*new)->socketdes = socket(AF_INET ,SOCK_STREAM, 0); - (*new)->local_addr->sin_family = AF_INET; - (*new)->remote_addr->sin_family = AF_INET; - (*new)->addr_len = sizeof(*(*new)->local_addr); - memset(&(*new)->local_addr->sin_zero, 0, sizeof((*new)->local_addr->sin_zero)); - memset(&(*new)->remote_addr->sin_zero, 0, sizeof((*new)->remote_addr->sin_zero)); - - if ((*new)->socketdes < 0) { - return errno; - } - - (*new)->timeout = -1; - apr_register_cleanup((*new)->cntxt, (void *)(*new), - socket_cleanup, apr_null_cleanup); - return APR_SUCCESS; -} - -apr_status_t apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) -{ - return shutdown(thesocket->socketdes, how); -} - -apr_status_t apr_close_socket(apr_socket_t *thesocket) -{ - apr_kill_cleanup(thesocket->cntxt,thesocket,socket_cleanup); - return socket_cleanup(thesocket); -} - -apr_status_t apr_bind(apr_socket_t *sock) -{ - if (bind(sock->socketdes, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) - return errno; - else - return APR_SUCCESS; -} - -apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) -{ - if (listen(sock->socketdes, backlog) == -1) - return errno; - else - return APR_SUCCESS; -} - -apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) -{ - (*new) = (apr_socket_t *)apr_palloc(connection_context, - sizeof(apr_socket_t)); - - (*new)->cntxt = connection_context; - (*new)->local_addr = (struct sockaddr_in *)apr_palloc((*new)->cntxt, - sizeof(struct sockaddr_in)); - - (*new)->remote_addr = (struct sockaddr_in *)apr_palloc((*new)->cntxt, - sizeof(struct sockaddr_in)); - (*new)->addr_len = sizeof(struct sockaddr_in); - (*new)->connected = 1; - - (*new)->socketdes = accept(sock->socketdes, (struct sockaddr *)(*new)->remote_addr, - &(*new)->addr_len); - - if (getsockname((*new)->socketdes, (struct sockaddr *)(*new)->local_addr, - &((*new)->addr_len)) < 0) { - return errno; - } - if ((*new)->socketdes <0){ - return errno; - } - - apr_register_cleanup((*new)->cntxt, (void *)new, - socket_cleanup, apr_null_cleanup); - return APR_SUCCESS; -} - -apr_status_t apr_connect(apr_socket_t *sock, const char *hostname) -{ - struct hostent *hp; - - if ((sock->socketdes < 0) || (!sock->remote_addr)) { - return APR_ENOTSOCK; - } - - if (hostname != NULL){ - hp = gethostbyname(hostname); - if (!hp) - return (h_errno + APR_OS_START_SYSERR); - - memcpy((char *)&sock->remote_addr->sin_addr, hp->h_addr , hp->h_length); - } - - sock->remote_addr->sin_family = AF_INET; - - memset(sock->remote_addr->sin_zero, 0, sizeof(sock->remote_addr->sin_zero)); - - sock->addr_len = sizeof(sock->remote_addr); - - if ((connect(sock->socketdes, (const struct sockaddr *)sock->remote_addr, sock->addr_len) < 0) - && (errno != EINPROGRESS)) { - return errno; - } else { - int namelen = sizeof(*sock->local_addr); - getsockname(sock->socketdes, (struct sockaddr *)sock->local_addr, &namelen); - sock->connected = 1; - } - - return APR_SUCCESS; -} - -apr_status_t apr_get_socketdata(void **data, const char *key, apr_socket_t *sock) -{ - return apr_get_userdata(data, key, sock->cntxt); -} - -apr_status_t apr_set_socketdata(apr_socket_t *sock, void *data, const char *key, - apr_status_t (*cleanup) (void *)) -{ - return apr_set_userdata(data, key, cleanup, sock->cntxt); -} - -apr_status_t apr_get_os_sock(apr_os_sock_t *thesock, apr_socket_t *sock) -{ - *thesock = sock->socketdes; - return APR_SUCCESS; -} - -apr_status_t apr_put_os_sock(apr_socket_t **sock, apr_os_sock_t *thesock, - apr_pool_t *cont) -{ - if (cont == NULL) { - return APR_ENOPOOL; - } - if ((*sock) == NULL) { - (*sock) = (apr_socket_t *)apr_palloc(cont, sizeof(apr_socket_t)); - (*sock)->cntxt = cont; - } - (*sock)->socketdes = *thesock; - return APR_SUCCESS; -} -#endif /* BEOS_BONE */ diff --git a/network_io/beos/sockopt.c b/network_io/beos/sockopt.c deleted file mode 100644 index fe3086fd2..000000000 --- a/network_io/beos/sockopt.c +++ /dev/null @@ -1,184 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "apr_private.h" -#if BEOS_BONE /* BONE uses the unix code - woohoo */ -#include "../unix/sockopt.c" -#else -#include "networkio.h" - -static int setnonblocking(int on, int sock) -{ - return setsockopt(sock, SOL_SOCKET, SO_NONBLOCK, - &on, sizeof(on)); -} - -apr_status_t apr_setsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on) -{ - int one; - int rv; - if (on){ - one = 1; - }else { - one = 0; - } - if (opt & APR_SO_SNDBUF) - return APR_ENOTIMPL; - - if (opt & APR_SO_DEBUG) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) == -1) { - return errno; - } - } - if (opt & APR_SO_REUSEADDR) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) == -1) { - return errno; - } - } - if (opt & APR_SO_NONBLOCK) { - if ((rv = setnonblocking (one, sock->socketdes)) < 0) { - return errno; - } - } - if (opt & APR_SO_TIMEOUT) { - if (on > 0 && sock->timeout < 0) - /* we should be in non-blocking mode right now... */ - one = 1; - else if (on < 0 && sock->timeout >= 0) - /* they've set a timeout so we should be blocking... */ - one = 0; - else if (on == 0) - /* we need to be in nonblocking or this will hang the server */ - one = 1; - - if ((rv = setnonblocking (one, sock->socketdes)) < 0) - return rv; - - sock->timeout = on; - } - if (opt & APR_TCP_NODELAY) { - /* BeOS pre-BONE has TCP_NODELAY set to ON by default. - * This is a hang over from a long time ago and until BONE there - * is no way to turn it off. Use this information as follows... - * - * on == 0 - return APR_ENOTIMPL - * on == 1 - allow it to return APR_SUCCESS - * - * based on information from Howard Berkey (howard@be.com) - */ - if (! on) - return APR_ENOTIMPL; - } - return APR_SUCCESS; -} - -apr_status_t apr_getsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on) -{ - switch(opt) { - case APR_SO_TIMEOUT: - *on = sock->timeout; - break; - default: - return APR_EINVAL; - } - return APR_SUCCESS; -} - -apr_status_t apr_gethostname(char * buf, int len, apr_pool_t *cont) -{ - if (gethostname(buf, len) == -1){ - return errno; - } else { - return APR_SUCCESS; - } -} - -apr_status_t apr_get_local_hostname(char **name, apr_socket_t *sock) -{ - struct hostent *hptr; - - hptr = gethostbyaddr((char *)&(sock->local_addr->sin_addr), - sizeof(struct in_addr), AF_INET); - if (hptr != NULL) { - *name = apr_pstrdup(sock->cntxt, hptr->h_name); - if (*name) { - return APR_SUCCESS; - } - return APR_ENOMEM; - } - - /* XXX - Is this threadsafe? - manoj */ - /* on BeOS h_errno is a global... */ - return h_errno; -} - -apr_status_t apr_get_remote_hostname(char **name, apr_socket_t *sock) -{ - struct hostent *hptr; - - hptr = gethostbyaddr((char *)&(sock->remote_addr->sin_addr), - sizeof(struct in_addr), AF_INET); - if (hptr != NULL) { - *name = apr_pstrdup(sock->cntxt, hptr->h_name); - if (*name) { - return APR_SUCCESS; - } - return APR_ENOMEM; - } - - /* XXX - Is this threadsafe? - manoj */ - /* on BeOS h_errno is a global... */ - return h_errno; -} -#endif |