Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MCommandReply.h
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) 2004-2006 Sage Weil <sage@newdream.net>
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_MCOMMANDREPLY_H
16 #define CEPH_MCOMMANDREPLY_H
17
18 #include "msg/Message.h"
19 #include "MCommand.h"
20
21 class MCommandReply : public Message {
22  public:
23   errorcode32_t r;
24   string rs;
25   
26   MCommandReply()
27     : Message(MSG_COMMAND_REPLY) {}
28   MCommandReply(MCommand *m, int _r)
29     : Message(MSG_COMMAND_REPLY), r(_r) {
30     header.tid = m->get_tid();
31   }
32   MCommandReply(int _r, string s)
33     : Message(MSG_COMMAND_REPLY),
34       r(_r), rs(s) { }
35 private:
36   ~MCommandReply() override {}
37
38 public:
39   const char *get_type_name() const override { return "command_reply"; }
40   void print(ostream& o) const override {
41     o << "command_reply(tid " << get_tid() << ": " << r << " " << rs << ")";
42   }
43   
44   void encode_payload(uint64_t features) override {
45     ::encode(r, payload);
46     ::encode(rs, payload);
47   }
48   void decode_payload() override {
49     bufferlist::iterator p = payload.begin();
50     ::decode(r, p);
51     ::decode(rs, p);
52   }
53 };
54
55 #endif