xref: /haiku/headers/private/netservices/UrlContext.h (revision 08b9db66ac0a5d4fa92dcb82820e1435f203ea42)
1 /*
2  * Copyright 2010-2015 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #ifndef _B_URL_CONTEXT_H_
8 #define _B_URL_CONTEXT_H_
9 
10 
11 #include <Certificate.h>
12 #include <HttpAuthentication.h>
13 #include <NetworkCookieJar.h>
14 #include <Referenceable.h>
15 
16 
17 #ifndef LIBNETAPI_DEPRECATED
18 namespace BPrivate {
19 
20 namespace Network {
21 #endif
22 
23 class BUrlContext: public BReferenceable {
24 public:
25 								BUrlContext();
26 								~BUrlContext();
27 
28 	// Context modifiers
29 			void				SetCookieJar(
30 									const BNetworkCookieJar& cookieJar);
31 			void				AddAuthentication(const BUrl& url,
32 									const BHttpAuthentication& authentication);
33 			void				SetProxy(BString host, uint16 port);
34 			void				AddCertificateException(const BCertificate& certificate);
35 
36 	// Context accessors
37 			BNetworkCookieJar&	GetCookieJar();
38 			BHttpAuthentication& GetAuthentication(const BUrl& url);
39 			bool				UseProxy();
40 			BString				GetProxyHost();
41 			uint16				GetProxyPort();
42 			bool				HasCertificateException(const BCertificate& certificate);
43 
44 private:
45 			class 				BHttpAuthenticationMap;
46 
47 private:
48 			BNetworkCookieJar	fCookieJar;
49 			BHttpAuthenticationMap* fAuthenticationMap;
50 			typedef BObjectList<const BCertificate> BCertificateSet;
51 			BCertificateSet		fCertificates;
52 
53 			BString				fProxyHost;
54 			uint16				fProxyPort;
55 };
56 
57 
58 #ifndef LIBNETAPI_DEPRECATED
59 } // namespace Network
60 
61 } // namespace BPrivate
62 #endif
63 
64 
65 #endif // _B_URL_CONTEXT_H_
66