FreeNOS
ICMPSocket.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_ICMPSOCKET_H
19#define __LIB_LIBNET_ICMPSOCKET_H
20
21#include "NetworkSocket.h"
22#include "NetworkQueue.h"
23#include "NetworkClient.h"
24
25class ICMP;
26
43{
44 public:
45
53 ICMPSocket(const u32 inode,
54 ICMP *icmp,
55 const ProcessID pid);
56
60 virtual ~ICMPSocket();
61
67 const IPV4::Address getAddress() const;
68
79 virtual FileSystem::Result read(IOBuffer & buffer,
80 Size & size,
81 const Size offset);
82
93 virtual FileSystem::Result write(IOBuffer & buffer,
94 Size & size,
95 const Size offset);
96
105
111 void setReply(const ICMP::Header *reply);
112
113 private:
114
117
121};
122
128#endif /* __LIB_LIBNET_ICMPSOCKET_H */
Internet Control Message Protocol (ICMP) socket.
Definition ICMPSocket.h:43
virtual ~ICMPSocket()
Destructor.
bool m_gotReply
Definition ICMPSocket.h:120
const IPV4::Address getAddress() const
Get associated IP host.
virtual FileSystem::Result process(const NetworkQueue::Packet *pkt)
Process incoming network packet.
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read ICMP response.
virtual FileSystem::Result write(IOBuffer &buffer, Size &size, const Size offset)
Send ICMP request.
void setReply(const ICMP::Header *reply)
Set ICMP reply.
ICMP::Header m_reply
Reply.
Definition ICMPSocket.h:119
ICMP * m_icmp
ICMP protocol instance.
Definition ICMPSocket.h:116
Internet Control Message Protocol (ICMP)
Definition ICMP.h:43
Abstract Input/Output buffer.
Definition IOBuffer.h:38
u32 Address
IP-address.
Definition IPV4.h:47
Network socket represents a single logical connection on a protocol.
u32 ProcessID
Process Identification Number.
Definition Types.h:140
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Result
Result code for filesystem Actions.
Definition FileSystem.h:53
Packet header format.
Definition ICMP.h:65
Represents a network packet.