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#include <boot/net/NetDefs.h> 7 8#include <stdio.h> 9 10const mac_addr_t kBroadcastMACAddress( 11 (uint8[6]){0xff, 0xff, 0xff, 0xff, 0xff, 0xff}); 12const mac_addr_t kNoMACAddress((uint8[6]){0, 0, 0, 0, 0, 0}); 13 14// net service names 15const char *const kEthernetServiceName = "ethernet"; 16const char *const kARPServiceName = "arp"; 17const char *const kIPServiceName = "ip"; 18const char *const kUDPServiceName = "udp"; 19const char *const kTCPServiceName = "tcp"; 20 21 22// constructor 23NetService::NetService(const char *name) 24 : fName(name) 25{ 26} 27 28// destructor 29NetService::~NetService() 30{ 31} 32 33// NetServiceName 34const char * 35NetService::NetServiceName() 36{ 37 return fName; 38} 39 40// CountSubNetServices 41int 42NetService::CountSubNetServices() const 43{ 44 return 0; 45} 46 47// SubNetServiceAt 48NetService * 49NetService::SubNetServiceAt(int index) const 50{ 51 return NULL; 52} 53 54// FindSubNetService 55NetService * 56NetService::FindSubNetService(const char *name) const 57{ 58 int count = CountSubNetServices(); 59 for (int i = 0; i < count; i++) { 60 NetService *service = SubNetServiceAt(i); 61 if (strcmp(service->NetServiceName(), name) == 0) 62 return service; 63 } 64 65 return NULL; 66} 67