FreeNOS
NetworkServer.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <Assert.h>
19#include "NetworkServer.h"
20
22 : DeviceServer(path)
23 , m_device(ZERO)
24{
25}
26
30
36
42
44{
45 DEBUG("pid = " << pid);
46
47 if (m_device != ZERO)
48 {
50 }
51}
52
54{
56
57 // Process all pending requests
59 {
60 }
61
62 // Start DMA engine
63 const FileSystem::Result result = m_device->startDMA();
64 if (result != FileSystem::Success)
65 {
66 ERROR("failed to start DMA: result = " << (int) result);
67 }
68
69 // All requests done
70 return false;
71}
Device driver server.
virtual FileSystem::Result initialize()
Initialize DeviceServer.
void registerDevice(Device *dev, const char *path)
Add a Device.
virtual bool retryRequests()
Retry any pending requests.
Network Device abstract class.
virtual FileSystem::Result startDMA()
Start DMA processing.
void unregisterSockets(const ProcessID pid)
Remove sockets for a process.
void registerNetworkDevice(NetworkDevice *dev)
Register network device.
virtual ~NetworkServer()
Destructor.
virtual bool retryRequests()
Starts DMA on NetworkDevices after all pending requests are done.
virtual FileSystem::Result initialize()
Initialize the NetworkServer.
virtual void onProcessTerminated(const ProcessID pid)
Called whenever another Process is terminated.
NetworkServer(const char *path)
Constructor.
NetworkDevice * m_device
Network device instance.
#define assert(exp)
Insert program diagnostics.
Definition assert.h:60
u32 ProcessID
Process Identification Number.
Definition Types.h:140
#define ERROR(msg)
Output an error message.
Definition Log.h:61
#define ZERO
Zero value.
Definition Macros.h:43
#define DEBUG(msg)
Output a debug message to standard output.
Definition Log.h:89
Result
Result code for filesystem Actions.
Definition FileSystem.h:53