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
ppp-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#ifndef PPP_HEADER_H
8
#define PPP_HEADER_H
9
10
#include "ns3/header.h"
11
12
namespace
ns3
13
{
14
15
/**
16
* \ingroup point-to-point
17
* \brief Packet header for PPP
18
*
19
* This class can be used to add a header to PPP packet. Currently we do not
20
* implement any of the state machine in \RFC{1661}, we just encapsulate the
21
* inbound packet send it on. The goal here is not really to implement the
22
* point-to-point protocol, but to encapsulate our packets in a known protocol
23
* so packet sniffers can parse them.
24
*
25
* if PPP is transmitted over a serial link, it will typically be framed in
26
* some way derivative of IBM SDLC (HDLC) with all that that entails.
27
* Thankfully, we don't have to deal with all of that -- we can use our own
28
* protocol for getting bits across the serial link which we call an ns3
29
* Packet. What we do have to worry about is being able to capture PPP frames
30
* which are understandable by Wireshark. All this means is that we need to
31
* teach the PcapWriter about the appropriate data link type (DLT_PPP = 9),
32
* and we need to add a PPP header to each packet. Since we are not using
33
* framed PPP, this just means prepending the sixteen bit PPP protocol number
34
* to the packet. The ns-3 way to do this is via a class that inherits from
35
* class Header.
36
*/
37
class
PppHeader
:
public
Header
38
{
39
public
:
40
/**
41
* \brief Construct a PPP header.
42
*/
43
PppHeader
();
44
45
/**
46
* \brief Destroy a PPP header.
47
*/
48
~PppHeader
()
override
;
49
50
/**
51
* \brief Get the TypeId
52
*
53
* \return The TypeId for this class
54
*/
55
static
TypeId
GetTypeId
();
56
57
/**
58
* \brief Get the TypeId of the instance
59
*
60
* \return The TypeId for this instance
61
*/
62
TypeId
GetInstanceTypeId
()
const override
;
63
64
void
Print
(std::ostream& os)
const override
;
65
void
Serialize
(
Buffer::Iterator
start)
const override
;
66
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
67
uint32_t
GetSerializedSize
()
const override
;
68
69
/**
70
* \brief Set the protocol type carried by this PPP packet
71
*
72
* The type numbers to be used are defined in \RFC{3818}
73
*
74
* \param protocol the protocol type being carried
75
*/
76
void
SetProtocol
(uint16_t protocol);
77
78
/**
79
* \brief Get the protocol type carried by this PPP packet
80
*
81
* The type numbers to be used are defined in \RFC{3818}
82
*
83
* \return the protocol type being carried
84
*/
85
uint16_t
GetProtocol
()
const
;
86
87
private
:
88
/**
89
* \brief The PPP protocol type of the payload packet
90
*/
91
uint16_t
m_protocol
;
92
};
93
94
}
// namespace ns3
95
96
#endif
/* PPP_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::PppHeader
Packet header for PPP.
Definition
ppp-header.h:38
ns3::PppHeader::m_protocol
uint16_t m_protocol
The PPP protocol type of the payload packet.
Definition
ppp-header.h:91
ns3::PppHeader::SetProtocol
void SetProtocol(uint16_t protocol)
Set the protocol type carried by this PPP packet.
Definition
ppp-header.cc:86
ns3::PppHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
ppp-header.cc:79
ns3::PppHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the TypeId of the instance.
Definition
ppp-header.cc:42
ns3::PppHeader::GetTypeId
static TypeId GetTypeId()
Get the TypeId.
Definition
ppp-header.cc:32
ns3::PppHeader::~PppHeader
~PppHeader() override
Destroy a PPP header.
Definition
ppp-header.cc:27
ns3::PppHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
ppp-header.cc:67
ns3::PppHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
ppp-header.cc:73
ns3::PppHeader::GetProtocol
uint16_t GetProtocol() const
Get the protocol type carried by this PPP packet.
Definition
ppp-header.cc:92
ns3::PppHeader::PppHeader
PppHeader()
Construct a PPP header.
Definition
ppp-header.cc:23
ns3::PppHeader::Print
void Print(std::ostream &os) const override
Definition
ppp-header.cc:48
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
point-to-point
model
ppp-header.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0