├── doc ├── .gitignore ├── index.rst ├── Makefile ├── make.bat ├── conf.py ├── quic.rst └── mpquic.rst ├── examples ├── CMakeLists.txt ├── wscript ├── quic-tester.cc └── quic-pacing.cc ├── ns3.patch ├── README_mpquic.md ├── CMakeLists.txt ├── model ├── quic-stream.cc ├── quic-socket-tx-pfifo-scheduler.h ├── mp-quic-path-manager.h ├── quic-socket-factory.cc ├── quic-socket-factory.h ├── quic-socket.cc ├── quic-socket-tx-pfifo-scheduler.cc ├── quic-socket-tx-edf-scheduler.h ├── mp-quic-scheduler.h ├── mp-quic-subflow.cc ├── mp-quic-subflow.h ├── quic-socket-rx-buffer.h ├── quic-socket.h ├── quic-stream-rx-buffer.h ├── mp-quic-path-manager.cc ├── quic-socket-tx-scheduler.h ├── quic-congestion-ops.h ├── quic-socket-rx-buffer.cc ├── mp-quic-congestion-ops.h ├── quic-stream-tx-buffer.h ├── quic-stream.h ├── quic-socket-tx-edf-scheduler.cc └── quic-l5-protocol.h ├── quic-applications ├── helper │ ├── mpquic-bulk-send-helper.cc │ ├── quic-client-server-helper.cc │ ├── mpquic-bulk-send-helper.h │ ├── quic-echo-helper.cc │ └── quic-client-server-helper.h └── model │ ├── quic-client.h │ ├── quic-echo-server.h │ ├── quic-server.h │ ├── quic-server.cc │ ├── mpquic-bulk-send-application.h │ ├── quic-echo-client.h │ ├── quic-client.cc │ └── quic-echo-server.cc ├── wscript ├── helper ├── quic-helper.h └── quic-helper.cc └── README.md /doc/.gitignore: -------------------------------------------------------------------------------- 1 | _build/* 2 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | build_example( 2 | NAME wns3-mpquic-two-path 3 | SOURCE_FILES wns3-mpquic-two-path.cc 4 | LIBRARIES_TO_LINK 5 | ${libquic} 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. mpquic documentation master file, created by 2 | sphinx-quickstart on Tue Apr 18 22:17:44 2023. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to mpquic's documentation! 7 | ================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | quic.rst 13 | 14 | 15 | Indices and tables 16 | ================== 17 | 18 | * :ref:`genindex` 19 | * :ref:`modindex` 20 | * :ref:`search` 21 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.https://www.sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /examples/wscript: -------------------------------------------------------------------------------- 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- 2 | 3 | def build(bld): 4 | obj = bld.create_ns3_program('quic-tester-streams', ['quic']) 5 | obj.source = 'quic-tester-streams.cc' 6 | obj = bld.create_ns3_program('quic-tester', ['quic']) 7 | obj.source = 'quic-tester.cc' 8 | obj = bld.create_ns3_program('quic-variants-comparison', ['quic']) 9 | obj.source = 'quic-variants-comparison.cc' 10 | obj = bld.create_ns3_program('quic-variants-comparison-bulksend', ['quic']) 11 | obj.source = 'quic-variants-comparison-bulksend.cc' 12 | obj = bld.create_ns3_program('wns3-mpquic-one-path', ['quic']) 13 | obj.source = 'wns3-mpquic-one-path.cc' 14 | obj = bld.create_ns3_program('wns3-mpquic-two-path', ['quic']) 15 | obj.source = 'wns3-mpquic-two-path.cc' 16 | obj = bld.create_ns3_program('wns3-mpquic-four-path', ['quic']) 17 | obj.source = 'wns3-mpquic-four-path.cc' 18 | obj = bld.create_ns3_program('wns3-mpquic-two-path-cwnd', ['quic']) 19 | obj.source = 'wns3-mpquic-two-path-cwnd.cc' 20 | obj = bld.create_ns3_program('wns3-mpquic-two-path-flip', ['quic']) 21 | obj.source = 'wns3-mpquic-two-path-flip.cc' 22 | 23 | -------------------------------------------------------------------------------- /ns3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/applications/CMakeLists.txt b/src/applications/CMakeLists.txt 2 | index 77b0993ad..3d3835cd7 100644 3 | --- a/src/applications/CMakeLists.txt 4 | +++ b/src/applications/CMakeLists.txt 5 | @@ -1,6 +1,14 @@ 6 | build_lib( 7 | LIBNAME applications 8 | SOURCE_FILES 9 | + model/mpquic-bulk-send-application.cc 10 | + model/quic-client.cc 11 | + model/quic-server.cc 12 | + model/quic-echo-client.cc 13 | + model/quic-echo-server.cc 14 | + helper/mpquic-bulk-send-helper.cc 15 | + helper/quic-client-server-helper.cc 16 | + helper/quic-echo-helper.cc 17 | helper/bulk-send-helper.cc 18 | helper/on-off-helper.cc 19 | helper/packet-sink-helper.cc 20 | @@ -25,6 +33,14 @@ build_lib( 21 | model/udp-server.cc 22 | model/udp-trace-client.cc 23 | HEADER_FILES 24 | + model/mpquic-bulk-send-application.h 25 | + model/quic-client.h 26 | + model/quic-server.h 27 | + model/quic-echo-client.h 28 | + model/quic-echo-server.h 29 | + helper/mpquic-bulk-send-helper.h 30 | + helper/quic-client-server-helper.h 31 | + helper/quic-echo-helper.h 32 | helper/bulk-send-helper.h 33 | helper/on-off-helper.h 34 | helper/packet-sink-helper.h 35 | 36 | -------------------------------------------------------------------------------- /README_mpquic.md: -------------------------------------------------------------------------------- 1 | To integrate mpquic module in ns-3, 2 | 3 | ``` 4 | cd src 5 | git clone https://github.com/ssjShirley/ns3-mpquic-module.git quic 6 | cp -r quic/quic-applications/helper/. applications/helper/. 7 | cp -r quic/quic-applications/model/. applications/model/. 8 | cp -r quic/examples ../examples/quic 9 | ``` 10 | 11 | ## `CMake` 12 | After `ns-3.36`, `ns-3` adopted `cmake` as the new build system. 13 | 14 | ``` 15 | git apply < quic/ns3.patch 16 | ``` 17 | 18 | To enable Python bindings, additionally install `cppyy` and add `--enable-python-bindings` to the `./ns3 configure` command line. 19 | 20 | ``` 21 | ./ns3 configure --enable-examples --enable-python-bindings -- -DNS3_BINDINGS_INSTALL_DIR="$HOME/.local/lib/python3.10/site-packages" 22 | ``` 23 | 24 | Otherwise, configure `ns3` without Python bindings 25 | 26 | ``` 27 | ./ns3 configure --enable-examples 28 | ``` 29 | 30 | Build and install 31 | 32 | ``` 33 | ./ns3 build -j$(nproc) 34 | ./ns3 install 35 | sudo ldconfig 36 | ``` 37 | 38 | Run mpquic examples 39 | 40 | ``` 41 | ./ns3 run wns3-mpquic-two-path 42 | ``` 43 | 44 | ## `Waf` 45 | 46 | In src/applications/wscript, add the following to module.source 47 | ``` 48 | 'model/mpquic-bulk-send-application.cc', 49 | 'model/quic-client.cc', 50 | 'model/quic-server.cc', 51 | 'model/quic-echo-client.cc', 52 | 'model/quic-echo-server.cc', 53 | 'helper/mpquic-bulk-send-helper.cc', 54 | 'helper/quic-client-server-helper.cc', 55 | 'helper/quic-echo-helper.cc', 56 | ``` 57 | 58 | add the following to headers.source 59 | ``` 60 | 'model/mpquic-bulk-send-application.h', 61 | 'model/quic-client.h', 62 | 'model/quic-server.h', 63 | 'model/quic-echo-client.h', 64 | 'model/quic-echo-server.h', 65 | 'helper/mpquic-bulk-send-helper.h', 66 | 'helper/quic-client-server-helper.h', 67 | 'helper/quic-echo-helper.h', 68 | ``` 69 | 70 | Configure the mpquic module 71 | ``` 72 | ./waf configure --enable-example 73 | ./waf 74 | ``` 75 | 76 | Run examples 77 | ``` 78 | ./waf --run wns3-mpquic-two-path 79 | ``` 80 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | build_lib( 2 | LIBNAME quic 3 | SOURCE_FILES 4 | model/quic-congestion-ops.cc 5 | model/quic-socket.cc 6 | model/quic-socket-base.cc 7 | model/quic-socket-factory.cc 8 | model/quic-l4-protocol.cc 9 | model/quic-socket-rx-buffer.cc 10 | model/quic-socket-tx-buffer.cc 11 | model/quic-socket-tx-scheduler.cc 12 | model/quic-socket-tx-pfifo-scheduler.cc 13 | model/quic-socket-tx-edf-scheduler.cc 14 | model/quic-stream.cc 15 | model/quic-stream-base.cc 16 | model/quic-l5-protocol.cc 17 | model/quic-stream-tx-buffer.cc 18 | model/quic-stream-rx-buffer.cc 19 | model/quic-header.cc 20 | model/quic-subheader.cc 21 | model/quic-transport-parameters.cc 22 | model/quic-bbr.cc 23 | model/mp-quic-subflow.cc 24 | model/mp-quic-scheduler.cc 25 | model/mp-quic-path-manager.cc 26 | model/mp-quic-congestion-ops.cc 27 | helper/quic-helper.cc 28 | HEADER_FILES 29 | model/quic-congestion-ops.h 30 | model/quic-socket.h 31 | model/quic-socket-base.h 32 | model/quic-socket-factory.h 33 | model/quic-l4-protocol.h 34 | model/quic-socket-rx-buffer.h 35 | model/quic-socket-tx-buffer.h 36 | model/quic-socket-tx-scheduler.h 37 | model/quic-socket-tx-pfifo-scheduler.h 38 | model/quic-socket-tx-edf-scheduler.h 39 | model/quic-stream.h 40 | model/quic-stream-base.h 41 | model/quic-l5-protocol.h 42 | model/quic-stream-tx-buffer.h 43 | model/quic-stream-rx-buffer.h 44 | model/quic-header.h 45 | model/quic-subheader.h 46 | model/quic-transport-parameters.h 47 | model/quic-bbr.h 48 | helper/quic-helper.h 49 | model/mp-quic-subflow.h 50 | model/mp-quic-scheduler.h 51 | model/mp-quic-path-manager.h 52 | model/mp-quic-congestion-ops.h 53 | model/windowed-filter.h 54 | LIBRARIES_TO_LINK 55 | ${libinternet} 56 | ${libapplications} 57 | ${libflow-monitor} 58 | ${libpoint-to-point} 59 | TEST_SOURCES 60 | test/quic-rx-buffer-test.cc 61 | test/quic-tx-buffer-test.cc 62 | test/quic-header-test.cc 63 | ) 64 | -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | # import os 14 | # import sys 15 | # sys.path.insert(0, os.path.abspath('.')) 16 | 17 | 18 | # -- Project information ----------------------------------------------------- 19 | 20 | project = 'mpquic' 21 | copyright = '2023, Shengjie Shu' 22 | author = 'Shengjie Shu' 23 | 24 | # The full version, including alpha/beta/rc tags 25 | release = '1.2' 26 | 27 | 28 | # -- General configuration --------------------------------------------------- 29 | 30 | # Add any Sphinx extension module names here, as strings. They can be 31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 32 | # ones. 33 | extensions = [ 34 | ] 35 | 36 | # Add any paths that contain templates here, relative to this directory. 37 | templates_path = ['_templates'] 38 | 39 | # List of patterns, relative to source directory, that match files and 40 | # directories to ignore when looking for source files. 41 | # This pattern also affects html_static_path and html_extra_path. 42 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 43 | 44 | 45 | # -- Options for HTML output ------------------------------------------------- 46 | 47 | # The theme to use for HTML and HTML Help pages. See the documentation for 48 | # a list of builtin themes. 49 | # 50 | html_theme = 'alabaster' 51 | 52 | # Add any paths that contain custom static files (such as style sheets) here, 53 | # relative to this directory. They are copied after the builtin static files, 54 | # so a file named "default.css" will overwrite the builtin "default.css". 55 | html_static_path = ['_static'] -------------------------------------------------------------------------------- /model/quic-stream.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Alvise De Biasio 19 | * Federico Chiariotti 20 | * Michele Polese 21 | * Davide Marcato 22 | * 23 | */ 24 | 25 | #define __STDC_LIMIT_MACROS 26 | 27 | #include "ns3/object.h" 28 | #include "ns3/log.h" 29 | #include "ns3/uinteger.h" 30 | #include "ns3/double.h" 31 | #include "ns3/boolean.h" 32 | #include "ns3/trace-source-accessor.h" 33 | #include "ns3/nstime.h" 34 | #include "quic-stream.h" 35 | #include "ns3/node.h" 36 | 37 | namespace ns3 { 38 | 39 | NS_LOG_COMPONENT_DEFINE ("QuicStream"); 40 | 41 | NS_OBJECT_ENSURE_REGISTERED (QuicStream); 42 | 43 | const char* const 44 | QuicStream::QuicStreamStateName[QuicStream::LAST_STATE] = {"IDLE", "OPEN", "SEND", "RECV", "SIZE_KNOWN", "DATA_SENT", "DATA_RECVD", "DATA_READ", "RESET_SENT", "RESET_RECVD", "RESET_READ"}; 45 | 46 | TypeId 47 | QuicStream::GetTypeId (void) 48 | { 49 | static TypeId tid = TypeId ("ns3::QuicStream") 50 | .SetParent () 51 | .SetGroupName ("Internet") 52 | ; 53 | return tid; 54 | } 55 | 56 | QuicStream::QuicStream () 57 | : Object () 58 | { 59 | NS_LOG_FUNCTION_NOARGS (); 60 | } 61 | 62 | QuicStream::~QuicStream () 63 | { 64 | NS_LOG_FUNCTION_NOARGS (); 65 | } 66 | 67 | } // namespace ns3 68 | -------------------------------------------------------------------------------- /model/quic-socket-tx-pfifo-scheduler.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2020 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Federico Chiariotti 19 | * Michele Polese 20 | * Umberto Paro 21 | * 22 | */ 23 | 24 | #ifndef QUICSOCKETTXPFIFOSCHEDULER_H 25 | #define QUICSOCKETTXPFIFOSCHEDULER_H 26 | 27 | #include "quic-socket-tx-scheduler.h" 28 | #include 29 | #include 30 | 31 | namespace ns3 { 32 | 33 | /** 34 | * \brief The PFIFO implementation 35 | * 36 | * This class is a Priority FIFO implementation of the socket scheduler, which prioritizes streams with a lower stream number 37 | */ 38 | class QuicSocketTxPFifoScheduler : public QuicSocketTxScheduler 39 | { 40 | public: 41 | /** 42 | * \brief Get the type ID. 43 | * \return the object TypeId 44 | */ 45 | static TypeId GetTypeId (void); 46 | 47 | QuicSocketTxPFifoScheduler (); 48 | QuicSocketTxPFifoScheduler (const QuicSocketTxPFifoScheduler &other); 49 | virtual ~QuicSocketTxPFifoScheduler (void); 50 | 51 | /** 52 | * Add a tx item to the scheduling list and assign priority 53 | * 54 | * \param item a smart pointer to a transmission item 55 | * \param retx true if the transmission item is being retransmitted 56 | * 57 | */ 58 | void Add (Ptr item, bool retx) override; 59 | 60 | private: 61 | bool m_retxFirst; 62 | }; 63 | 64 | } // namepsace ns3 65 | 66 | #endif /* QUIC_SOCKET_TX_PFIFO_SCHEDULER_H */ 67 | -------------------------------------------------------------------------------- /model/mp-quic-path-manager.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2022 Pan Lab, Department of Computer Science, University of Victoria 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Shengjie Shu 19 | */ 20 | 21 | #ifndef MpQUICPATHMANAGER_H 22 | #define MpQUICPATHMANAGER_H 23 | 24 | #include "ns3/node.h" 25 | 26 | #include "quic-socket-base.h" 27 | #include "mp-quic-subflow.h" 28 | 29 | namespace ns3 { 30 | 31 | /** 32 | * \ingroup quic 33 | * 34 | * \see MpQuicPathManagerBase 35 | * \brief (abstract) base class of all MpQuicPathManagers 36 | * 37 | * This class constitutes a basic implementation of a Quic Stream. 38 | * 39 | */ 40 | class MpQuicPathManager : public Object 41 | { 42 | public: 43 | /** 44 | * Get the type ID. 45 | * \brief Get the type ID. 46 | * \return the object TypeId 47 | */ 48 | static TypeId GetTypeId (void); 49 | 50 | MpQuicPathManager (void); 51 | virtual ~MpQuicPathManager (void); 52 | 53 | 54 | Ptr InitialSubflow0 (Address localAddress, Address peerAddress); 55 | Ptr AddSubflow(Address address, Address from, uint8_t pathId); 56 | Ptr AddSubflowWithPeerAddress(Address localAddress, Address peerAddress, uint8_t pathId); 57 | 58 | void SetSocket(Ptr sock); 59 | void SetSegSize(uint32_t size); 60 | uint32_t GetSegSize() const; 61 | void SetInitialSSThresh (uint32_t threshold); 62 | uint32_t GetInitialSSThresh (void) const; 63 | 64 | 65 | 66 | private: 67 | Ptr m_socket; 68 | uint32_t m_segSize; 69 | uint32_t m_initialSsThresh; 70 | 71 | 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* MP_QUIC_PATH_MANAGER_H */ 77 | 78 | 79 | -------------------------------------------------------------------------------- /model/quic-socket-factory.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Alvise De Biasio 19 | * Federico Chiariotti 20 | * Michele Polese 21 | * Davide Marcato 22 | * 23 | */ 24 | 25 | #include "quic-socket-factory.h" 26 | #include "ns3/socket.h" 27 | #include "ns3/assert.h" 28 | #include "ns3/log.h" 29 | 30 | 31 | namespace ns3 { 32 | NS_LOG_COMPONENT_DEFINE ("QuicSocketFactory"); 33 | 34 | NS_OBJECT_ENSURE_REGISTERED (QuicSocketFactory); 35 | 36 | TypeId QuicSocketFactory::GetTypeId (void) 37 | { 38 | static TypeId tid = TypeId ("ns3::QuicSocketFactory") 39 | .SetParent () 40 | .SetGroupName ("Internet") 41 | .AddConstructor () 42 | ; 43 | return tid; 44 | } 45 | 46 | QuicSocketFactory::QuicSocketFactory () 47 | : m_quicl4 (0) 48 | { 49 | NS_LOG_INFO ("Creating QuicSocketFactory"); 50 | m_sockets = std::vector > (); 51 | } 52 | 53 | QuicSocketFactory::~QuicSocketFactory () 54 | { 55 | NS_LOG_INFO ("Destroying QuicSocketFactory"); 56 | NS_ASSERT (m_quicl4 == 0); 57 | } 58 | 59 | void 60 | QuicSocketFactory::SetQuicL4 (Ptr quic) 61 | { 62 | m_quicl4 = quic; 63 | } 64 | 65 | Ptr 66 | QuicSocketFactory::CreateSocket (void) 67 | { 68 | NS_LOG_INFO ("QuicSocketFactory -- creating socket"); 69 | return m_quicl4->CreateSocket (); 70 | } 71 | 72 | void 73 | QuicSocketFactory::DoDispose (void) 74 | { 75 | m_quicl4 = 0; 76 | SocketFactory::DoDispose (); 77 | } 78 | 79 | } // namespace ns3 80 | -------------------------------------------------------------------------------- /quic-applications/helper/mpquic-bulk-send-helper.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2008 INRIA 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Geoge Riley 19 | * Adapted from OnOffHelper by: 20 | * Author: Mathieu Lacage 21 | */ 22 | 23 | #include "mpquic-bulk-send-helper.h" 24 | #include "ns3/inet-socket-address.h" 25 | #include "ns3/packet-socket-address.h" 26 | #include "ns3/string.h" 27 | #include "ns3/names.h" 28 | 29 | namespace ns3 { 30 | 31 | MpquicBulkSendHelper::MpquicBulkSendHelper (std::string protocol, Address address) 32 | { 33 | m_factory.SetTypeId ("ns3::MpquicBulkSendApplication"); 34 | m_factory.Set ("Protocol", StringValue (protocol)); 35 | m_factory.Set ("Remote", AddressValue (address)); 36 | } 37 | 38 | void 39 | MpquicBulkSendHelper::SetAttribute (std::string name, const AttributeValue &value) 40 | { 41 | m_factory.Set (name, value); 42 | } 43 | 44 | ApplicationContainer 45 | MpquicBulkSendHelper::Install (Ptr node) const 46 | { 47 | return ApplicationContainer (InstallPriv (node)); 48 | } 49 | 50 | ApplicationContainer 51 | MpquicBulkSendHelper::Install (std::string nodeName) const 52 | { 53 | Ptr node = Names::Find (nodeName); 54 | return ApplicationContainer (InstallPriv (node)); 55 | } 56 | 57 | ApplicationContainer 58 | MpquicBulkSendHelper::Install (NodeContainer c) const 59 | { 60 | ApplicationContainer apps; 61 | for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) 62 | { 63 | apps.Add (InstallPriv (*i)); 64 | } 65 | 66 | return apps; 67 | } 68 | 69 | Ptr 70 | MpquicBulkSendHelper::InstallPriv (Ptr node) const 71 | { 72 | Ptr app = m_factory.Create (); 73 | node->AddApplication (app); 74 | 75 | return app; 76 | } 77 | 78 | } // namespace ns3 79 | -------------------------------------------------------------------------------- /model/quic-socket-factory.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Alvise De Biasio 19 | * Federico Chiariotti 20 | * Michele Polese 21 | * Davide Marcato 22 | * 23 | */ 24 | 25 | #ifndef QUICSOCKETFACTORY_H 26 | #define QUICSOCKETFACTORY_H 27 | 28 | #include "ns3/socket-factory.h" 29 | #include "quic-socket-base.h" 30 | #include "ns3/node.h" 31 | #include "quic-l4-protocol.h" 32 | 33 | namespace ns3 { 34 | 35 | /** 36 | * \ingroup socket 37 | * \ingroup quic 38 | * 39 | * \brief API to create QUIC socket instances 40 | * 41 | * This class defines the API for QUIC socket factory. 42 | * All QUIC socket factoty implementations must provide an implementation 43 | * of CreateSocket below. 44 | * 45 | */ 46 | class QuicSocketFactory : public SocketFactory 47 | { 48 | public: 49 | QuicSocketFactory (); 50 | virtual ~QuicSocketFactory (); 51 | 52 | /** 53 | * Get the type ID. 54 | * \brief Get the type ID. 55 | * \return the object TypeId 56 | */ 57 | static TypeId GetTypeId (void); 58 | 59 | /** 60 | * \brief Implements a method to create a QUIC-based socket and return a base class smart pointer to the socket 61 | * 62 | * \return smart pointer to Socket 63 | */ 64 | virtual Ptr CreateSocket (void); 65 | 66 | /** 67 | * \brief Set the associated QUIC L4 protocol. 68 | * 69 | * \param quic the QUIC L4 protocol 70 | */ 71 | void SetQuicL4 (Ptr quic); 72 | 73 | protected: 74 | virtual void DoDispose (void); 75 | 76 | private: 77 | Ptr m_quicl4; //!< The associated QUIC L4 protocol 78 | std::vector > m_sockets; //!< The list of QuicSocketBase 79 | 80 | }; 81 | 82 | } // namespace ns3 83 | 84 | #endif /* QUIC_SOCKET_FACTORY_H */ 85 | -------------------------------------------------------------------------------- /doc/quic.rst: -------------------------------------------------------------------------------- 1 | Example Module Documentation 2 | ---------------------------- 3 | 4 | .. include:: replace.txt 5 | .. highlight:: cpp 6 | 7 | .. heading hierarchy: 8 | ------------- Chapter 9 | ************* Section (#.#) 10 | ============= Subsection (#.#.#) 11 | ############# Paragraph (no number) 12 | 13 | This is a suggested outline for adding new module documentation to |ns3|. 14 | See ``src/click/doc/click.rst`` for an example. 15 | 16 | The introductory paragraph is for describing what this code is trying to 17 | model. 18 | 19 | For consistency (italicized formatting), please use |ns3| to refer to 20 | ns-3 in the documentation (and likewise, |ns2| for ns-2). These macros 21 | are defined in the file ``replace.txt``. 22 | 23 | Model Description 24 | ***************** 25 | 26 | The source code for the new module lives in the directory ``src/quic``. 27 | 28 | Add here a basic description of what is being modeled. 29 | 30 | Design 31 | ====== 32 | 33 | Briefly describe the software design of the model and how it fits into 34 | the existing ns-3 architecture. 35 | 36 | Scope and Limitations 37 | ===================== 38 | 39 | What can the model do? What can it not do? Please use this section to 40 | describe the scope and limitations of the model. 41 | 42 | References 43 | ========== 44 | 45 | Add academic citations here, such as if you published a paper on this 46 | model, or if readers should read a particular specification or other work. 47 | 48 | Usage 49 | ***** 50 | 51 | This section is principally concerned with the usage of your model, using 52 | the public API. Focus first on most common usage patterns, then go 53 | into more advanced topics. 54 | 55 | Building New Module 56 | =================== 57 | 58 | Include this subsection only if there are special build instructions or 59 | platform limitations. 60 | 61 | Helpers 62 | ======= 63 | 64 | What helper API will users typically use? Describe it here. 65 | 66 | Attributes 67 | ========== 68 | 69 | What classes hold attributes, and what are the key ones worth mentioning? 70 | 71 | Output 72 | ====== 73 | 74 | What kind of data does the model generate? What are the key trace 75 | sources? What kind of logging output can be enabled? 76 | 77 | Advanced Usage 78 | ============== 79 | 80 | Go into further details (such as using the API outside of the helpers) 81 | in additional sections, as needed. 82 | 83 | Examples 84 | ======== 85 | 86 | What examples using this new code are available? Describe them here. 87 | 88 | Troubleshooting 89 | =============== 90 | 91 | Add any tips for avoiding pitfalls, etc. 92 | 93 | Validation 94 | ********** 95 | 96 | Describe how the model has been tested/validated. What tests run in the 97 | test suite? How much API and code is covered by the tests? Again, 98 | references to outside published work may help here. 99 | -------------------------------------------------------------------------------- /quic-applications/model/quic-client.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2007,2008,2009 INRIA, UDCAST 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Amine Ismail 19 | * 20 | * 21 | */ 22 | 23 | #ifndef QUIC_CLIENT_H 24 | #define QUIC_CLIENT_H 25 | 26 | #include "ns3/application.h" 27 | #include "ns3/event-id.h" 28 | #include "ns3/ptr.h" 29 | #include "ns3/ipv4-address.h" 30 | 31 | namespace ns3 { 32 | 33 | class Socket; 34 | class Packet; 35 | 36 | /** 37 | * \ingroup quicclientserver 38 | * 39 | * \brief A QUIC client. Sends QUIC packet carrying sequence number and time stamp 40 | * in their payloads 41 | * 42 | */ 43 | class QuicClient : public Application 44 | { 45 | public: 46 | /** 47 | * \brief Get the type ID. 48 | * \return the object TypeId 49 | */ 50 | static TypeId GetTypeId (void); 51 | 52 | QuicClient (); 53 | 54 | virtual ~QuicClient (); 55 | 56 | /** 57 | * \brief set the remote address and port 58 | * \param ip remote IP address 59 | * \param port remote port 60 | */ 61 | void SetRemote (Address ip, uint16_t port); 62 | /** 63 | * \brief set the remote address 64 | * \param addr remote address 65 | */ 66 | void SetRemote (Address addr); 67 | 68 | protected: 69 | virtual void DoDispose (void); 70 | 71 | private: 72 | 73 | virtual void StartApplication (void); 74 | virtual void StopApplication (void); 75 | 76 | /** 77 | * \brief Send a packet 78 | */ 79 | void Send (void); 80 | 81 | uint32_t m_count; //!< Maximum number of packets the application will send 82 | Time m_interval; //!< Packet inter-send time 83 | uint32_t m_size; //!< Size of the sent packet (including the SeqTsHeader) 84 | 85 | uint32_t m_sent; //!< Counter for sent packets 86 | Ptr m_socket; //!< Socket 87 | Address m_peerAddress; //!< Remote peer address 88 | uint16_t m_peerPort; //!< Remote peer port 89 | EventId m_sendEvent; //!< Event to send the next packet 90 | 91 | uint32_t m_numStreams; 92 | uint32_t m_lastUsedStream; 93 | 94 | }; 95 | 96 | } // namespace ns3 97 | 98 | #endif /* QUIC_CLIENT_H */ 99 | -------------------------------------------------------------------------------- /wscript: -------------------------------------------------------------------------------- 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- 2 | 3 | # def options(opt): 4 | # pass 5 | 6 | # def configure(conf): 7 | # conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H') 8 | 9 | def build(bld): 10 | module = bld.create_ns3_module('quic', ['internet', 'applications', 'flow-monitor', 'point-to-point']) 11 | module.source = [ 12 | 'model/quic-congestion-ops.cc', 13 | 'model/quic-socket.cc', 14 | 'model/quic-socket-base.cc', 15 | 'model/quic-socket-factory.cc', 16 | 'model/quic-l4-protocol.cc', 17 | 'model/quic-socket-rx-buffer.cc', 18 | 'model/quic-socket-tx-buffer.cc', 19 | 'model/quic-socket-tx-scheduler.cc', 20 | 'model/quic-socket-tx-pfifo-scheduler.cc', 21 | 'model/quic-socket-tx-edf-scheduler.cc', 22 | 'model/quic-stream.cc', 23 | 'model/quic-stream-base.cc', 24 | 'model/quic-l5-protocol.cc', 25 | 'model/quic-stream-tx-buffer.cc', 26 | 'model/quic-stream-rx-buffer.cc', 27 | 'model/quic-header.cc', 28 | 'model/quic-subheader.cc', 29 | 'model/quic-transport-parameters.cc', 30 | 'model/quic-bbr.cc', 31 | 'model/mp-quic-subflow.cc', 32 | 'model/mp-quic-scheduler.cc', 33 | 'model/mp-quic-path-manager.cc', 34 | 'model/mp-quic-congestion-ops.cc', 35 | 'helper/quic-helper.cc' 36 | ] 37 | 38 | module_test = bld.create_ns3_module_test_library('quic') 39 | module_test.source = [ 40 | 'test/quic-rx-buffer-test.cc', 41 | 'test/quic-tx-buffer-test.cc', 42 | 'test/quic-header-test.cc', 43 | ] 44 | 45 | headers = bld(features='ns3header') 46 | headers.module = 'quic' 47 | headers.source = [ 48 | 'model/quic-congestion-ops.h', 49 | 'model/quic-socket.h', 50 | 'model/quic-socket-base.h', 51 | 'model/quic-socket-factory.h', 52 | 'model/quic-l4-protocol.h', 53 | 'model/quic-socket-rx-buffer.h', 54 | 'model/quic-socket-tx-buffer.h', 55 | 'model/quic-socket-tx-scheduler.h', 56 | 'model/quic-socket-tx-pfifo-scheduler.h', 57 | 'model/quic-socket-tx-edf-scheduler.h', 58 | 'model/quic-stream.h', 59 | 'model/quic-stream-base.h', 60 | 'model/quic-l5-protocol.h', 61 | 'model/quic-stream-tx-buffer.h', 62 | 'model/quic-stream-rx-buffer.h', 63 | 'model/quic-header.h', 64 | 'model/quic-subheader.h', 65 | 'model/quic-transport-parameters.h', 66 | 'model/quic-bbr.h', 67 | 'helper/quic-helper.h', 68 | 'model/mp-quic-subflow.h', 69 | 'model/mp-quic-scheduler.h', 70 | 'model/mp-quic-path-manager.h', 71 | 'model/mp-quic-congestion-ops.h', 72 | 'model/windowed-filter.h' 73 | ] 74 | 75 | if bld.env.ENABLE_EXAMPLES: 76 | bld.recurse('examples') 77 | 78 | # bld.ns3_python_bindings() 79 | 80 | -------------------------------------------------------------------------------- /quic-applications/model/quic-echo-server.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * This program is free software; you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License version 2 as 5 | * published by the Free Software Foundation; 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License 13 | * along with this program; if not, write to the Free Software 14 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | * 16 | * Authors: Davide Marcato 17 | * Stefano Ravazzolo 18 | * Alvise De Biasio 19 | */ 20 | 21 | #ifndef QUIC_ECHO_SERVER_H 22 | #define QUIC_ECHO_SERVER_H 23 | 24 | #include "ns3/application.h" 25 | #include "ns3/event-id.h" 26 | #include "ns3/ptr.h" 27 | #include "ns3/address.h" 28 | 29 | namespace ns3 { 30 | 31 | class Socket; 32 | class Packet; 33 | 34 | /** 35 | * \ingroup applications 36 | * \defgroup quicecho QuicEcho 37 | */ 38 | 39 | /** 40 | * \ingroup quicecho 41 | * \brief A Quic Echo server 42 | * 43 | * Every packet received is sent back. 44 | */ 45 | class QuicEchoServer : public Application 46 | { 47 | public: 48 | /** 49 | * \brief Get the type ID. 50 | * \return the object TypeId 51 | */ 52 | static TypeId GetTypeId (void); 53 | QuicEchoServer (); 54 | virtual ~QuicEchoServer (); 55 | 56 | Ptr GetSocket (); 57 | 58 | /** 59 | * Set the ID of the stream to be used in the underlying QUIC socket 60 | * 61 | * \param streamId the ID of the stream (>0) 62 | */ 63 | void SetStreamId (uint32_t streamId); 64 | 65 | /** 66 | * Get the stream ID to be used in the underlying QUIC socket 67 | * 68 | * \return the stream ID 69 | */ 70 | uint32_t GetStreamId (void) const; 71 | 72 | protected: 73 | virtual void DoDispose (void); 74 | 75 | private: 76 | 77 | virtual void StartApplication (void); 78 | virtual void StopApplication (void); 79 | 80 | /** 81 | * \brief Handle a packet reception. 82 | * 83 | * This function is called by lower layers. 84 | * 85 | * \param socket the socket the packet was received to. 86 | */ 87 | void HandleRead (Ptr socket); 88 | 89 | uint16_t m_port; //!< Port on which we listen for incoming packets. 90 | Ptr m_socket; //!< IPv4 Socket 91 | Ptr m_socket6; //!< IPv6 Socket 92 | Address m_local; //!< local multicast address 93 | 94 | uint32_t m_streamId; 95 | }; 96 | 97 | } // namespace ns3 98 | 99 | #endif /* QUIC_ECHO_SERVER_H */ 100 | 101 | -------------------------------------------------------------------------------- /model/quic-socket.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Alvise De Biasio 19 | * Federico Chiariotti 20 | * Michele Polese 21 | * Davide Marcato 22 | * 23 | */ 24 | 25 | #define __STDC_LIMIT_MACROS 26 | 27 | #include "ns3/object.h" 28 | #include "ns3/log.h" 29 | #include "ns3/uinteger.h" 30 | #include "ns3/double.h" 31 | #include "ns3/boolean.h" 32 | #include "ns3/trace-source-accessor.h" 33 | #include "ns3/nstime.h" 34 | #include "quic-socket.h" 35 | 36 | namespace ns3 { 37 | 38 | NS_LOG_COMPONENT_DEFINE ("QuicSocket"); 39 | 40 | NS_OBJECT_ENSURE_REGISTERED (QuicSocket); 41 | 42 | const char* const 43 | QuicSocket::QuicStateName[QuicSocket::LAST_STATE] = { 44 | "IDLE", "LISTENING", "CONNECTING_SVR", 45 | "CONNECTING_CLT", "OPEN", "CLOSING" 46 | }; 47 | 48 | TypeId 49 | QuicSocket::GetTypeId (void) 50 | { 51 | static TypeId tid = TypeId ("ns3::QuicSocket") 52 | .SetParent () 53 | .SetGroupName ("Internet") 54 | ; 55 | return tid; 56 | } 57 | 58 | QuicSocket::QuicSocket () 59 | : Socket (), 60 | m_socketType (NONE) 61 | { 62 | NS_LOG_FUNCTION_NOARGS (); 63 | } 64 | 65 | QuicSocket::QuicSocket (const QuicSocket& sock) 66 | : Socket (sock), 67 | m_socketType (sock.m_socketType) 68 | { 69 | NS_LOG_FUNCTION_NOARGS (); 70 | } 71 | 72 | QuicSocket::~QuicSocket () 73 | { 74 | NS_LOG_FUNCTION_NOARGS (); 75 | } 76 | 77 | QuicSocket::QuicSocketTypes_t 78 | QuicSocket::GetQuicSocketType () const 79 | { 80 | return m_socketType; 81 | } 82 | 83 | void 84 | QuicSocket::SetQuicSocketType (QuicSocketTypes_t m_socketType) 85 | { 86 | QuicSocket::m_socketType = m_socketType; 87 | } 88 | 89 | bool 90 | QuicSocket::CheckVersionNegotiation (uint32_t version) 91 | { 92 | if (version == QUIC_VERSION_NEGOTIATION) 93 | { 94 | return true; 95 | } 96 | else if ((version & QUIC_VERSION_NEGOTIATION_PATTERN) == QUIC_VERSION_NEGOTIATION_PATTERN) 97 | { 98 | return true; 99 | } 100 | else 101 | { 102 | return false; 103 | } 104 | } 105 | 106 | } // namespace ns3 107 | -------------------------------------------------------------------------------- /model/quic-socket-tx-pfifo-scheduler.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2020 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Federico Chiariotti 19 | * Michele Polese 20 | * Umberto Paro 21 | * 22 | */ 23 | 24 | #include "quic-socket-tx-pfifo-scheduler.h" 25 | 26 | #include 27 | #include 28 | #include 29 | #include "ns3/simulator.h" 30 | 31 | #include "ns3/packet.h" 32 | #include "ns3/log.h" 33 | #include "ns3/abort.h" 34 | #include "quic-subheader.h" 35 | #include "quic-socket-base.h" 36 | 37 | namespace ns3 { 38 | 39 | NS_LOG_COMPONENT_DEFINE ("QuicSocketTxPFifoScheduler"); 40 | 41 | NS_OBJECT_ENSURE_REGISTERED (QuicSocketTxPFifoScheduler); 42 | 43 | TypeId QuicSocketTxPFifoScheduler::GetTypeId (void) 44 | { 45 | static TypeId tid = TypeId ("ns3::QuicSocketTxPFifoScheduler") 46 | .SetParent () 47 | .SetGroupName ("Internet") 48 | .AddConstructor () 49 | .AddAttribute ("RetxFirst", "Prioritize retransmissions regardless of stream", 50 | BooleanValue (false), 51 | MakeBooleanAccessor (&QuicSocketTxPFifoScheduler::m_retxFirst), 52 | MakeBooleanChecker ()) 53 | ; 54 | return tid; 55 | } 56 | 57 | QuicSocketTxPFifoScheduler::QuicSocketTxPFifoScheduler () : 58 | QuicSocketTxScheduler (), m_retxFirst (false) 59 | {} 60 | 61 | QuicSocketTxPFifoScheduler::QuicSocketTxPFifoScheduler ( 62 | const QuicSocketTxPFifoScheduler &other) : 63 | QuicSocketTxScheduler (other), m_retxFirst ( 64 | other.m_retxFirst) 65 | {} 66 | 67 | QuicSocketTxPFifoScheduler::~QuicSocketTxPFifoScheduler (void) 68 | {} 69 | 70 | void 71 | QuicSocketTxPFifoScheduler::Add (Ptr item, bool retx) 72 | { 73 | NS_LOG_FUNCTION (this << item); 74 | QuicSubheader qsb; 75 | item->m_packet->PeekHeader (qsb); 76 | NS_LOG_INFO ("Adding packet on stream " << qsb.GetStreamId ()); 77 | if (!retx) 78 | { 79 | NS_LOG_INFO ("Standard item, add at end (offset " << qsb.GetOffset () << ")"); 80 | } 81 | else 82 | { 83 | NS_LOG_INFO ("Retransmitted item, add at beginning (offset " << qsb.GetOffset () << ")"); 84 | } 85 | AddScheduleItem (CreateObject (qsb.GetStreamId (), qsb.GetOffset (), 0, item), (retx && m_retxFirst)); 86 | } 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /quic-applications/helper/quic-client-server-helper.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2008 INRIA 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mohamed Amine Ismail 19 | */ 20 | #include "quic-client-server-helper.h" 21 | #include "ns3/quic-server.h" 22 | #include "ns3/quic-client.h" 23 | #include "ns3/uinteger.h" 24 | #include "ns3/string.h" 25 | 26 | namespace ns3 { 27 | 28 | QuicServerHelper::QuicServerHelper () 29 | { 30 | m_factory.SetTypeId (QuicServer::GetTypeId ()); 31 | } 32 | 33 | QuicServerHelper::QuicServerHelper (uint16_t port) 34 | { 35 | m_factory.SetTypeId (QuicServer::GetTypeId ()); 36 | SetAttribute ("Port", UintegerValue (port)); 37 | } 38 | 39 | void 40 | QuicServerHelper::SetAttribute (std::string name, const AttributeValue &value) 41 | { 42 | m_factory.Set (name, value); 43 | } 44 | 45 | ApplicationContainer 46 | QuicServerHelper::Install (NodeContainer c) 47 | { 48 | ApplicationContainer apps; 49 | for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) 50 | { 51 | Ptr node = *i; 52 | 53 | m_server = m_factory.Create (); 54 | node->AddApplication (m_server); 55 | apps.Add (m_server); 56 | 57 | } 58 | return apps; 59 | } 60 | 61 | Ptr 62 | QuicServerHelper::GetServer (void) 63 | { 64 | return m_server; 65 | } 66 | 67 | QuicClientHelper::QuicClientHelper () 68 | { 69 | m_factory.SetTypeId (QuicClient::GetTypeId ()); 70 | } 71 | 72 | QuicClientHelper::QuicClientHelper (Address address, uint16_t port) 73 | { 74 | m_factory.SetTypeId (QuicClient::GetTypeId ()); 75 | SetAttribute ("RemoteAddress", AddressValue (address)); 76 | SetAttribute ("RemotePort", UintegerValue (port)); 77 | } 78 | 79 | QuicClientHelper::QuicClientHelper (Address address) 80 | { 81 | m_factory.SetTypeId (QuicClient::GetTypeId ()); 82 | SetAttribute ("RemoteAddress", AddressValue (address)); 83 | } 84 | 85 | void 86 | QuicClientHelper::SetAttribute (std::string name, const AttributeValue &value) 87 | { 88 | m_factory.Set (name, value); 89 | } 90 | 91 | ApplicationContainer 92 | QuicClientHelper::Install (NodeContainer c) 93 | { 94 | ApplicationContainer apps; 95 | for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) 96 | { 97 | Ptr node = *i; 98 | Ptr client = m_factory.Create (); 99 | node->AddApplication (client); 100 | apps.Add (client); 101 | } 102 | return apps; 103 | } 104 | 105 | } // namespace ns3 106 | -------------------------------------------------------------------------------- /model/quic-socket-tx-edf-scheduler.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2020 SIGNET Lab, Department of Information Engineering, University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Federico Chiariotti 19 | * Michele Polese 20 | * Umberto Paro 21 | * 22 | */ 23 | 24 | 25 | 26 | #ifndef QUICSOCKETTXEDFSCHED_H 27 | #define QUICSOCKETTXEDFSCHED_H 28 | 29 | #include "quic-socket-tx-scheduler.h" 30 | #include 31 | #include 32 | #include 33 | #include "ns3/nstime.h" 34 | 35 | namespace ns3 { 36 | 37 | /** 38 | * \brief The EDF implementation 39 | * 40 | * This class is an Earliest Deadline First implementation of the socket scheduler, which prioritizes the packet with the earliest deadline 41 | */ 42 | class QuicSocketTxEdfScheduler : public QuicSocketTxScheduler 43 | { 44 | public: 45 | /** 46 | * \brief Get the type ID. 47 | * \return the object TypeId 48 | */ 49 | static TypeId GetTypeId (void); 50 | 51 | QuicSocketTxEdfScheduler (); 52 | QuicSocketTxEdfScheduler (const QuicSocketTxEdfScheduler &other); 53 | virtual ~QuicSocketTxEdfScheduler (void); 54 | 55 | /** 56 | * Add a tx item to the scheduling list and assign priority 57 | * 58 | * \param item a smart pointer to a transmission item 59 | * \param retx true if the transmission item is being retransmitted 60 | * 61 | */ 62 | void Add (Ptr item, bool retx) override; 63 | 64 | /** 65 | * Set the latency bound for a specified stream 66 | * 67 | * \param streamId The stream ID 68 | * \param latency The stream's maximum latency 69 | */ 70 | void SetLatency (uint32_t streamId, Time latency); 71 | 72 | /** 73 | * Get the latency bound for a specified stream 74 | * 75 | * \param streamId The stream ID 76 | * \return The stream's maximum latency, or 0 if the stream is not registered 77 | */ 78 | const Time GetLatency (uint32_t streamId); 79 | 80 | /** 81 | * Set the default latency bound 82 | * 83 | * \param latency The default maximum latency 84 | */ 85 | void SetDefaultLatency (Time latency); 86 | 87 | /** 88 | * Get the default latency bound 89 | * 90 | * \param streamId The stream ID 91 | * \return The default maximum latency 92 | */ 93 | const Time GetDefaultLatency (); 94 | 95 | private: 96 | /** 97 | * Gets the deadline for a transmission item 98 | * \param item The pointer to the item 99 | */ 100 | Time GetDeadline (Ptr item); 101 | 102 | bool m_retxFirst; 103 | Time m_defaultLatency; 104 | std::map m_latencyMap; 105 | }; 106 | 107 | } // namepsace ns3 108 | 109 | #endif /* QUICSOCKETTXEDFSCHED_H */ 110 | -------------------------------------------------------------------------------- /model/mp-quic-scheduler.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2022 Pan Lab, Department of Computer Science, University of Victoria 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Shengjie Shu 19 | */ 20 | 21 | 22 | #ifndef MPQUICSCHEDULER_H 23 | #define MPQUICSCHEDULER_H 24 | 25 | #include "ns3/node.h" 26 | #include "quic-socket-base.h" 27 | #include 28 | using Eigen::MatrixXd; 29 | using Eigen::VectorXd; 30 | 31 | namespace ns3 { 32 | 33 | class MpQuicScheduler : public Object 34 | { 35 | public: 36 | 37 | typedef enum 38 | { 39 | ROUND_ROBIN, 40 | MIN_RTT, 41 | BLEST, 42 | ECF, 43 | PEEKABOO, 44 | MAB_DELAY 45 | } SchedulerType_t; 46 | 47 | /** 48 | * Get the type ID. 49 | * \brief Get the type ID. 50 | * \return the object TypeId 51 | */ 52 | static TypeId GetTypeId (void); 53 | 54 | MpQuicScheduler (void); 55 | virtual ~MpQuicScheduler (void); 56 | 57 | std::vector GetNextPathIdToUse(); 58 | void SetSocket(Ptr sock); 59 | 60 | void UpdateReward (uint32_t oldValue, uint32_t newValue); 61 | void SetNumOfLostPackets(uint16_t lost); 62 | void UpdateRewardMab(uint8_t pathId, uint32_t lostOut, uint32_t inflight, uint32_t round); 63 | uint32_t GetCurrentRound(); 64 | 65 | void PeekabooReward(uint8_t pathId, Time lastActTime); 66 | 67 | private: 68 | Ptr m_socket; 69 | uint8_t m_lastUsedPathId; 70 | 71 | 72 | std::vector > m_subflows; 73 | SchedulerType_t m_schedulerType; 74 | 75 | 76 | std::vector RoundRobin(); 77 | std::vector MinRtt(); 78 | std::vector Peekaboo(); 79 | std::vector MabDelay(); 80 | std::vector Blest(); 81 | std::vector Ecf(); 82 | std::vector LocalOpt(); 83 | 84 | std::vector m_rewards; 85 | std::vector m_rewardTemp; 86 | std::vector m_rewardTemp0; 87 | std::vector m_rewardAvg; 88 | uint32_t m_rounds; 89 | TracedValue m_reward {0}; 90 | 91 | uint32_t m_rate; 92 | uint16_t m_lostPackets; 93 | uint16_t m_lambda; 94 | uint16_t m_bVar; 95 | uint8_t m_waiting = 0; 96 | uint16_t m_select; 97 | 98 | std::vector m_cost; 99 | std::vector m_missingRounds; 100 | uint32_t m_lastUpdateRounds; 101 | uint32_t m_e; 102 | std::vector m_L; 103 | std::vector m_eL; 104 | std::vector m_p; 105 | std::vector EPR; 106 | std::vector A; 107 | std::vector b; 108 | VectorXd peek_x = VectorXd::Constant(6,0); 109 | double T_r, g = 1, R = 0, T_e; 110 | double rtt[8]; 111 | }; 112 | 113 | } // namespace ns3 114 | 115 | #endif /* MP_QUIC_SCHEDULER_H */ 116 | 117 | 118 | -------------------------------------------------------------------------------- /model/mp-quic-subflow.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2022 Pan Lab, Department of Computer Science, University of Victoria 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Shengjie Shu 19 | */ 20 | 21 | 22 | #include 23 | #include 24 | #include "ns3/buffer.h" 25 | #include "ns3/address-utils.h" 26 | #include "ns3/log.h" 27 | #include "mp-quic-subflow.h" 28 | #include 29 | #include 30 | #include "ns3/traced-value.h" 31 | #include "ns3/trace-source-accessor.h" 32 | #include 33 | #include "ns3/simulator.h" 34 | #include "time.h" 35 | #include "ns3/string.h" 36 | 37 | #include "quic-socket-tx-scheduler.h" 38 | #include "quic-socket-base.h" 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | NS_LOG_COMPONENT_DEFINE ("MpQuicSubFlow"); 45 | namespace ns3 { 46 | 47 | NS_OBJECT_ENSURE_REGISTERED (MpQuicSubFlow); 48 | 49 | 50 | TypeId 51 | MpQuicSubFlow::GetTypeId (void) 52 | { 53 | static TypeId tid = TypeId ("ns3::MpQuicSubFlow") 54 | .SetParent (Object::GetTypeId ()) 55 | 56 | .AddTraceSource ("CWindow", 57 | "The QUIC connection's congestion window", 58 | MakeTraceSourceAccessor (&MpQuicSubFlow::m_cWndTrace), 59 | "ns3::TracedValueCallback::Uint32") 60 | ; 61 | return tid; 62 | } 63 | 64 | MpQuicSubFlow::MpQuicSubFlow() 65 | : m_flowId (0), 66 | m_lastMaxData(0), 67 | m_maxDataInterval(10), 68 | m_rounds(1) 69 | { 70 | 71 | m_numPacketsReceivedSinceLastAckSent = 0; 72 | m_queue_ack = false; 73 | m_receivedPacketNumbers = std::vector (); 74 | 75 | //For congestion control 76 | m_tcb = CreateObject (); 77 | m_tcb->m_cWnd = m_tcb->m_initialCWnd; 78 | m_tcb->m_ssThresh = m_tcb->m_initialSsThresh; 79 | m_tcb->m_pacingRate = m_tcb->m_maxPacingRate; 80 | 81 | // connect callbacks 82 | bool ok; 83 | ok = m_tcb->TraceConnectWithoutContext ("CongestionWindow", 84 | MakeCallback (&MpQuicSubFlow::UpdateCwnd, this)); 85 | NS_ASSERT_MSG (ok == true, "Failed connection to CWND trace"); 86 | 87 | } 88 | 89 | MpQuicSubFlow::~MpQuicSubFlow() 90 | { 91 | m_flowId = 0; 92 | } 93 | 94 | 95 | 96 | void 97 | MpQuicSubFlow::SetSegSize (uint32_t size) 98 | { 99 | NS_LOG_FUNCTION (this << size); 100 | 101 | m_tcb->m_segmentSize = size; 102 | m_tcb->m_initialCWnd = 2 * size; 103 | m_tcb->m_kMinimumWindow = 2 * size; 104 | } 105 | 106 | uint32_t 107 | MpQuicSubFlow::GetSegSize (void) const 108 | { 109 | return m_tcb->m_segmentSize; 110 | } 111 | 112 | double 113 | MpQuicSubFlow::GetRate() 114 | { 115 | if (m_tcb->m_lastRtt.Get().GetSeconds() == 0){ 116 | return 0; 117 | } 118 | return m_tcb->m_cWnd/m_tcb->m_segmentSize/m_tcb->m_lastRtt.Get().GetSeconds(); 119 | } 120 | 121 | void 122 | MpQuicSubFlow::UpdateCwnd (uint32_t oldValue, uint32_t newValue) 123 | { 124 | m_cWndTrace (oldValue, newValue); 125 | } 126 | 127 | 128 | } // namespace ns3 129 | -------------------------------------------------------------------------------- /quic-applications/model/quic-server.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2007,2008,2009 INRIA, UDCAST 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Amine Ismail 19 | * 20 | * 21 | */ 22 | 23 | #ifndef QUIC_SERVER_H 24 | #define QUIC_SERVER_H 25 | 26 | #include "ns3/application.h" 27 | #include "ns3/event-id.h" 28 | #include "ns3/ptr.h" 29 | #include "ns3/address.h" 30 | #include "packet-loss-counter.h" 31 | #include 32 | #include 33 | 34 | namespace ns3 { 35 | /** 36 | * \ingroup applications 37 | * \defgroup quicclientserver QuicClientServer 38 | */ 39 | 40 | /** 41 | * \ingroup quicclientserver 42 | * 43 | * \brief A QUIC server, receives QUIC packets from a remote host. 44 | * 45 | * QUIC packets carry a 32bits sequence number followed by a 64bits time 46 | * stamp in their payloads. The application uses the sequence number 47 | * to determine if a packet is lost, and the time stamp to compute the delay. 48 | */ 49 | class QuicServer : public Application 50 | { 51 | public: 52 | /** 53 | * \brief Get the type ID. 54 | * \return the object TypeId 55 | */ 56 | static TypeId GetTypeId (void); 57 | QuicServer (); 58 | virtual ~QuicServer (); 59 | /** 60 | * \brief Returns the number of lost packets 61 | * \return the number of lost packets 62 | */ 63 | uint32_t GetLost (void) const; 64 | 65 | /** 66 | * \brief Returns the number of received packets 67 | * \return the number of received packets 68 | */ 69 | uint64_t GetReceived (void) const; 70 | 71 | /** 72 | * \brief Returns the size of the window used for checking loss. 73 | * \return the size of the window used for checking loss. 74 | */ 75 | uint16_t GetPacketWindowSize () const; 76 | 77 | /** 78 | * \brief Set the size of the window used for checking loss. This value should 79 | * be a multiple of 8 80 | * \param size the size of the window used for checking loss. This value should 81 | * be a multiple of 8 82 | */ 83 | void SetPacketWindowSize (uint16_t size); 84 | 85 | protected: 86 | virtual void DoDispose (void); 87 | 88 | private: 89 | 90 | virtual void StartApplication (void); 91 | virtual void StopApplication (void); 92 | 93 | /** 94 | * \brief Handle a packet reception. 95 | * 96 | * This function is called by lower layers. 97 | * 98 | * \param socket the socket the packet was received to. 99 | */ 100 | void HandleRead (Ptr socket); 101 | 102 | uint16_t m_port; //!< Port on which we listen for incoming packets. 103 | Ptr m_socket; //!< IPv4 Socket 104 | Ptr m_socket6; //!< IPv6 Socket 105 | uint64_t m_received; //!< Number of received packets 106 | PacketLossCounter m_lossCounter; //!< Lost packet counter 107 | 108 | Time m_txTs; //!< Time at which the last packet with header was received 109 | // uint32_t m_currentSequenceNumber; //!< SN of the last packet with header 110 | // uint32_t m_hSize; //!< Size of the last header received 111 | 112 | std::string m_outFilename; 113 | std::ofstream m_outFile; 114 | }; 115 | 116 | } // namespace ns3 117 | 118 | #endif /* QUIC_SERVER_H */ 119 | -------------------------------------------------------------------------------- /helper/quic-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2008 INRIA 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mathieu Lacage 19 | */ 20 | 21 | #ifndef QUIC_HELPER_H 22 | #define QUIC_HELPER_H 23 | 24 | #include "ns3/node-container.h" 25 | #include "ns3/net-device-container.h" 26 | #include "ns3/packet.h" 27 | #include "ns3/ptr.h" 28 | #include "ns3/object-factory.h" 29 | #include "ns3/ipv4-l3-protocol.h" 30 | #include "ns3/ipv6-l3-protocol.h" 31 | #include "ns3/internet-trace-helper.h" 32 | #include "ns3/internet-stack-helper.h" 33 | 34 | namespace ns3 { 35 | /** 36 | * \defgroup internet Internet 37 | * 38 | * This section documents the API of the ns-3 internet module. For a generic functional description, please refer to the ns-3 manual. 39 | */ 40 | 41 | /** 42 | * \ingroup internet 43 | * \defgroup ipv4Helpers IPv4 Helper classes 44 | */ 45 | 46 | /** 47 | * \ingroup internet 48 | * \defgroup ipv6Helpers IPv6 Helper classes 49 | */ 50 | 51 | /** 52 | * \ingroup internet 53 | * 54 | * \brief aggregate IP/TCP/UDP functionality to existing Nodes. 55 | * 56 | * This helper enables pcap and ascii tracing of events in the internet stack 57 | * associated with a node. This is substantially similar to the tracing 58 | * that happens in device helpers, but the important difference is that, well, 59 | * there is no device. This means that the creation of output file names will 60 | * change, and also the user-visible methods will not reference devices and 61 | * therefore the number of trace enable methods is reduced. 62 | * 63 | * Normally we avoid multiple inheritance in ns-3, however, the classes 64 | * PcapUserHelperForIpv4 and AsciiTraceUserHelperForIpv4 are 65 | * treated as "mixins". A mixin is a self-contained class that 66 | * encapsulates a general attribute or a set of functionality that 67 | * may be of interest to many other classes. 68 | * 69 | * This class aggregates instances of these objects, by default, to each node: 70 | * - ns3::ArpL3Protocol 71 | * - ns3::Ipv4L3Protocol 72 | * - ns3::Icmpv4L4Protocol 73 | * - ns3::Ipv6L3Protocol 74 | * - ns3::Icmpv6L4Protocol 75 | * - ns3::UdpL4Protocol 76 | * - ns3::TrafficControlLayer 77 | * - a TCP based on the TCP factory provided 78 | * - a PacketSocketFactory 79 | * - Ipv4 routing (a list routing object, a global routing object, and a static routing object) 80 | * - Ipv6 routing (a static routing object) 81 | */ 82 | class QuicHelper : public InternetStackHelper 83 | { 84 | public: 85 | /** 86 | * For each node in the input container, aggregate implementations of the 87 | * ns3::Ipv4, ns3::Ipv6, ns3::Udp, ns3::Quic, and ns3::Tcp classes. The program will assert 88 | * if this method is called on a container with a node that already has 89 | * an Ipv4 object aggregated to it. 90 | * 91 | * \param c NodeContainer that holds the set of nodes on which to install the 92 | * new stacks. 93 | */ 94 | void InstallQuic (NodeContainer c) const; 95 | 96 | private: 97 | /** 98 | * \brief create an object from its TypeId and aggregates it to the node 99 | * \param node the node 100 | * \param typeId the object TypeId 101 | */ 102 | static void CreateAndAggregateObjectFromTypeId (Ptr node, const std::string typeId); 103 | }; 104 | 105 | } // namespace ns3 106 | 107 | #endif /* QUIC_HELPER_H */ 108 | -------------------------------------------------------------------------------- /quic-applications/helper/mpquic-bulk-send-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2008 INRIA 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Geoge Riley 19 | * Adapted from OnOffHelper by: 20 | * Author: Mathieu Lacage 21 | */ 22 | 23 | #ifndef MPQUIC_BULK_SEND_HELPER_H 24 | #define MPQUIC_BULK_SEND_HELPER_H 25 | 26 | #include 27 | #include 28 | #include "ns3/object-factory.h" 29 | #include "ns3/address.h" 30 | #include "ns3/attribute.h" 31 | #include "ns3/net-device.h" 32 | #include "ns3/node-container.h" 33 | #include "ns3/application-container.h" 34 | 35 | namespace ns3 { 36 | 37 | /** 38 | * \ingroup bulksend 39 | * \brief A helper to make it easier to instantiate an ns3::BulkSendApplication 40 | * on a set of nodes. 41 | */ 42 | class MpquicBulkSendHelper 43 | { 44 | public: 45 | /** 46 | * Create an MpquicBulkSendHelper to make it easier to work with BulkSendApplications 47 | * 48 | * \param protocol the name of the protocol to use to send traffic 49 | * by the applications. This string identifies the socket 50 | * factory type used to create sockets for the applications. 51 | * A typical value would be ns3::UdpSocketFactory. 52 | * \param address the address of the remote node to send traffic 53 | * to. 54 | */ 55 | MpquicBulkSendHelper (std::string protocol, Address address); 56 | 57 | /** 58 | * Helper function used to set the underlying application attributes, 59 | * _not_ the socket attributes. 60 | * 61 | * \param name the name of the application attribute to set 62 | * \param value the value of the application attribute to set 63 | */ 64 | void SetAttribute (std::string name, const AttributeValue &value); 65 | 66 | /** 67 | * Install an ns3::BulkSendApplication on each node of the input container 68 | * configured with all the attributes set with SetAttribute. 69 | * 70 | * \param c NodeContainer of the set of nodes on which an BulkSendApplication 71 | * will be installed. 72 | * \returns Container of Ptr to the applications installed. 73 | */ 74 | ApplicationContainer Install (NodeContainer c) const; 75 | 76 | /** 77 | * Install an ns3::BulkSendApplication on the node configured with all the 78 | * attributes set with SetAttribute. 79 | * 80 | * \param node The node on which an BulkSendApplication will be installed. 81 | * \returns Container of Ptr to the applications installed. 82 | */ 83 | ApplicationContainer Install (Ptr node) const; 84 | 85 | /** 86 | * Install an ns3::BulkSendApplication on the node configured with all the 87 | * attributes set with SetAttribute. 88 | * 89 | * \param nodeName The node on which an BulkSendApplication will be installed. 90 | * \returns Container of Ptr to the applications installed. 91 | */ 92 | ApplicationContainer Install (std::string nodeName) const; 93 | 94 | private: 95 | /** 96 | * Install an ns3::BulkSendApplication on the node configured with all the 97 | * attributes set with SetAttribute. 98 | * 99 | * \param node The node on which an BulkSendApplication will be installed. 100 | * \returns Ptr to the application installed. 101 | */ 102 | Ptr InstallPriv (Ptr node) const; 103 | 104 | ObjectFactory m_factory; //!< Object factory. 105 | }; 106 | 107 | } // namespace ns3 108 | 109 | #endif /* ON_OFF_HELPER_H */ 110 | 111 | -------------------------------------------------------------------------------- /model/mp-quic-subflow.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2022 Pan Lab, Department of Computer Science, University of Victoria 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Authors: Shengjie Shu 19 | */ 20 | 21 | #include 22 | #include 23 | #include "ns3/sequence-number.h" 24 | #include "ns3/rtt-estimator.h" 25 | #include "ns3/ipv4-address.h" 26 | #include "ns3/event-id.h" 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "ns3/object.h" 33 | #include "ns3/uinteger.h" 34 | #include "ns3/traced-value.h" 35 | #include "ns3/trace-source-accessor.h" 36 | 37 | #include "quic-socket-tx-buffer.h" 38 | #include "quic-socket-base.h" 39 | 40 | #ifndef MP_QUIC_SUBFLOW_H 41 | #define MP_QUIC_SUBFLOW_H 42 | 43 | using namespace std; 44 | 45 | namespace ns3 { 46 | 47 | class MpQuicSubFlow : public Object 48 | { 49 | public: 50 | 51 | typedef enum 52 | { 53 | Validating, //!< subflow is initialed, cannot send data yet 54 | Active, //!< sublfow is fully active 55 | Closeing, //!< subflow is closing 56 | Closed //!< subflow is fully closed 57 | } SubflowStates_t; 58 | 59 | static TypeId GetTypeId (void); 60 | 61 | MpQuicSubFlow (); 62 | ~MpQuicSubFlow (); 63 | 64 | uint16_t m_flowId; 65 | Address m_localAddr; 66 | Address m_peerAddr; 67 | 68 | TracedValue m_subflowState; //!< State 69 | 70 | void SetSegSize (uint32_t size); 71 | uint32_t GetSegSize (void) const; 72 | double GetRate(); 73 | 74 | 75 | void UpdateCwnd (uint32_t oldValue, uint32_t newValue); 76 | 77 | // The following member parameters are moved from 'quic-socket-base.h' 78 | // Timers and Events 79 | EventId m_sendPendingDataEvent; //!< Micro-delay event to send pending data 80 | EventId m_retxEvent; //!< Retransmission event 81 | EventId m_idleTimeoutEvent; //!< Event triggered upon receiving or sending a packet, when it expires the connection closes 82 | EventId m_drainingPeriodEvent; //!< Event triggered upon idle timeout or immediate connection close, when it expires all closes 83 | TracedValue