]>
Commit | Line | Data |
---|---|---|
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 | ||
26 | class CephContext; | |
27 | class KeyServer; | |
28 | class Message; | |
29 | ||
30 | struct AuthSessionHandler { | |
31 | protected: | |
32 | CephContext *cct; | |
33 | int protocol; | |
34 | CryptoKey key; | |
35 | ||
36 | public: | |
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 | ||
54 | extern AuthSessionHandler *get_auth_session_handler(CephContext *cct, int protocol, CryptoKey key, | |
55 | uint64_t features); | |
56 | ||
57 | #endif |