]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MAuthReply.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MAuthReply.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_MAUTHREPLY_H
16 #define CEPH_MAUTHREPLY_H
17
18 #include "msg/Message.h"
19 #include "common/errno.h"
20
21 class MAuthReply : public MessageInstance<MAuthReply> {
22 public:
23 friend factory;
24
25 __u32 protocol;
26 errorcode32_t result;
27 uint64_t global_id; // if zero, meaningless
28 string result_msg;
29 bufferlist result_bl;
30
31 MAuthReply() : MessageInstance(CEPH_MSG_AUTH_REPLY), protocol(0), result(0), global_id(0) {}
32 MAuthReply(__u32 p, bufferlist *bl = NULL, int r = 0, uint64_t gid=0, const char *msg = "") :
33 MessageInstance(CEPH_MSG_AUTH_REPLY),
34 protocol(p), result(r), global_id(gid),
35 result_msg(msg) {
36 if (bl)
37 result_bl = *bl;
38 }
39 private:
40 ~MAuthReply() override {}
41
42 public:
43 std::string_view get_type_name() const override { return "auth_reply"; }
44 void print(ostream& o) const override {
45 o << "auth_reply(proto " << protocol << " " << result << " " << cpp_strerror(result);
46 if (result_msg.length())
47 o << ": " << result_msg;
48 o << ")";
49 }
50
51 void decode_payload() override {
52 auto p = payload.cbegin();
53 decode(protocol, p);
54 decode(result, p);
55 decode(global_id, p);
56 decode(result_bl, p);
57 decode(result_msg, p);
58 }
59 void encode_payload(uint64_t features) override {
60 using ceph::encode;
61 encode(protocol, payload);
62 encode(result, payload);
63 encode(global_id, payload);
64 encode(result_bl, payload);
65 encode(result_msg, payload);
66 }
67 };
68
69 #endif