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";
425 namespace ProvideMessageFields {
426 constexpr std::string_view
RequestCode(
"requestCode");
427 constexpr std::string_view
RequestId(
"requestId");
430 namespace ProvideStartedMsgFields
432 constexpr std::string_view
Url (
"url");
437 namespace ProvideFinishedMsgFields
440 constexpr std::string_view
CacheHit (
"cacheHit");
443 namespace AuthInfoMsgFields
445 constexpr std::string_view
Username (
"username");
446 constexpr std::string_view
Password (
"password");
448 constexpr std::string_view
AuthType (
"authType");
451 namespace RedirectMsgFields
453 constexpr std::string_view
NewUrl (
"new_url");
456 namespace MetalinkRedirectMsgFields
458 constexpr std::string_view
NewUrl (
"new_url");
461 namespace ErrMsgFields
463 constexpr std::string_view
Reason (
"reason");
464 constexpr std::string_view
Transient (
"transient");
465 constexpr std::string_view
History (
"history");
468 namespace ProvideMsgFields
470 constexpr std::string_view
Url (
"url");
471 constexpr std::string_view
Filename (
"filename");
472 constexpr std::string_view
DeltaFile (
"delta_file");
474 constexpr std::string_view
CheckExistOnly (
"check_existance_only");
478 namespace AttachMsgFields
480 constexpr std::string_view
Url (
"url");
481 constexpr std::string_view
AttachId (
"attach_id");
482 constexpr std::string_view
VerifyType (
"verify_type");
483 constexpr std::string_view
VerifyData (
"verify_data");
484 constexpr std::string_view
MediaNr (
"media_nr");
485 constexpr std::string_view
Device (
"device");
486 constexpr std::string_view
Label (
"label");
489 namespace AttachFinishedMsgFields
494 namespace DetachMsgFields
496 constexpr std::string_view
Url (
"url");
499 namespace AuthDataRequestMsgFields
501 constexpr std::string_view
EffectiveUrl (
"effective_url");
503 constexpr std::string_view
LastUser (
"username");
504 constexpr std::string_view
AuthHint (
"authHint");
507 namespace MediaChangeRequestMsgFields
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");
515 namespace EjectMsgFields
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 = {} );
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 );
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;
WorkerCaps & operator=(const WorkerCaps &)=default
constexpr std::string_view Url("url")
constexpr std::string_view LocalFilename("local_filename")
static constexpr std::string_view typeName
constexpr std::string_view AttachId("attach_id")
Container of Capability (currently read only).
constexpr std::string_view VerifyData("verify_data")
static ProvideMessage createMetalinkRedir(const uint32_t reqId, const std::vector< zypp::Url > &newUrls)
Command frame for communication with PluginScript.
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={})
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.
void setCode(const Code newCode)
constexpr std::string_view MediaNr("media_nr")
static ProvideMessage createErrorResponse(const uint32_t reqId, const Code code, const std::string &reason, bool transient=false)
constexpr std::string_view VerifyType("verify_type")
void addValue(const std::string &name, const FieldVal &value)
constexpr std::string_view RequestCode("requestCode")
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")
static zyppng::expected< ProviderConfiguration > fromStompMessage(const zypp::PluginFrame &msg)
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 RequestId("requestId")
static expected< ProvideMessage > create(const zypp::PluginFrame &message)
constexpr std::string_view LocalFilename("local_filename")
FieldVal value(const std::string_view &str, const FieldVal &defaultVal=FieldVal()) const
static zyppng::expected< WorkerCaps > fromStompMessage(const zypp::PluginFrame &msg)
constexpr std::string_view LastAuthTimestamp("last_auth_timestamp")
zyppng::expected< zypp::PluginFrame > toStompMessage() 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)
uint32_t _protocolVersion
zyppng::expected< zypp::PluginFrame > toStompMessage() const
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")
static constexpr std::string_view typeName
static expected< ProvideMessage > fromStompMessage(const zypp::PluginFrame &msg)
const std::string & worker_name() const
constexpr std::string_view Transient("transient")
const std::vector< ProvideMessage::FieldVal > & values(const std::string_view &str) const
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")
static constexpr std::string_view typeName
const HeaderValueMap & headers() const
expected< zypp::PluginFrame > toStompMessage() const
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")