xref: /haiku/headers/private/kernel/boot/net/NetStack.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * Copyright 2005, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _BOOT_NET_STACK_H
7 #define _BOOT_NET_STACK_H
8 
9 #include <SupportDefs.h>
10 
11 class EthernetInterface;
12 class EthernetService;
13 class ARPService;
14 class IPService;
15 class UDPService;
16 
17 
18 class NetStack {
19 private:
20 	NetStack();
21 	~NetStack();
22 
23 	status_t Init();
24 
25 public:
26 	static status_t CreateDefault();
27 	static NetStack *Default();
28 
29 	status_t AddEthernetInterface(EthernetInterface *interface);
30 
31 	EthernetInterface *GetEthernetInterface() const
32 		{ return fEthernetInterface; }
33 	EthernetService *GetEthernetService() const	{ return fEthernetService; }
34 	ARPService *GetARPService() const			{ return fARPService; }
35 	IPService *GetIPService() const				{ return fIPService; }
36 	UDPService *GetUDPService() const			{ return fUDPService; }
37 
38 private:
39 	static NetStack		*sNetStack;
40 
41 	EthernetInterface	*fEthernetInterface;
42 	EthernetService		*fEthernetService;
43 	ARPService			*fARPService;
44 	IPService			*fIPService;
45 	UDPService			*fUDPService;
46 };
47 
48 
49 // net_stack_init() creates the NetStack and calls platform_net_stack_init()
50 // afterwards, which is supposed to add network interfaces.
51 status_t net_stack_init();
52 status_t platform_net_stack_init();
53 
54 
55 #endif	// _BOOT_NET_STACK_H
56