Skip to content

Commit 66ccbe8

Browse files
authored
Reformat Packet++ documentation to use triple-slash doxygen format. (#1659)
* Converted some files to tripple slash docs. * Converted more files. * Converted more files. * more conversions... * Converted more files * Converted more files. * converted files * converted more files. * Reformatted SSH layer. PS: Formatting ASCII drawings is annoying. * Converted SSL layer files. PS: Formating ASCII Drawings. * Attempt at suppressing multi-line comment warning due to backslashes in ASCII drawings. * Converted Stplayer. * Converted remaining files. * Wrapped diagrams in ASCII borders to avoid the multi-line comment compiler errors. * Wrapped more diagrams that triggered the multi-line error. The error is triggered by having a \ as the last character before a new-line. * Reformatted /** */ style comments to /// and // comments. * Added empty lines around verbatim blocks to attempt to fix doxygen error. * Replaced verbatim blocks with @code{.unparsed} as per this workaround. https://web.archive.org/web/20240724083629/https://technicalwriting.dev/src/verbatim-wrangling.html * Lint * Removed borders and instances of \ at the end of the line
1 parent 4ea938b commit 66ccbe8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+9664
-14573
lines changed

Packet++/header/ArpLayer.h

Lines changed: 50 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,165 +6,132 @@
66

77
/// @file
88

9-
/**
10-
* \namespace pcpp
11-
* \brief The main namespace for the PcapPlusPlus lib
12-
*/
9+
/// @namespace pcpp
10+
/// @brief The main namespace for the PcapPlusPlus lib
1311
namespace pcpp
1412
{
15-
16-
/**
17-
* @struct arphdr
18-
* Represents an ARP protocol header
19-
*/
13+
/// @struct arphdr
14+
/// Represents an ARP protocol header
2015
#pragma pack(push, 1)
2116
struct arphdr
2217
{
23-
/** Hardware type (HTYPE) */
18+
/// Hardware type (HTYPE)
2419
uint16_t hardwareType;
25-
/** Protocol type (PTYPE). The permitted PTYPE values share a numbering space with those for EtherType */
20+
/// Protocol type (PTYPE). The permitted PTYPE values share a numbering space with those for EtherType
2621
uint16_t protocolType;
27-
/** Hardware address length (HLEN). For IPv4, this has the value 0x0800 */
22+
/// Hardware address length (HLEN). For IPv4, this has the value 0x0800
2823
uint8_t hardwareSize;
29-
/** Protocol length (PLEN). Length (in octets) of addresses used in the upper layer protocol. (The upper layer
30-
* protocol specified in PTYPE.) IPv4 address size is 4 */
24+
/// Protocol length (PLEN). Length (in octets) of addresses used in the upper layer protocol. (The upper layer
25+
/// protocol specified in PTYPE.) IPv4 address size is 4
3126
uint8_t protocolSize;
32-
/** Specifies the operation that the sender is performing: 1 (::ARP_REQUEST) for request, 2 (::ARP_REPLY) for
33-
* reply */
27+
/// Specifies the operation that the sender is performing: 1 (::ARP_REQUEST) for request, 2 (::ARP_REPLY) for
28+
/// reply
3429
uint16_t opcode;
35-
/** Sender hardware address (SHA) */
30+
/// Sender hardware address (SHA)
3631
uint8_t senderMacAddr[6];
37-
/** Sender protocol address (SPA) */
32+
/// Sender protocol address (SPA)
3833
uint32_t senderIpAddr;
39-
/** Target hardware address (THA) */
34+
/// Target hardware address (THA)
4035
uint8_t targetMacAddr[6];
41-
/** Target protocol address (TPA) */
36+
/// Target protocol address (TPA)
4237
uint32_t targetIpAddr;
4338
};
4439
#pragma pack(pop)
4540

46-
/**
47-
* An enum for ARP message type
48-
*/
41+
/// An enum for ARP message type
4942
enum ArpOpcode
5043
{
5144
ARP_REQUEST = 0x0001, ///< ARP request
5245
ARP_REPLY = 0x0002 ///< ARP reply (response)
5346
};
5447

55-
/**
56-
* @class ArpLayer
57-
* Represents an ARP protocol layer. Currently only IPv4 ARP messages are supported
58-
*/
48+
/// @class ArpLayer
49+
/// Represents an ARP protocol layer. Currently only IPv4 ARP messages are supported
5950
class ArpLayer : public Layer
6051
{
6152
public:
62-
/**
63-
* A constructor that creates the layer from an existing packet raw data
64-
* @param[in] data A pointer to the raw data (will be casted to @ref arphdr)
65-
* @param[in] dataLen Size of the data in bytes
66-
* @param[in] prevLayer A pointer to the previous layer
67-
* @param[in] packet A pointer to the Packet instance where layer will be stored in
68-
*/
53+
/// A constructor that creates the layer from an existing packet raw data
54+
/// @param[in] data A pointer to the raw data (will be casted to @ref arphdr)
55+
/// @param[in] dataLen Size of the data in bytes
56+
/// @param[in] prevLayer A pointer to the previous layer
57+
/// @param[in] packet A pointer to the Packet instance where layer will be stored in
6958
ArpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
7059
: Layer(data, dataLen, prevLayer, packet, ARP)
7160
{
7261
m_DataLen = sizeof(arphdr);
7362
}
7463

75-
/**
76-
* A constructor that allocates a new ARP header
77-
* @param[in] opCode ARP message type (ARP request or ARP reply)
78-
* @param[in] senderMacAddr The sender MAC address (will be put in arphdr#senderMacAddr)
79-
* @param[in] targetMacAddr The target MAC address (will be put in arphdr#targetMacAddr)
80-
* @param[in] senderIpAddr The sender IP address (will be put in arphdr#senderIpAddr)
81-
* @param[in] targetIpAddr The target IP address (will be put in arphdr#targetIpAddr)
82-
*/
64+
/// A constructor that allocates a new ARP header
65+
/// @param[in] opCode ARP message type (ARP request or ARP reply)
66+
/// @param[in] senderMacAddr The sender MAC address (will be put in arphdr#senderMacAddr)
67+
/// @param[in] targetMacAddr The target MAC address (will be put in arphdr#targetMacAddr)
68+
/// @param[in] senderIpAddr The sender IP address (will be put in arphdr#senderIpAddr)
69+
/// @param[in] targetIpAddr The target IP address (will be put in arphdr#targetIpAddr)
8370
ArpLayer(ArpOpcode opCode, const MacAddress& senderMacAddr, const MacAddress& targetMacAddr,
8471
const IPv4Address& senderIpAddr, const IPv4Address& targetIpAddr);
8572

8673
~ArpLayer() override = default;
8774

88-
/**
89-
* Get a pointer to the ARP header. Notice this points directly to the data, so every change will change the
90-
* actual packet data
91-
* @return A pointer to the @ref arphdr
92-
*/
75+
/// Get a pointer to the ARP header. Notice this points directly to the data, so every change will change the
76+
/// actual packet data
77+
/// @return A pointer to the @ref arphdr
9378
inline arphdr* getArpHeader() const
9479
{
9580
return reinterpret_cast<arphdr*>(m_Data);
9681
}
9782

98-
/**
99-
* Get the sender hardware address (SHA) in the form of MacAddress
100-
* @return A MacAddress containing the sender hardware address (SHA)
101-
*/
83+
/// Get the sender hardware address (SHA) in the form of MacAddress
84+
/// @return A MacAddress containing the sender hardware address (SHA)
10285
inline MacAddress getSenderMacAddress() const
10386
{
10487
return MacAddress(getArpHeader()->senderMacAddr);
10588
}
10689

107-
/**
108-
* Get the target hardware address (THA) in the form of MacAddress
109-
* @return A MacAddress containing the target hardware address (THA)
110-
*/
90+
/// Get the target hardware address (THA) in the form of MacAddress
91+
/// @return A MacAddress containing the target hardware address (THA)
11192
inline MacAddress getTargetMacAddress() const
11293
{
11394
return MacAddress(getArpHeader()->targetMacAddr);
11495
}
11596

116-
/**
117-
* Get the sender protocol address (SPA) in the form of IPv4Address
118-
* @return An IPv4Address containing the sender protocol address (SPA)
119-
*/
97+
/// Get the sender protocol address (SPA) in the form of IPv4Address
98+
/// @return An IPv4Address containing the sender protocol address (SPA)
12099
inline IPv4Address getSenderIpAddr() const
121100
{
122101
return getArpHeader()->senderIpAddr;
123102
}
124103

125-
/**
126-
* Get the target protocol address (TPA) in the form of IPv4Address
127-
* @return An IPv4Address containing the target protocol address (TPA)
128-
*/
104+
/// Get the target protocol address (TPA) in the form of IPv4Address
105+
/// @return An IPv4Address containing the target protocol address (TPA)
129106
inline IPv4Address getTargetIpAddr() const
130107
{
131108
return getArpHeader()->targetIpAddr;
132109
}
133110

134111
// implement abstract methods
135112

136-
/**
137-
* Does nothing for this layer (ArpLayer is always last)
138-
*/
113+
/// Does nothing for this layer (ArpLayer is always last)
139114
void parseNextLayer() override
140115
{}
141116

142-
/**
143-
* @return The size of @ref arphdr
144-
*/
117+
/// @return The size of @ref arphdr
145118
size_t getHeaderLen() const override
146119
{
147120
return sizeof(arphdr);
148121
}
149122

150-
/**
151-
* Calculate the following fields:
152-
* - @ref arphdr#hardwareType = Ethernet (1)
153-
* - @ref arphdr#hardwareSize = 6
154-
* - @ref arphdr#protocolType = ETHERTYPE_IP (assume IPv4 over ARP)
155-
* - @ref arphdr#protocolSize = 4 (assume IPv4 over ARP)
156-
* - if it's an ARP request: @ref arphdr#targetMacAddr = MacAddress("00:00:00:00:00:00")
157-
*/
123+
/// Calculate the following fields:
124+
/// - @ref arphdr#hardwareType = Ethernet (1)
125+
/// - @ref arphdr#hardwareSize = 6
126+
/// - @ref arphdr#protocolType = ETHERTYPE_IP (assume IPv4 over ARP)
127+
/// - @ref arphdr#protocolSize = 4 (assume IPv4 over ARP)
128+
/// - if it's an ARP request: @ref arphdr#targetMacAddr = MacAddress("00:00:00:00:00:00")
158129
void computeCalculateFields() override;
159130

160-
/**
161-
* Is this packet an ARP request?
162-
*/
131+
/// Is this packet an ARP request?
163132
bool isRequest() const;
164133

165-
/**
166-
* Is this packet an ARP reply?
167-
*/
134+
/// Is this packet an ARP reply?
168135
bool isReply() const;
169136

170137
std::string toString() const override;

0 commit comments

Comments
 (0)