]> git.proxmox.com Git - ceph.git/blame - ceph/src/messages/MAuth.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / messages / MAuth.h
CommitLineData
7c673cae
FG
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_MAUTH_H
16#define CEPH_MAUTH_H
17
18#include "messages/PaxosServiceMessage.h"
19
11fdf7f2
TL
20class MAuth : public MessageInstance<MAuth, PaxosServiceMessage> {
21public:
22 friend factory;
23
7c673cae
FG
24 __u32 protocol;
25 bufferlist auth_payload;
26 epoch_t monmap_epoch;
27
28 /* if protocol == 0, then auth_payload is a set<__u32> listing protocols the client supports */
29
11fdf7f2 30 MAuth() : MessageInstance(CEPH_MSG_AUTH, 0), protocol(0), monmap_epoch(0) { }
7c673cae
FG
31private:
32 ~MAuth() override {}
33
34public:
11fdf7f2 35 std::string_view get_type_name() const override { return "auth"; }
7c673cae
FG
36 void print(ostream& out) const override {
37 out << "auth(proto " << protocol << " " << auth_payload.length() << " bytes"
38 << " epoch " << monmap_epoch << ")";
39 }
40
41 void decode_payload() override {
11fdf7f2
TL
42 using ceph::encode;
43 auto p = payload.cbegin();
7c673cae 44 paxos_decode(p);
11fdf7f2
TL
45 decode(protocol, p);
46 decode(auth_payload, p);
7c673cae 47 if (!p.end())
11fdf7f2 48 decode(monmap_epoch, p);
7c673cae
FG
49 else
50 monmap_epoch = 0;
51 }
52 void encode_payload(uint64_t features) override {
11fdf7f2 53 using ceph::encode;
7c673cae 54 paxos_encode();
11fdf7f2
TL
55 encode(protocol, payload);
56 encode(auth_payload, payload);
57 encode(monmap_epoch, payload);
7c673cae
FG
58 }
59 bufferlist& get_auth_payload() { return auth_payload; }
60};
61
62#endif