}
}
+std::string ExternalEncryptionClient::getDevicePath() const
+{
+ try {
+ return context->methodCall<std::string>("ExternalEncryptionServer::getDevicePath");
+ } catch (runtime::Exception& e) {
+ return "";
+ }
+}
+
} // namespace ode
unsigned int getSupportedOptions();
+ std::string getDevicePath() const;
+
private:
RmiClientPtr& context;
};
}
}
+std::string InternalEncryptionClient::getDevicePath() const
+{
+ try {
+ return context->methodCall<std::string>("InternalEncryptionServer::getDevicePath");
+ } catch (runtime::Exception& e) {
+ return "";
+ }
+}
+
} // namespace ode
unsigned int getSupportedOptions();
+ std::string getDevicePath() const;
+
private:
RmiClientPtr& context;
};
#include "error-translation.h"
#include "rmi/common.h"
+#include <string.h>
+
using namespace ode;
int ode_external_encryption_set_mount_password(const char* password)
return ODE_ERROR_NONE;
}
+
+/*
+ * TODO
+ * This API is required to move from old external key API to new generic one
+ * (see keys.h). The old API could be then removed. Next step could be to pass
+ * the device as argument to all functions as LUKS API does. If that happens
+ * this function will become unnecessary.
+ */
+int ode_external_encryption_get_device_path(char** device)
+{
+ RET_ON_FAILURE(device, ODE_ERROR_INVALID_PARAMETER);
+
+ ClientContext client;
+ RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
+ ExternalEncryptionClient external = client.createInterface<ExternalEncryptionClient>();
+ std::string path = external.getDevicePath();
+ if (path.empty())
+ return ODE_ERROR_UNKNOWN;
+
+ *device = strdup(path.c_str());
+ return ODE_ERROR_NONE;
+}
ODE_API int ode_external_encryption_unset_mount_event_cb();
/**
+ * @brief Get the device path of external storage
+ * @details Services can use this API to retrieve the path to external
+ * storage device node.
+ * @since_tizen 4.0
+ * @param[out] device The path to external storage device node. Caller is
+ * responsible for freeing it with free()
+ * @return #ODE_ERROR_NONE on success, otherwise a negative value
+ * @retval #ODE_ERROR_NONE Successful
+ * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ODE_ERROR_CONNECTION_REFUSED Connection to server failed
+ * @retval #ODE_ERROR_UNKNOWN Unknown error
+ */
+ODE_API int ode_external_encryption_get_device_path(char** device);
+
+/**
* @}
*/
#include "error-translation.h"
#include "rmi/common.h"
+#include <string.h>
+
using namespace ode;
int ode_internal_encryption_set_mount_password(const char* password)
return ODE_ERROR_NONE;
}
+
+/*
+ * TODO
+ * This API is required to move from old internal key API to new generic one
+ * (see keys.h). The old API could be then removed. Next step could be to pass
+ * the device as argument to all functions as LUKS API does. If that happens
+ * this function will become unnecessary.
+ */
+int ode_internal_encryption_get_device_path(char** device)
+{
+ RET_ON_FAILURE(device, ODE_ERROR_INVALID_PARAMETER);
+
+ ClientContext client;
+ RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
+ InternalEncryptionClient internal = client.createInterface<InternalEncryptionClient>();
+ std::string path = internal.getDevicePath();
+ if (path.empty())
+ return ODE_ERROR_UNKNOWN;
+
+ *device = strdup(path.c_str());
+ return ODE_ERROR_NONE;
+}
*/
ODE_API int ode_internal_encryption_unset_mount_event_cb();
+/**
+ * @brief Get the device path of internal storage
+ * @details Services can use this API to retrieve the path to internal
+ * storage device node.
+ * @since_tizen 4.0
+ * @param[out] device The path to internal storage device node. Caller is
+ * responsible for freeing it with free()
+ * @return #ODE_ERROR_NONE on success, otherwise a negative value
+ * @retval #ODE_ERROR_NONE Successful
+ * @retval #ODE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ODE_ERROR_CONNECTION_REFUSED Connection to server failed
+ * @retval #ODE_ERROR_UNKNOWN Unknown error
+ */
+ODE_API int ode_internal_encryption_get_device_path(char** device);
+
/*
* @}
*/
};
virtual unsigned int getSupportedOptions() = 0;
+
+ virtual std::string getDevicePath() const = 0;
};
} // namespace ode
};
virtual unsigned int getSupportedOptions() = 0;
+
+ virtual std::string getDevicePath() const = 0;
};
} // namespace ode
server.expose(this, PRIVILEGE_PLATFORM, (int)(ExternalEncryptionServer::verifyPassword)(std::string));
server.expose(this, "", (int)(ExternalEncryptionServer::getState)());
server.expose(this, "", (unsigned int)(ExternalEncryptionServer::getSupportedOptions)());
+ server.expose(this, "", (std::string)(ExternalEncryptionServer::getDevicePath)());
server.createNotification("ExternalEncryptionServer::mount");
return engine->getSupportedOptions();
}
+std::string ExternalEncryptionServer::getDevicePath() const
+{
+ return engine->getSource();
+}
+
} // namespace ode
unsigned int getSupportedOptions();
+ std::string getDevicePath() const;
+
private:
ServerContext& server;
server.expose(this, PRIVILEGE_PLATFORM, (int)(InternalEncryptionServer::verifyPassword)(std::string));
server.expose(this, "", (int)(InternalEncryptionServer::getState)());
server.expose(this, "", (unsigned int)(InternalEncryptionServer::getSupportedOptions)());
+ server.expose(this, "", (std::string)(InternalEncryptionServer::getDevicePath)());
server.createNotification("InternalEncryptionServer::mount");
return engine->getSupportedOptions();
}
+std::string InternalEncryptionServer::getDevicePath() const
+{
+ return engine->getSource();
+}
+
} // namespace ode
unsigned int getSupportedOptions();
+ std::string getDevicePath() const;
+
private:
ServerContext& server;