]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/msg/simple/SimpleMessenger.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / msg / simple / SimpleMessenger.h
index aebc190e14e38fc8ffe3f6a495dbee1dae3e9eb6..b1aad539998057db8c3838b5cf277b24860198b3 100644 (file)
 #ifndef CEPH_SIMPLEMESSENGER_H
 #define CEPH_SIMPLEMESSENGER_H
 
+#include <list>
+#include <map>
+
 #include "include/types.h"
 #include "include/xlist.h"
 
-#include <list>
-#include <map>
-using namespace std;
 #include "include/unordered_map.h"
 #include "include/unordered_set.h"
 
 #include "common/Mutex.h"
-#include "include/Spinlock.h"
 #include "common/Cond.h"
 #include "common/Thread.h"
 #include "common/Throttle.h"
 
+#include "include/spinlock.h"
+
 #include "msg/SimplePolicyMessenger.h"
 #include "msg/Message.h"
-#include "include/assert.h"
+#include "include/ceph_assert.h"
 
 #include "msg/DispatchQueue.h"
 #include "Pipe.h"
@@ -92,8 +93,9 @@ public:
   /** @defgroup Accessors
    * @{
    */
-  void set_addr_unknowns(const entity_addr_t& addr) override;
-  void set_addr(const entity_addr_t &addr) override;
+  bool set_addr_unknowns(const entity_addrvec_t& addr) override;
+  void set_addrs(const entity_addrvec_t &addr) override;
+  void set_myaddrs(const entity_addrvec_t& a) override;
 
   int get_dispatch_queue_len() override {
     return dispatch_queue.get_queue_len();
@@ -109,7 +111,7 @@ public:
    * @{
    */
   void set_cluster_protocol(int p) override {
-    assert(!started && !did_bind);
+    ceph_assert(!started && !did_bind);
     cluster_protocol = p;
   }
 
@@ -133,8 +135,13 @@ public:
    * @defgroup Messaging
    * @{
    */
-  int send_message(Message *m, const entity_inst_t& dest) override {
-    return _send_message(m, dest);
+  int send_to(
+    Message *m,
+    int type,
+    const entity_addrvec_t& addr) override {
+    // temporary
+    return _send_message(m, entity_inst_t(entity_name_t(type, -1),
+                                         addr.legacy_addr()));
   }
 
   int send_message(Message *m, Connection *con) {
@@ -147,7 +154,7 @@ public:
    * @defgroup Connection Management
    * @{
    */
-  ConnectionRef get_connection(const entity_inst_t& dest) override;
+  ConnectionRef connect_to(int type, const entity_addrvec_t& addrs) override;
   ConnectionRef get_loopback_connection() override;
   int send_keepalive(Connection *con);
   void mark_down(const entity_addr_t& addr) override;
@@ -283,7 +290,9 @@ private:
   /// counter for the global seq our connection protocol uses
   __u32 global_seq;
   /// lock to protect the global_seq
-  ceph_spinlock_t global_seq_lock;
+  ceph::spinlock global_seq_lock;
+
+  entity_addr_t my_addr;
 
   /**
    * hash map of addresses to Pipes
@@ -293,7 +302,7 @@ private:
    */
   ceph::unordered_map<entity_addr_t, Pipe*> rank_pipe;
   /**
-   * list of pipes are in teh process of accepting
+   * list of pipes are in the process of accepting
    *
    * These are not yet in the rank_pipe map.
    */
@@ -339,17 +348,6 @@ public:
    * @{
    */
 
-  /**
-   * This wraps ms_deliver_get_authorizer. We use it for Pipe.
-   */
-  AuthAuthorizer *get_authorizer(int peer_type, bool force_new);
-  /**
-   * This wraps ms_deliver_verify_authorizer; we use it for Pipe.
-   */
-  bool verify_authorizer(Connection *con, int peer_type, int protocol, bufferlist& auth,
-                        bufferlist& auth_reply,
-                         bool& isvalid,CryptoKey& session_key,
-                        std::unique_ptr<AuthAuthorizerChallenge> *challenge);
   /**
    * Increment the global sequence for this SimpleMessenger and return it.
    * This is for the connect protocol, although it doesn't hurt if somebody
@@ -358,11 +356,12 @@ public:
    * @return a global sequence ID that nobody else has seen.
    */
   __u32 get_global_seq(__u32 old=0) {
-    ceph_spin_lock(&global_seq_lock);
+    std::lock_guard<decltype(global_seq_lock)> lg(global_seq_lock);
+
     if (old > global_seq)
       global_seq = old;
     __u32 ret = ++global_seq;
-    ceph_spin_unlock(&global_seq_lock);
+
     return ret;
   }
   /**