LCOV - code coverage report
Current view: top level - src - netmessagemaker.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 9 10 90.0 %
Date: 2023-11-06 23:13:05 Functions: 21 56 37.5 %
Branches: 24 136 17.6 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2                 :            : // Copyright (c) 2009-2020 The Bitcoin Core developers
       3                 :            : // Distributed under the MIT software license, see the accompanying
       4                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5                 :            : 
       6                 :            : #ifndef BITCOIN_NETMESSAGEMAKER_H
       7                 :            : #define BITCOIN_NETMESSAGEMAKER_H
       8                 :            : 
       9                 :            : #include <net.h>
      10                 :            : #include <serialize.h>
      11                 :            : 
      12                 :            : class CNetMsgMaker
      13                 :            : {
      14                 :            : public:
      15                 :       6489 :     explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){}
      16                 :            : 
      17                 :            :     template <typename... Args>
      18                 :       6072 :     CSerializedNetMsg Make(int nFlags, std::string msg_type, Args&&... args) const
      19                 :            :     {
      20                 :       6072 :         CSerializedNetMsg msg;
      21                 :       6072 :         msg.m_type = std::move(msg_type);
      22 [ +  - ][ +  - ]:       6072 :         CVectorWriter{nFlags | nVersion, msg.data, 0, std::forward<Args>(args)...};
         [ +  - ][ +  - ]
         [ #  # ][ +  - ]
         [ #  # ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ +  - ]
      23                 :       6072 :         return msg;
      24 [ +  - ][ +  - ]:       6072 :     }
         [ +  - ][ +  - ]
         [ #  # ][ +  - ]
         [ #  # ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ +  - ]
      25                 :            : 
      26                 :            :     template <typename... Args>
      27                 :       6072 :     CSerializedNetMsg Make(std::string msg_type, Args&&... args) const
      28                 :            :     {
      29 [ +  - ][ +  - ]:       6072 :         return Make(0, std::move(msg_type), std::forward<Args>(args)...);
         [ +  - ][ #  # ]
         [ +  - ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ +  - ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
      30                 :          0 :     }
      31                 :            : 
      32                 :            : private:
      33                 :            :     const int nVersion;
      34                 :            : };
      35                 :            : 
      36                 :            : #endif // BITCOIN_NETMESSAGEMAKER_H

Generated by: LCOV version 1.14