A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
arp-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#ifndef ARP_HEADER_H
10
#define ARP_HEADER_H
11
12
#include "ns3/address.h"
13
#include "ns3/header.h"
14
#include "ns3/ipv4-address.h"
15
16
#include <string>
17
18
namespace
ns3
19
{
20
/**
21
* \ingroup arp
22
* \brief The packet header for an ARP packet
23
*/
24
class
ArpHeader
:
public
Header
25
{
26
public
:
27
/**
28
* \brief Set the ARP request parameters
29
* \param sourceHardwareAddress the source hardware address
30
* \param sourceProtocolAddress the source IP address
31
* \param destinationHardwareAddress the destination hardware address (usually the
32
* broadcast address)
33
* \param destinationProtocolAddress the destination IP address
34
*/
35
void
SetRequest
(
Address
sourceHardwareAddress,
36
Ipv4Address
sourceProtocolAddress,
37
Address
destinationHardwareAddress,
38
Ipv4Address
destinationProtocolAddress);
39
/**
40
* \brief Set the ARP reply parameters
41
* \param sourceHardwareAddress the source hardware address
42
* \param sourceProtocolAddress the source IP address
43
* \param destinationHardwareAddress the destination hardware address (usually the
44
* broadcast address)
45
* \param destinationProtocolAddress the destination IP address
46
*/
47
void
SetReply
(
Address
sourceHardwareAddress,
48
Ipv4Address
sourceProtocolAddress,
49
Address
destinationHardwareAddress,
50
Ipv4Address
destinationProtocolAddress);
51
52
/**
53
* \brief Check if the ARP is a request
54
* \returns true if it is a request
55
*/
56
bool
IsRequest
()
const
;
57
58
/**
59
* \brief Check if the ARP is a reply
60
* \returns true if it is a reply
61
*/
62
bool
IsReply
()
const
;
63
64
/**
65
* \brief Returns the source hardware address
66
* \returns the source hardware address
67
*/
68
Address
GetSourceHardwareAddress
()
const
;
69
70
/**
71
* \brief Returns the destination hardware address
72
* \returns the destination hardware address
73
*/
74
Address
GetDestinationHardwareAddress
()
const
;
75
76
/**
77
* \brief Returns the source IP address
78
* \returns the source IP address
79
*/
80
Ipv4Address
GetSourceIpv4Address
()
const
;
81
82
/**
83
* \brief Returns the destination IP address
84
* \returns the destination IP address
85
*/
86
Ipv4Address
GetDestinationIpv4Address
()
const
;
87
88
/**
89
* \brief Get the type ID.
90
* \return the object TypeId
91
*/
92
static
TypeId
GetTypeId
();
93
TypeId
GetInstanceTypeId
()
const override
;
94
void
Print
(std::ostream& os)
const override
;
95
uint32_t
GetSerializedSize
()
const override
;
96
void
Serialize
(
Buffer::Iterator
start)
const override
;
97
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
98
99
/**
100
* \brief Enumeration listing the possible ARP types
101
*/
102
enum
ArpType_e
103
{
104
ARP_TYPE_REQUEST
= 1,
105
ARP_TYPE_REPLY
= 2
106
};
107
108
uint16_t
m_type
;
//!< type of the ICMP (ARP_TYPE_REQUEST)
109
Address
m_macSource
;
//!< hardware source address
110
Address
m_macDest
;
//!< hardware destination address
111
Ipv4Address
m_ipv4Source
;
//!< IP source address
112
Ipv4Address
m_ipv4Dest
;
//!< IP destination address
113
};
114
115
}
// namespace ns3
116
117
#endif
/* ARP_HEADER_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::ArpHeader
The packet header for an ARP packet.
Definition
arp-header.h:25
ns3::ArpHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
arp-header.cc:168
ns3::ArpHeader::m_macSource
Address m_macSource
hardware source address
Definition
arp-header.h:109
ns3::ArpHeader::Print
void Print(std::ostream &os) const override
Definition
arp-header.cc:112
ns3::ArpHeader::SetReply
void SetReply(Address sourceHardwareAddress, Ipv4Address sourceProtocolAddress, Address destinationHardwareAddress, Ipv4Address destinationProtocolAddress)
Set the ARP reply parameters.
Definition
arp-header.cc:38
ns3::ArpHeader::IsReply
bool IsReply() const
Check if the ARP is a reply.
Definition
arp-header.cc:60
ns3::ArpHeader::IsRequest
bool IsRequest() const
Check if the ARP is a request.
Definition
arp-header.cc:53
ns3::ArpHeader::GetDestinationHardwareAddress
Address GetDestinationHardwareAddress() const
Returns the destination hardware address.
Definition
arp-header.cc:74
ns3::ArpHeader::m_type
uint16_t m_type
type of the ICMP (ARP_TYPE_REQUEST)
Definition
arp-header.h:108
ns3::ArpHeader::ArpType_e
ArpType_e
Enumeration listing the possible ARP types.
Definition
arp-header.h:103
ns3::ArpHeader::ARP_TYPE_REQUEST
@ ARP_TYPE_REQUEST
Definition
arp-header.h:104
ns3::ArpHeader::ARP_TYPE_REPLY
@ ARP_TYPE_REPLY
Definition
arp-header.h:105
ns3::ArpHeader::GetDestinationIpv4Address
Ipv4Address GetDestinationIpv4Address() const
Returns the destination IP address.
Definition
arp-header.cc:88
ns3::ArpHeader::SetRequest
void SetRequest(Address sourceHardwareAddress, Ipv4Address sourceProtocolAddress, Address destinationHardwareAddress, Ipv4Address destinationProtocolAddress)
Set the ARP request parameters.
Definition
arp-header.cc:23
ns3::ArpHeader::m_macDest
Address m_macDest
hardware destination address
Definition
arp-header.h:110
ns3::ArpHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
arp-header.cc:148
ns3::ArpHeader::m_ipv4Dest
Ipv4Address m_ipv4Dest
IP destination address.
Definition
arp-header.h:112
ns3::ArpHeader::GetSourceIpv4Address
Ipv4Address GetSourceIpv4Address() const
Returns the source IP address.
Definition
arp-header.cc:81
ns3::ArpHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
arp-header.cc:105
ns3::ArpHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
arp-header.cc:95
ns3::ArpHeader::m_ipv4Source
Ipv4Address m_ipv4Source
IP source address.
Definition
arp-header.h:111
ns3::ArpHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
arp-header.cc:134
ns3::ArpHeader::GetSourceHardwareAddress
Address GetSourceHardwareAddress() const
Returns the source hardware address.
Definition
arp-header.cc:67
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
arp-header.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0