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