libzypp: zypp-media/ng/providemessage.cc Source File

libzypp 17.36.6

providemessage.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#include "private/providemessage_p.h"
11#include "zypp-core/zyppng/rpc/stompframestream.h"
12
13#include <zypp-core/Url.h>
14#include <string_view>
15#include <string>
16
17namespace zyppng {
18
19 zyppng::expected<zypp::PluginFrame> ProviderConfiguration::toStompMessage() const
20 {
21 auto frame = rpc::prepareFrame<ProviderConfiguration>();
22 for ( const auto &v : *this ) {
23 frame.addHeader( v.first, v.second );
24 }
25 return zyppng::expected<zypp::PluginFrame>::success( std::move(frame) );
26 }
27
28 zyppng::expected<ProviderConfiguration> ProviderConfiguration::fromStompMessage(const zypp::PluginFrame &msg)
29 {
30 try {
31 if ( msg.command() != ProviderConfiguration::typeName )
32 ZYPP_THROW( InvalidMessageReceivedException("Message is not of type ProviderConfiguration") );
33
34 ProviderConfiguration res;
35 for ( auto i = msg.headerBegin (); i != msg.headerEnd(); i++ ) {
36 res.insert_or_assign ( i->first, i->second );
37 }
38
39 return zyppng::expected<ProviderConfiguration>::success ( std::move(res) );
40
41 } catch ( const zypp::Exception &e ) {
42 ZYPP_CAUGHT (e);
43 return zyppng::expected<ProviderConfiguration>::error( ZYPP_EXCPT_PTR(e) );
44 }
45 }
46
50 WorkerCaps::WorkerCaps()
51 { }
52
53 WorkerCaps::~WorkerCaps()
54 { }
55
56 uint32_t WorkerCaps::protocol_version() const
57 {
58 return _protocolVersion;
59 }
60
61 WorkerCaps::WorkerType WorkerCaps::worker_type() const
62 {
63 return static_cast<WorkerType>(_workerType);
64 }
65
66 WorkerCaps::Flags WorkerCaps::cfg_flags() const
67 {
68 return static_cast<WorkerCaps::Flags>(_cfgFlags);
69 }
70
71 const std::string &WorkerCaps::worker_name() const
72 {
73 return _workerName;
74 }
75
76 void WorkerCaps::set_protocol_version(uint32_t v)
77 {
78 _protocolVersion = v;
79 }
80
81 void WorkerCaps::set_worker_type(WorkerType t)
82 {
83 _workerType = t;
84 }
85
86 void WorkerCaps::set_cfg_flags(Flags f)
87 {
88 _cfgFlags = f;
89 }
90
91 void WorkerCaps::set_worker_name(std::string name)
92 {
93 _workerName = std::move(name);
94 }
95
96 zyppng::expected<zypp::PluginFrame> WorkerCaps::toStompMessage() const
97 {
98 try {
99 zypp::PluginFrame pf = zyppng::rpc::prepareFrame<WorkerCaps>();
100 pf.addHeader ( "protocolVersion", zypp::str::asString (_protocolVersion) );
101 pf.addHeader ( "workerType" , zypp::str::asString (_workerType) );
102 pf.addHeader ( "cfgFlags" , zypp::str::asString (_cfgFlags) );
103 pf.addHeader ( "workerName" , zypp::str::asString (_workerName) );
104 return zyppng::expected<zypp::PluginFrame>::success ( std::move(pf) );
105
106 } catch ( const zypp::Exception &e ) {
107 ZYPP_CAUGHT (e);
108 return zyppng::expected<zypp::PluginFrame>::error( ZYPP_EXCPT_PTR(e) );
109 }
110 }
111
112 zyppng::expected<WorkerCaps> WorkerCaps::fromStompMessage(const zypp::PluginFrame &msg)
113 {
114 try {
115 if ( msg.command() != WorkerCaps::typeName )
116 ZYPP_THROW( InvalidMessageReceivedException("Message is not of type WorkerCaps") );
117
118 WorkerCaps res;
119 zyppng::rpc::parseHeaderIntoField( msg, "protocolVersion", res._protocolVersion );
120 zyppng::rpc::parseHeaderIntoField( msg, "workerType", res._workerType );
121 zyppng::rpc::parseHeaderIntoField( msg, "cfgFlags", res._cfgFlags );
122 zyppng::rpc::parseHeaderIntoField( msg, "workerName", res._workerName );
123 return zyppng::expected<WorkerCaps>::success ( std::move(res) );
124
125 } catch ( const zypp::Exception &e ) {
126 ZYPP_CAUGHT (e);
127 return zyppng::expected<WorkerCaps>::error( ZYPP_EXCPT_PTR(e) );
128 }
129 }
130
131 template <typename T>
132 static zyppng::expected<void> doParseField( const std::string &val, ProvideMessage &t, std::string_view msgtype, std::string_view name ) {
133 try {
134 T tVal; // the target value type
135 zyppng::rpc::parseDataIntoField ( val, tVal );
136 t.addValue( name, std::move(tVal) );
137 return zyppng::expected<void>::success();
138 } catch ( const zypp::Exception &e ) {
139 ZYPP_CAUGHT(e);
140 return zyppng::expected<void>::error( ZYPP_EXCPT_PTR( InvalidMessageReceivedException( zypp::str::Str() << "Parse error " << msgtype << ", Field " << name << " has invalid type" ) ) );
141 }
142 }
143
144 ProvideMessage::ProvideMessage()
145 { }
146
147 expected<zyppng::ProvideMessage> ProvideMessage::create(const zypp::PluginFrame &msg)
148 {
149 if ( msg.command() != ProvideMessage::typeName ) {
150 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR( InvalidMessageReceivedException("Message is not of type WorkerCaps") ) );
151 }
152
153 const std::string &codeStr = msg.getHeaderNT( std::string(ProvideMessageFields::RequestCode) );
154 if ( codeStr.empty () ) {
155 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Invalid message, PluginFrame has no requestId header.")) );
156 }
157
158 const auto c = zyppng::str::safe_strtonum<uint32_t>( codeStr ).value_or ( NoCode );
159 const auto validCode = ( c >= ProvideMessage::Code::FirstInformalCode && c <= ProvideMessage::Code::LastInformalCode )
160 || ( c >= ProvideMessage::Code::FirstSuccessCode && c <= ProvideMessage::Code::LastSuccessCode )
161 || ( c >= ProvideMessage::Code::FirstRedirCode && c <= ProvideMessage::Code::LastRedirCode )
162 || ( c >= ProvideMessage::Code::FirstClientErrCode && c <= ProvideMessage::Code::LastClientErrCode )
163 || ( c >= ProvideMessage::Code::FirstSrvErrCode && c <= ProvideMessage::Code::LastSrvErrCode )
164 || ( c >= ProvideMessage::Code::FirstControllerCode && c <= ProvideMessage::Code::LastControllerCode)
165 || ( c >= ProvideMessage::Code::FirstWorkerCode && c <= ProvideMessage::Code::LastWorkerCode );
166 if ( !validCode ) {
167 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Invalid code in PluginFrame")) );
168 }
169
170 const std::string & idStr = msg.getHeaderNT( std::string(ProvideMessageFields::RequestId) );
171 if ( idStr.empty () ) {
172 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Invalid message, PluginFrame has no requestId header.")) );
173 }
174
175 const auto &maybeId = zyppng::str::safe_strtonum<uint>( idStr );
176 if ( !maybeId ) {
177 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Invalid message, can not parse requestId header.")) );
178 }
179
180 ProvideMessage pMessage;
181 pMessage.setCode ( static_cast<MessageCodes>(c) );
182 pMessage.setRequestId ( *maybeId );
183
184 #define DEF_REQ_FIELD( fname ) bool has_##fname = false
185
186 #define PARSE_FIELD( msgtype, fname, ftype, _C_ ) \
187 if ( name == #fname ) { \
188 const auto &res = doParseField<ftype>( val, pMessage, #msgtype, #fname ); \
189 if ( !res ) { \
190 return zyppng::expected<ProvideMessage>::error(res.error()); \
191 } \
192 _C_ \
193 }
194
195 #define HANDLE_UNKNOWN_FIELD( fname, val ) { \
196 pMessage.addValue( fname, val ); \
197 }
198
199 #define OR_HANDLE_UNKNOWN_FIELD( fname, val ) else HANDLE_UNKNOWN_FIELD( fname, val )
200
201 #define BEGIN_PARSE_HEADERS \
202 for ( const auto &header : msg.headerList() ) { \
203 const auto &name = header.first; \
204 const auto &val = header.second;
205
206 #define END_PARSE_HEADERS }
207
208 #define PARSE_REQ_FIELD( msgtype, fname, ftype ) PARSE_FIELD( msgtype, fname, ftype, has_##fname = true; )
209 #define OR_PARSE_REQ_FIELD( msgtype, fname, ftype ) else PARSE_REQ_FIELD( msgtype, fname, ftype )
210 #define PARSE_OPT_FIELD( msgtype, fname, ftype ) PARSE_FIELD( msgtype, fname, ftype, )
211 #define OR_PARSE_OPT_FIELD( msgtype, fname, ftype ) else PARSE_OPT_FIELD( msgtype, fname, ftype )
212
213 #define FAIL_IF_NOT_SEEN_REQ_FIELD( msgtype, fname ) \
214 if ( !has_##fname ) \
215 return expected<ProvideMessage>::error( ZYPP_EXCPT_PTR( InvalidMessageReceivedException( zypp::str::Str() << #msgtype <<" message does not contain required " << #fname << " field" ) ) )
216
217 auto validateErrorMsg = [&]( const auto &msg ){
218 DEF_REQ_FIELD(reason);
219 BEGIN_PARSE_HEADERS
220 PARSE_REQ_FIELD ( Error, reason, std::string )
221 OR_PARSE_OPT_FIELD ( Error, history, std::string )
222 OR_PARSE_OPT_FIELD ( Error, transient, bool )
223 OR_HANDLE_UNKNOWN_FIELD( name, val )
224 END_PARSE_HEADERS
225 FAIL_IF_NOT_SEEN_REQ_FIELD( Error, reason );
226 return expected<ProvideMessage>::success( std::move(pMessage) );
227 };
228
229 switch ( c )
230 {
231 case ProvideMessage::Code::ProvideStarted: {
232 DEF_REQ_FIELD(url);
233 BEGIN_PARSE_HEADERS
234 PARSE_REQ_FIELD ( ProvideStarted, url, std::string )
235 OR_PARSE_OPT_FIELD ( ProvideStarted, local_filename, std::string )
236 OR_PARSE_OPT_FIELD ( ProvideStarted, staging_filename, std::string )
237 OR_HANDLE_UNKNOWN_FIELD( name, val )
238 END_PARSE_HEADERS
239 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideStarted, url );
240 return expected<ProvideMessage>::success( std::move(pMessage) );
241 }
242 case ProvideMessage::Code::ProvideFinished: {
243 DEF_REQ_FIELD(cacheHit);
244 DEF_REQ_FIELD(local_filename);
245 BEGIN_PARSE_HEADERS
246 PARSE_REQ_FIELD ( ProvideFinished, cacheHit, bool )
247 OR_PARSE_REQ_FIELD ( ProvideFinished, local_filename, std::string )
248 OR_HANDLE_UNKNOWN_FIELD( name, val )
249 END_PARSE_HEADERS
250 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideFinished, cacheHit );
251 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideFinished, local_filename );
252 return expected<ProvideMessage>::success( std::move(pMessage) );
253 }
254 case ProvideMessage::Code::AttachFinished: {
255 BEGIN_PARSE_HEADERS
256 PARSE_OPT_FIELD ( AttachFinished, local_mountpoint, std::string )
257 OR_HANDLE_UNKNOWN_FIELD( name, val )
258 END_PARSE_HEADERS
259 return expected<ProvideMessage>::success( std::move(pMessage) );
260 }
261 case ProvideMessage::Code::DetachFinished: {
262 // no known fields
263 BEGIN_PARSE_HEADERS
264 HANDLE_UNKNOWN_FIELD( name, val )
265 END_PARSE_HEADERS
266 return expected<ProvideMessage>::success( std::move(pMessage) );
267 }
268 case ProvideMessage::Code::AuthInfo: {
269 DEF_REQ_FIELD(username);
270 DEF_REQ_FIELD(password);
271 DEF_REQ_FIELD(auth_timestamp);
272 BEGIN_PARSE_HEADERS
273 PARSE_REQ_FIELD ( AuthInfo, username, std::string )
274 OR_PARSE_REQ_FIELD ( AuthInfo, password, std::string )
275 OR_PARSE_REQ_FIELD ( AuthInfo, auth_timestamp, int64_t )
276 OR_PARSE_OPT_FIELD ( AuthInfo, authType, std::string )
277 OR_HANDLE_UNKNOWN_FIELD( name, val )
278 END_PARSE_HEADERS
279 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideStarted, username );
280 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideStarted, password );
281 FAIL_IF_NOT_SEEN_REQ_FIELD( ProvideStarted, auth_timestamp );
282 return expected<ProvideMessage>::success( std::move(pMessage) );
283 }
284 case ProvideMessage::Code::MediaChanged:
285 // no known fields
286 BEGIN_PARSE_HEADERS
287 HANDLE_UNKNOWN_FIELD( name, val )
288 END_PARSE_HEADERS
289 return expected<ProvideMessage>::success( std::move(pMessage) );
290
291 case ProvideMessage::Code::Redirect: {
292 DEF_REQ_FIELD(new_url);
293 BEGIN_PARSE_HEADERS
294 PARSE_REQ_FIELD ( Redirect, new_url, std::string )
295 OR_HANDLE_UNKNOWN_FIELD( name, val )
296 END_PARSE_HEADERS
297 FAIL_IF_NOT_SEEN_REQ_FIELD( Redirect, new_url );
298 return expected<ProvideMessage>::success( std::move(pMessage) );
299 }
300 case ProvideMessage::Code::Metalink: {
301 DEF_REQ_FIELD(new_url);
302 BEGIN_PARSE_HEADERS
303 PARSE_REQ_FIELD ( Metalink, new_url, std::string )
304 OR_HANDLE_UNKNOWN_FIELD( name, val )
305 END_PARSE_HEADERS
306 FAIL_IF_NOT_SEEN_REQ_FIELD( Metalink, new_url );
307 return expected<ProvideMessage>::success( std::move(pMessage) );
308 }
309 case ProvideMessage::Code::BadRequest:
310 case ProvideMessage::Code::Unauthorized:
311 case ProvideMessage::Code::Forbidden:
312 case ProvideMessage::Code::PeerCertificateInvalid:
313 case ProvideMessage::Code::NotFound:
314 case ProvideMessage::Code::ExpectedSizeExceeded:
315 case ProvideMessage::Code::ConnectionFailed:
316 case ProvideMessage::Code::Timeout:
317 case ProvideMessage::Code::Cancelled:
318 case ProvideMessage::Code::InvalidChecksum:
319 case ProvideMessage::Code::MountFailed:
320 case ProvideMessage::Code::Jammed:
321 case ProvideMessage::Code::NoAuthData:
322 case ProvideMessage::Code::MediaChangeAbort:
323 case ProvideMessage::Code::MediaChangeSkip:
324 case ProvideMessage::Code::InternalError: {
325 return validateErrorMsg(msg);
326 }
327 case ProvideMessage::Code::Prov: {
328 DEF_REQ_FIELD(url);
329 BEGIN_PARSE_HEADERS
330 PARSE_REQ_FIELD ( Provide, url, std::string )
331 OR_PARSE_OPT_FIELD ( Provide, filename, std::string )
332 OR_PARSE_OPT_FIELD ( Provide, delta_file, std::string )
333 OR_PARSE_OPT_FIELD ( Provide, expected_filesize, int64_t )
334 OR_PARSE_OPT_FIELD ( Provide, check_existance_only, bool )
335 OR_PARSE_OPT_FIELD ( Provide, metalink_enabled, bool )
336 OR_HANDLE_UNKNOWN_FIELD( name, val )
337 END_PARSE_HEADERS
338 FAIL_IF_NOT_SEEN_REQ_FIELD( Provide, url );
339 return expected<ProvideMessage>::success( std::move(pMessage) );
340 }
341 case ProvideMessage::Code::Cancel:
342 // no known fields
343 BEGIN_PARSE_HEADERS
344 HANDLE_UNKNOWN_FIELD( name, val )
345 END_PARSE_HEADERS
346 return expected<ProvideMessage>::success( std::move(pMessage) );
347
348 case ProvideMessage::Code::Attach: {
349 std::exception_ptr error;
350
351 DEF_REQ_FIELD(url);
352 DEF_REQ_FIELD(attach_id);
353 DEF_REQ_FIELD(label);
354
355 // not really required, but this way we can check if all false or all true
356 DEF_REQ_FIELD(verify_type);
357 DEF_REQ_FIELD(verify_data);
358 DEF_REQ_FIELD(media_nr);
359
360 BEGIN_PARSE_HEADERS
361 PARSE_REQ_FIELD ( Attach, url , std::string )
362 OR_PARSE_REQ_FIELD ( Attach, attach_id , std::string )
363 OR_PARSE_REQ_FIELD ( Attach, label , std::string )
364 OR_PARSE_REQ_FIELD ( Attach, verify_type, std::string )
365 OR_PARSE_REQ_FIELD ( Attach, verify_data, std::string )
366 OR_PARSE_REQ_FIELD ( Attach, media_nr , int32_t )
367 OR_PARSE_OPT_FIELD ( Attach, device , std::string )
368 OR_HANDLE_UNKNOWN_FIELD( name, val )
369 END_PARSE_HEADERS
370 FAIL_IF_NOT_SEEN_REQ_FIELD( Provide, url );
371 FAIL_IF_NOT_SEEN_REQ_FIELD( Provide, label );
372 FAIL_IF_NOT_SEEN_REQ_FIELD( Provide, attach_id );
373 if ( ! ( ( has_verify_data == has_verify_type ) && ( has_verify_type == has_media_nr ) ) )
374 return expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Error in Attach message, one of the following fields is not set or invalid: ( verify_type, verify_data, media_nr ). Either none or all need to be set. ")) );
375
376 return expected<ProvideMessage>::success( std::move(pMessage) );
377 }
378 case ProvideMessage::Code::Detach: {
379 DEF_REQ_FIELD(url);
380 BEGIN_PARSE_HEADERS
381 PARSE_REQ_FIELD ( Detach, url, std::string )
382 OR_HANDLE_UNKNOWN_FIELD( name, val )
383 END_PARSE_HEADERS
384 FAIL_IF_NOT_SEEN_REQ_FIELD( Detach, url );
385
386 return expected<ProvideMessage>::success( std::move(pMessage) );
387 }
388 case ProvideMessage::Code::AuthDataRequest: {
389 DEF_REQ_FIELD(effective_url);
390 BEGIN_PARSE_HEADERS
391 PARSE_REQ_FIELD ( AuthDataRequest, effective_url, std::string )
392 OR_PARSE_OPT_FIELD ( AuthDataRequest, last_auth_timestamp, int64_t )
393 OR_PARSE_OPT_FIELD ( AuthDataRequest, username, std::string )
394 OR_PARSE_OPT_FIELD ( AuthDataRequest, authHint, std::string )
395 OR_HANDLE_UNKNOWN_FIELD( name, val )
396 END_PARSE_HEADERS
397 FAIL_IF_NOT_SEEN_REQ_FIELD( AuthDataRequest, effective_url );
398
399 return expected<ProvideMessage>::success( std::move(pMessage) );
400 }
401 case ProvideMessage::Code::MediaChangeRequest: {
402 DEF_REQ_FIELD(label);
403 DEF_REQ_FIELD(media_nr);
404 DEF_REQ_FIELD(device);
405 BEGIN_PARSE_HEADERS
406 PARSE_REQ_FIELD ( MediaChangeRequest, label, std::string )
407 OR_PARSE_REQ_FIELD ( MediaChangeRequest, media_nr, int32_t )
408 OR_PARSE_REQ_FIELD ( MediaChangeRequest, device, std::string )
409 OR_PARSE_OPT_FIELD ( MediaChangeRequest, desc, std::string )
410 OR_HANDLE_UNKNOWN_FIELD( name, val )
411 END_PARSE_HEADERS
412 FAIL_IF_NOT_SEEN_REQ_FIELD( MediaChangeRequest, label );
413 FAIL_IF_NOT_SEEN_REQ_FIELD( MediaChangeRequest, media_nr );
414 FAIL_IF_NOT_SEEN_REQ_FIELD( MediaChangeRequest, device );
415
416 return expected<ProvideMessage>::success( std::move(pMessage) );
417 }
418 default: {
419 // all error messages have the same format
420 if ( c >= ProvideMessage::Code::FirstClientErrCode && c <= ProvideMessage::Code::LastSrvErrCode ) {
421 return validateErrorMsg(msg);
422 }
423 }
424 }
425
426 // we should never reach this line because we check in the beginning if the know the message code
427 return zyppng::expected<ProvideMessage>::error( ZYPP_EXCPT_PTR ( InvalidMessageReceivedException("Unknown code in PluginFrame")) );
428 }
429
430 expected<zypp::PluginFrame> ProvideMessage::toStompMessage() const
431 {
432 zypp::PluginFrame f = rpc::prepareFrame<ProvideMessage>();
433 f.addHeader ( std::string(ProvideMessageFields::RequestCode), zypp::str::asString (static_cast<uint32_t>(_code)) );
434 f.addHeader ( std::string(ProvideMessageFields::RequestId), zypp::str::asString (_reqId) );
435 for ( auto i = _headers.beginList (); i != _headers.endList(); i++ ) {
436 for ( const auto &val : i->second ) {
437 const auto &strVal = std::visit([&]( const auto &val ){
438 if constexpr( std::is_same_v<std::decay_t<decltype(val)>, std::monostate> )
439 return std::string();
440 else {
441 return zypp::str::asString(val);
442 }
443 }, val.asVariant() );
444 if ( strVal.empty () )
445 continue;
446 f.addHeader( i->first, strVal );
447 }
448 }
449
450 return expected<zypp::PluginFrame>::success ( std::move(f) );
451 }
452
453 expected<ProvideMessage> ProvideMessage::fromStompMessage(const zypp::PluginFrame &msg)
454 {
455 return ProvideMessage::create(msg);
456 }
457
458 ProvideMessage ProvideMessage::createProvideStarted( const uint32_t reqId, const zypp::Url &url, const std::optional<std::string> &localFilename, const std::optional<std::string> &stagingFilename )
459 {
460 ProvideMessage msg;
461 msg.setCode ( ProvideMessage::Code::ProvideStarted );
462 msg.setRequestId ( reqId );
463 msg.setValue ( ProvideStartedMsgFields::Url, url.asCompleteString() );
464 if ( localFilename )
465 msg.setValue ( ProvideStartedMsgFields::LocalFilename, *localFilename );
466 if ( stagingFilename )
467 msg.setValue ( ProvideStartedMsgFields::StagingFilename, *stagingFilename );
468
469 return msg;
470 }
471
472 ProvideMessage ProvideMessage::createProvideFinished( const uint32_t reqId, const std::string &localFilename, bool cacheHit )
473 {
474 ProvideMessage msg;
475 msg.setCode ( ProvideMessage::Code::ProvideFinished );
476 msg.setRequestId ( reqId );
477 msg.setValue ( ProvideFinishedMsgFields::LocalFilename, localFilename );
478 msg.setValue ( ProvideFinishedMsgFields::CacheHit, cacheHit );
479
480 return msg;
481 }
482
483 ProvideMessage ProvideMessage::createAttachFinished(const uint32_t reqId , const std::optional<std::string> &localMountPoint )
484 {
485 ProvideMessage msg;
486 msg.setCode ( ProvideMessage::Code::AttachFinished );
487 msg.setRequestId ( reqId );
488
489 if ( localMountPoint )
490 msg.setValue ( AttachFinishedMsgFields::LocalMountPoint, *localMountPoint );
491
492 return msg;
493 }
494
495 ProvideMessage ProvideMessage::createDetachFinished(const uint32_t reqId)
496 {
497 ProvideMessage msg;
498 msg.setCode ( ProvideMessage::Code::DetachFinished );
499 msg.setRequestId ( reqId );
500
501 return msg;
502 }
503
504 ProvideMessage 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 )
505 {
506 ProvideMessage msg;
507 msg.setCode ( ProvideMessage::Code::AuthInfo );
508 msg.setRequestId ( reqId );
509 msg.setValue ( AuthInfoMsgFields::Username, user );
510 msg.setValue ( AuthInfoMsgFields::Password, pw );
511 msg.setValue ( AuthInfoMsgFields::AuthTimestamp, timestamp );
512 for ( const auto& i : extraValues ) {
513 msg.setValue( i.first, i.second );
514 }
515 return msg;
516 }
517
518 ProvideMessage ProvideMessage::createMediaChanged( const uint32_t reqId )
519 {
520 ProvideMessage msg;
521 msg.setCode ( ProvideMessage::Code::MediaChanged );
522 msg.setRequestId ( reqId );
523
524 return msg;
525 }
526
527 ProvideMessage ProvideMessage::createRedirect( const uint32_t reqId, const zypp::Url &newUrl )
528 {
529 ProvideMessage msg;
530 msg.setCode ( ProvideMessage::Code::Redirect );
531 msg.setRequestId ( reqId );
532 msg.setValue ( RedirectMsgFields::NewUrl, newUrl.asCompleteString() );
533
534 return msg;
535 }
536
537 ProvideMessage ProvideMessage::createMetalinkRedir( const uint32_t reqId, const std::vector<zypp::Url> &newUrls )
538 {
539 ProvideMessage msg;
540 msg.setCode ( ProvideMessage::Code::Metalink );
541 msg.setRequestId ( reqId );
542 for( const auto &val : newUrls )
543 msg.addValue( MetalinkRedirectMsgFields::NewUrl, val.asCompleteString() );
544
545 return msg;
546 }
547
548 ProvideMessage ProvideMessage::createErrorResponse( const uint32_t reqId, const Code code, const std::string &reason, bool transient )
549 {
550 ProvideMessage msg;
551 if ( code < Code::FirstClientErrCode || code > Code::LastSrvErrCode )
552 ZYPP_THROW(std::out_of_range("code must be between 400 and 599"));
553 msg.setCode ( code );
554 msg.setRequestId ( reqId );
555 msg.setValue ( ErrMsgFields::Reason, reason );
556 msg.setValue ( ErrMsgFields::Transient, transient );
557 return msg;
558 }
559
560 ProvideMessage 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 )
561 {
562 ProvideMessage msg;
563 msg.setCode ( ProvideMessage::Code::Prov );
564 msg.setRequestId ( reqId );
565 msg.setValue ( ProvideMsgFields::Url, url.asCompleteString() );
566
567 if ( filename )
568 msg.setValue ( ProvideMsgFields::Filename, *filename );
569 if ( deltaFile )
570 msg.setValue ( ProvideMsgFields::DeltaFile, *deltaFile );
571 if ( expFilesize )
572 msg.setValue ( ProvideMsgFields::ExpectedFilesize, *expFilesize );
573 msg.setValue ( ProvideMsgFields::CheckExistOnly, checkExistOnly );
574
575 return msg;
576 }
577
578 ProvideMessage ProvideMessage::createCancel( const uint32_t reqId )
579 {
580 ProvideMessage msg;
581 msg.setCode ( ProvideMessage::Code::Cancel );
582 msg.setRequestId ( reqId );
583
584 return msg;
585 }
586
587 ProvideMessage 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 )
588 {
589 ProvideMessage msg;
590 msg.setCode ( ProvideMessage::Code::Attach );
591 msg.setRequestId ( reqId );
592 msg.setValue ( AttachMsgFields::Url, url.asCompleteString() );
593 msg.setValue ( AttachMsgFields::AttachId, attachId );
594 msg.setValue ( AttachMsgFields::Label, label );
595
596 if ( verifyType.has_value() && verifyData.has_value() && mediaNr.has_value() ) {
597 msg.setValue ( AttachMsgFields::VerifyType, *verifyType );
598 msg.setValue ( AttachMsgFields::VerifyData, *verifyData );
599 msg.setValue ( AttachMsgFields::MediaNr, *mediaNr );
600 } else {
601 if ( !( ( verifyType.has_value() == verifyData.has_value() ) && ( verifyData.has_value() == mediaNr.has_value() ) ) )
602 WAR << "Attach message requires verifyType, verifyData and mediaNr either set together or not set at all." << std::endl;
603 }
604
605 return msg;
606 }
607
608 ProvideMessage ProvideMessage::createDetach( const uint32_t reqId, const zypp::Url &attachUrl )
609 {
610 ProvideMessage msg;
611 msg.setCode ( ProvideMessage::Code::Detach );
612 msg.setRequestId ( reqId );
613 msg.setValue ( DetachMsgFields::Url, attachUrl.asCompleteString() );
614
615 return msg;
616 }
617
618 ProvideMessage 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 )
619 {
620 ProvideMessage msg;
621 msg.setCode ( ProvideMessage::Code::AuthDataRequest );
622 msg.setRequestId ( reqId );
623 msg.setValue ( AuthDataRequestMsgFields::EffectiveUrl, effectiveUrl.asCompleteString() );
624 if ( lastTriedUser.size() )
625 msg.setValue( AuthDataRequestMsgFields::LastUser, lastTriedUser );
626 if ( lastAuthTimestamp )
627 msg.setValue ( AuthDataRequestMsgFields::LastAuthTimestamp, *lastAuthTimestamp );
628
629 return msg;
630 }
631
632 ProvideMessage 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 )
633 {
634 ProvideMessage msg;
635 msg.setCode ( ProvideMessage::Code::MediaChangeRequest );
636 msg.setRequestId ( reqId );
637 msg.setValue ( MediaChangeRequestMsgFields::Label, label );
638 msg.setValue ( MediaChangeRequestMsgFields::MediaNr, mediaNr );
639 for ( const auto &device : devices )
640 msg.addValue ( MediaChangeRequestMsgFields::Device, device );
641 if ( desc )
642 msg.setValue ( MediaChangeRequestMsgFields::Desc, *desc );
643
644 return msg;
645 }
646
647 uint ProvideMessage::requestId() const
648 {
649 return _reqId;
650 }
651
652 void ProvideMessage::setRequestId(const uint id)
653 {
654 _reqId = id;
655 }
656
657 ProvideMessage::Code ProvideMessage::code() const
658 {
659 return _code;
660 }
661
662 void ProvideMessage::setCode(const ProvideMessage::Code newCode )
663 {
664 _code = newCode;
665 }
666
667 const std::vector<ProvideMessage::FieldVal> &ProvideMessage::values( const std::string_view &str ) const
668 {
669 return _headers.values ( str );
670 }
671
672 const std::vector<ProvideMessage::FieldVal> &ProvideMessage::values( const std::string &str ) const
673 {
674 return values( std::string_view(str));
675 }
676
677 ProvideMessage::FieldVal ProvideMessage::value( const std::string_view &str, const FieldVal &defaultVal ) const
678 {
679 return _headers.value ( str, defaultVal );
680 }
681
682 const HeaderValueMap &ProvideMessage::headers() const
683 {
684 return _headers;
685 }
686
687 ProvideMessage::FieldVal ProvideMessage::value( const std::string &str, const FieldVal &defaultVal ) const
688 {
689 return value( std::string_view(str), defaultVal );
690 }
691
692 void ProvideMessage::setValue( const std::string &name, const FieldVal &value )
693 {
694 setValue( std::string_view(name), value );
695 }
696
697 void ProvideMessage::setValue( const std::string_view &name, const FieldVal &value )
698 {
699 _headers.set( std::string(name), value );
700 }
701
702 void ProvideMessage::addValue( const std::string &name, const FieldVal &value )
703 {
704 return addValue( std::string_view(name), value );
705 }
706
707 void ProvideMessage::addValue( const std::string_view &name, const FieldVal &value )
708 {
709 _headers.add( std::string(name), value );
710 }
711
712}
zypp::Exception
Base class for Exception.
Definition Exception.h:147
zypp::PluginFrame
Command frame for communication with PluginScript.
Definition PluginFrame.h:42
zypp::PluginFrame::command
const std::string & command() const
Return the frame command.
Definition PluginFrame.cc:439
zypp::PluginFrame::addHeader
void addHeader(const std::string &key_r, const std::string &value_r=std::string())
Add header for key_r leaving already existing headers for key_r unchanged.
Definition PluginFrame.cc:481
zypp::PluginFrame::headerEnd
HeaderListIterator headerEnd() const
Return iterator pointing behind the last header.
Definition PluginFrame.h:175
zypp::PluginFrame::getHeaderNT
const std::string & getHeaderNT(const std::string &key_r, const std::string &default_r=std::string()) const
Not throwing version returing one of the matching header values or default_r string.
Definition PluginFrame.cc:475
zypp::PluginFrame::headerBegin
HeaderListIterator headerBegin() const
Return iterator pointing to the 1st header (or headerEnd)
Definition PluginFrame.h:171
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::Url::asCompleteString
std::string asCompleteString() const
Returns a complete string representation of the Url object.
Definition Url.cc:523
zyppng::HeaderValueMap
Definition headervaluemap.h:67
zyppng::InvalidMessageReceivedException
Definition stompframestream.h:36
zyppng::ProvideMessage
Definition providemessage_p.h:521
zyppng::ProvideMessage::createProvideStarted
static ProvideMessage createProvideStarted(const uint32_t reqId, const zypp::Url &url, const std::optional< std::string > &localFilename={}, const std::optional< std::string > &stagingFilename={})
Definition providemessage.cc:458
zyppng::ProvideMessage::createAuthInfo
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={})
Definition providemessage.cc:504
zyppng::ProvideMessage::toStompMessage
expected< zypp::PluginFrame > toStompMessage() const
Definition providemessage.cc:430
zyppng::ProvideMessage::fromStompMessage
static expected< ProvideMessage > fromStompMessage(const zypp::PluginFrame &msg)
Definition providemessage.cc:453
zyppng::ProvideMessage::createRedirect
static ProvideMessage createRedirect(const uint32_t reqId, const zypp::Url &newUrl)
Definition providemessage.cc:527
zyppng::ProvideMessage::_headers
HeaderValueMap _headers
Definition providemessage_p.h:592
zyppng::ProvideMessage::createMetalinkRedir
static ProvideMessage createMetalinkRedir(const uint32_t reqId, const std::vector< zypp::Url > &newUrls)
Definition providemessage.cc:537
zyppng::ProvideMessage::ProvideMessage
ProvideMessage(const ProvideMessage &)=default
zyppng::ProvideMessage::FieldVal
HeaderValue FieldVal
Definition providemessage_p.h:529
zyppng::ProvideMessage::createCancel
static ProvideMessage createCancel(const uint32_t reqId)
Definition providemessage.cc:578
zyppng::ProvideMessage::headers
const HeaderValueMap & headers() const
Definition providemessage.cc:682
zyppng::ProvideMessage::requestId
uint requestId() const
Definition providemessage.cc:647
zyppng::ProvideMessage::typeName
static constexpr std::string_view typeName
Definition providemessage_p.h:531
zyppng::ProvideMessage::createMediaChanged
static ProvideMessage createMediaChanged(const uint32_t reqId)
Definition providemessage.cc:518
zyppng::ProvideMessage::createProvideFinished
static ProvideMessage createProvideFinished(const uint32_t reqId, const std::string &localFilename, bool cacheHit)
Definition providemessage.cc:472
zyppng::ProvideMessage::Code
MessageCodes Code
Definition providemessage_p.h:523
zyppng::ProvideMessage::createMediaChangeRequest
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)
Definition providemessage.cc:632
zyppng::ProvideMessage::value
FieldVal value(const std::string_view &str, const FieldVal &defaultVal=FieldVal()) const
Definition providemessage.cc:677
zyppng::ProvideMessage::values
const std::vector< ProvideMessage::FieldVal > & values(const std::string_view &str) const
Definition providemessage.cc:667
zyppng::ProvideMessage::setValue
void setValue(const std::string &name, const FieldVal &value)
Definition providemessage.cc:692
zyppng::ProvideMessage::createAuthDataRequest
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={})
Definition providemessage.cc:618
zyppng::ProvideMessage::createErrorResponse
static ProvideMessage createErrorResponse(const uint32_t reqId, const Code code, const std::string &reason, bool transient=false)
Definition providemessage.cc:548
zyppng::ProvideMessage::createProvide
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)
Definition providemessage.cc:560
zyppng::ProvideMessage::_reqId
uint _reqId
Definition providemessage_p.h:590
zyppng::ProvideMessage::setRequestId
void setRequestId(const uint id)
Definition providemessage.cc:652
zyppng::ProvideMessage::code
Code code() const
Definition providemessage.cc:657
zyppng::ProvideMessage::createDetachFinished
static ProvideMessage createDetachFinished(const uint32_t reqId)
Definition providemessage.cc:495
zyppng::ProvideMessage::addValue
void addValue(const std::string &name, const FieldVal &value)
Definition providemessage.cc:702
zyppng::ProvideMessage::createDetach
static ProvideMessage createDetach(const uint32_t reqId, const zypp::Url &attachUrl)
Definition providemessage.cc:608
zyppng::ProvideMessage::setCode
void setCode(const Code newCode)
Definition providemessage.cc:662
zyppng::ProvideMessage::create
static expected< ProvideMessage > create(const zypp::PluginFrame &message)
Definition providemessage.cc:147
zyppng::ProvideMessage::createAttachFinished
static ProvideMessage createAttachFinished(const uint32_t reqId, const std::optional< std::string > &localMountPoint={})
Definition providemessage.cc:483
zyppng::ProvideMessage::ProvideMessage
ProvideMessage()
Definition providemessage.cc:144
zyppng::ProvideMessage::_code
Code _code
Definition providemessage_p.h:591
zyppng::ProvideMessage::createAttach
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={})
Definition providemessage.cc:587
zyppng::Provide
Definition provide.h:112
zyppng::ProviderConfiguration
Definition providemessage_p.h:366
zyppng::ProviderConfiguration::fromStompMessage
static zyppng::expected< ProviderConfiguration > fromStompMessage(const zypp::PluginFrame &msg)
Definition providemessage.cc:28
zyppng::ProviderConfiguration::toStompMessage
zyppng::expected< zypp::PluginFrame > toStompMessage() const
Definition providemessage.cc:19
zyppng::ProviderConfiguration::typeName
static constexpr std::string_view typeName
Definition providemessage_p.h:370
zyppng::WorkerCaps::toStompMessage
zyppng::expected< zypp::PluginFrame > toStompMessage() const
Definition providemessage.cc:96
zyppng::WorkerCaps::worker_name
const std::string & worker_name() const
Definition providemessage.cc:71
zyppng::WorkerCaps::cfg_flags
Flags cfg_flags() const
Definition providemessage.cc:66
zyppng::WorkerCaps::_workerType
uint32_t _workerType
Definition providemessage_p.h:420
zyppng::WorkerCaps::_protocolVersion
uint32_t _protocolVersion
Definition providemessage_p.h:419
zyppng::WorkerCaps::set_worker_type
void set_worker_type(WorkerType t)
Definition providemessage.cc:81
zyppng::WorkerCaps::WorkerType
WorkerType
Definition providemessage_p.h:379
zyppng::WorkerCaps::set_protocol_version
void set_protocol_version(uint32_t v)
Definition providemessage.cc:76
zyppng::WorkerCaps::worker_type
WorkerType worker_type() const
Definition providemessage.cc:61
zyppng::WorkerCaps::WorkerCaps
WorkerCaps()
Definition providemessage.cc:50
zyppng::WorkerCaps::protocol_version
uint32_t protocol_version() const
Definition providemessage.cc:56
zyppng::WorkerCaps::~WorkerCaps
~WorkerCaps()
Definition providemessage.cc:53
zyppng::WorkerCaps::Flags
Flags
Definition providemessage_p.h:387
zyppng::WorkerCaps::typeName
static constexpr std::string_view typeName
Definition providemessage_p.h:414
zyppng::WorkerCaps::_workerName
std::string _workerName
Definition providemessage_p.h:422
zyppng::WorkerCaps::fromStompMessage
static zyppng::expected< WorkerCaps > fromStompMessage(const zypp::PluginFrame &msg)
Definition providemessage.cc:112
zyppng::WorkerCaps::_cfgFlags
uint32_t _cfgFlags
Definition providemessage_p.h:421
zyppng::WorkerCaps::set_worker_name
void set_worker_name(std::string name)
Definition providemessage.cc:91
zyppng::WorkerCaps::set_cfg_flags
void set_cfg_flags(Flags f)
Definition providemessage.cc:86
zyppng::expected
Definition expected.h:27
zyppng::expected::success
static expected success(ConsParams &&...params)
Definition expected.h:115
zyppng::expected::error
E & error()
Definition expected.h:225
std::decay_t
typename decay< T >::type decay_t
Definition TypeTraits.h:42
str
String related utilities and Regular expression matching.
zypp::str::asString
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
Definition String.h:139
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zyppng::AttachFinishedMsgFields::LocalMountPoint
constexpr std::string_view LocalMountPoint("local_mountpoint")
zyppng::AttachMsgFields::AttachId
constexpr std::string_view AttachId("attach_id")
zyppng::AttachMsgFields::VerifyData
constexpr std::string_view VerifyData("verify_data")
zyppng::AttachMsgFields::VerifyType
constexpr std::string_view VerifyType("verify_type")
zyppng::AttachMsgFields::Label
constexpr std::string_view Label("label")
zyppng::AttachMsgFields::MediaNr
constexpr std::string_view MediaNr("media_nr")
zyppng::AttachMsgFields::Url
constexpr std::string_view Url("url")
zyppng::AuthDataRequestMsgFields::LastUser
constexpr std::string_view LastUser("username")
zyppng::AuthDataRequestMsgFields::EffectiveUrl
constexpr std::string_view EffectiveUrl("effective_url")
zyppng::AuthDataRequestMsgFields::LastAuthTimestamp
constexpr std::string_view LastAuthTimestamp("last_auth_timestamp")
zyppng::AuthInfoMsgFields::Password
constexpr std::string_view Password("password")
zyppng::AuthInfoMsgFields::Username
constexpr std::string_view Username("username")
zyppng::AuthInfoMsgFields::AuthTimestamp
constexpr std::string_view AuthTimestamp("auth_timestamp")
zyppng::DetachMsgFields::Url
constexpr std::string_view Url("url")
zyppng::ErrMsgFields::Reason
constexpr std::string_view Reason("reason")
zyppng::ErrMsgFields::Transient
constexpr std::string_view Transient("transient")
zyppng::MediaChangeRequestMsgFields::Label
constexpr std::string_view Label("label")
zyppng::MediaChangeRequestMsgFields::Desc
constexpr std::string_view Desc("desc")
zyppng::MediaChangeRequestMsgFields::MediaNr
constexpr std::string_view MediaNr("media_nr")
zyppng::MediaChangeRequestMsgFields::Device
constexpr std::string_view Device("device")
zyppng::MetalinkRedirectMsgFields::NewUrl
constexpr std::string_view NewUrl("new_url")
zyppng::ProvideFinishedMsgFields::LocalFilename
constexpr std::string_view LocalFilename("local_filename")
zyppng::ProvideFinishedMsgFields::CacheHit
constexpr std::string_view CacheHit("cacheHit")
zyppng::ProvideMessageFields::RequestId
constexpr std::string_view RequestId("requestId")
zyppng::ProvideMessageFields::RequestCode
constexpr std::string_view RequestCode("requestCode")
zyppng::ProvideMsgFields::Url
constexpr std::string_view Url("url")
zyppng::ProvideMsgFields::ExpectedFilesize
constexpr std::string_view ExpectedFilesize("expected_filesize")
zyppng::ProvideMsgFields::DeltaFile
constexpr std::string_view DeltaFile("delta_file")
zyppng::ProvideMsgFields::CheckExistOnly
constexpr std::string_view CheckExistOnly("check_existance_only")
zyppng::ProvideMsgFields::Filename
constexpr std::string_view Filename("filename")
zyppng::ProvideStartedMsgFields::StagingFilename
constexpr std::string_view StagingFilename("staging_filename")
zyppng::ProvideStartedMsgFields::Url
constexpr std::string_view Url("url")
zyppng::ProvideStartedMsgFields::LocalFilename
constexpr std::string_view LocalFilename("local_filename")
zyppng::RedirectMsgFields::NewUrl
constexpr std::string_view NewUrl("new_url")
zyppng::rpc::parseHeaderIntoField
void parseHeaderIntoField(const zypp::PluginFrame &msg, const std::string &name, T &target)
Definition stompframestream.h:77
zyppng::rpc::parseDataIntoField
void parseDataIntoField(const std::string &headerVal, T &target)
Definition stompframestream.h:56
zyppng::rpc::prepareFrame
zypp::PluginFrame prepareFrame()
Definition stompframestream.h:83
zyppng::str::safe_strtonum
std::optional< T > safe_strtonum(const std::string_view &val)
Definition string.h:23
zyppng
Definition MediaCurl2.h:22
zyppng::MessageCodes
MessageCodes
Definition providemessage_p.h:308
zyppng::ProvideStarted
@ ProvideStarted
Definition providemessage_p.h:311
zyppng::MediaChangeRequest
@ MediaChangeRequest
Definition providemessage_p.h:361
zyppng::Redirect
@ Redirect
Definition providemessage_p.h:323
zyppng::AttachFinished
@ AttachFinished
Definition providemessage_p.h:316
zyppng::AuthInfo
@ AuthInfo
Definition providemessage_p.h:317
zyppng::NoCode
@ NoCode
Definition providemessage_p.h:309
zyppng::ProvideFinished
@ ProvideFinished
Definition providemessage_p.h:315
zyppng::Attach
@ Attach
Definition providemessage_p.h:355
zyppng::AuthDataRequest
@ AuthDataRequest
Definition providemessage_p.h:360
zyppng::Detach
@ Detach
Definition providemessage_p.h:356
zyppng::Metalink
@ Metalink
Definition providemessage_p.h:324
zyppng::doParseField
static zyppng::expected< void > doParseField(const std::string &val, ProvideMessage &t, std::string_view msgtype, std::string_view name)
Definition providemessage.cc:132
FAIL_IF_NOT_SEEN_REQ_FIELD
#define FAIL_IF_NOT_SEEN_REQ_FIELD(msgtype, fname)
HANDLE_UNKNOWN_FIELD
#define HANDLE_UNKNOWN_FIELD(fname, val)
DEF_REQ_FIELD
#define DEF_REQ_FIELD(fname)
OR_PARSE_OPT_FIELD
#define OR_PARSE_OPT_FIELD(msgtype, fname, ftype)
END_PARSE_HEADERS
#define END_PARSE_HEADERS
OR_HANDLE_UNKNOWN_FIELD
#define OR_HANDLE_UNKNOWN_FIELD(fname, val)
PARSE_REQ_FIELD
#define PARSE_REQ_FIELD(msgtype, fname, ftype)
PARSE_OPT_FIELD
#define PARSE_OPT_FIELD(msgtype, fname, ftype)
BEGIN_PARSE_HEADERS
#define BEGIN_PARSE_HEADERS
OR_PARSE_REQ_FIELD
#define OR_PARSE_REQ_FIELD(msgtype, fname, ftype)
providemessage_p.h
stompframestream.h
zypp::str::Str
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition String.h:212
Url.h
ZYPP_CAUGHT
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Definition Exception.h:440
ZYPP_EXCPT_PTR
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition Exception.h:428
ZYPP_THROW
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition Exception.h:424
WAR
#define WAR
Definition Logger.h:101