Changeset 3933
- Timestamp:
- Nov 18, 2009, 2:23:58 PM (11 years ago)
- Location:
- zzuf/trunk
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/msvc/config.h
r2562 r3933 17 17 */ 18 18 19 #define VERSION "0.7 (msvc)"19 #define PACKAGE_VERSION "0.7 (msvc)" 20 20 #define SONAME "libzzuf.dll" 21 22 #define ATTRIBUTE_PRINTF(x,y) 21 23 22 24 #define HAVE_WINDOWS_H 1 -
zzuf/trunk/src/network.c
r3635 r3933 27 27 #include <stdlib.h> 28 28 #include <string.h> 29 #include <sys/socket.h> 30 #include <netinet/in.h> 31 #include <arpa/inet.h> 29 #if defined HAVE_SYS_SOCKET_H 30 # include <sys/socket.h> 31 # include <netinet/in.h> 32 # include <arpa/inet.h> 33 #endif 32 34 33 35 #include "libzzuf.h" … … 36 38 #include "network.h" 37 39 40 #if defined HAVE_SYS_SOCKET_H 38 41 static unsigned int get_socket_ip(int); 39 42 static int host_in_list(unsigned int, unsigned int const *); … … 49 52 static int *ports = NULL; 50 53 static int static_ports[512]; 54 #endif 51 55 52 56 void _zz_network_init(void) … … 57 61 void _zz_network_fini(void) 58 62 { 63 #if defined HAVE_SYS_SOCKET_H 59 64 if(ports != static_ports) 60 65 free(ports); … … 63 68 if(deny != static_deny) 64 69 free(deny); 70 #endif 65 71 } 66 72 67 73 void _zz_allow(char const *allowlist) 68 74 { 75 #if defined HAVE_SYS_SOCKET_H 69 76 allow = create_host_list(allowlist, static_allow); 77 #endif 70 78 } 71 79 72 80 void _zz_deny(char const *denylist) 73 81 { 82 #if defined HAVE_SYS_SOCKET_H 74 83 deny = create_host_list(denylist, static_deny); 84 #endif 75 85 } 76 86 77 87 void _zz_ports(char const *portlist) 78 88 { 89 #if defined HAVE_SYS_SOCKET_H 79 90 ports = _zz_allocrange(portlist, static_ports); 91 #endif 80 92 } 81 93 82 94 int _zz_portwatched(int port) 83 95 { 96 #if defined HAVE_SYS_SOCKET_H 84 97 if(!ports) 85 98 return 1; 86 99 87 100 return _zz_isinrange(port, ports); 101 #else 102 return 0; 103 #endif 88 104 } 89 105 90 106 int _zz_hostwatched(int sock) 91 107 { 108 #if defined HAVE_SYS_SOCKET_H 92 109 int watch = 1; 93 110 unsigned int ip; … … 104 121 105 122 return watch; 123 #else 124 return 0; 125 #endif 106 126 } 107 127 108 128 /* XXX: the following functions are local */ 109 129 130 #if defined HAVE_SYS_SOCKET_H 110 131 static unsigned int *create_host_list(char const *list, 111 132 unsigned int *static_list) … … 193 214 return sin.sin_addr.s_addr; 194 215 } 195 216 #endif /* HAVE_SYS_SOCKET_H */
Note: See TracChangeset
for help on using the changeset viewer.