A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
arp-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 INRIA
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 version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#ifndef ARP_HEADER_H
21#define ARP_HEADER_H
22
23#include "ns3/address.h"
24#include "ns3/header.h"
25#include "ns3/ipv4-address.h"
26
27#include <string>
28
29namespace ns3
30{
35class ArpHeader : public Header
36{
37 public:
46 void SetRequest(Address sourceHardwareAddress,
47 Ipv4Address sourceProtocolAddress,
48 Address destinationHardwareAddress,
49 Ipv4Address destinationProtocolAddress);
58 void SetReply(Address sourceHardwareAddress,
59 Ipv4Address sourceProtocolAddress,
60 Address destinationHardwareAddress,
61 Ipv4Address destinationProtocolAddress);
62
67 bool IsRequest() const;
68
73 bool IsReply() const;
74
80
86
92
98
103 static TypeId GetTypeId();
104 TypeId GetInstanceTypeId() const override;
105 void Print(std::ostream& os) const override;
106 uint32_t GetSerializedSize() const override;
107 void Serialize(Buffer::Iterator start) const override;
108 uint32_t Deserialize(Buffer::Iterator start) override;
109
114 {
117 };
118
119 uint16_t m_type;
124};
125
126} // namespace ns3
127
128#endif /* ARP_HEADER_H */
a polymophic address class
Definition: address.h:101
The packet header for an ARP packet.
Definition: arp-header.h:36
uint32_t Deserialize(Buffer::Iterator start) override
Definition: arp-header.cc:179
Address m_macSource
hardware source address
Definition: arp-header.h:120
void Print(std::ostream &os) const override
Definition: arp-header.cc:123
void SetReply(Address sourceHardwareAddress, Ipv4Address sourceProtocolAddress, Address destinationHardwareAddress, Ipv4Address destinationProtocolAddress)
Set the ARP reply parameters.
Definition: arp-header.cc:49
bool IsReply() const
Check if the ARP is a reply.
Definition: arp-header.cc:71
bool IsRequest() const
Check if the ARP is a request.
Definition: arp-header.cc:64
Address GetDestinationHardwareAddress() const
Returns the destination hardware address.
Definition: arp-header.cc:85
uint16_t m_type
type of the ICMP (ARP_TYPE_REQUEST)
Definition: arp-header.h:119
ArpType_e
Enumeration listing the possible ARP types.
Definition: arp-header.h:114
Ipv4Address GetDestinationIpv4Address() const
Returns the destination IP address.
Definition: arp-header.cc:99
void SetRequest(Address sourceHardwareAddress, Ipv4Address sourceProtocolAddress, Address destinationHardwareAddress, Ipv4Address destinationProtocolAddress)
Set the ARP request parameters.
Definition: arp-header.cc:34
Address m_macDest
hardware destination address
Definition: arp-header.h:121
void Serialize(Buffer::Iterator start) const override
Definition: arp-header.cc:159
Ipv4Address m_ipv4Dest
IP destination address.
Definition: arp-header.h:123
Ipv4Address GetSourceIpv4Address() const
Returns the source IP address.
Definition: arp-header.cc:92
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: arp-header.cc:116
static TypeId GetTypeId()
Get the type ID.
Definition: arp-header.cc:106
Ipv4Address m_ipv4Source
IP source address.
Definition: arp-header.h:122
uint32_t GetSerializedSize() const override
Definition: arp-header.cc:145
Address GetSourceHardwareAddress() const
Returns the source hardware address.
Definition: arp-header.cc:78
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.