// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace isc; using namespace isc::asiolink; using namespace isc::dhcp; using namespace isc::util; using namespace std; /// @brief Maximum size of an IPv6 address represented as a text string. /// /// This is 32 hexadecimal characters written in 8 groups of four, plus seven /// colon separators. const size_t ADDRESS6_TEXT_MAX_LEN = 39; /// @brief Maximum length of classes stored in a dhcp4/6_client_classes /// columns. const size_t CLIENT_CLASSES_MAX_LEN = 255; /// @brief Maximum length of the hostname stored in DNS. /// /// This length is restricted by the length of the domain-name carried /// in the Client FQDN %Option (see RFC4702 and RFC4704). const size_t HOSTNAME_MAX_LEN = 255; /// @brief Maximum length of option value. const size_t OPTION_VALUE_MAX_LEN = 4096; /// @brief Maximum length of option value specified in textual format. const size_t OPTION_FORMATTED_VALUE_MAX_LEN = 8192; /// @brief Maximum length of option space name. const size_t OPTION_SPACE_MAX_LEN = 128; /// @brief Maximum length of the server hostname. const size_t SERVER_HOSTNAME_MAX_LEN = 64; /// @brief Maximum length of the boot file name. const size_t BOOT_FILE_NAME_MAX_LEN = 128; /// @brief Numeric value representing last supported identifier. /// /// This value is used to validate whether the identifier type stored in /// a database is within bounds. of supported identifiers. const uint8_t MAX_IDENTIFIER_TYPE = static_cast(Host::LAST_IDENTIFIER_TYPE); namespace isc { namespace dhcp { RadiusHostDataSource:: RadiusHostDataSource(const DatabaseConnection::ParameterMap& parameters) { int res; rh = rc_new(); if (rh == NULL) { isc_throw(isc::Exception, "Failed to initialize Radius client"); } res = rc_add_config(rh, "authserver", "127.0.0.1", NULL, 0); if (res != 0) { isc_throw(isc::Exception, "Failed to initialize Radius client"); } res = rc_add_config(rh, "radius_timeout", "1", NULL, 0); res = rc_add_config(rh, "radius_retries", "2", NULL, 0); res = rc_add_config(rh, "serv-type", "tcp", NULL, 0); } RadiusHostDataSource::~RadiusHostDataSource() { } void RadiusHostDataSource::add(const HostPtr& host) { // cannot add a host with radius isc_throw(NotImplemented, "RadiusHostDataSource::add not implemented"); } bool RadiusHostDataSource::del(const SubnetID& subnet_id, const asiolink::IOAddress& addr) { // cannot delete hosts with radius isc_throw(NotImplemented, "RadiusHostDataSource::del not implemented"); return false; } bool RadiusHostDataSource::del4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) { // cannot delete hosts with radius isc_throw(NotImplemented, "RadiusHostDataSource::del4 not implemented"); return false; } bool RadiusHostDataSource::del6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) { // cannot delete hosts with radius isc_throw(NotImplemented, "RadiusHostDataSource::del6 not implemented"); return false; } ConstHostCollection RadiusHostDataSource::getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid) const { // TODO: libradcli call return (ConstHostCollection()); } ConstHostCollection RadiusHostDataSource::getAll(const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { // TODO: libradcli call return (ConstHostCollection()); } ConstHostCollection RadiusHostDataSource::getAll4(const asiolink::IOAddress& address) const { return (ConstHostCollection()); } ConstHostPtr RadiusHostDataSource::get4(const SubnetID& subnet_id, const HWAddrPtr& hwaddr, const DuidPtr& duid) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get4(const SubnetID& subnet_id, const asiolink::IOAddress& address) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get6(const SubnetID& subnet_id, const DuidPtr& duid, const HWAddrPtr& hwaddr) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, const size_t identifier_len) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get6(const asiolink::IOAddress& prefix, const uint8_t prefix_len) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } ConstHostPtr RadiusHostDataSource::get6(const SubnetID& subnet_id, const asiolink::IOAddress& address) const { // TODO: libradcli call ConstHostPtr result = NULL; return (result); } // Miscellaneous database methods. std::string RadiusHostDataSource::getName() const { std::string name = ""; return (name); } std::string RadiusHostDataSource::getDescription() const { return (std::string("Host data source that retrieves host information" "in radius server")); } std::pair RadiusHostDataSource::getVersion() const { // TODO: Not relevant for libradcli ? return std::make_pair(0,0); } void RadiusHostDataSource::commit() { // Not relevant for radius. } void RadiusHostDataSource::rollback() { // Not relevant for radius. } }; // end of isc::dhcp namespace }; // end of isc namespace