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