xref: /haiku/headers/private/netservices/GopherRequest.h (revision 78b14420513565ee1b68e0ac5db550fd855b287c)
1603e0bdfSNiels Sascha Reedijk /*
2603e0bdfSNiels Sascha Reedijk  * Copyright 2014 Haiku Inc. All rights reserved.
3603e0bdfSNiels Sascha Reedijk  * Distributed under the terms of the MIT License.
4603e0bdfSNiels Sascha Reedijk  */
5603e0bdfSNiels Sascha Reedijk #ifndef _B_GOPHER_REQUEST_H_
6603e0bdfSNiels Sascha Reedijk #define _B_GOPHER_REQUEST_H_
7603e0bdfSNiels Sascha Reedijk 
8603e0bdfSNiels Sascha Reedijk 
9603e0bdfSNiels Sascha Reedijk #include <deque>
10603e0bdfSNiels Sascha Reedijk 
11603e0bdfSNiels Sascha Reedijk #include <NetworkRequest.h>
12603e0bdfSNiels Sascha Reedijk #include <UrlProtocolRoster.h>
13603e0bdfSNiels Sascha Reedijk 
14603e0bdfSNiels Sascha Reedijk 
15ce64ffdbSNiels Sascha Reedijk #ifndef LIBNETAPI_DEPRECATED
16ce64ffdbSNiels Sascha Reedijk namespace BPrivate {
17ce64ffdbSNiels Sascha Reedijk 
18ce64ffdbSNiels Sascha Reedijk namespace Network {
19ce64ffdbSNiels Sascha Reedijk #endif
20ce64ffdbSNiels Sascha Reedijk 
21603e0bdfSNiels Sascha Reedijk class BGopherRequest : public BNetworkRequest {
22603e0bdfSNiels Sascha Reedijk public:
23603e0bdfSNiels Sascha Reedijk 	virtual						~BGopherRequest();
24603e0bdfSNiels Sascha Reedijk 
25603e0bdfSNiels Sascha Reedijk 			status_t			Stop();
26603e0bdfSNiels Sascha Reedijk 	const 	BUrlResult&			Result() const;
27603e0bdfSNiels Sascha Reedijk             void                SetDisableListener(bool disable);
28603e0bdfSNiels Sascha Reedijk 
29603e0bdfSNiels Sascha Reedijk private:
30603e0bdfSNiels Sascha Reedijk 			friend class BUrlProtocolRoster;
31603e0bdfSNiels Sascha Reedijk 
32*78b14420SLeorize #ifdef LIBNETAPI_DEPRECATED
33603e0bdfSNiels Sascha Reedijk 								BGopherRequest(const BUrl& url,
34603e0bdfSNiels Sascha Reedijk 									BUrlProtocolListener* listener = NULL,
35603e0bdfSNiels Sascha Reedijk 									BUrlContext* context = NULL);
36*78b14420SLeorize #else
37*78b14420SLeorize 								BGopherRequest(const BUrl& url,
38*78b14420SLeorize 									BDataIO* output,
39*78b14420SLeorize 									BUrlProtocolListener* listener = NULL,
40*78b14420SLeorize 									BUrlContext* context = NULL);
41*78b14420SLeorize #endif
42603e0bdfSNiels Sascha Reedijk 
43603e0bdfSNiels Sascha Reedijk 			status_t			_ProtocolLoop();
44603e0bdfSNiels Sascha Reedijk 			void				_SendRequest();
45603e0bdfSNiels Sascha Reedijk 
46603e0bdfSNiels Sascha Reedijk 			bool				_NeedsParsing();
47603e0bdfSNiels Sascha Reedijk 			bool				_NeedsLastDotStrip();
48*78b14420SLeorize #ifdef LIBNETAPI_DEPRECATED
49603e0bdfSNiels Sascha Reedijk 			void				_ParseInput(bool last);
50*78b14420SLeorize #else
51*78b14420SLeorize 			status_t			_ParseInput(bool last);
52*78b14420SLeorize #endif
53603e0bdfSNiels Sascha Reedijk 
54603e0bdfSNiels Sascha Reedijk 			BString&			_HTMLEscapeString(BString &str);
55603e0bdfSNiels Sascha Reedijk 
56603e0bdfSNiels Sascha Reedijk private:
57603e0bdfSNiels Sascha Reedijk 			char				fItemType;
58603e0bdfSNiels Sascha Reedijk 			BString				fPath;
59603e0bdfSNiels Sascha Reedijk 
60603e0bdfSNiels Sascha Reedijk 			ssize_t				fPosition;
61603e0bdfSNiels Sascha Reedijk 
62603e0bdfSNiels Sascha Reedijk 			BUrlResult			fResult;
63603e0bdfSNiels Sascha Reedijk };
64603e0bdfSNiels Sascha Reedijk 
65ce64ffdbSNiels Sascha Reedijk #ifndef LIBNETAPI_DEPRECATED
66ce64ffdbSNiels Sascha Reedijk } // namespace Network
67ce64ffdbSNiels Sascha Reedijk 
68ce64ffdbSNiels Sascha Reedijk } // namespace BPrivate
69ce64ffdbSNiels Sascha Reedijk #endif
70603e0bdfSNiels Sascha Reedijk 
71603e0bdfSNiels Sascha Reedijk #endif // _B_GOPHER_REQUEST_H_
72