Debian Codegraph @

cpp/include/proton/sasl.hpp

raw
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/object.hpp"
27
28 #include <proton/sasl.h>
29
30 #include <string>
31
32 /// @file
33 /// @copybrief proton::sasl
34
35 namespace proton {
36
37 /// SASL information.
38 class sasl {
39 /// @cond INTERNAL
40 sasl(pn_sasl_t* s) : object_(s) {}
41 /// @endcond
42
43 sasl() = delete;
44
45 public:
46 /// The result of the SASL negotiation.
47 enum outcome {
48 NONE = PN_SASL_NONE, ///< Negotiation not completed
49 OK = PN_SASL_OK, ///< Authentication succeeded
50 AUTH = PN_SASL_AUTH, ///< Failed due to bad credentials
51 SYS = PN_SASL_SYS, ///< Failed due to a system error
52 PERM = PN_SASL_PERM, ///< Failed due to unrecoverable error
53 TEMP = PN_SASL_TEMP ///< Failed due to transient error
54 };
55
56 /// Get the outcome.
57 PN_CPP_EXTERN enum outcome outcome() const;
58
59 /// Get the user name.
60 PN_CPP_EXTERN std::string user() const;
61
62 /// Get the mechanism.
63 PN_CPP_EXTERN std::string mech() const;
64
65 /// @cond INTERNAL
66 private:
67 pn_sasl_t* const object_;
68
69 friend class transport;
70 /// @endcond
71 };
72
73 } // proton
74
75 #endif // PROTON_SASL_HPP