Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <TSaslServerTransport.h>
Classes | |
class | Factory |
struct | TSaslServerDefinition |
Public Member Functions | |
TSaslServerTransport (boost::shared_ptr< TTransport > transport) | |
TSaslServerTransport (const std::string &mechanism, const std::string &protocol, const std::string &serverName, const std::string &realm, unsigned flags, const std::map< std::string, std::string > &props, const std::vector< struct sasl_callback > &callbacks, boost::shared_ptr< TTransport > transport) | |
void | addServerDefinition (const std::string &mechanism, const std::string &protocol, const std::string &serverName, const std::string &realm, unsigned int flags, std::map< std::string, std::string > props, std::vector< struct sasl_callback > callbacks) |
void | setSaslServer (sasl::TSasl *saslServer) |
virtual bool | isOpen () |
virtual bool | peek () |
virtual void | open () |
virtual void | close () |
uint32_t | read (uint8_t *buf, uint32_t len) |
void | write (const uint8_t *buf, uint32_t len) |
virtual void | flush () |
boost::shared_ptr< TTransport > | getUnderlyingTransport () |
std::string | getUsername () |
Protected Member Functions | |
void | encodeInt (uint32_t x, uint8_t *buf, uint32_t offset) |
uint32_t | decodeInt (uint8_t *buf, uint32_t offset) |
uint8_t * | receiveSaslMessage (NegotiationStatus *status, uint32_t *length) |
void | sendSaslMessage (const NegotiationStatus status, const uint8_t *payload, const uint32_t length, bool flush=true) |
uint32_t | readLength () |
void | writeLength (uint32_t length) |
void | shrinkBuffer () |
Protected Attributes | |
boost::shared_ptr< TTransport > | transport_ |
Underlying transport. More... | |
TMemoryBuffer * | memBuf_ |
Buffer for reading and writing. More... | |
boost::shared_ptr< sasl::TSasl > | sasl_ |
bool | shouldWrap_ |
IF true we wrap data in encryption. More... | |
bool | isClient_ |
True if this is a client. More... | |
boost::scoped_array< uint8_t > | protoBuf_ |
Buffer to hold protocol info. More... | |
Private Member Functions | |
virtual void | handleSaslStartMessage () |
TSaslServerTransport (const std::map< std::string, TSaslServerDefinition * > &serverMap, boost::shared_ptr< TTransport > transport) | |
Private Attributes | |
std::map< std::string, TSaslServerDefinition * > | serverDefinitionMap_ |
This transport implements the Simple Authentication and Security Layer (SASL). see: http://www.ietf.org/rfc/rfc2222.txt. It is based on and depends on the presence of the cyrus-sasl library.
Definition at line 42 of file TSaslServerTransport.h.
|
private |
Definition at line 58 of file TSaslServerTransport.cpp.
References serverDefinitionMap_.
Referenced by apache::thrift::transport::TSaslServerTransport::Factory::getTransport().
apache::thrift::transport::TSaslServerTransport::TSaslServerTransport | ( | boost::shared_ptr< TTransport > | transport | ) |
Constructs a new TSaslTransport to act as a server. transport: the underlying transport used to read and write data.
apache::thrift::transport::TSaslServerTransport::TSaslServerTransport | ( | const std::string & | mechanism, |
const std::string & | protocol, | ||
const std::string & | serverName, | ||
const std::string & | realm, | ||
unsigned | flags, | ||
const std::map< std::string, std::string > & | props, | ||
const std::vector< struct sasl_callback > & | callbacks, | ||
boost::shared_ptr< TTransport > | transport | ||
) |
Construct a new TSaslTrasnport, passing in the components of the definition.
|
inline |
Definition at line 113 of file TSaslServerTransport.h.
References serverDefinitionMap_.
|
virtualinherited |
Closes the transport.
Definition at line 134 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::transport_.
|
inlineprotectedinherited |
Definition at line 173 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::readLength(), and apache::thrift::transport::TSaslTransport::receiveSaslMessage().
|
inlineprotectedinherited |
Definition at line 168 of file TSaslTransport.h.
References offset.
Referenced by apache::thrift::transport::TSaslTransport::sendSaslMessage(), and apache::thrift::transport::TSaslTransport::writeLength().
|
virtualinherited |
Flushes any pending data to be written. Typically used with buffered transport mechanisms.
TTransportException | if an error occurs |
Definition at line 228 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::transport_.
|
inlineinherited |
Returns the transport underlying this one
Definition at line 136 of file TSaslTransport.h.
References apache::thrift::transport::TSaslTransport::transport_.
Referenced by impala::ThriftServer::ThriftServerEventProcessor::createContext().
|
inherited |
Returns the username associated with the underlying sasl connection.
TTransportException | if an error occurs |
Definition at line 67 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::sasl_.
Referenced by impala::ThriftServer::ThriftServerEventProcessor::createContext().
|
privatevirtual |
Implements apache::thrift::transport::TSaslTransport.
Definition at line 76 of file TSaslServerTransport.cpp.
References apache::thrift::transport::TSaslServerTransport::TSaslServerDefinition::callbacks_, apache::thrift::transport::TSaslServerTransport::TSaslServerDefinition::flags_, apache::thrift::transport::TSaslServerTransport::TSaslServerDefinition::protocol_, apache::thrift::transport::TSaslServerTransport::TSaslServerDefinition::realm_, apache::thrift::transport::TSaslTransport::receiveSaslMessage(), apache::thrift::transport::TSaslTransport::sasl_, apache::thrift::transport::TSaslTransport::sendSaslMessage(), serverDefinitionMap_, apache::thrift::transport::TSaslServerTransport::TSaslServerDefinition::serverName_, apache::thrift::transport::TSASL_BAD, apache::thrift::transport::TSASL_ERROR, and apache::thrift::transport::TSASL_START.
|
virtualinherited |
Whether this transport is open.
Definition at line 59 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::transport_.
|
virtualinherited |
Opens the transport for communications.
TTransportException | if opening failed |
Definition at line 85 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::handleSaslStartMessage(), apache::thrift::transport::TSaslTransport::isClient_, apache::thrift::transport::TSaslTransport::receiveSaslMessage(), apache::thrift::transport::TSaslTransport::sasl_, apache::thrift::transport::TSaslTransport::sendSaslMessage(), apache::thrift::transport::TSaslTransport::transport_, apache::thrift::transport::TSASL_COMPLETE, apache::thrift::transport::TSASL_INVALID, and apache::thrift::transport::TSASL_OK.
|
virtualinherited |
Tests whether there is more data to read or if the remote side is still open.
Definition at line 63 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::transport_.
|
inherited |
Attempt to read up to the specified number of bytes into the string.
buf | Reference to the location to write the data |
len | How many bytes to read |
TTransportException | If an error occurs |
Definition at line 170 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::memBuf_, apache::thrift::transport::TSaslTransport::readLength(), apache::thrift::transport::TSaslTransport::sasl_, apache::thrift::transport::TSaslTransport::shouldWrap_, apache::thrift::transport::TSaslTransport::shrinkBuffer(), and apache::thrift::transport::TSaslTransport::transport_.
|
protectedinherited |
Opens the transport for communications.
TTransportException | if opening failed |
Definition at line 138 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::decodeInt(), apache::thrift::transport::PAYLOAD_LENGTH_BYTES, and apache::thrift::transport::TSaslTransport::transport_.
Referenced by apache::thrift::transport::TSaslTransport::read().
|
protectedinherited |
Read a complete Thrift SASL message.
TTransportException | Thrown if there is a failure reading from the underlying transport, or if a status code of BAD or ERROR is encountered. |
Definition at line 232 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::decodeInt(), apache::thrift::transport::HEADER_LENGTH, apache::thrift::transport::TSaslTransport::protoBuf_, apache::thrift::transport::STATUS_BYTES, apache::thrift::transport::TSaslTransport::transport_, apache::thrift::transport::TSASL_BAD, apache::thrift::transport::TSASL_COMPLETE, apache::thrift::transport::TSASL_ERROR, and apache::thrift::transport::TSASL_START.
Referenced by handleSaslStartMessage(), and apache::thrift::transport::TSaslTransport::open().
|
protectedinherited |
send message with SASL transport headers. status is put before the payload. If flush is false we delay flushing the underlying transport so that the following message will be in the same packet if necessary.
Definition at line 71 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::encodeInt(), apache::thrift::transport::HEADER_LENGTH, apache::thrift::transport::PAYLOAD_LENGTH_BYTES, apache::thrift::transport::STATUS_BYTES, and apache::thrift::transport::TSaslTransport::transport_.
Referenced by handleSaslStartMessage(), apache::thrift::transport::TSaslClientTransport::handleSaslStartMessage(), and apache::thrift::transport::TSaslTransport::open().
void apache::thrift::transport::TSaslServerTransport::setSaslServer | ( | sasl::TSasl * | saslServer | ) |
Set the server for this transport
Definition at line 68 of file TSaslServerTransport.cpp.
References apache::thrift::transport::TSaslTransport::isClient_, and apache::thrift::transport::TSaslTransport::sasl_.
|
protectedinherited |
If memBuf_ is filled with bytes that are already read, and has crossed a size threshold (see implementation for exact value), resize the buffer to a default value.
Definition at line 149 of file TSaslTransport.cpp.
References DEFAULT_MEM_BUF_SIZE, and apache::thrift::transport::TSaslTransport::memBuf_.
Referenced by apache::thrift::transport::TSaslTransport::read().
|
inherited |
Writes the string in its entirety to the buffer.
Note: You must call flush() to ensure the data is actually written, and available to be read back in the future. Destroying a TTransport object does not automatically flush pending data–if you destroy a TTransport object with written but unflushed data, that data may be discarded.
buf | The data to write out |
TTransportException | if an error occurs |
Definition at line 216 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::sasl_, apache::thrift::transport::TSaslTransport::shouldWrap_, apache::thrift::transport::TSaslTransport::transport_, and apache::thrift::transport::TSaslTransport::writeLength().
|
protectedinherited |
Write the given integer as 4 bytes to the underlying transport.
length | The length prefix of the next SASL message to write. |
TTransportException | Thrown if writing to the underlying transport fails. |
Definition at line 209 of file TSaslTransport.cpp.
References apache::thrift::transport::TSaslTransport::encodeInt(), apache::thrift::transport::PAYLOAD_LENGTH_BYTES, and apache::thrift::transport::TSaslTransport::transport_.
Referenced by apache::thrift::transport::TSaslTransport::write().
|
protectedinherited |
True if this is a client.
Definition at line 162 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::open(), and setSaslServer().
|
protectedinherited |
Buffer for reading and writing.
Definition at line 152 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::read(), apache::thrift::transport::TSaslTransport::shrinkBuffer(), and apache::thrift::transport::TSaslTransport::~TSaslTransport().
|
protectedinherited |
Buffer to hold protocol info.
Definition at line 165 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::receiveSaslMessage().
|
protectedinherited |
Sasl implementation class. This is passed in to the transport constructor initialized for either a client or a server.
Definition at line 156 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::getUsername(), handleSaslStartMessage(), apache::thrift::transport::TSaslClientTransport::handleSaslStartMessage(), apache::thrift::transport::TSaslTransport::open(), apache::thrift::transport::TSaslTransport::read(), setSaslServer(), and apache::thrift::transport::TSaslTransport::write().
|
private |
Definition at line 85 of file TSaslServerTransport.h.
Referenced by addServerDefinition(), handleSaslStartMessage(), and TSaslServerTransport().
|
protectedinherited |
IF true we wrap data in encryption.
Definition at line 159 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::read(), and apache::thrift::transport::TSaslTransport::write().
|
protectedinherited |
Underlying transport.
Definition at line 149 of file TSaslTransport.h.
Referenced by apache::thrift::transport::TSaslTransport::close(), apache::thrift::transport::TSaslTransport::flush(), apache::thrift::transport::TSaslTransport::getUnderlyingTransport(), apache::thrift::transport::TSaslClientTransport::handleSaslStartMessage(), apache::thrift::transport::TSaslTransport::isOpen(), apache::thrift::transport::TSaslTransport::open(), apache::thrift::transport::TSaslTransport::peek(), apache::thrift::transport::TSaslTransport::read(), apache::thrift::transport::TSaslTransport::readLength(), apache::thrift::transport::TSaslTransport::receiveSaslMessage(), apache::thrift::transport::TSaslTransport::sendSaslMessage(), apache::thrift::transport::TSaslTransport::write(), and apache::thrift::transport::TSaslTransport::writeLength().