1/* 2 * Copyright 2010 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_ 6#define _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_ 7 8 9#include <Handler.h> 10#include <Message.h> 11#include <UrlProtocolDispatchingListener.h> 12 13 14class BUrlProtocolAsynchronousListener : public BHandler { 15public: 16 BUrlProtocolAsynchronousListener( 17 bool transparent = false); 18 virtual ~BUrlProtocolAsynchronousListener(); 19 20 virtual void ConnectionOpened(BUrlProtocol* caller); 21 virtual void HostnameResolved(BUrlProtocol* caller, 22 const char* ip); 23 virtual void ResponseStarted(BUrlProtocol* caller); 24 virtual void HeadersReceived(BUrlProtocol* caller); 25 virtual void DataReceived(BUrlProtocol* caller, 26 const char* data, ssize_t size); 27 virtual void DownloadProgress(BUrlProtocol* caller, 28 ssize_t bytesReceived, ssize_t bytesTotal); 29 virtual void UploadProgress(BUrlProtocol* caller, 30 ssize_t bytesSent, ssize_t bytesTotal); 31 virtual void RequestCompleted(BUrlProtocol* caller, 32 bool success); 33 34 // Synchronous listener access 35 BUrlProtocolListener* SynchronousListener(); 36 37 // BHandler interface 38 virtual void MessageReceived(BMessage* message); 39 40private: 41 BUrlProtocolDispatchingListener* 42 fSynchronousListener; 43}; 44 45#endif // _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_ 46 47