2016-11-10 17:05:23 -05:00
|
|
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
2020-12-31 09:48:25 +01:00
|
|
|
// Copyright (c) 2009-2020 The Bitcoin Core developers
|
2016-11-10 17:05:23 -05:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_NETMESSAGEMAKER_H
|
|
|
|
#define BITCOIN_NETMESSAGEMAKER_H
|
|
|
|
|
2017-11-10 13:57:53 +13:00
|
|
|
#include <net.h>
|
|
|
|
#include <serialize.h>
|
2016-11-10 17:05:23 -05:00
|
|
|
|
2023-11-16 15:43:15 +01:00
|
|
|
namespace NetMsg {
|
2016-11-10 17:05:23 -05:00
|
|
|
template <typename... Args>
|
2023-11-16 15:43:15 +01:00
|
|
|
CSerializedNetMsg Make(std::string msg_type, Args&&... args)
|
2016-11-10 17:05:23 -05:00
|
|
|
{
|
|
|
|
CSerializedNetMsg msg;
|
2020-05-10 19:48:11 +02:00
|
|
|
msg.m_type = std::move(msg_type);
|
2023-11-16 12:59:43 +01:00
|
|
|
VectorWriter{msg.data, 0, std::forward<Args>(args)...};
|
2016-11-10 17:05:23 -05:00
|
|
|
return msg;
|
|
|
|
}
|
2023-11-16 15:43:15 +01:00
|
|
|
} // namespace NetMsg
|
2016-11-10 17:05:23 -05:00
|
|
|
|
|
|
|
#endif // BITCOIN_NETMESSAGEMAKER_H
|