xref: /haiku/headers/private/netservices/GopherRequest.h (revision ce64ffdb9003171981534bc5d3e49147561ed096)
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 
15*ce64ffdbSNiels Sascha Reedijk #ifndef LIBNETAPI_DEPRECATED
16*ce64ffdbSNiels Sascha Reedijk namespace BPrivate {
17*ce64ffdbSNiels Sascha Reedijk 
18*ce64ffdbSNiels Sascha Reedijk namespace Network {
19*ce64ffdbSNiels Sascha Reedijk #endif
20*ce64ffdbSNiels 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 
32603e0bdfSNiels Sascha Reedijk 								BGopherRequest(const BUrl& url,
33603e0bdfSNiels Sascha Reedijk 									BUrlProtocolListener* listener = NULL,
34603e0bdfSNiels Sascha Reedijk 									BUrlContext* context = NULL);
35603e0bdfSNiels Sascha Reedijk 
36603e0bdfSNiels Sascha Reedijk 			status_t			_ProtocolLoop();
37603e0bdfSNiels Sascha Reedijk 			void				_SendRequest();
38603e0bdfSNiels Sascha Reedijk 
39603e0bdfSNiels Sascha Reedijk 			bool				_NeedsParsing();
40603e0bdfSNiels Sascha Reedijk 			bool				_NeedsLastDotStrip();
41603e0bdfSNiels Sascha Reedijk 			void				_ParseInput(bool last);
42603e0bdfSNiels Sascha Reedijk 
43603e0bdfSNiels Sascha Reedijk 			BString&			_HTMLEscapeString(BString &str);
44603e0bdfSNiels Sascha Reedijk 
45603e0bdfSNiels Sascha Reedijk private:
46603e0bdfSNiels Sascha Reedijk 			char				fItemType;
47603e0bdfSNiels Sascha Reedijk 			BString				fPath;
48603e0bdfSNiels Sascha Reedijk 
49603e0bdfSNiels Sascha Reedijk 			ssize_t				fPosition;
50603e0bdfSNiels Sascha Reedijk 
51603e0bdfSNiels Sascha Reedijk 			BUrlResult			fResult;
52603e0bdfSNiels Sascha Reedijk };
53603e0bdfSNiels Sascha Reedijk 
54*ce64ffdbSNiels Sascha Reedijk #ifndef LIBNETAPI_DEPRECATED
55*ce64ffdbSNiels Sascha Reedijk } // namespace Network
56*ce64ffdbSNiels Sascha Reedijk 
57*ce64ffdbSNiels Sascha Reedijk } // namespace BPrivate
58*ce64ffdbSNiels Sascha Reedijk #endif
59603e0bdfSNiels Sascha Reedijk 
60603e0bdfSNiels Sascha Reedijk #endif // _B_GOPHER_REQUEST_H_
61