|
|
| 28 |
* |
28 |
* |
| 29 |
* This class can be used to add a header to PPP packet. Currently we do not |
29 |
* This class can be used to add a header to PPP packet. Currently we do not |
| 30 |
* implement any of the state machine in RFC 1661, we just encapsulate the |
30 |
* implement any of the state machine in RFC 1661, we just encapsulate the |
| 31 |
* inbound packet as an IP version 4 type and send it on. The goal here is |
31 |
* inbound packet send it on. The goal here is not really to implement the |
| 32 |
* not really to implement the point-to-point protocol, but to encapsulate our |
32 |
* point-to-point protocol, but to encapsulate our packets in a known protocol |
| 33 |
* packets in a known protocol so packet sniffers can parse them. |
33 |
* so packet sniffers can parse them. |
| 34 |
* |
34 |
* |
| 35 |
* if PPP is transmitted over a serial link, it will typically be framed in |
35 |
* if PPP is transmitted over a serial link, it will typically be framed in |
| 36 |
* some way derivative of IBM SDLC (HDLC) with all that that entails. |
36 |
* some way derivative of IBM SDLC (HDLC) with all that that entails. |
|
|
| 41 |
* teach the PcapWriter about the appropriate data link type (DLT_PPP = 9), |
41 |
* teach the PcapWriter about the appropriate data link type (DLT_PPP = 9), |
| 42 |
* and we need to add a PPP header to each packet. Since we are not using |
42 |
* and we need to add a PPP header to each packet. Since we are not using |
| 43 |
* framed PPP, this just means prepending the sixteen bit PPP protocol number |
43 |
* framed PPP, this just means prepending the sixteen bit PPP protocol number |
| 44 |
* (0x0021) to the packet. The ns-3 way to do this is via a class that |
44 |
* to the packet. The ns-3 way to do this is via a class that inherits from |
| 45 |
* inherits from class Header. |
45 |
* class Header. |
| 46 |
*/ |
46 |
*/ |
| 47 |
class PppHeader : public Header |
47 |
class PppHeader : public Header |
| 48 |
{ |
48 |
{ |
| 49 |
public: |
49 |
public: |
| 50 |
|
50 |
|
| 51 |
/** |
51 |
/** |
| 52 |
* \brief Construct an IP version 4 PPP header. |
52 |
* \brief Construct a PPP header. |
| 53 |
*/ |
53 |
*/ |
| 54 |
PppHeader (); |
54 |
PppHeader (); |
| 55 |
|
55 |
|
| 56 |
/** |
56 |
/** |
| 57 |
* \brief Destroy an IP version 4 PPP header. |
57 |
* \brief Destroy a PPP header. |
| 58 |
*/ |
58 |
*/ |
| 59 |
virtual ~PppHeader (); |
59 |
virtual ~PppHeader (); |
| 60 |
|
60 |
|
|
|
| 64 |
virtual void Serialize (Buffer::Iterator start) const; |
64 |
virtual void Serialize (Buffer::Iterator start) const; |
| 65 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
65 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
| 66 |
virtual uint32_t GetSerializedSize (void) const; |
66 |
virtual uint32_t GetSerializedSize (void) const; |
|
|
67 |
|
| 68 |
/** |
| 69 |
* \brief Set the protocol type carried by this PPP packet |
| 70 |
* |
| 71 |
* The type numbers to be used are defined in RFC3818 |
| 72 |
* |
| 73 |
* \param protocol the protocol type being carried |
| 74 |
*/ |
| 75 |
void SetProtocol(uint16_t protocol); |
| 76 |
|
| 77 |
/** |
| 78 |
* \brief Get the protocol type carried by this PPP packet |
| 79 |
* |
| 80 |
* The type numbers to be used are defined in RFC3818 |
| 81 |
* |
| 82 |
* \return the protocol type being carried |
| 83 |
*/ |
| 84 |
uint16_t GetProtocol(void); |
| 85 |
|
| 86 |
private: |
| 87 |
uint16_t m_protocol; |
| 67 |
}; |
88 |
}; |
| 68 |
|
89 |
|
| 69 |
}; // namespace ns3 |
90 |
}; // namespace ns3 |