A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
status-code.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef STATUS_CODE_H
10#define STATUS_CODE_H
11
12#include "ns3/buffer.h"
13
14namespace ns3
15{
16
17/**
18 * Status code for association response.
19 */
21{
22 public:
23 StatusCode();
24 /**
25 * Set success bit to 0 (success).
26 */
27 void SetSuccess();
28 /**
29 * Set success bit to 1 (failure).
30 */
31 void SetFailure();
32
33 /**
34 * Return whether the status code is success.
35 *
36 * \return true if success,
37 * false otherwise
38 */
39 bool IsSuccess() const;
40
41 /**
42 * \returns the expected size of the status code.
43 *
44 * This method should return the number of bytes which are needed to store
45 * the status code data by Serialize.
46 */
48 /**
49 * \param start an iterator which points to where the status code should be written
50 *
51 * \return Buffer::Iterator
52 *
53 * This method is used to store a status code into the byte buffer.
54 * The data written is expected to match bit-for-bit the representation of this
55 * header in a real network.
56 */
58 /**
59 * \param start an iterator which points to where the status code should be read.
60 *
61 * \returns the number of bytes read.
62 *
63 * This method is used to re-create a status code from the byte buffer.
64 * The data read is expected to match bit-for-bit the representation of this
65 * header in real networks.
66 */
68
69 private:
70 uint16_t m_code; ///< status code
71};
72
73/**
74 * Serialize StatusCode to the given ostream.
75 *
76 * \param os the output stream
77 * \param code the StatusCode
78 *
79 * \return std::ostream
80 */
81std::ostream& operator<<(std::ostream& os, const StatusCode& code);
82
83} // namespace ns3
84
85#endif /* STATUS_CODE_H */
iterator in a Buffer instance
Definition buffer.h:89
Status code for association response.
Definition status-code.h:21
bool IsSuccess() const
Return whether the status code is success.
Buffer::Iterator Serialize(Buffer::Iterator start) const
void SetFailure()
Set success bit to 1 (failure).
Buffer::Iterator Deserialize(Buffer::Iterator start)
uint16_t m_code
status code
Definition status-code.h:70
uint32_t GetSerializedSize() const
void SetSuccess()
Set success bit to 0 (success).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148