]>
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 | |
28 | @headerfile protocol.h wx/protocol/protocol.h | |
7c913512 | 29 | |
a30b5ab9 | 30 | Represents a protocol for use with wxURL. |
7c913512 | 31 | |
23324ae1 | 32 | @library{wxnet} |
a30b5ab9 | 33 | @category{net} |
7c913512 | 34 | |
e54c96f1 | 35 | @see wxSocketBase, wxURL |
23324ae1 FM |
36 | */ |
37 | class wxProtocol : public wxSocketClient | |
38 | { | |
39 | public: | |
40 | /** | |
41 | Abort the current stream. | |
a30b5ab9 FM |
42 | |
43 | @warning | |
44 | It is advised to destroy the input stream instead of aborting the stream | |
45 | this way. | |
46 | ||
23324ae1 FM |
47 | @returns Returns @true, if successful, else @false. |
48 | */ | |
49 | bool Abort(); | |
50 | ||
51 | /** | |
52 | Returns the type of the content of the last opened stream. It is a mime-type. | |
53 | */ | |
54 | wxString GetContentType(); | |
55 | ||
56 | /** | |
57 | Returns the last occurred error. | |
a30b5ab9 FM |
58 | |
59 | @see wxProtocolError | |
23324ae1 FM |
60 | */ |
61 | wxProtocolError GetError(); | |
62 | ||
63 | /** | |
a30b5ab9 FM |
64 | Creates a new input stream on the specified path. |
65 | ||
66 | You can use all but seek() functionality of wxStream. | |
67 | Seek() isn't available on all streams. For example, HTTP or FTP streams | |
68 | don't deal with it. Other functions like StreamSize() and Tell() aren't | |
69 | available for the moment for this sort of stream. | |
23324ae1 | 70 | You will be notified when the EOF is reached by an error. |
a30b5ab9 | 71 | |
23324ae1 | 72 | @returns Returns the initialized stream. You will have to delete it |
4cc4bfaf FM |
73 | yourself once you don't use it anymore. The destructor |
74 | closes the network connection. | |
a30b5ab9 | 75 | |
4cc4bfaf | 76 | @see wxInputStream |
23324ae1 | 77 | */ |
4cc4bfaf | 78 | wxInputStream* GetInputStream(const wxString& path); |
23324ae1 FM |
79 | |
80 | /** | |
81 | Tries to reestablish a previous opened connection (close and renegotiate | |
82 | connection). | |
a30b5ab9 | 83 | |
23324ae1 FM |
84 | @returns @true, if the connection is established, else @false. |
85 | */ | |
86 | bool Reconnect(); | |
87 | ||
88 | /** | |
89 | Sets the authentication password. It is mainly useful when FTP is used. | |
90 | */ | |
91 | void SetPassword(const wxString& user); | |
92 | ||
93 | /** | |
94 | Sets the authentication user. It is mainly useful when FTP is used. | |
95 | */ | |
96 | void SetUser(const wxString& user); | |
97 | }; | |
e54c96f1 | 98 |