|
version 1.1.1.2, 2012/05/29 12:55:57
|
version 1.1.1.3, 2013/07/22 00:32:35
|
|
Line 1
|
Line 1
|
| /* $Id$ */ |
/* $Id$ */ |
| /* MiniUPnP project |
/* MiniUPnP project |
| * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
| * (c) 2006-2011 Thomas Bernard | * (c) 2006-2012 Thomas Bernard |
| * This software is subject to the conditions detailed |
* This software is subject to the conditions detailed |
| * in the LICENCE file provided within the distribution */ |
* in the LICENCE file provided within the distribution */ |
| |
|
|
Line 16
|
Line 16
|
| /*int logpackets = 1;*/ |
/*int logpackets = 1;*/ |
| int runtime_flags = 0; |
int runtime_flags = 0; |
| const char * tag = 0; |
const char * tag = 0; |
| |
const char * anchor_name = "miniupnpd"; |
| |
|
| void |
void |
| list_rules(void); |
list_rules(void); |
|
Line 70 main(int arc, char * * argv)
|
Line 71 main(int arc, char * * argv)
|
| { |
{ |
| char buf[32]; |
char buf[32]; |
| char desc[64]; |
char desc[64]; |
| |
char rhost[64]; |
| /*char rhost[32];*/ |
/*char rhost[32];*/ |
| unsigned short iport; |
unsigned short iport; |
| unsigned int timestamp; |
unsigned int timestamp; |
|
Line 82 main(int arc, char * * argv)
|
Line 84 main(int arc, char * * argv)
|
| fprintf(stderr, "init_redirect() failed\n"); |
fprintf(stderr, "init_redirect() failed\n"); |
| return 1; |
return 1; |
| } |
} |
| //add_redirect_rule("ep0", 12123, "192.168.1.23", 1234); | #if 0 |
| //add_redirect_rule2("ep0", 12155, "192.168.1.155", 1255, IPPROTO_TCP); | add_redirect_rule("ep0", 12123, "192.168.1.23", 1234); |
| | add_redirect_rule2("ep0", 12155, "192.168.1.155", 1255, IPPROTO_TCP); |
| | #endif |
| add_redirect_rule2("ep0", "8.8.8.8", 12123, "192.168.1.125", 1234, |
add_redirect_rule2("ep0", "8.8.8.8", 12123, "192.168.1.125", 1234, |
| IPPROTO_UDP, "test description", 0); |
IPPROTO_UDP, "test description", 0); |
| //add_redirect_rule2("em0", 12123, "127.1.2.3", 1234, | #if 0 |
| // IPPROTO_TCP, "test description tcp"); | add_redirect_rule2("em0", 12123, "127.1.2.3", 1234, |
| | IPPROTO_TCP, "test description tcp"); |
| | #endif |
| |
|
| list_rules(); |
list_rules(); |
| list_eports_tcp(); |
list_eports_tcp(); |
| |
|
| |
|
| |
|
| if(get_redirect_rule("xl1", 4662, IPPROTO_TCP, |
if(get_redirect_rule("xl1", 4662, IPPROTO_TCP, |
| buf, sizeof(buf), &iport, desc, sizeof(desc), |
buf, sizeof(buf), &iport, desc, sizeof(desc), |
| |
rhost, sizeof(rhost), |
| ×tamp, |
×tamp, |
| &packets, &bytes) < 0) |
&packets, &bytes) < 0) |
| printf("get_redirect_rule() failed\n"); |
printf("get_redirect_rule() failed\n"); |
|
Line 103 main(int arc, char * * argv)
|
Line 110 main(int arc, char * * argv)
|
| printf("\n%s:%d '%s' packets=%llu bytes=%llu\n", buf, (int)iport, desc, |
printf("\n%s:%d '%s' packets=%llu bytes=%llu\n", buf, (int)iport, desc, |
| packets, bytes); |
packets, bytes); |
| } |
} |
| #if 0 | |
| if(delete_redirect_rule("ep0", 12123, IPPROTO_UDP) < 0) |
if(delete_redirect_rule("ep0", 12123, IPPROTO_UDP) < 0) |
| printf("delete_redirect_rule() failed\n"); |
printf("delete_redirect_rule() failed\n"); |
| else |
else |
|
Line 113 main(int arc, char * * argv)
|
Line 120 main(int arc, char * * argv)
|
| printf("delete_redirect_rule() failed\n"); |
printf("delete_redirect_rule() failed\n"); |
| else |
else |
| printf("delete_redirect_rule() succeded\n"); |
printf("delete_redirect_rule() succeded\n"); |
| #endif |
|
| //test_index(); |
|
| |
|
| //clear_redirect_rules(); | #if 0 |
| //list_rules(); | test_index(); |
| | |
| | clear_redirect_rules(); |
| | list_rules(); |
| | #endif |
| |
|
| return 0; |
return 0; |
| } |
} |