Qpid Proton C++ API  0.33.0
sasl.hpp
Go to the documentation of this file.
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 
35 
36 namespace proton {
37 
39 class sasl {
41  sasl(pn_sasl_t* s) : object_(s) {}
43 
44 #if PN_CPP_HAS_DELETED_FUNCTIONS
45  sasl() = delete;
46 #else
47  sasl();
48 #endif
49 
50  public:
52  enum outcome {
53  NONE = PN_SASL_NONE,
54  OK = PN_SASL_OK,
55  AUTH = PN_SASL_AUTH,
56  SYS = PN_SASL_SYS,
57  PERM = PN_SASL_PERM,
58  TEMP = PN_SASL_TEMP
59  };
60 
62  PN_CPP_EXTERN enum outcome outcome() const;
63 
65  PN_CPP_EXTERN std::string user() const;
66 
68  PN_CPP_EXTERN std::string mech() const;
69 
71  private:
72  pn_sasl_t* const object_;
73 
74  friend class transport;
76 };
77 
78 } // proton
79 
80 #endif // PROTON_SASL_HPP
proton::sasl::mech
std::string mech() const
Get the mechanism.
proton::sasl::user
std::string user() const
Get the user name.
proton::sasl::TEMP
@ TEMP
Failed due to transient error.
Definition: sasl.hpp:58
proton::sasl::NONE
@ NONE
Negotiation not completed.
Definition: sasl.hpp:53
proton::sasl::SYS
@ SYS
Failed due to a system error.
Definition: sasl.hpp:56
proton::sasl::AUTH
@ AUTH
Failed due to bad credentials.
Definition: sasl.hpp:55
proton::sasl::outcome
outcome
The result of the SASL negotiation.
Definition: sasl.hpp:52
proton::transport
A network channel supporting an AMQP connection.
Definition: transport.hpp:37
proton
The main Proton namespace.
Definition: annotation_key.hpp:33
proton::sasl
SASL information.
Definition: sasl.hpp:39
proton::sasl::OK
@ OK
Authentication succeeded.
Definition: sasl.hpp:54
proton::sasl::PERM
@ PERM
Failed due to unrecoverable error.
Definition: sasl.hpp:57