|
8 | 8 | /// @brief The main namespace for the PcapPlusPlus lib
|
9 | 9 | namespace pcpp
|
10 | 10 | {
|
| 11 | + /// @defgroup ProtocolTypes ProtocolType and ProtocolTypeFamily |
| 12 | + /// In the PcapPlusPlus library, specific protocols are identified by a `ProtocolType` value, which is an 8-bit |
| 13 | + /// unsigned integer. Each Layer class has a ProtocolType that can be used to identify the protocol of that layer. |
| 14 | + /// |
| 15 | + /// As there are some situations where multiple protocols can be grouped together (e.g. IPv4 and IPv6 into IP), |
| 16 | + /// PcapPlusPlus also defines ProtocolTypeFamily, which is a group of multiple protocol types. In functions where a |
| 17 | + /// ProtocolTypeFamily parameter is expected, a single ProtocolType value can be passed instead. The library will |
| 18 | + /// treat it as a family containing only that single protocol. |
| 19 | + /// |
| 20 | + /// @internal |
| 21 | + /// |
| 22 | + /// A ProtocolTypeFamily pack is represented as a 32-bit unsigned integer. Each octet in the 32-bit value is a |
| 23 | + /// ProtocolType, allowing for up to 4 protocols to be packed into a single ProtocolTypeFamily value. For example, |
| 24 | + /// the ProtocolTypeFamily for IP is represented as 0x203, which contains both IPv4 (0x02) and IPv6 (0x03) |
| 25 | + /// protocols. A single ProtocolType casted to ProtocolTypeFamily will result the value '0x000000xx' where 'xx' is |
| 26 | + /// the value of the ProtocolType. |
| 27 | + /// |
| 28 | + /// @endinternal |
| 29 | + |
| 30 | + /// @addtogroup ProtocolTypes |
| 31 | + /// @{ |
| 32 | + |
11 | 33 | /// @typedef ProtocolType
|
12 | 34 | /// Representing all protocols supported by PcapPlusPlus
|
13 | 35 | typedef uint8_t ProtocolType;
|
@@ -229,6 +251,8 @@ namespace pcpp
|
229 | 251 | /// FTP protocol family (FTPControl and FtpData protocols)
|
230 | 252 | const ProtocolTypeFamily FTP = 0x3c29;
|
231 | 253 |
|
| 254 | + /// @} |
| 255 | + |
232 | 256 | /// An enum representing OSI model layers
|
233 | 257 | enum OsiModelLayer
|
234 | 258 | {
|
@@ -256,6 +280,7 @@ namespace pcpp
|
256 | 280 | /// @param family A protocol type family value.
|
257 | 281 | /// @param protocol A protocol type value to check against the family.
|
258 | 282 | /// @return True if the protocol is part of the family, false otherwise.
|
| 283 | + /// @ingroup ProtocolTypes |
259 | 284 | constexpr bool protoFamilyContainsProtocol(ProtocolTypeFamily family, ProtocolType protocol)
|
260 | 285 | {
|
261 | 286 | auto const protocolToFamily = static_cast<ProtocolTypeFamily>(protocol);
|
|
0 commit comments