]> git.proxmox.com Git - ceph.git/blame - ceph/src/auth/AuthSessionHandler.h
update sources to v12.1.2
[ceph.git] / ceph / src / auth / AuthSessionHandler.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-2009 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
16#ifndef CEPH_AUTHSESSIONHANDLER_H
17#define CEPH_AUTHSESSIONHANDLER_H
18
19#include "include/types.h"
20#include "Auth.h"
21
22#define SESSION_SIGNATURE_FAILURE -1
23
24// Defines the security applied to ongoing messages in a session, once the session is established. PLR
25
26class CephContext;
27class KeyServer;
28class Message;
29
30struct AuthSessionHandler {
31protected:
32 CephContext *cct;
33 int protocol;
34 CryptoKey key;
35
36public:
c07f9fc5 37 explicit AuthSessionHandler(CephContext *cct_) : cct(cct_), protocol(CEPH_AUTH_UNKNOWN) {}
7c673cae
FG
38
39 AuthSessionHandler(CephContext *cct_, int protocol_, CryptoKey key_) : cct(cct_),
c07f9fc5 40 protocol(protocol_), key(key_) {}
7c673cae
FG
41 virtual ~AuthSessionHandler() { }
42
7c673cae
FG
43 virtual bool no_security() = 0;
44 virtual int sign_message(Message *message) = 0;
45 virtual int check_message_signature(Message *message) = 0;
46 virtual int encrypt_message(Message *message) = 0;
47 virtual int decrypt_message(Message *message) = 0;
48
49 int get_protocol() {return protocol;}
50 CryptoKey get_key() {return key;}
51
52};
53
54extern AuthSessionHandler *get_auth_session_handler(CephContext *cct, int protocol, CryptoKey key,
55 uint64_t features);
56
57#endif