summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/interface/nethandler.h
blob: 9513b158d997421ed8ffee631ca2717edaeb2161 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/***************************************************************************

    nethandler.h

    OSD interface to virtual networking handlers

***************************************************************************/
#ifndef MAME_OSD_INTERFACE_NETHANDLER_H
#define MAME_OSD_INTERFACE_NETHANDLER_H

#pragma once

#include "osdcomm.h"

#include <array>
#include <string_view>


namespace osd {

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************


// base for virtual network interface handler

class network_handler
{
public:
	network_handler() noexcept;

	virtual void recv_cb(u8 *buf, int len) = 0;

	std::array<u8, 6> const &get_mac() noexcept { return m_mac; }

protected:
	~network_handler() = default;

	std::array<u8, 6> m_mac;
};


// interface to network device

class network_device
{
public:
	virtual ~network_device() = default;

	virtual void start() = 0;
	virtual void stop() = 0;
	virtual void poll() = 0;
	virtual int send(const void *buf, int len) = 0;
};


// description of an available network device

struct network_device_info
{
	int id;
	std::string_view description;
};

} // namespace osd

#endif // MAME_OSD_INTERFACE_NETHANDLER_H