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