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 static status_t ShutDown(); 30 31 status_t AddEthernetInterface(EthernetInterface *interface); 32 GetEthernetInterface()33 EthernetInterface *GetEthernetInterface() const 34 { return fEthernetInterface; } GetEthernetService()35 EthernetService *GetEthernetService() const { return fEthernetService; } GetARPService()36 ARPService *GetARPService() const { return fARPService; } GetIPService()37 IPService *GetIPService() const { return fIPService; } GetUDPService()38 UDPService *GetUDPService() const { return fUDPService; } GetTCPService()39 TCPService *GetTCPService() const { return fTCPService; } 40 41 private: 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. 55 status_t net_stack_init(); 56 status_t platform_net_stack_init(); 57 status_t net_stack_cleanup(); 58 59 60 #endif // _BOOT_NET_STACK_H 61