123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <hooks/hooks.h>
- #include <map>
- #include <boost/foreach.hpp>
- #include "logger.h"
- #include "common.h"
- using namespace isc::hooks;
- using namespace isc::data;
- std::map<std::string, std::string> cm_map;
- std::map<std::string, std::string> option122_map;
- std::string host;
- std::string database;
- std::string user;
- std::string password;
- extern "C" {
- int load(LibraryHandle& handle)
- {
- // seteo valores por defecto
- host = "mysql";
- database = "fd3_dhcp";
- user = "root";
- password = "235r2342gtfsw";
-
- ConstElementPtr hostPtr = handle.getParameter("host");
- ConstElementPtr databasePtr = handle.getParameter("database");
- ConstElementPtr userPtr = handle.getParameter("user");
- ConstElementPtr passwordPtr = handle.getParameter("password");
- if (hostPtr && hostPtr->getType() == Element::string) {
- host = hostPtr->stringValue();
- }
- if (databasePtr && databasePtr->getType() == Element::string) {
- database = databasePtr->stringValue();
- }
- if (userPtr && userPtr->getType() == Element::string) {
- user = userPtr->stringValue();
- }
- if (passwordPtr && passwordPtr->getType() == Element::string) {
- password = passwordPtr->stringValue();
- }
- return 0;
- }
- } // end extern "C"
|