1 /* 2 * Copyright 2014 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _B_NET_REQUEST_H_ 6 #define _B_NET_REQUEST_H_ 7 8 9 #include <NetBuffer.h> 10 #include <NetworkAddress.h> 11 #include <UrlRequest.h> 12 13 14 class BAbstractSocket; 15 16 17 #ifndef LIBNETAPI_DEPRECATED 18 namespace BPrivate { 19 20 namespace Network { 21 #endif 22 23 class BNetworkRequest: public BUrlRequest 24 { 25 public: 26 #ifdef LIBNETAPI_DEPRECATED 27 BNetworkRequest(const BUrl& url, 28 BUrlProtocolListener* listener, 29 BUrlContext* context, 30 const char* threadName, 31 const char* protocolName); 32 #else 33 BNetworkRequest(const BUrl& url, 34 BDataIO* output, 35 BUrlProtocolListener* listener, 36 BUrlContext* context, 37 const char* threadName, 38 const char* protocolName); 39 #endif 40 41 virtual status_t Stop(); 42 virtual void SetTimeout(bigtime_t timeout); 43 44 protected: 45 bool _ResolveHostName(BString host, uint16_t port); 46 47 void _ProtocolSetup(); 48 status_t _GetLine(BString& destString); 49 50 protected: 51 BAbstractSocket* fSocket; 52 BNetworkAddress fRemoteAddr; 53 54 BNetBuffer fInputBuffer; 55 }; 56 57 #ifndef LIBNETAPI_DEPRECATED 58 } // namespace Network 59 60 } // namespace BPrivate 61 #endif 62 63 #endif 64