00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2008 University of Washington 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 00019 #ifndef PPP_HEADER_H 00020 #define PPP_HEADER_H 00021 00022 #include "ns3/header.h" 00023 00024 namespace ns3 { 00025 00026 /** 00027 * \brief Packet header for PPP 00028 * 00029 * This class can be used to add a header to PPP packet. Currently we do not 00030 * implement any of the state machine in RFC 1661, we just encapsulate the 00031 * inbound packet as an IP version 4 type and send it on. The goal here is 00032 * not really to implement the point-to-point protocol, but to encapsulate our 00033 * packets in a known protocol so packet sniffers can parse them. 00034 * 00035 * if PPP is transmitted over a serial link, it will typically be framed in 00036 * some way derivative of IBM SDLC (HDLC) with all that that entails. 00037 * Thankfully, we don't have to deal with all of that -- we can use our own 00038 * protocol for getting bits across the serial link which we call an ns3 00039 * Packet. What we do have to worry about is being able to capture PPP frames 00040 * which are understandable by Wireshark. All this means is that we need to 00041 * teach the PcapWriter about the appropriate data link type (DLT_PPP = 9), 00042 * and we need to add a PPP header to each packet. Since we are not using 00043 * framed PPP, this just means prepending the sixteen bit PPP protocol number 00044 * (0x0021) to the packet. The ns-3 way to do this is via a class that 00045 * inherits from class Header. 00046 */ 00047 class PppHeader : public Header 00048 { 00049 public: 00050 00051 /** 00052 * \brief Construct an IP version 4 PPP header. 00053 */ 00054 PppHeader (); 00055 00056 /** 00057 * \brief Destroy an IP version 4 PPP header. 00058 */ 00059 virtual ~PppHeader (); 00060 00061 static TypeId GetTypeId (void); 00062 virtual TypeId GetInstanceTypeId (void) const; 00063 virtual void Print (std::ostream &os) const; 00064 virtual void Serialize (Buffer::Iterator start) const; 00065 virtual uint32_t Deserialize (Buffer::Iterator start); 00066 virtual uint32_t GetSerializedSize (void) const; 00067 }; 00068 00069 }; // namespace ns3 00070 00071 00072 #endif /* PPP_HEADER_H */