net.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _NET_H
  2. #define _NET_H
  3. #ifdef HAVE_CONFIG_H
  4. # include "config.h"
  5. #endif
  6. #include "types.h"
  7. #ifdef HAVE_OPENSSL_SSL_H
  8. # ifdef USE_SSL
  9. # include <openssl/ssl.h>
  10. # include <openssl/rand.h>
  11. # include <openssl/err.h>
  12. # undef HAVE_SSL
  13. # endif /* USE_SSL */
  14. /* #define HAVE_SSL 1 */
  15. #endif /* HAVE_OPENSSL_SSL_H */
  16. /*
  17. * Enable IPv6 debugging?
  18. */
  19. #define DEBUG_IPV6 1
  20. #define HAVE_IPV6 1
  21. /* IPv6 sanity checks. */
  22. #ifdef USE_IPV6
  23. # ifndef HAVE_IPV6
  24. # undef USE_IPV6
  25. # endif
  26. # ifndef HAVE_GETHOSTBYNAME2
  27. # ifndef HAVE_GETIPNODEBYNAME
  28. # undef USE_IPV6
  29. # endif
  30. # endif
  31. #endif
  32. #define SGRAB 2011 /* How much data to allow through sockets. */
  33. #define iptolong(a) (0xffffffff & \
  34. (long) (htonl((unsigned long) a)))
  35. #ifndef MAKING_MODS
  36. # define killsock(x) real_killsock((x),__FILE__,__LINE__)
  37. IP my_atoul(char *);
  38. #ifdef HAVE_SSL
  39. int ssl_cleanup();
  40. #endif /* HAVE_SSL */
  41. int ssl_link(int, int);
  42. char *myipstr(int);
  43. IP getmyip();
  44. void cache_my_ip();
  45. void neterror(char *);
  46. void setsock(int, int);
  47. int allocsock(int, int);
  48. #ifdef USE_IPV6
  49. int getsock(int, int);
  50. #else
  51. int getsock(int);
  52. #endif /* USE_IPV6 */
  53. int sockprotocol(int);
  54. int hostprotocol(char *);
  55. char *hostnamefromip(unsigned long);
  56. void dropssl(int);
  57. void real_killsock(int, const char *, int);
  58. int answer(int, char *, unsigned long *, unsigned short *, int);
  59. inline int open_listen(int *);
  60. inline int open_listen_by_af(int *, int);
  61. #ifdef USE_IPV6
  62. int open_address_listen(IP, int, int *);
  63. #else
  64. int open_address_listen(IP, int *);
  65. #endif /* USE_IPV6 */
  66. int open_telnet(char *, int);
  67. int open_telnet_dcc(int, char *, char *);
  68. int open_telnet_raw(int, char *, int);
  69. void tputs(int, char *, unsigned int);
  70. void dequeue_sockets();
  71. int sockgets(char *, int *);
  72. void tell_netdebug(int);
  73. int sanitycheck_dcc(char *, char *, char *, char *);
  74. void send_timesync(int);
  75. int hostsanitycheck_dcc(char *, char *, IP, char *, char *);
  76. char *iptostr(IP);
  77. int sock_has_data(int, int);
  78. int sockoptions(int sock, int operation, int sock_options);
  79. int flush_inbuf(int idx);
  80. #endif /* !MAKING_MODS */
  81. #endif /* !_NET_H */