1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
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.
15 #ifndef CEPH_AUTHCLIENTHANDLER_H
16 #define CEPH_AUTHCLIENTHANDLER_H
19 #include "auth/Auth.h"
20 #include "common/RWLock.h"
24 class RotatingKeyRing;
26 class AuthClientHandler {
37 explicit AuthClientHandler(CephContext *cct_)
38 : cct(cct_), global_id(0), want(CEPH_ENTITY_TYPE_AUTH), have(0), need(0),
39 lock("AuthClientHandler::lock") {}
40 virtual ~AuthClientHandler() {}
42 void init(const EntityName& n) { name = n; }
44 void set_want_keys(__u32 keys) {
45 RWLock::WLocker l(lock);
46 want = keys | CEPH_ENTITY_TYPE_AUTH;
50 virtual int get_protocol() const = 0;
52 virtual void reset() = 0;
53 virtual void prepare_build_request() = 0;
54 virtual int build_request(bufferlist& bl) const = 0;
55 virtual int handle_response(int ret, bufferlist::iterator& iter) = 0;
56 virtual bool build_rotating_request(bufferlist& bl) const = 0;
58 virtual AuthAuthorizer *build_authorizer(uint32_t service_id) const = 0;
60 virtual bool need_tickets() = 0;
62 virtual void set_global_id(uint64_t id) = 0;
64 virtual void validate_tickets() = 0;
68 extern AuthClientHandler *get_auth_client_handler(CephContext *cct,
69 int proto, RotatingKeyRing *rkeys);