3131#include < net/socket.hpp>
3232#include < net/ip4/ip4.hpp>
3333#include < util/bitops.hpp>
34+ #include < util/alloc_pmr.hpp>
3435
3536namespace net {
3637
@@ -370,6 +371,22 @@ namespace net {
370371 uint16_t max_syn_backlog () const
371372 { return max_syn_backlog_; }
372373
374+ /* *
375+ * @brief Set the maximum allowed memory
376+ * to be used by this TCP.
377+ *
378+ * @param[in] size The limit in bytes
379+ */
380+ void set_total_bufsize (const size_t size)
381+ {
382+ total_bufsize_ = size;
383+ mempool_.set_total_capacity (total_bufsize_);
384+ }
385+
386+ const os::mem::Pmr_pool& mempool () {
387+ return mempool_;
388+ }
389+
373390 /* *
374391 * @brief Sets the minimum buffer size.
375392 *
@@ -532,6 +549,12 @@ namespace net {
532549 Listeners listeners_;
533550 Connections connections_;
534551
552+ size_t total_bufsize_;
553+ os::mem::Pmr_pool mempool_;
554+
555+ size_t min_bufsize_;
556+ size_t max_bufsize_;
557+
535558 Port_utils& ports_;
536559
537560 downstream network_layer_out_;
@@ -557,9 +580,6 @@ namespace net {
557580 /* * Maximum SYN queue backlog */
558581 uint16_t max_syn_backlog_;
559582
560- size_t min_bufsize_ {tcp::default_min_bufsize};
561- size_t max_bufsize_ {tcp::default_max_bufsize};
562-
563583 /* * Stats */
564584 uint64_t * bytes_rx_ = nullptr ;
565585 uint64_t * bytes_tx_ = nullptr ;
0 commit comments