line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
2
|
|
|
|
|
|
|
#include "perl.h" |
3
|
|
|
|
|
|
|
#include "XSUB.h" |
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
#include "ip-tools.h" |
6
|
|
|
|
|
|
|
#include "block-china-data.h" |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
MODULE=IP::China PACKAGE=IP::China |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
PROTOTYPES: ENABLE |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
int |
13
|
|
|
|
|
|
|
chinese_ip (char * ip) |
14
|
|
|
|
|
|
|
CODE: |
15
|
|
|
|
|
|
|
unsigned long ipAddr; |
16
|
|
|
|
|
|
|
int found; |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
|
|
|
ipAddr = ip_tools_ip_to_int (ip); |
19
|
11
|
|
|
|
|
|
found = ip_tools_ip_range (china_ips, n_china_ips, ipAddr); |
20
|
11
|
100
|
|
|
|
|
if (found != NOTFOUND) { |
21
|
5
|
|
|
|
|
|
RETVAL = -1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
6
|
|
|
|
|
|
RETVAL = 0; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
OUTPUT: |
27
|
|
|
|
|
|
|
RETVAL |