]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/messenger/xio_dispatcher.h
update download target update for octopus release
[ceph.git] / ceph / src / test / messenger / xio_dispatcher.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) 2013 CohortFS, LLC
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#ifndef XIODISPATCHER_H_
16#define XIODISPATCHER_H_
17
18#include "msg/Dispatcher.h"
19#include "msg/Messenger.h"
20
21class XioDispatcher: public Dispatcher {
22private:
23 bool active;
24 Messenger *messenger;
25 uint64_t dcount;
26public:
27 explicit XioDispatcher(Messenger *msgr);
28 virtual ~XioDispatcher();
29
30 uint64_t get_dcount() { return dcount; }
31
32 void set_active() {
33 active = true;
34 };
35
36 // how i receive messages
37 virtual bool ms_dispatch(Message *m);
38
39 /**
40 * This function will be called whenever a new Connection is made to the
41 * Messenger.
42 *
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!
45 */
46 virtual void ms_handle_connect(Connection *con) { };
47
48 /**
49 * Callback indicating we have accepted an incoming connection.
50 *
51 * @param con The (new or existing) Connection associated with the session
52 */
53 virtual void ms_handle_accept(Connection *con) { };
54
55 /*
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().
61 *
62 * @param con The Connection which broke. You are not granted
63 * a reference to it.
64 */
65 virtual bool ms_handle_reset(Connection *con);
66
67 /**
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.
72 *
73 * @param con The Connection which broke. You are not granted
74 * a reference to it.
75 */
76 virtual void ms_handle_remote_reset(Connection *con);
77
78 virtual bool ms_handle_refused(Connection *con) { return false; }
79
80 /**
81 * @defgroup test_xio_dispatcher_h_auth Authentication
82 * @{
83 */
84 /**
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.
87 *
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.
7c673cae
FG
92 *
93 * @return True if this function call properly filled in *a, false otherwise.
94 */
11fdf7f2
TL
95 virtual bool ms_get_authorizer(int dest_type, AuthAuthorizer **a) {
96 return false;
7c673cae
FG
97 };
98
11fdf7f2 99
7c673cae
FG
100};
101
102#endif /* XIODISPATCHER_H_ */