//////////////////////////////////////////////////////////////////////////////// /// @brief connection endpoint list /// /// @file /// /// DISCLAIMER /// /// Copyright 2010-2011 triagens GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. /// You may obtain a copy of the License at /// /// http://www.apache.org/licenses/LICENSE-2.0 /// /// Unless required by applicable law or agreed to in writing, software /// distributed under the License is distributed on an "AS IS" BASIS, /// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. /// See the License for the specific language governing permissions and /// limitations under the License. /// /// Copyright holder is triAGENS GmbH, Cologne, Germany /// /// @author Jan Steemann /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// #ifndef TRIAGENS_FYN_REST_ENDPOINT_LIST_H #define TRIAGENS_FYN_REST_ENDPOINT_LIST_H 1 #include #include // ----------------------------------------------------------------------------- // --SECTION-- EndpointList // ----------------------------------------------------------------------------- namespace triagens { namespace rest { class EndpointList { public: // ----------------------------------------------------------------------------- // --SECTION-- typedefs // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @addtogroup Rest /// @{ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /// @brief typedef for list contents //////////////////////////////////////////////////////////////////////////////// typedef set ListType; //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------- // --SECTION-- constructors / destructors // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @addtogroup Rest /// @{ //////////////////////////////////////////////////////////////////////////////// public: //////////////////////////////////////////////////////////////////////////////// /// @brief creates an endpoint list //////////////////////////////////////////////////////////////////////////////// EndpointList (); //////////////////////////////////////////////////////////////////////////////// /// @brief destroys an endpoint list //////////////////////////////////////////////////////////////////////////////// ~EndpointList (); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------- // --SECTION-- public methods // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @addtogroup Rest /// @{ //////////////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------- // --SECTION-- private methods // ----------------------------------------------------------------------------- static const string getKey (const Endpoint::ProtocolType protocol, const Endpoint::EncryptionType encryption) { return string(getProtocolName(protocol) + " " + getEncryptionName(encryption)); } //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /// @addtogroup Rest /// @{ //////////////////////////////////////////////////////////////////////////////// public: //////////////////////////////////////////////////////////////////////////////// /// @brief return a protocol name //////////////////////////////////////////////////////////////////////////////// static const string getProtocolName (const Endpoint::ProtocolType protocol) { switch (protocol) { case Endpoint::PROTOCOL_HTTP: return "http"; default: return "unknown"; } } //////////////////////////////////////////////////////////////////////////////// /// @brief return a encryption name //////////////////////////////////////////////////////////////////////////////// static const string getEncryptionName (const Endpoint::EncryptionType encryption) { switch (encryption) { case Endpoint::ENCRYPTION_SSL: return "ssl"; case Endpoint::ENCRYPTION_NONE: default: return "tcp"; } } //////////////////////////////////////////////////////////////////////////////// /// @brief count the number of elements in a sub-list //////////////////////////////////////////////////////////////////////////////// size_t count (const Endpoint::ProtocolType, const Endpoint::EncryptionType) const; //////////////////////////////////////////////////////////////////////////////// /// @brief dump all used endpoints //////////////////////////////////////////////////////////////////////////////// void dump() const ; //////////////////////////////////////////////////////////////////////////////// /// @brief return all endpoints for a specific protocol //////////////////////////////////////////////////////////////////////////////// ListType getEndpoints (const Endpoint::ProtocolType, const Endpoint::EncryptionType) const; //////////////////////////////////////////////////////////////////////////////// /// @brief adds an endpoint for a specific protocol //////////////////////////////////////////////////////////////////////////////// bool addEndpoint (const Endpoint::ProtocolType, const Endpoint::EncryptionType, Endpoint*); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------- // --SECTION-- private variables // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// /// @addtogroup Rest /// @{ //////////////////////////////////////////////////////////////////////////////// private: //////////////////////////////////////////////////////////////////////////////// /// @brief lists of endpoints //////////////////////////////////////////////////////////////////////////////// map _lists; //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// }; } } //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// #endif // Local Variables: // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" // End: