X-Git-Url: http://git.indexdata.com/?p=yazproxy-moved-to-github.git;a=blobdiff_plain;f=src%2Fmodules.cpp;h=689b40d4ea268f6e01b4ad6166a1066671ce554e;hp=6c2a91b1cf36da56c1c46a3d77552c4acb770187;hb=dfdff5f2d2825a500d3d27200d2ec32ee063a975;hpb=d7f41f16caf965adb1a5ffcdaa937787dfcc030a diff --git a/src/modules.cpp b/src/modules.cpp index 6c2a91b..689b40d 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -1,7 +1,5 @@ -/* $Id: modules.cpp,v 1.4 2005-06-25 15:58:33 adam Exp $ - Copyright (c) 1998-2005, Index Data. - -This file is part of the yaz-proxy. +/* This file is part of YAZ proxy + Copyright (C) 1998-2009 Index Data YAZ proxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -14,10 +12,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with YAZ proxy; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include #if HAVE_DLFCN_H @@ -33,13 +30,13 @@ class Yaz_ProxyModule { private: void *m_dl_handle; /* dlopen/close handle */ Yaz_ProxyModule_entry *m_entry; - Yaz_ProxyModule *m_next; + Yaz_ProxyModule *m_next; void *m_user_handle; /* user handle */ public: Yaz_ProxyModule(void *dl_handle, Yaz_ProxyModule_entry *ent, Yaz_ProxyModule *next); ~Yaz_ProxyModule(); - + Yaz_ProxyModule *get_next() { return m_next; }; int is_module(const char *name); int authenticate(const char *target_name, void *element_ptr, @@ -94,7 +91,7 @@ int Yaz_ProxyModule::authenticate(const char *name, { struct Yaz_ProxyModule_int0 *int0 = reinterpret_cast(m_entry->fl); - + if (!int0->authenticate) return YAZPROXY_RET_NOT_ME; return (*int0->authenticate)(m_user_handle, name, element_ptr, @@ -159,7 +156,7 @@ int Yaz_ProxyModules::add_module(const char *fname) if (dl_handle) { Yaz_ProxyModule_entry *fl_ptr = 0; - fl_ptr = reinterpret_cast + fl_ptr = reinterpret_cast (dlsym(dl_handle, "yazproxy_module")); if (fl_ptr) { @@ -169,18 +166,24 @@ int Yaz_ProxyModules::add_module(const char *fname) m_list = m; m_no_open++; - yaz_log(YLOG_LOG, "Loaded module no_open=%d", m_no_open); + yaz_log(YLOG_LOG, "Loaded module %s OK", fname); return 0; } else { + yaz_log(YLOG_WARN, "Failed loading module %s - missing symbols", + fname); return -1; dlclose(dl_handle); } } else + { + yaz_log(YLOG_WARN, "Failed loading module %s", fname); return -1; + } #else + yaz_log(YLOG_WARN, "Failed loading module %s - no module support", fname); return -1; #endif } @@ -188,6 +191,7 @@ int Yaz_ProxyModules::add_module(const char *fname) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab