fspr_arch_networkio.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef NETWORK_IO_H
  17. #define NETWORK_IO_H
  18. #include "fspr_private.h"
  19. #include "fspr_network_io.h"
  20. #include "fspr_general.h"
  21. #include "fspr_arch_os2calls.h"
  22. #include "fspr_poll.h"
  23. #if APR_HAVE_NETDB_H
  24. #include <netdb.h>
  25. #endif
  26. typedef struct sock_userdata_t sock_userdata_t;
  27. struct sock_userdata_t {
  28. sock_userdata_t *next;
  29. const char *key;
  30. void *data;
  31. };
  32. struct fspr_socket_t {
  33. fspr_pool_t *pool;
  34. int socketdes;
  35. int type;
  36. int protocol;
  37. fspr_sockaddr_t *local_addr;
  38. fspr_sockaddr_t *remote_addr;
  39. fspr_interval_time_t timeout;
  40. int nonblock;
  41. int local_port_unknown;
  42. int local_interface_unknown;
  43. int remote_addr_unknown;
  44. fspr_int32_t options;
  45. fspr_int32_t inherit;
  46. sock_userdata_t *userdata;
  47. /* if there is a timeout set, then this pollset is used */
  48. fspr_pollset_t *pollset;
  49. };
  50. /* Error codes returned from sock_errno() */
  51. #define SOCBASEERR 10000
  52. #define SOCEPERM (SOCBASEERR+1) /* Not owner */
  53. #define SOCESRCH (SOCBASEERR+3) /* No such process */
  54. #define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */
  55. #define SOCENXIO (SOCBASEERR+6) /* No such device or address */
  56. #define SOCEBADF (SOCBASEERR+9) /* Bad file number */
  57. #define SOCEACCES (SOCBASEERR+13) /* Permission denied */
  58. #define SOCEFAULT (SOCBASEERR+14) /* Bad address */
  59. #define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */
  60. #define SOCEMFILE (SOCBASEERR+24) /* Too many open files */
  61. #define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */
  62. #define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */
  63. const char *fspr_inet_ntop(int af, const void *src, char *dst, fspr_size_t size);
  64. int fspr_inet_pton(int af, const char *src, void *dst);
  65. void fspr_sockaddr_vars_set(fspr_sockaddr_t *, int, fspr_port_t);
  66. #endif /* ! NETWORK_IO_H */