libceph, ceph: implement msgr2.1 protocol (crc and secure modes)
[linux-2.6-microblaze.git] / include / linux / ceph / auth.h
index 6728c2e..3fbe72e 100644 (file)
@@ -32,8 +32,6 @@ struct ceph_auth_handshake {
 };
 
 struct ceph_auth_client_ops {
-       const char *name;
-
        /*
         * true if we are authenticated and can connect to
         * services.
@@ -53,7 +51,9 @@ struct ceph_auth_client_ops {
         */
        int (*build_request)(struct ceph_auth_client *ac, void *buf, void *end);
        int (*handle_reply)(struct ceph_auth_client *ac, int result,
-                           void *buf, void *end);
+                           void *buf, void *end, u8 *session_key,
+                           int *session_key_len, u8 *con_secret,
+                           int *con_secret_len);
 
        /*
         * Create authorizer for connecting to a service, and verify
@@ -69,7 +69,10 @@ struct ceph_auth_client_ops {
                                        void *challenge_buf,
                                        int challenge_buf_len);
        int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
-                                      struct ceph_authorizer *a);
+                                      struct ceph_authorizer *a,
+                                      void *reply, int reply_len,
+                                      u8 *session_key, int *session_key_len,
+                                      u8 *con_secret, int *con_secret_len);
        void (*invalidate_authorizer)(struct ceph_auth_client *ac,
                                      int peer_type);
 
@@ -95,11 +98,15 @@ struct ceph_auth_client {
        const struct ceph_crypto_key *key;     /* our secret key */
        unsigned want_keys;     /* which services we want */
 
+       int preferred_mode;     /* CEPH_CON_MODE_* */
+       int fallback_mode;      /* ditto */
+
        struct mutex mutex;
 };
 
-extern struct ceph_auth_client *ceph_auth_init(const char *name,
-                                              const struct ceph_crypto_key *key);
+struct ceph_auth_client *ceph_auth_init(const char *name,
+                                       const struct ceph_crypto_key *key,
+                                       const int *con_modes);
 extern void ceph_auth_destroy(struct ceph_auth_client *ac);
 
 extern void ceph_auth_reset(struct ceph_auth_client *ac);
@@ -113,8 +120,12 @@ int ceph_auth_entity_name_encode(const char *name, void **p, void *end);
 
 extern int ceph_build_auth(struct ceph_auth_client *ac,
                    void *msg_buf, size_t msg_len);
-
 extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac);
+
+int __ceph_auth_get_authorizer(struct ceph_auth_client *ac,
+                              struct ceph_auth_handshake *auth,
+                              int peer_type, bool force_new,
+                              int *proto, int *pref_mode, int *fallb_mode);
 extern int ceph_auth_create_authorizer(struct ceph_auth_client *ac,
                                       int peer_type,
                                       struct ceph_auth_handshake *auth);
@@ -126,8 +137,11 @@ int ceph_auth_add_authorizer_challenge(struct ceph_auth_client *ac,
                                       struct ceph_authorizer *a,
                                       void *challenge_buf,
                                       int challenge_buf_len);
-extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac,
-                                            struct ceph_authorizer *a);
+int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac,
+                                     struct ceph_authorizer *a,
+                                     void *reply, int reply_len,
+                                     u8 *session_key, int *session_key_len,
+                                     u8 *con_secret, int *con_secret_len);
 extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac,
                                            int peer_type);
 
@@ -147,4 +161,34 @@ int ceph_auth_check_message_signature(struct ceph_auth_handshake *auth,
                return auth->check_message_signature(auth, msg);
        return 0;
 }
+
+int ceph_auth_get_request(struct ceph_auth_client *ac, void *buf, int buf_len);
+int ceph_auth_handle_reply_more(struct ceph_auth_client *ac, void *reply,
+                               int reply_len, void *buf, int buf_len);
+int ceph_auth_handle_reply_done(struct ceph_auth_client *ac,
+                               u64 global_id, void *reply, int reply_len,
+                               u8 *session_key, int *session_key_len,
+                               u8 *con_secret, int *con_secret_len);
+bool ceph_auth_handle_bad_method(struct ceph_auth_client *ac,
+                                int used_proto, int result,
+                                const int *allowed_protos, int proto_cnt,
+                                const int *allowed_modes, int mode_cnt);
+
+int ceph_auth_get_authorizer(struct ceph_auth_client *ac,
+                            struct ceph_auth_handshake *auth,
+                            int peer_type, void *buf, int *buf_len);
+int ceph_auth_handle_svc_reply_more(struct ceph_auth_client *ac,
+                                   struct ceph_auth_handshake *auth,
+                                   void *reply, int reply_len,
+                                   void *buf, int *buf_len);
+int ceph_auth_handle_svc_reply_done(struct ceph_auth_client *ac,
+                                   struct ceph_auth_handshake *auth,
+                                   void *reply, int reply_len,
+                                   u8 *session_key, int *session_key_len,
+                                   u8 *con_secret, int *con_secret_len);
+bool ceph_auth_handle_bad_authorizer(struct ceph_auth_client *ac,
+                                    int peer_type, int used_proto, int result,
+                                    const int *allowed_protos, int proto_cnt,
+                                    const int *allowed_modes, int mode_cnt);
+
 #endif