Fix FreeBSD build.
[haiku.git] / headers / os / net / UrlProtocolDispatchingListener.h
blob0107c2cfdc634c9d4d8c8a40ab38fa953f603f6e
1 /*
2 * Copyright 2010 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_
6 #define _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_
9 #include <Messenger.h>
10 #include <Message.h>
11 #include <UrlProtocolListener.h>
14 //! To be in AppTypes.h
15 enum {
16 B_URL_PROTOCOL_NOTIFICATION = '_UPN'
20 // Notification types
21 enum {
22 B_URL_PROTOCOL_CONNECTION_OPENED,
23 B_URL_PROTOCOL_HOSTNAME_RESOLVED,
24 B_URL_PROTOCOL_RESPONSE_STARTED,
25 B_URL_PROTOCOL_HEADERS_RECEIVED,
26 B_URL_PROTOCOL_DATA_RECEIVED,
27 B_URL_PROTOCOL_DOWNLOAD_PROGRESS,
28 B_URL_PROTOCOL_UPLOAD_PROGRESS,
29 B_URL_PROTOCOL_REQUEST_COMPLETED,
30 B_URL_PROTOCOL_CERTIFICATE_VERIFICATION_FAILED,
31 B_URL_PROTOCOL_DEBUG_MESSAGE
35 class BUrlProtocolDispatchingListener : public BUrlProtocolListener {
36 public:
37 BUrlProtocolDispatchingListener(
38 BHandler* handler);
39 BUrlProtocolDispatchingListener(
40 const BMessenger& messenger);
41 virtual ~BUrlProtocolDispatchingListener();
43 virtual void ConnectionOpened(BUrlRequest* caller);
44 virtual void HostnameResolved(BUrlRequest* caller,
45 const char* ip);
46 virtual void ResponseStarted(BUrlRequest* caller);
47 virtual void HeadersReceived(BUrlRequest* caller,
48 const BUrlResult& result);
49 virtual void DataReceived(BUrlRequest* caller,
50 const char* data, off_t position,
51 ssize_t size);
52 virtual void DownloadProgress(BUrlRequest* caller,
53 ssize_t bytesReceived, ssize_t bytesTotal);
54 virtual void UploadProgress(BUrlRequest* caller,
55 ssize_t bytesSent, ssize_t bytesTotal);
56 virtual void RequestCompleted(BUrlRequest* caller,
57 bool success);
58 virtual void DebugMessage(BUrlRequest* caller,
59 BUrlProtocolDebugMessage type,
60 const char* text);
61 virtual bool CertificateVerificationFailed(
62 BUrlRequest* caller,
63 BCertificate& certificate,
64 const char* message);
66 private:
67 void _SendMessage(BMessage* message,
68 int8 notification, BUrlRequest* caller);
70 private:
71 BMessenger fMessenger;
74 #endif // _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_