]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2011 New Dream Network | |
7 | * | |
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. | |
12 | * | |
13 | */ | |
14 | ||
15 | #ifndef CEPH_MMONGETVERSIONREPLY_H | |
16 | #define CEPH_MMONGETVERSIONREPLY_H | |
17 | ||
18 | #include "msg/Message.h" | |
19 | ||
20 | #include "include/types.h" | |
21 | ||
22 | /* | |
23 | * This message is sent from the monitors to clients in response to a | |
24 | * MMonGetVersion. The latest version of the requested thing is sent | |
25 | * back. | |
26 | */ | |
27 | class MMonGetVersionReply : public Message { | |
28 | ||
29 | static const int HEAD_VERSION = 2; | |
30 | ||
31 | public: | |
32 | MMonGetVersionReply() : Message(CEPH_MSG_MON_GET_VERSION_REPLY, HEAD_VERSION) { } | |
33 | ||
34 | const char *get_type_name() const override { | |
35 | return "mon_get_version_reply"; | |
36 | } | |
37 | ||
38 | void print(ostream& o) const override { | |
39 | o << "mon_get_version_reply(handle=" << handle << " version=" << version << ")"; | |
40 | } | |
41 | ||
42 | void encode_payload(uint64_t features) override { | |
43 | ::encode(handle, payload); | |
44 | ::encode(version, payload); | |
45 | ::encode(oldest_version, payload); | |
46 | } | |
47 | ||
48 | void decode_payload() override { | |
49 | bufferlist::iterator p = payload.begin(); | |
50 | ::decode(handle, p); | |
51 | ::decode(version, p); | |
52 | if (header.version >= 2) | |
53 | ::decode(oldest_version, p); | |
54 | } | |
55 | ||
56 | ceph_tid_t handle = 0; | |
57 | version_t version = 0; | |
58 | version_t oldest_version = 0; | |
59 | ||
60 | private: | |
61 | ~MMonGetVersionReply() override {} | |
62 | }; | |
63 | ||
64 | #endif |