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
11class EthernetInterface;
12class EthernetService;
13class ARPService;
14class IPService;
15class UDPService;
16class TCPService;
17
18
19class NetStack {
20private:
21	NetStack();
22	~NetStack();
23
24	status_t Init();
25
26public:
27	static status_t CreateDefault();
28	static NetStack *Default();
29	static status_t ShutDown();
30
31	status_t AddEthernetInterface(EthernetInterface *interface);
32
33	EthernetInterface *GetEthernetInterface() const
34		{ return fEthernetInterface; }
35	EthernetService *GetEthernetService() const	{ return fEthernetService; }
36	ARPService *GetARPService() const			{ return fARPService; }
37	IPService *GetIPService() const				{ return fIPService; }
38	UDPService *GetUDPService() const			{ return fUDPService; }
39	TCPService *GetTCPService() const			{ return fTCPService; }
40
41private:
42	static NetStack		*sNetStack;
43
44	EthernetInterface	*fEthernetInterface;
45	EthernetService		*fEthernetService;
46	ARPService			*fARPService;
47	IPService			*fIPService;
48	UDPService			*fUDPService;
49	TCPService			*fTCPService;
50};
51
52
53// net_stack_init() creates the NetStack and calls platform_net_stack_init()
54// afterwards, which is supposed to add network interfaces.
55status_t net_stack_init();
56status_t platform_net_stack_init();
57status_t net_stack_cleanup();
58
59
60#endif	// _BOOT_NET_STACK_H
61