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