00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2005 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 00019 */ 00020 00021 #ifndef ARP_HEADER_H 00022 #define ARP_HEADER_H 00023 00024 #include "ns3/header.h" 00025 #include "ns3/address.h" 00026 #include "ns3/ipv4-address.h" 00027 #include <string> 00028 00029 namespace ns3 { 00030 /** 00031 * \ingroup arp 00032 * \brief The packet header for an ARP packet 00033 */ 00034 class ArpHeader : public Header 00035 { 00036 public: 00037 void SetRequest (Address sourceHardwareAddress, 00038 Ipv4Address sourceProtocolAddress, 00039 Address destinationHardwareAddress, 00040 Ipv4Address destinationProtocolAddress); 00041 void SetReply (Address sourceHardwareAddress, 00042 Ipv4Address sourceProtocolAddress, 00043 Address destinationHardwareAddress, 00044 Ipv4Address destinationProtocolAddress); 00045 bool IsRequest (void) const; 00046 bool IsReply (void) const; 00047 Address GetSourceHardwareAddress (void); 00048 Address GetDestinationHardwareAddress (void); 00049 Ipv4Address GetSourceIpv4Address (void); 00050 Ipv4Address GetDestinationIpv4Address (void); 00051 00052 static TypeId GetTypeId (void); 00053 virtual TypeId GetInstanceTypeId (void) const; 00054 virtual void Print (std::ostream &os) const; 00055 virtual uint32_t GetSerializedSize (void) const; 00056 virtual void Serialize (Buffer::Iterator start) const; 00057 virtual uint32_t Deserialize (Buffer::Iterator start); 00058 00059 enum ArpType_e { 00060 ARP_TYPE_REQUEST = 1, 00061 ARP_TYPE_REPLY = 2 00062 }; 00063 uint16_t m_type; 00064 Address m_macSource; 00065 Address m_macDest; 00066 Ipv4Address m_ipv4Source; 00067 Ipv4Address m_ipv4Dest; 00068 }; 00069 00070 }; // namespace ns3 00071 00072 #endif /* ARP_HEADER_H */