Fix FreeBSD build.
[haiku.git] / headers / os / net / UrlSynchronousRequest.h
blob4a7dbfc3eff237cd2c8427eb2df773712fe59346
1 /*
2 * Copyright 2010 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _B_URL_SYNCHRONOUS_REQUEST_H_
6 #define _B_URL_SYNCHRONOUS_REQUEST_H_
9 #include <UrlRequest.h>
10 #include <UrlProtocolListener.h>
13 class BUrlSynchronousRequest : public BUrlRequest, public BUrlProtocolListener {
14 public:
15 BUrlSynchronousRequest(BUrlRequest& asynchronousRequest);
16 virtual ~BUrlSynchronousRequest() { };
18 // Synchronous wait
19 virtual status_t Perform();
20 virtual status_t WaitUntilCompletion();
22 // Protocol hooks
23 virtual void ConnectionOpened(BUrlRequest* caller);
24 virtual void HostnameResolved(BUrlRequest* caller,
25 const char* ip);
26 virtual void ResponseStarted(BUrlRequest* caller);
27 virtual void HeadersReceived(BUrlRequest* caller,
28 const BUrlResult& result);
29 virtual void DataReceived(BUrlRequest* caller,
30 const char* data, off_t position,
31 ssize_t size);
32 virtual void DownloadProgress(BUrlRequest* caller,
33 ssize_t bytesReceived, ssize_t bytesTotal);
34 virtual void UploadProgress(BUrlRequest* caller,
35 ssize_t bytesSent, ssize_t bytesTotal);
36 virtual void RequestCompleted(BUrlRequest* caller,
37 bool success);
40 protected:
41 bool fRequestComplete;
42 BUrlRequest& fWrappedRequest;
46 #endif // _B_URL_SYNCHRONOUS_REQUEST_H_