13#ifndef ZYPP_MEDIA_PRIVATE_PROVIDE_MESSAGE_P_H_INCLUDED
14#define ZYPP_MEDIA_PRIVATE_PROVIDE_MESSAGE_P_H_INCLUDED
292#include <zypp-core/zyppng/pipelines/Expected>
294#include <zypp-media/ng/ProvideSpec>
295#include <zypp-media/ng/HeaderValueMap>
297#include <boost/iterator/iterator_adaptor.hpp>
303 class ProvideMessage;
370 static constexpr std::string_view
typeName =
"ProviderConfiguration";
414 static constexpr std::string_view
typeName =
"WorkerCaps";
432 constexpr std::string_view
Url (
"url");
453 constexpr std::string_view
NewUrl (
"new_url");
458 constexpr std::string_view
NewUrl (
"new_url");
463 constexpr std::string_view
Reason (
"reason");
465 constexpr std::string_view
History (
"history");
470 constexpr std::string_view
Url (
"url");
480 constexpr std::string_view
Url (
"url");
484 constexpr std::string_view
MediaNr (
"media_nr");
485 constexpr std::string_view
Device (
"device");
486 constexpr std::string_view
Label (
"label");
496 constexpr std::string_view
Url (
"url");
509 constexpr std::string_view
Label (
"label");
510 constexpr std::string_view
MediaNr (
"media_nr");
511 constexpr std::string_view
Device (
"device");
512 constexpr std::string_view
Desc (
"desc");
517 constexpr std::string_view
device (
"device");
531 static constexpr std::string_view
typeName =
"ProvideMessage";
541 static ProvideMessage createAuthInfo (
const uint32_t reqId,
const std::string &user,
const std::string &pw, int64_t timestamp,
const std::map<std::string, std::string> &extraValues = {} );
548 ,
const zypp::Url &url
549 ,
const std::optional<std::string> &filename = {}
550 ,
const std::optional<std::string> &deltaFile = {}
551 ,
const std::optional<int64_t> &expFilesize = {}
552 ,
bool checkExistOnly = false );
557 ,
const zypp::Url &url
558 ,
const std::string attachId
559 ,
const std::string &label
560 ,
const std::optional<std::string> &verifyType = {}
561 ,
const std::optional<std::string> &verifyData = {}
562 ,
const std::optional<int32_t> &mediaNr = {} );
565 static ProvideMessage createAuthDataRequest (
const uint32_t reqId,
const zypp::Url &effectiveUrl,
const std::string &lastTriedUser =
"",
const std::optional<int64_t> &lastAuthTimestamp = {},
const std::map<std::string, std::string> &extraValues = {} );
566 static ProvideMessage createMediaChangeRequest (
const uint32_t reqId,
const std::string &label, int32_t mediaNr,
const std::vector<std::string> &devices,
const std::optional<std::string> &desc );
574 const std::vector<ProvideMessage::FieldVal> &
values (
const std::string_view &str )
const;
575 const std::vector<ProvideMessage::FieldVal> &
values (
const std::string &str )
const;
576 const HeaderValueMap &
headers()
const;
Container of Capability (currently read only).
Command frame for communication with PluginScript.
static ProvideMessage createProvideStarted(const uint32_t reqId, const zypp::Url &url, const std::optional< std::string > &localFilename={}, const std::optional< std::string > &stagingFilename={})
static ProvideMessage createAuthInfo(const uint32_t reqId, const std::string &user, const std::string &pw, int64_t timestamp, const std::map< std::string, std::string > &extraValues={})
expected< zypp::PluginFrame > toStompMessage() const
static expected< ProvideMessage > fromStompMessage(const zypp::PluginFrame &msg)
ProvideMessage & operator=(ProvideMessage &&)=default
static ProvideMessage createRedirect(const uint32_t reqId, const zypp::Url &newUrl)
static ProvideMessage createMetalinkRedir(const uint32_t reqId, const std::vector< zypp::Url > &newUrls)
ProvideMessage(const ProvideMessage &)=default
static ProvideMessage createCancel(const uint32_t reqId)
const HeaderValueMap & headers() const
static constexpr std::string_view typeName
static ProvideMessage createMediaChanged(const uint32_t reqId)
static ProvideMessage createProvideFinished(const uint32_t reqId, const std::string &localFilename, bool cacheHit)
ProvideMessage & operator=(const ProvideMessage &)=default
static ProvideMessage createMediaChangeRequest(const uint32_t reqId, const std::string &label, int32_t mediaNr, const std::vector< std::string > &devices, const std::optional< std::string > &desc)
FieldVal value(const std::string_view &str, const FieldVal &defaultVal=FieldVal()) const
const std::vector< ProvideMessage::FieldVal > & values(const std::string_view &str) const
ProvideMessage(ProvideMessage &&)=default
void setValue(const std::string &name, const FieldVal &value)
static ProvideMessage createAuthDataRequest(const uint32_t reqId, const zypp::Url &effectiveUrl, const std::string &lastTriedUser="", const std::optional< int64_t > &lastAuthTimestamp={}, const std::map< std::string, std::string > &extraValues={})
static ProvideMessage createErrorResponse(const uint32_t reqId, const Code code, const std::string &reason, bool transient=false)
static ProvideMessage createProvide(const uint32_t reqId, const zypp::Url &url, const std::optional< std::string > &filename={}, const std::optional< std::string > &deltaFile={}, const std::optional< int64_t > &expFilesize={}, bool checkExistOnly=false)
void setRequestId(const uint id)
static ProvideMessage createDetachFinished(const uint32_t reqId)
void addValue(const std::string &name, const FieldVal &value)
static ProvideMessage createDetach(const uint32_t reqId, const zypp::Url &attachUrl)
void setCode(const Code newCode)
static expected< ProvideMessage > create(const zypp::PluginFrame &message)
static ProvideMessage createAttachFinished(const uint32_t reqId, const std::optional< std::string > &localMountPoint={})
static ProvideMessage createAttach(const uint32_t reqId, const zypp::Url &url, const std::string attachId, const std::string &label, const std::optional< std::string > &verifyType={}, const std::optional< std::string > &verifyData={}, const std::optional< int32_t > &mediaNr={})
static zyppng::expected< ProviderConfiguration > fromStompMessage(const zypp::PluginFrame &msg)
zyppng::expected< zypp::PluginFrame > toStompMessage() const
static constexpr std::string_view typeName
zyppng::expected< zypp::PluginFrame > toStompMessage() const
const std::string & worker_name() const
WorkerCaps(WorkerCaps &&)=default
WorkerCaps(const WorkerCaps &)=default
uint32_t _protocolVersion
void set_worker_type(WorkerType t)
WorkerCaps & operator=(const WorkerCaps &)=default
void set_protocol_version(uint32_t v)
WorkerType worker_type() const
uint32_t protocol_version() const
WorkerCaps & operator=(WorkerCaps &&)=default
static constexpr std::string_view typeName
static zyppng::expected< WorkerCaps > fromStompMessage(const zypp::PluginFrame &msg)
void set_worker_name(std::string name)
void set_cfg_flags(Flags f)
constexpr std::string_view LocalMountPoint("local_mountpoint")
constexpr std::string_view AttachId("attach_id")
constexpr std::string_view Device("device")
constexpr std::string_view VerifyData("verify_data")
constexpr std::string_view VerifyType("verify_type")
constexpr std::string_view Label("label")
constexpr std::string_view MediaNr("media_nr")
constexpr std::string_view LastUser("username")
constexpr std::string_view AuthHint("authHint")
constexpr std::string_view EffectiveUrl("effective_url")
constexpr std::string_view LastAuthTimestamp("last_auth_timestamp")
constexpr std::string_view Password("password")
constexpr std::string_view AuthType("authType")
constexpr std::string_view Username("username")
constexpr std::string_view AuthTimestamp("auth_timestamp")
constexpr std::string_view device("device")
constexpr std::string_view Reason("reason")
constexpr std::string_view History("history")
constexpr std::string_view Transient("transient")
constexpr std::string_view LocalFilename("local_filename")
constexpr std::string_view CacheHit("cacheHit")
constexpr std::string_view RequestId("requestId")
constexpr std::string_view RequestCode("requestCode")
constexpr std::string_view MetalinkEnabled("metalink_enabled")
constexpr std::string_view ExpectedFilesize("expected_filesize")
constexpr std::string_view DeltaFile("delta_file")
constexpr std::string_view CheckExistOnly("check_existance_only")
constexpr std::string_view Filename("filename")
constexpr std::string_view StagingFilename("staging_filename")
constexpr std::string_view LocalFilename("local_filename")
constexpr std::string_view NewUrl("new_url")