13#ifndef ZYPP_MEDIA_PRIVATE_PROVIDE_MESSAGE_P_H_INCLUDED
14#define ZYPP_MEDIA_PRIVATE_PROVIDE_MESSAGE_P_H_INCLUDED
298#include <zypp-core/zyppng/pipelines/Expected>
299#include <zypp-core/zyppng/rpc/MessageStream>
300#include <zypp-media/ng/ProvideSpec>
301#include <zypp-media/ng/HeaderValueMap>
303#include <boost/iterator/iterator_adaptor.hpp>
311 class ProvideMessage;
425 namespace ProvideStartedMsgFields
427 constexpr std::string_view
Url (
"url");
432 namespace ProvideFinishedMsgFields
438 namespace AuthInfoMsgFields
446 namespace RedirectMsgFields
448 constexpr std::string_view
NewUrl (
"new_url");
451 namespace MetalinkRedirectMsgFields
453 constexpr std::string_view
NewUrl (
"new_url");
456 namespace ErrMsgFields
458 constexpr std::string_view
Reason (
"reason");
460 constexpr std::string_view
History (
"history");
463 namespace ProvideMsgFields
465 constexpr std::string_view
Url (
"url");
473 namespace AttachMsgFields
475 constexpr std::string_view
Url (
"url");
479 constexpr std::string_view
MediaNr (
"media_nr");
480 constexpr std::string_view
Device (
"device");
481 constexpr std::string_view
Label (
"label");
484 namespace AttachFinishedMsgFields
489 namespace DetachMsgFields
491 constexpr std::string_view
Url (
"url");
494 namespace AuthDataRequestMsgFields
502 namespace MediaChangeRequestMsgFields
504 constexpr std::string_view
Label (
"label");
505 constexpr std::string_view
MediaNr (
"media_nr");
506 constexpr std::string_view
Device (
"device");
507 constexpr std::string_view
Desc (
"desc");
510 namespace EjectMsgFields
512 constexpr std::string_view
device (
"device");
533 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 = {} );
541 ,
const std::optional<std::string> &filename = {}
542 ,
const std::optional<std::string> &deltaFile = {}
543 ,
const std::optional<int64_t> &expFilesize = {}
544 ,
bool checkExistOnly = false );
550 ,
const std::string attachId
551 ,
const std::string &label
552 ,
const std::optional<std::string> &verifyType = {}
553 ,
const std::optional<std::string> &verifyData = {}
554 ,
const std::optional<int32_t> &mediaNr = {} );
557 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 = {} );
558 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 );
563 uint32_t
code()
const;
564 void setCode (
const uint32_t newCode );
566 std::vector<FieldVal>
values (
const std::string_view &
str )
const;
567 std::vector<FieldVal>
values (
const std::string &
str )
const;
568 HeaderValueMap
headers()
const;
579 void forEachVal(
const std::function<
bool(
const std::string &name,
const FieldVal &val)> &cb )
const;
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={})
void setCode(const uint32_t newCode)
zypp::RWCOW_pointer< zypp::proto::ProvideMessage > _impl
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)
void forEachVal(const std::function< bool(const std::string &name, const FieldVal &val)> &cb) const
HeaderValueMap headers() const
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
std::vector< FieldVal > values(const std::string_view &str) const
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
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 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 expected< ProvideMessage > create(const zyppng::RpcMessage &message)
static ProvideMessage createDetach(const uint32_t reqId, const zypp::Url &attachUrl)
static ProvideMessage createAttachFinished(const uint32_t reqId, const std::optional< std::string > &localMountPoint={})
static ProvideMessage createErrorResponse(const uint32_t reqId, const uint code, const std::string &reason, bool transient=false)
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={})
zypp::RWCOW_pointer< zypp::proto::Capabilities > _data
const std::string & worker_name() const
WorkerCaps(WorkerCaps &&)=default
WorkerCaps(const WorkerCaps &)=default
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
void set_worker_name(std::string name)
void set_cfg_flags(Flags f)
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
zypp::proto::ProvideMessage * rwcowClone< zypp::proto::ProvideMessage >(const zypp::proto::ProvideMessage *rhs)
zypp::proto::Capabilities * rwcowClone< zypp::proto::Capabilities >(const zypp::proto::Capabilities *rhs)
zypp::proto::Configuration * rwcowClone< zypp::proto::Configuration >(const zypp::proto::Configuration *rhs)
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 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")
zyppng::ProviderConfiguration Configuration
RW_pointer supporting 'copy on write' functionality.