1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_MDATAPING_H
16 #define CEPH_MDATAPING_H
18 #include "msg/Message.h"
19 #include "messages/MPing.h"
20 #include "include/encoding.h"
26 struct xio_reg_mem
{};
29 typedef void (*mdata_hook_func
)(struct xio_reg_mem
*mp
);
31 class MDataPing
: public MessageInstance
<MDataPing
> {
35 static constexpr int HEAD_VERSION
= 1;
36 static constexpr int COMPAT_VERSION
= 1;
40 mdata_hook_func mdata_hook
;
41 struct xio_reg_mem mp
;
45 : MessageInstance(MSG_DATA_PING
, HEAD_VERSION
, COMPAT_VERSION
),
50 struct xio_reg_mem
*get_mp()
55 void set_rdma_hook(mdata_hook_func hook
)
67 for (const auto& node
: data
.buffers()) {
68 free(const_cast<void*>(static_cast<const void*>(node
.c_str())));
74 void decode_payload() override
{
75 auto p
= payload
.cbegin();
79 void encode_payload(uint64_t features
) override
{
82 encode(counter
, payload
);
85 std::string_view
get_type_name() const override
{ return "data_ping"; }
87 void print(ostream
& out
) const override
{
88 out
<< get_type_name() << " " << tag
<< " " << counter
;
92 #endif /* CEPH_MDATAPING_H */