]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: protocol/protocol.h | |
e54c96f1 | 3 | // Purpose: interface of wxProtocol |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
a30b5ab9 FM |
9 | /** |
10 | Error values returned by wxProtocol. | |
11 | */ | |
12 | enum wxProtocolError | |
13 | { | |
14 | wxPROTO_NOERR = 0, //!< No error. | |
15 | wxPROTO_NETERR, //!< A generic network error occurred. | |
16 | wxPROTO_PROTERR, //!< An error occurred during negotiation. | |
17 | wxPROTO_CONNERR, //!< The client failed to connect the server. | |
18 | wxPROTO_INVVAL, //!< Invalid value. | |
19 | wxPROTO_NOHNDLR, //!< Not currently used. | |
20 | wxPROTO_NOFILE, //!< The remote file doesn't exist. | |
21 | wxPROTO_ABRT, //!< Last action aborted. | |
22 | wxPROTO_RCNCT, //!< An error occurred during reconnection. | |
23 | wxPROTO_STREAMING //!< Someone tried to send a command during a transfer. | |
24 | }; | |
25 | ||
23324ae1 FM |
26 | /** |
27 | @class wxProtocol | |
7c913512 | 28 | |
a30b5ab9 | 29 | Represents a protocol for use with wxURL. |
7c913512 | 30 | |
23324ae1 | 31 | @library{wxnet} |
a30b5ab9 | 32 | @category{net} |
7c913512 | 33 | |
e54c96f1 | 34 | @see wxSocketBase, wxURL |
23324ae1 FM |
35 | */ |
36 | class wxProtocol : public wxSocketClient | |
37 | { | |
38 | public: | |
39 | /** | |
40 | Abort the current stream. | |
a30b5ab9 FM |
41 | |
42 | @warning | |
43 | It is advised to destroy the input stream instead of aborting the stream | |
44 | this way. | |
45 | ||
d29a9a8a | 46 | @return Returns @true, if successful, else @false. |
23324ae1 | 47 | */ |
da1ed74c | 48 | virtual bool Abort() = 0; |
23324ae1 FM |
49 | |
50 | /** | |
51 | Returns the type of the content of the last opened stream. It is a mime-type. | |
52 | */ | |
adaaa686 | 53 | virtual wxString GetContentType(); |
23324ae1 FM |
54 | |
55 | /** | |
56 | Returns the last occurred error. | |
a30b5ab9 FM |
57 | |
58 | @see wxProtocolError | |
23324ae1 | 59 | */ |
da1ed74c | 60 | virtual wxProtocolError GetError() = 0; |
23324ae1 FM |
61 | |
62 | /** | |
a30b5ab9 FM |
63 | Creates a new input stream on the specified path. |
64 | ||
65 | You can use all but seek() functionality of wxStream. | |
66 | Seek() isn't available on all streams. For example, HTTP or FTP streams | |
67 | don't deal with it. Other functions like StreamSize() and Tell() aren't | |
68 | available for the moment for this sort of stream. | |
23324ae1 | 69 | You will be notified when the EOF is reached by an error. |
a30b5ab9 | 70 | |
d29a9a8a | 71 | @return Returns the initialized stream. You will have to delete it |
4cc4bfaf FM |
72 | yourself once you don't use it anymore. The destructor |
73 | closes the network connection. | |
a30b5ab9 | 74 | |
4cc4bfaf | 75 | @see wxInputStream |
23324ae1 | 76 | */ |
da1ed74c | 77 | virtual wxInputStream* GetInputStream(const wxString& path) = 0; |
23324ae1 FM |
78 | |
79 | /** | |
80 | Tries to reestablish a previous opened connection (close and renegotiate | |
81 | connection). | |
a30b5ab9 | 82 | |
d29a9a8a | 83 | @return @true, if the connection is established, else @false. |
23324ae1 FM |
84 | */ |
85 | bool Reconnect(); | |
86 | ||
87 | /** | |
88 | Sets the authentication password. It is mainly useful when FTP is used. | |
89 | */ | |
adaaa686 | 90 | virtual void SetPassword(const wxString& user); |
23324ae1 FM |
91 | |
92 | /** | |
93 | Sets the authentication user. It is mainly useful when FTP is used. | |
94 | */ | |
adaaa686 | 95 | virtual void SetUser(const wxString& user); |
23324ae1 | 96 | }; |
e54c96f1 | 97 |