xref: /haiku/src/system/boot/loader/net/NetDefs.cpp (revision b7e825d6e742817cd52eca03f6f1897452fa68e7)
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 const char *const kTCPServiceName = "tcp";
20 
21 
22 // constructor
NetService(const char * name)23 NetService::NetService(const char *name)
24 	: fName(name)
25 {
26 }
27 
28 // destructor
~NetService()29 NetService::~NetService()
30 {
31 }
32 
33 // NetServiceName
34 const char *
NetServiceName()35 NetService::NetServiceName()
36 {
37 	return fName;
38 }
39 
40 // CountSubNetServices
41 int
CountSubNetServices() const42 NetService::CountSubNetServices() const
43 {
44 	return 0;
45 }
46 
47 // SubNetServiceAt
48 NetService *
SubNetServiceAt(int index) const49 NetService::SubNetServiceAt(int index) const
50 {
51 	return NULL;
52 }
53 
54 // FindSubNetService
55 NetService *
FindSubNetService(const char * name) const56 NetService::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