Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MAuth.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_MAUTH_H
16 #define CEPH_MAUTH_H
17
18 #include "messages/PaxosServiceMessage.h"
19
20 struct MAuth : public PaxosServiceMessage {
21   __u32 protocol;
22   bufferlist auth_payload;
23   epoch_t monmap_epoch;
24
25   /* if protocol == 0, then auth_payload is a set<__u32> listing protocols the client supports */
26
27   MAuth() : PaxosServiceMessage(CEPH_MSG_AUTH, 0), protocol(0), monmap_epoch(0) { }
28 private:
29   ~MAuth() override {}
30
31 public:
32   const char *get_type_name() const override { return "auth"; }
33   void print(ostream& out) const override {
34     out << "auth(proto " << protocol << " " << auth_payload.length() << " bytes"
35         << " epoch " << monmap_epoch << ")";
36   }
37
38   void decode_payload() override {
39     bufferlist::iterator p = payload.begin();
40     paxos_decode(p);
41     ::decode(protocol, p);
42     ::decode(auth_payload, p);
43     if (!p.end())
44       ::decode(monmap_epoch, p);
45     else
46       monmap_epoch = 0;
47   }
48   void encode_payload(uint64_t features) override {
49     paxos_encode();
50     ::encode(protocol, payload);
51     ::encode(auth_payload, payload);
52     ::encode(monmap_epoch, payload);
53   }
54   bufferlist& get_auth_payload() { return auth_payload; }
55 };
56
57 #endif