FreeNOS
NetworkProtocol.h
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#ifndef __LIB_LIBNET_NETWORKPROTOCOL_H
19#define __LIB_LIBNET_NETWORKPROTOCOL_H
20
21#include <Directory.h>
22#include <Types.h>
23#include "NetworkQueue.h"
24
25class NetworkServer;
26class NetworkDevice;
27
40{
41 protected:
42
55
56 public:
57
66 NetworkDevice &device,
67 NetworkProtocol &parent);
68
72 virtual ~NetworkProtocol();
73
74
80 virtual const Size getMaximumPacketSize() const;
81
88
101 const void *address,
102 const Size addressSize,
103 const Identifier protocol,
104 const Size payloadSize);
105
115 const Size offset) = 0;
116
117 protected:
118
121
124
127};
128
134#endif /* __LIB_LIBNET_NETWORKPROTOCOL_H */
Directory File functionality.
Definition Directory.h:60
Ethernet networking protocol.
Definition Ethernet.h:43
Network Device abstract class.
Network protocol abstraction class.
virtual FileSystem::Result initialize()=0
Perform initialization.
Identifier
List of known network protocol identifiers.
NetworkProtocol & m_parent
Parent upper-layer protocol instance.
NetworkDevice & m_device
Network device instance.
virtual ~NetworkProtocol()
Destructor.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt, const Size offset)=0
Process incoming network packet.
virtual FileSystem::Result getTransmitPacket(NetworkQueue::Packet **pkt, const void *address, const Size addressSize, const Identifier protocol, const Size payloadSize)
Get a new packet for transmission.
NetworkServer & m_server
Network server instance.
virtual const Size getMaximumPacketSize() const
Get maximum packet size.
Networking server.
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Result
Result code for filesystem Actions.
Definition FileSystem.h:53
Represents a network packet.