1*ec7d71e6SNiels Sascha Reedijk /* 2*ec7d71e6SNiels Sascha Reedijk * Copyright 2021 Haiku Inc. All rights reserved. 3*ec7d71e6SNiels Sascha Reedijk * Distributed under the terms of the MIT License. 4*ec7d71e6SNiels Sascha Reedijk */ 5*ec7d71e6SNiels Sascha Reedijk 6*ec7d71e6SNiels Sascha Reedijk #ifndef _NETSERVICES_DEFS_H_ 7*ec7d71e6SNiels Sascha Reedijk #define _NETSERVICES_DEFS_H_ 8*ec7d71e6SNiels Sascha Reedijk 9*ec7d71e6SNiels Sascha Reedijk 10*ec7d71e6SNiels Sascha Reedijk #include <ErrorsExt.h> 11*ec7d71e6SNiels Sascha Reedijk #include <StringList.h> 12*ec7d71e6SNiels Sascha Reedijk #include <Url.h> 13*ec7d71e6SNiels Sascha Reedijk 14*ec7d71e6SNiels Sascha Reedijk 15*ec7d71e6SNiels Sascha Reedijk namespace BPrivate { 16*ec7d71e6SNiels Sascha Reedijk 17*ec7d71e6SNiels Sascha Reedijk namespace Network { 18*ec7d71e6SNiels Sascha Reedijk 19*ec7d71e6SNiels Sascha Reedijk 20*ec7d71e6SNiels Sascha Reedijk // Standard exceptions 21*ec7d71e6SNiels Sascha Reedijk class BUnsupportedProtocol : public BError { 22*ec7d71e6SNiels Sascha Reedijk public: 23*ec7d71e6SNiels Sascha Reedijk BUnsupportedProtocol(const char* origin, BUrl url, 24*ec7d71e6SNiels Sascha Reedijk BStringList supportedProtocols); 25*ec7d71e6SNiels Sascha Reedijk BUnsupportedProtocol(BString origin, BUrl url, 26*ec7d71e6SNiels Sascha Reedijk BStringList supportedProtocols); 27*ec7d71e6SNiels Sascha Reedijk 28*ec7d71e6SNiels Sascha Reedijk virtual const char* Message() const noexcept override; 29*ec7d71e6SNiels Sascha Reedijk 30*ec7d71e6SNiels Sascha Reedijk const BUrl& Url() const; 31*ec7d71e6SNiels Sascha Reedijk const BStringList& SupportedProtocols() const; 32*ec7d71e6SNiels Sascha Reedijk 33*ec7d71e6SNiels Sascha Reedijk private: 34*ec7d71e6SNiels Sascha Reedijk BUrl fUrl; 35*ec7d71e6SNiels Sascha Reedijk BStringList fSupportedProtocols; 36*ec7d71e6SNiels Sascha Reedijk }; 37*ec7d71e6SNiels Sascha Reedijk 38*ec7d71e6SNiels Sascha Reedijk 39*ec7d71e6SNiels Sascha Reedijk class BInvalidUrl : public BError { 40*ec7d71e6SNiels Sascha Reedijk public: 41*ec7d71e6SNiels Sascha Reedijk BInvalidUrl(const char* origin, BUrl url); 42*ec7d71e6SNiels Sascha Reedijk BInvalidUrl(BString origin, BUrl url); 43*ec7d71e6SNiels Sascha Reedijk 44*ec7d71e6SNiels Sascha Reedijk virtual const char* Message() const noexcept override; 45*ec7d71e6SNiels Sascha Reedijk 46*ec7d71e6SNiels Sascha Reedijk const BUrl& Url() const; 47*ec7d71e6SNiels Sascha Reedijk 48*ec7d71e6SNiels Sascha Reedijk private: 49*ec7d71e6SNiels Sascha Reedijk BUrl fUrl; 50*ec7d71e6SNiels Sascha Reedijk }; 51*ec7d71e6SNiels Sascha Reedijk 52*ec7d71e6SNiels Sascha Reedijk 53*ec7d71e6SNiels Sascha Reedijk } 54*ec7d71e6SNiels Sascha Reedijk 55*ec7d71e6SNiels Sascha Reedijk } 56*ec7d71e6SNiels Sascha Reedijk 57*ec7d71e6SNiels Sascha Reedijk #endif 58