]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/messenger/simple_dispatcher.h
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) 2013 CohortFS, LLC
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 SIMPLEDISPATCHER_H_
16 #define SIMPLEDISPATCHER_H_
18 #include "msg/Dispatcher.h"
19 #include "msg/Messenger.h"
21 class SimpleDispatcher
: public Dispatcher
{
27 explicit SimpleDispatcher(Messenger
*msgr
);
28 ~SimpleDispatcher() override
;
30 uint64_t get_dcount() { return dcount
; }
36 // how i receive messages
37 bool ms_dispatch(Message
*m
) override
;
40 * This function will be called whenever a new Connection is made to the
43 * @param con The new Connection which has been established. You are not
44 * granted a reference to it -- take one if you need one!
46 void ms_handle_connect(Connection
*con
) override
{ };
49 * Callback indicating we have accepted an incoming connection.
51 * @param con The (new or existing) Connection associated with the session
53 void ms_handle_accept(Connection
*con
) override
{ };
56 * this indicates that the ordered+reliable delivery semantics have
57 * been violated. Messages may have been lost due to a fault
58 * in the network connection.
59 * Only called on lossy Connections or those you've
60 * designated mark_down_on_empty().
62 * @param con The Connection which broke. You are not granted
65 bool ms_handle_reset(Connection
*con
) override
;
68 * This indicates that the ordered+reliable delivery semantics
69 * have been violated because the remote somehow reset.
70 * It implies that incoming messages were dropped, and
71 * probably some of our previous outgoing messages were too.
73 * @param con The Connection which broke. You are not granted
76 void ms_handle_remote_reset(Connection
*con
) override
;
78 bool ms_handle_refused(Connection
*con
) override
{ return false; }
81 * @defgroup Authentication
85 * Retrieve the AuthAuthorizer for the given peer type. It might not
86 * provide one if it knows there is no AuthAuthorizer for that type.
88 * @param dest_type The peer type we want the authorizer for.
89 * @param a Double pointer to an AuthAuthorizer. The Dispatcher will fill
90 * in *a with the correct AuthAuthorizer, if it can. Make sure that you have
91 * set *a to NULL before calling in.
92 * @param force_new Force the Dispatcher to wait for a new set of keys before
93 * returning the authorizer.
95 * @return True if this function call properly filled in *a, false otherwise.
97 bool ms_get_authorizer(int dest_type
, AuthAuthorizer
**a
,
98 bool force_new
) override
{ return false; };
101 * Verify the authorizer for a new incoming Connection.
103 * @param con The new incoming Connection
104 * @param peer_type The type of the endpoint which initiated this Connection
105 * @param protocol The ID of the protocol in use (at time of writing, cephx
107 * @param authorizer The authorization string supplied by the remote
108 * @param authorizer_reply Output param: The string we should send back to
109 * the remote to authorize ourselves. Only filled in if isvalid
110 * @param isvalid Output param: True if authorizer is valid, false otherwise
112 * @return True if we were able to prove or disprove correctness of
113 * authorizer, false otherwise.
115 bool ms_verify_authorizer(Connection
*con
, int peer_type
,
116 int protocol
, bufferlist
& authorizer
,
117 bufferlist
& authorizer_reply
,
118 bool& isvalid
, CryptoKey
& session_key
,
119 std::unique_ptr
<AuthAuthorizerChallenge
> *challenge
) override
{
127 #endif /* SIMPLEDISPATCHER_H_ */