2013-04-14 19:04:33 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2013, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Ingo Weinhold <ingo_weinhold@gmx.de>
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__PRIVATE__DAEMON_CLIENT_H_
|
|
|
|
#define _PACKAGE__PRIVATE__DAEMON_CLIENT_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <Messenger.h>
|
|
|
|
#include <package/PackageDefs.h>
|
2013-04-20 03:28:18 +04:00
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
#include <package/DaemonDefs.h>
|
2013-04-14 19:04:33 +04:00
|
|
|
|
|
|
|
|
2013-04-20 23:24:28 +04:00
|
|
|
class BDirectory;
|
|
|
|
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
|
|
|
class BInstallationLocationInfo;
|
|
|
|
class BPackageInfoSet;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
2013-04-20 03:28:18 +04:00
|
|
|
class BActivationTransaction;
|
|
|
|
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
class BDaemonClient {
|
2013-04-20 03:28:18 +04:00
|
|
|
public:
|
|
|
|
class BCommitTransactionResult;
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
public:
|
|
|
|
BDaemonClient();
|
|
|
|
~BDaemonClient();
|
|
|
|
|
|
|
|
status_t GetInstallationLocationInfo(
|
|
|
|
BPackageInstallationLocation location,
|
|
|
|
BInstallationLocationInfo& _info);
|
2013-04-20 03:28:18 +04:00
|
|
|
status_t CommitTransaction(
|
|
|
|
const BActivationTransaction& transaction,
|
|
|
|
BCommitTransactionResult& _result);
|
2013-09-10 20:37:35 +04:00
|
|
|
// B_OK only means _result is initialized,
|
|
|
|
// not the success of committing the
|
|
|
|
// transaction
|
2013-04-14 19:04:33 +04:00
|
|
|
|
2013-04-20 23:24:28 +04:00
|
|
|
status_t CreateTransaction(
|
|
|
|
BPackageInstallationLocation location,
|
|
|
|
BActivationTransaction& _transaction,
|
|
|
|
BDirectory& _transactionDirectory);
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
private:
|
|
|
|
status_t _InitMessenger();
|
|
|
|
status_t _ExtractPackageInfoSet(const BMessage& message,
|
|
|
|
const char* field, BPackageInfoSet& _infos);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BMessenger fDaemonMessenger;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-20 03:28:18 +04:00
|
|
|
class BDaemonClient::BCommitTransactionResult {
|
|
|
|
public:
|
|
|
|
BCommitTransactionResult();
|
|
|
|
BCommitTransactionResult(int32 error,
|
|
|
|
const BString& errorMessage,
|
|
|
|
const BString& errorPackage,
|
|
|
|
const BString& oldStateDirectory);
|
|
|
|
~BCommitTransactionResult();
|
|
|
|
|
|
|
|
void SetTo(int32 error, const BString& errorMessage,
|
|
|
|
const BString& errorPackage,
|
|
|
|
const BString& oldStateDirectory);
|
|
|
|
|
|
|
|
status_t Error() const;
|
|
|
|
BDaemonError DaemonError() const;
|
|
|
|
// may be B_DAEMON_OK, even if Error() is
|
|
|
|
// != B_OK, then Error() is as specific as
|
|
|
|
// is known
|
|
|
|
const BString& ErrorMessage() const;
|
|
|
|
// may be empty, even on error
|
|
|
|
const BString& ErrorPackage() const;
|
|
|
|
// may be empty, even on error
|
|
|
|
|
2013-04-20 23:24:28 +04:00
|
|
|
BString FullErrorMessage() const;
|
|
|
|
|
2013-04-20 03:28:18 +04:00
|
|
|
const BString& OldStateDirectory() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32 fError;
|
|
|
|
BString fErrorMessage;
|
|
|
|
BString fErrorPackage;
|
|
|
|
BString fOldStateDirectory;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
} // namespace BPrivate
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__PRIVATE__DAEMON_CLIENT_H_
|