xref: /haiku/src/tests/add-ons/kernel/network/net_stack_tester.cpp (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1*51978af1SPhilippe Houdoin /* Network modules debug platform
2*51978af1SPhilippe Houdoin */
3*51978af1SPhilippe Houdoin 
4*51978af1SPhilippe Houdoin #include <stdio.h>
5*51978af1SPhilippe Houdoin #include <string.h>
6*51978af1SPhilippe Houdoin #include <stdlib.h>
7*51978af1SPhilippe Houdoin 
8*51978af1SPhilippe Houdoin #include <app/Application.h>
9*51978af1SPhilippe Houdoin #include <drivers/module.h>
10*51978af1SPhilippe Houdoin 
11*51978af1SPhilippe Houdoin #include <core_module.h>
12*51978af1SPhilippe Houdoin #include <userland_ipc.h>
13*51978af1SPhilippe Houdoin 
14*51978af1SPhilippe Houdoin struct core_module_info * core = NULL;
15*51978af1SPhilippe Houdoin 
main(int argc,char ** argv)16*51978af1SPhilippe Houdoin int main(int argc, char **argv)
17*51978af1SPhilippe Houdoin {
18*51978af1SPhilippe Houdoin 	char buffer[8];
19*51978af1SPhilippe Houdoin 	int ret = -1;
20*51978af1SPhilippe Houdoin 
21*51978af1SPhilippe Houdoin 	new BApplication("application/x-vnd-OBOS-net_server");
22*51978af1SPhilippe Houdoin 
23*51978af1SPhilippe Houdoin 	if (init_userland_ipc() < B_OK)
24*51978af1SPhilippe Houdoin 		goto exit;
25*51978af1SPhilippe Houdoin 
26*51978af1SPhilippe Houdoin 	if (get_module(NET_CORE_MODULE_NAME, (module_info **) &core) != B_OK) {
27*51978af1SPhilippe Houdoin 		shutdown_userland_ipc();
28*51978af1SPhilippe Houdoin 		goto exit;
29*51978af1SPhilippe Houdoin 	}
30*51978af1SPhilippe Houdoin 
31*51978af1SPhilippe Houdoin 	puts("Starting core module...");
32*51978af1SPhilippe Houdoin 	core->start();
33*51978af1SPhilippe Houdoin 
34*51978af1SPhilippe Houdoin 	puts("Userland net stack (net_server) is running. Press <Return> to quit.");
35*51978af1SPhilippe Houdoin 	fgets(buffer,sizeof(buffer), stdin);
36*51978af1SPhilippe Houdoin 
37*51978af1SPhilippe Houdoin 	put_module(NET_CORE_MODULE_NAME);;
38*51978af1SPhilippe Houdoin 	shutdown_userland_ipc();
39*51978af1SPhilippe Houdoin 
40*51978af1SPhilippe Houdoin 	ret = 0;
41*51978af1SPhilippe Houdoin 
42*51978af1SPhilippe Houdoin exit:;
43*51978af1SPhilippe Houdoin 	delete be_app;
44*51978af1SPhilippe Houdoin 	return ret;
45*51978af1SPhilippe Houdoin }
46*51978af1SPhilippe Houdoin 
47