Qpid Proton C++  0.14.0
sasl.hpp
1 #ifndef PROTON_SASL_HPP
2 #define PROTON_SASL_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./internal/export.hpp"
26 #include "./internal/config.hpp"
27 #include "./internal/object.hpp"
28 
29 #include <proton/sasl.h>
30 
31 #include <string>
32 
33 namespace proton {
34 
36 class sasl {
38  sasl(pn_sasl_t* s) : object_(s) {}
40 
41  public:
42 #if PN_CPP_HAS_DELETED_FUNCTIONS
43  sasl() = delete;
44  sasl(const sasl&) = delete;
45  sasl& operator=(const sasl&) = delete;
46  sasl& operator=(sasl&&) = delete;
47 #endif
48 #if PN_CPP_HAS_DEFAULTED_FUNCTIONS
49  sasl(sasl&&) = default;
50 #endif
51 
53  enum outcome {
54  NONE = PN_SASL_NONE,
55  OK = PN_SASL_OK,
56  AUTH = PN_SASL_AUTH,
57  SYS = PN_SASL_SYS,
58  PERM = PN_SASL_PERM,
59  TEMP = PN_SASL_TEMP
60  };
61 
63  PN_CPP_EXTERN enum outcome outcome() const;
64 
66  PN_CPP_EXTERN std::string user() const;
67 
69  PN_CPP_EXTERN std::string mech() const;
70 
72  private:
73  pn_sasl_t* const object_;
74 
75  friend class internal::factory<sasl>;
77 };
78 
79 } // proton
80 
81 #endif // PROTON_SASL_HPP
Failed due to a system error.
Definition: sasl.hpp:57
Failed due to unrecoverable error.
Definition: sasl.hpp:58
SASL information.
Definition: sasl.hpp:36
Failed due to bad credentials.
Definition: sasl.hpp:56
Authentication succeeded.
Definition: sasl.hpp:55
Failed due to transient error.
Definition: sasl.hpp:59
Negotiation not completed.
Definition: sasl.hpp:54
std::string mech() const
Get the mechanism.
std::string user() const
Get the user name.
outcome
The result of the SASL negotiation.
Definition: sasl.hpp:53
enum outcome outcome() const
Get the outcome.
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28