Qpid Proton C++  0.17.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;
52 #endif
53 
55  enum outcome {
56  NONE = PN_SASL_NONE,
57  OK = PN_SASL_OK,
58  AUTH = PN_SASL_AUTH,
59  SYS = PN_SASL_SYS,
60  PERM = PN_SASL_PERM,
61  TEMP = PN_SASL_TEMP
62  };
63 
65  PN_CPP_EXTERN enum outcome outcome() const;
66 
68  PN_CPP_EXTERN std::string user() const;
69 
71  PN_CPP_EXTERN std::string mech() const;
72 
74  private:
75  pn_sasl_t* const object_;
76 
77  friend class internal::factory<sasl>;
79 };
80 
81 } // proton
82 
83 #endif // PROTON_SASL_HPP
Failed due to a system error.
Definition: sasl.hpp:59
Failed due to unrecoverable error.
Definition: sasl.hpp:60
SASL information.
Definition: sasl.hpp:36
Failed due to bad credentials.
Definition: sasl.hpp:58
Authentication succeeded.
Definition: sasl.hpp:57
Failed due to transient error.
Definition: sasl.hpp:61
Negotiation not completed.
Definition: sasl.hpp:56
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:55
enum outcome outcome() const
Get the outcome.
The main Proton namespace.
Definition: annotation_key.hpp:30