Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / msg / simple / PipeConnection.h
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) 2014 Red Hat
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 CEPH_MSG_PIPECONNECTION_H
16 #define CEPH_MSG_PIPECONNECTION_H
17
18 #include "msg/Connection.h"
19
20 class Pipe;
21
22 class PipeConnection : public Connection {
23   Pipe* pipe;
24
25   friend class boost::intrusive_ptr<PipeConnection>;
26   friend class Pipe;
27
28 public:
29
30   PipeConnection(CephContext *cct, Messenger *m)
31     : Connection(cct, m),
32       pipe(NULL) { }
33
34   ~PipeConnection() override;
35
36   Pipe* get_pipe();
37
38   bool try_get_pipe(Pipe** p);
39
40   bool clear_pipe(Pipe* old_p);
41
42   void reset_pipe(Pipe* p);
43
44   bool is_connected() override;
45
46   int send_message(Message *m) override;
47   void send_keepalive() override;
48   void mark_down() override;
49   void mark_disposable() override;
50
51 }; /* PipeConnection */
52
53 typedef boost::intrusive_ptr<PipeConnection> PipeConnectionRef;
54
55 #endif