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.
16 #ifndef CEPH_AUTHSESSIONHANDLER_H
17 #define CEPH_AUTHSESSIONHANDLER_H
19 #include "include/types.h"
22 #define SESSION_SIGNATURE_FAILURE -1
24 // Defines the security applied to ongoing messages in a session, once the session is established. PLR
30 struct AuthSessionHandler {
37 explicit AuthSessionHandler(CephContext *cct_) : cct(cct_), protocol(CEPH_AUTH_UNKNOWN) {}
39 AuthSessionHandler(CephContext *cct_, int protocol_, CryptoKey key_) : cct(cct_),
40 protocol(protocol_), key(key_) {}
41 virtual ~AuthSessionHandler() { }
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;
49 int get_protocol() {return protocol;}
50 CryptoKey get_key() {return key;}
54 extern AuthSessionHandler *get_auth_session_handler(CephContext *cct, int protocol, CryptoKey key,