File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,10 @@ class TINS_API IP : public PDU {
281
281
282
282
/* Getters */
283
283
284
+ uint32_t advertised_size () const {
285
+ return static_cast <uint32_t >(tot_len ());
286
+ }
287
+
284
288
/* *
285
289
* \brief Getter for the header length field.
286
290
*
Original file line number Diff line number Diff line change @@ -281,6 +281,12 @@ class TINS_API PDU {
281
281
*/
282
282
uint32_t size () const ;
283
283
284
+ /* * \brief The whole chain of PDU's advertised size, including this one.
285
+ *
286
+ * Returns the sum of this and all children PDU's advertised size.
287
+ */
288
+ virtual uint32_t advertised_size () const ;
289
+
284
290
/* *
285
291
* \brief Getter for the inner PDU.
286
292
* \return The current inner PDU. Might be a null pointer.
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ uint32_t PDU::size() const {
85
85
return sz;
86
86
}
87
87
88
+ uint32_t PDU::advertised_size () const {
89
+ return header_size () + trailer_size () + inner_pdu ()->advertised_size ();
90
+ }
91
+
88
92
void PDU::send (PacketSender &, const NetworkInterface &) {
89
93
90
94
}
You can’t perform that action at this time.
0 commit comments