summaryrefslogtreecommitdiffstats
path: root/utils.hpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-11-21 14:19:28 -0800
committerPatrick Venture <venture@google.com>2018-11-28 08:47:53 -0800
commitc18e2b649691e393f0c6e0fcd9af288b68d7d9b5 (patch)
tree50b0ea97c204c1b43d32303f8a3ce0b115eaf98f /utils.hpp
parent2536863d32314250b94794143d6cadaf8e8c86fe (diff)
downloadphosphor-ipmi-blobs-c18e2b649691e393f0c6e0fcd9af288b68d7d9b5.tar.gz
phosphor-ipmi-blobs-c18e2b649691e393f0c6e0fcd9af288b68d7d9b5.zip
add dynamic library interface to enable testing
Add interface defining the methods for dynamic linking to enable testing. Change-Id: If4d090d3cedc019b426435a1f651191803bfc1a9 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'utils.hpp')
-rw-r--r--utils.hpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/utils.hpp b/utils.hpp
index 9b75a40..50d320e 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -1,15 +1,34 @@
#pragma once
+#include "internal/sys.hpp"
+
+#include <blobs-ipmid/manager.hpp>
+#include <memory>
#include <string>
namespace blobs
{
+using HandlerFactory = std::unique_ptr<GenericBlobInterface> (*)();
+
+/**
+ * The bitbake recipe symlinks the library lib*.so.? into the folder
+ * only, and not the other names, .so, .so.?.?, .so.?.?.?
+ *
+ * Therefore only care if it's lib*.so.?
+ *
+ * @param[in] the path to check.
+ * @return true if matches, false otherwise
+ */
+bool matchBlobHandler(const std::string& filename);
/**
* @brief Given a path, find libraries (*.so only) and load them.
*
+ * @param[in] manager - pointer to a manager
* @param[in] paths - list of fully qualified paths to libraries to load.
+ * @param[in] sys - pointer to implementation of the dlsys interface.
*/
-void loadLibraries(const std::string& path);
+void loadLibraries(ManagerInterface* manager, const std::string& path,
+ const internal::DlSysInterface* sys = &internal::dlsys_impl);
} // namespace blobs
OpenPOWER on IntegriCloud