diff options
author | 2015-11-08 12:56:12 +0100 | |
---|---|---|
committer | 2015-11-08 12:56:12 +0100 | |
commit | 7c19aac60e12d6f5ea301bdb34d7826a01e0b06f (patch) | |
tree | f310d86aa2c6bfc19d115307dedde4eb0cd52dad /src/emu/dinetwork.cpp | |
parent | a57b46ae933badd7441ce1644711dbb851e2b504 (diff) |
Rename *.c -> *.cpp in our source (nw)
Diffstat (limited to 'src/emu/dinetwork.cpp')
-rw-r--r-- | src/emu/dinetwork.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/emu/dinetwork.cpp b/src/emu/dinetwork.cpp new file mode 100644 index 00000000000..fc411c6529c --- /dev/null +++ b/src/emu/dinetwork.cpp @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Carl, Miodrag Milanovic +#include "emu.h" +#include "osdnet.h" + +device_network_interface::device_network_interface(const machine_config &mconfig, device_t &device, float bandwidth) + : device_interface(device, "network") +{ + m_promisc = false; + m_bandwidth = bandwidth; + set_mac("\0\0\0\0\0\0"); + m_intf = 0; +} + +device_network_interface::~device_network_interface() +{ +} + +int device_network_interface::send(UINT8 *buf, int len) +{ + if(!m_dev) return 0; + return m_dev->send(buf, len); +} + +void device_network_interface::recv_cb(UINT8 *buf, int len) +{ +} + +void device_network_interface::set_promisc(bool promisc) +{ + m_promisc = promisc; + if(m_dev) m_dev->set_promisc(promisc); +} + +void device_network_interface::set_mac(const char *mac) +{ + memcpy(m_mac, mac, 6); + if(m_dev) m_dev->set_mac(m_mac); +} + +void device_network_interface::set_interface(int id) +{ + m_dev.reset(open_netdev(id, this, (int)(m_bandwidth*1000000/8.0f/1500))); + if(!m_dev) { + device().logerror("Network interface %d not found\n", id); + id = -1; + } + m_intf = id; +} |