xref: /haiku/headers/private/netservices/UrlProtocolListener.h (revision 70b63f18b32a7ae90e4ff49659ba3844ce4c9aa5)
1603e0bdfSNiels Sascha Reedijk /*
2603e0bdfSNiels Sascha Reedijk  * Copyright 2010-2017 Haiku Inc. All rights reserved.
3603e0bdfSNiels Sascha Reedijk  * Distributed under the terms of the MIT License.
4603e0bdfSNiels Sascha Reedijk  */
5603e0bdfSNiels Sascha Reedijk #ifndef _B_URL_PROTOCOL_LISTENER_H_
6603e0bdfSNiels Sascha Reedijk #define _B_URL_PROTOCOL_LISTENER_H_
7603e0bdfSNiels Sascha Reedijk 
8603e0bdfSNiels Sascha Reedijk 
9603e0bdfSNiels Sascha Reedijk #include <stddef.h>
10603e0bdfSNiels Sascha Reedijk #include <cstdlib>
11603e0bdfSNiels Sascha Reedijk 
12603e0bdfSNiels Sascha Reedijk #include <UrlResult.h>
13603e0bdfSNiels Sascha Reedijk 
14603e0bdfSNiels Sascha Reedijk 
15603e0bdfSNiels Sascha Reedijk class BCertificate;
16ce64ffdbSNiels Sascha Reedijk 
17*70b63f18SNiels Sascha Reedijk 
18ce64ffdbSNiels Sascha Reedijk namespace BPrivate {
19ce64ffdbSNiels Sascha Reedijk 
20ce64ffdbSNiels Sascha Reedijk namespace Network {
21*70b63f18SNiels Sascha Reedijk 
22ce64ffdbSNiels Sascha Reedijk 
23603e0bdfSNiels Sascha Reedijk class BUrlRequest;
24603e0bdfSNiels Sascha Reedijk 
25603e0bdfSNiels Sascha Reedijk 
26603e0bdfSNiels Sascha Reedijk enum BUrlProtocolDebugMessage {
27603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_TEXT,
28603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_ERROR,
29603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_HEADER_IN,
30603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_HEADER_OUT,
31603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_TRANSFER_IN,
32603e0bdfSNiels Sascha Reedijk 	B_URL_PROTOCOL_DEBUG_TRANSFER_OUT
33603e0bdfSNiels Sascha Reedijk };
34603e0bdfSNiels Sascha Reedijk 
35603e0bdfSNiels Sascha Reedijk 
36603e0bdfSNiels Sascha Reedijk class BUrlProtocolListener {
37603e0bdfSNiels Sascha Reedijk public:
38603e0bdfSNiels Sascha Reedijk 	virtual	void				ConnectionOpened(BUrlRequest* caller);
39603e0bdfSNiels Sascha Reedijk 	virtual	void				HostnameResolved(BUrlRequest* caller,
40603e0bdfSNiels Sascha Reedijk 									const char* ip);
41603e0bdfSNiels Sascha Reedijk 	virtual	void				ResponseStarted(BUrlRequest* caller);
4278b14420SLeorize 	virtual	void				HeadersReceived(BUrlRequest* caller);
4378b14420SLeorize 	virtual	void				BytesWritten(BUrlRequest* caller,
4478b14420SLeorize 									size_t bytesWritten);
45626466daSX512 	virtual	void				DownloadProgress(BUrlRequest* caller,
46626466daSX512 									off_t bytesReceived, off_t bytesTotal);
47626466daSX512 	virtual void				UploadProgress(BUrlRequest* caller,
48626466daSX512 									off_t bytesSent, off_t bytesTotal);
49626466daSX512 
50603e0bdfSNiels Sascha Reedijk 	virtual	void				RequestCompleted(BUrlRequest* caller,
51603e0bdfSNiels Sascha Reedijk 									bool success);
52603e0bdfSNiels Sascha Reedijk 	virtual	void				DebugMessage(BUrlRequest* caller,
53603e0bdfSNiels Sascha Reedijk 									BUrlProtocolDebugMessage type,
54603e0bdfSNiels Sascha Reedijk 									const char* text);
55603e0bdfSNiels Sascha Reedijk 	virtual	bool				CertificateVerificationFailed(
56603e0bdfSNiels Sascha Reedijk 									BUrlRequest* caller,
57603e0bdfSNiels Sascha Reedijk 									BCertificate& certificate,
58603e0bdfSNiels Sascha Reedijk 									const char* message);
59603e0bdfSNiels Sascha Reedijk };
60603e0bdfSNiels Sascha Reedijk 
61*70b63f18SNiels Sascha Reedijk 
62ce64ffdbSNiels Sascha Reedijk } // namespace Network
63ce64ffdbSNiels Sascha Reedijk 
64ce64ffdbSNiels Sascha Reedijk } // namespace BPrivate
65ce64ffdbSNiels Sascha Reedijk 
66603e0bdfSNiels Sascha Reedijk #endif // _B_URL_PROTOCOL_LISTENER_H_
67