1 /* $Id: testupnpdescgen.c,v 1.25 2011/05/18 22:22:23 nanard Exp $ */
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2011 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
13 #include <sys/types.h>
17 #include "upnpdescgen.h"
19 char uuidvalue
[] = "uuid:12345678-0000-0000-0000-00000000abcd";
20 char serialnumber
[] = "12345678";
21 char modelnumber
[] = "1";
22 char presentationurl
[] = "http://192.168.0.1:8080/";
23 /*char presentationurl[] = "";*/
25 char * use_ext_ip_addr
= NULL
;
26 const char * ext_if_name
= "eth0";
28 #ifdef ENABLE_6FC_SERVICE
29 int ipv6fc_firewall_enabled
= 1;
30 int ipv6fc_inbound_pinhole_allowed
= 1;
33 int getifaddr(const char * ifname
, char * buf
, int len
)
35 strncpy(buf
, "1.2.3.4", len
);
39 int upnp_get_portmapping_number_of_entries(void)
44 int get_wan_connection_status(const char * ifname
)
51 xml_pretty_print(const char * s
, int len
, FILE * f
)
64 if(len
>0 && *s
== '/')
66 else if(len
>0 && *s
== '?')
75 for(i
=indent
; i
>0; i
--)
85 /*fputc('\n', f); n++; */
90 else if(elt_close
== 0)
94 /* remove existing LF */
104 const char * str1
= "Prefix123String";
105 const char * str2
= "123String";
107 void stupid_test(void)
109 printf("str1:'%s' str2:'%s'\n", str1
, str2
);
110 printf("str1:%p str2:%p str2-str1:%ld\n", str1
, str2
, (long)(str2
-str1
));
116 main(int argc
, char * * argv
)
124 if(mkdir("testdescs", 0777) < 0) {
125 if(errno
!= EEXIST
) {
129 printf("Root Description :\n");
130 rootDesc
= genRootDesc(&rootDescLen
);
131 xml_pretty_print(rootDesc
, rootDescLen
, stdout
);
132 f
= fopen("testdescs/rootdesc.xml", "w");
134 xml_pretty_print(rootDesc
, rootDescLen
, f
);
138 printf("\n-------------\n");
139 printf("WANIPConnection Description :\n");
141 xml_pretty_print(s
, l
, stdout
);
142 f
= fopen("testdescs/wanipc_scpd.xml", "w");
144 xml_pretty_print(s
, l
, f
);
148 printf("\n-------------\n");
149 printf("WANConfig Description :\n");
151 xml_pretty_print(s
, l
, stdout
);
152 f
= fopen("testdescs/wanconfig_scpd.xml", "w");
154 xml_pretty_print(s
, l
, f
);
158 printf("\n-------------\n");
159 #ifdef ENABLE_L3F_SERVICE
160 printf("Layer3Forwarding service :\n");
162 xml_pretty_print(s
, l
, stdout
);
163 f
= fopen("testdescs/l3f_scpd.xml", "w");
165 xml_pretty_print(s
, l
, f
);
169 printf("\n-------------\n");
171 #ifdef ENABLE_6FC_SERVICE
172 printf("WANIPv6FirewallControl service :\n");
174 xml_pretty_print(s
, l
, stdout
);
175 f
= fopen("testdescs/wanipv6fc_scpd.xml", "w");
177 xml_pretty_print(s
, l
, f
);
181 printf("\n-------------\n");
183 #ifdef ENABLE_DP_SERVICE
184 printf("DeviceProtection service :\n");
186 xml_pretty_print(s
, l
, stdout
);
187 f
= fopen("testdescs/dp_scpd.xml", "w");
189 xml_pretty_print(s
, l
, f
);
193 printf("\n-------------\n");
196 s
= getVarsWANIPCn(&l
);
197 xml_pretty_print(s
, l
, stdout
);
199 printf("\n-------------\n");
200 s
= getVarsWANCfg(&l
);
201 xml_pretty_print(s
, l
, stdout
);
203 printf("\n-------------\n");
204 #ifdef ENABLE_L3F_SERVICE
206 xml_pretty_print(s
, l
, stdout
);
208 printf("\n-------------\n");
209 #ifdef ENABLE_6FC_SERVICE
211 xml_pretty_print(s
, l
, stdout
);
213 printf("\n-------------\n");
215 #ifdef ENABLE_DP_SERVICE
217 xml_pretty_print(s
, l
, stdout
);
219 printf("\n-------------\n");