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> 305 #include <functional> 311 class ProvideMessage;
425 namespace ProvideStartedMsgFields
427 constexpr std::string_view
Url (
"url");
432 namespace ProvideFinishedMsgFields
435 constexpr std::string_view
CacheHit (
"cacheHit");
438 namespace AuthInfoMsgFields
440 constexpr std::string_view
Username (
"username");
441 constexpr std::string_view
Password (
"password");
443 constexpr std::string_view
AuthType (
"authType");
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");
459 constexpr std::string_view
Transient (
"transient");
460 constexpr std::string_view
History (
"history");
463 namespace ProvideMsgFields
465 constexpr std::string_view
Url (
"url");
466 constexpr std::string_view
Filename (
"filename");
467 constexpr std::string_view
DeltaFile (
"delta_file");
469 constexpr std::string_view
CheckExistOnly (
"check_existance_only");
473 namespace AttachMsgFields
475 constexpr std::string_view
Url (
"url");
476 constexpr std::string_view
AttachId (
"attach_id");
477 constexpr std::string_view
VerifyType (
"verify_type");
478 constexpr std::string_view
VerifyData (
"verify_data");
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
496 constexpr std::string_view
EffectiveUrl (
"effective_url");
498 constexpr std::string_view
LastUser (
"username");
499 constexpr std::string_view
AuthHint (
"authHint");
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");
527 static expected<ProvideMessage>
create (
const zyppng::RpcMessage &message );
528 static expected<ProvideMessage>
create (
const zypp::proto::ProvideMessage &message );
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;
589 template<> zypp::proto::Capabilities* rwcowClone<zypp::proto::Capabilities>(
const zypp::proto::Capabilities * rhs );
590 template<> zypp::proto::ProvideMessage* rwcowClone<zypp::proto::ProvideMessage>(
const zypp::proto::ProvideMessage * rhs );
static ProvideMessage createErrorResponse(const uint32_t reqId, const uint code, const std::string &reason, bool transient=false)
WorkerCaps & operator=(const WorkerCaps &)=default
constexpr std::string_view Url("url")
constexpr std::string_view LocalFilename("local_filename")
constexpr std::string_view AttachId("attach_id")
Container of Capability (currently read only).
zypp::RWCOW_pointer< zypp::proto::Capabilities > _data
zypp::RWCOW_pointer< zypp::proto::ProvideMessage > _impl
void forEachVal(const std::function< bool(const std::string &name, const FieldVal &val)> &cb) const
constexpr std::string_view VerifyData("verify_data")
static ProvideMessage createMetalinkRedir(const uint32_t reqId, const std::vector< zypp::Url > &newUrls)
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)
constexpr std::string_view Filename("filename")
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={})
HeaderValueMap headers() const
void set_cfg_flags(Flags f)
void set_protocol_version(uint32_t v)
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 ProvideMessage createMediaChanged(const uint32_t reqId)
String related utilities and Regular expression matching.
constexpr std::string_view MediaNr("media_nr")
constexpr std::string_view VerifyType("verify_type")
void addValue(const std::string &name, const FieldVal &value)
static ProvideMessage createProvideStarted(const uint32_t reqId, const zypp::Url &url, const std::optional< std::string > &localFilename={}, const std::optional< std::string > &stagingFilename={})
constexpr std::string_view Password("password")
constexpr std::string_view Username("username")
constexpr std::string_view Device("device")
void set_worker_type(WorkerType t)
constexpr std::string_view CheckExistOnly("check_existance_only")
constexpr std::string_view NewUrl("new_url")
constexpr std::string_view LocalFilename("local_filename")
FieldVal value(const std::string_view &str, const FieldVal &defaultVal=FieldVal()) const
void setCode(const uint32_t newCode)
constexpr std::string_view LastAuthTimestamp("last_auth_timestamp")
std::vector< FieldVal > values(const std::string_view &str) const
constexpr std::string_view Label("label")
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={})
void set_worker_name(std::string name)
static ProvideMessage createDetach(const uint32_t reqId, const zypp::Url &attachUrl)
WorkerType worker_type() const
constexpr std::string_view AuthHint("authHint")
constexpr std::string_view Reason("reason")
static ProvideMessage createRedirect(const uint32_t reqId, const zypp::Url &newUrl)
uint32_t protocol_version() const
void setValue(const std::string &name, const FieldVal &value)
constexpr std::string_view DeltaFile("delta_file")
constexpr std::string_view EffectiveUrl("effective_url")
const std::string & worker_name() const
constexpr std::string_view Transient("transient")
constexpr std::string_view AuthTimestamp("auth_timestamp")
void setRequestId(const uint id)
static ProvideMessage createCancel(const uint32_t reqId)
constexpr std::string_view Url("url")
constexpr std::string_view LocalMountPoint("local_mountpoint")
constexpr std::string_view AuthType("authType")
static ProvideMessage createProvideFinished(const uint32_t reqId, const std::string &localFilename, bool cacheHit)
constexpr std::string_view Url("url")
zyppng::ProviderConfiguration Configuration
constexpr std::string_view MetalinkEnabled("metalink_enabled")
constexpr std::string_view History("history")
constexpr std::string_view device("device")
constexpr std::string_view StagingFilename("staging_filename")
ProvideMessage & operator=(const ProvideMessage &)=default
constexpr std::string_view Url("url")
Easy-to use interface to the ZYPP dependency resolver.
static expected< ProvideMessage > create(const zyppng::RpcMessage &message)
static ProvideMessage createDetachFinished(const uint32_t reqId)
constexpr std::string_view CacheHit("cacheHit")
constexpr std::string_view LastUser("username")
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)
static ProvideMessage createAttachFinished(const uint32_t reqId, const std::optional< std::string > &localMountPoint={})
constexpr std::string_view ExpectedFilesize("expected_filesize")