#ifndef __FENNIX_KERNEL_NETWORK_CONTROLLER_H__ #define __FENNIX_KERNEL_NETWORK_CONTROLLER_H__ #include #include #include #include #include #include namespace NetworkInterfaceManager { struct DeviceInterface { /** @brief Device interface name */ char Name[128]; /** @brief Device interface index */ uint64_t ID; /** @brief Device interface MAC address (Big-endian) */ MediaAccessControl MAC; /** @brief Device interface IP address (Big-endian) */ InternetProtocol4 IP; /** @brief Reserved */ void *DriverCallBackAddress; /** @brief Reserved */ unsigned int DriverID; }; class Events { protected: Events(DeviceInterface *Interface); ~Events(); public: virtual void OnInterfaceAdded(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); } virtual void OnInterfaceRemoved(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); } virtual void OnInterfaceChanged(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); } virtual void OnInterfaceReceived(DeviceInterface *Interface, uint8_t *Data, uint64_t Length) { netdbg("Event for %s not handled.", Interface->Name); } virtual void OnInterfaceSent(DeviceInterface *Interface, uint8_t *Data, uint64_t Length) { netdbg("Event for %s not handled.", Interface->Name); } }; class NetworkInterface { private: Memory::MemMgr *mem; int CardIDs = 0; Vector Interfaces; Tasking::PCB *NetSvcProcess; Tasking::TCB *NetSvcThread; void StopNetworkStack(); void FetchNetworkCards(unsigned long DriverUID); public: NetworkInterface(); ~NetworkInterface(); void StartService(); void Send(DeviceInterface *Interface, uint8_t *Data, uint64_t Length); void Receive(DeviceInterface *Interface, uint8_t *Data, uint64_t Length); void DrvSend(unsigned int DriverID, unsigned char *Data, unsigned short Size); void DrvReceive(unsigned int DriverID, unsigned char *Data, unsigned short Size); void StartNetworkStack(); }; } #endif // !__FENNIX_KERNEL_NETWORK_CONTROLLER_H__