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