]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/protocol/protocol.h
ea076402de785f701f7f4b61d32c5d3b21fceb01
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: protocol/protocol.h
3 // Purpose: interface of wxProtocol
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 Error values returned by wxProtocol.
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.
29 Represents a protocol for use with wxURL.
31 Note that you may want to change the default time-out for HTTP/FTP connections
32 and network operations (using SetDefaultTimeout()) since the default time-out
33 value is quite long (60 seconds).
38 @see wxSocketBase, wxURL
40 class wxProtocol
: public wxSocketClient
44 Abort the current stream.
47 It is advised to destroy the input stream instead of aborting the stream
50 @return Returns @true, if successful, else @false.
52 virtual bool Abort() = 0;
55 Returns the type of the content of the last opened stream. It is a mime-type.
56 May be an empty string if the content-type is unknown.
58 virtual wxString
GetContentType() const;
61 Returns the last occurred error.
65 virtual wxProtocolError
GetError() const;
68 Creates a new input stream on the specified path.
70 You can use all but seek() functionality of wxStream.
71 Seek() isn't available on all streams. For example, HTTP or FTP streams
72 don't deal with it. Other functions like StreamSize() and Tell() aren't
73 available for the moment for this sort of stream.
74 You will be notified when the EOF is reached by an error.
76 @return Returns the initialized stream. You will have to delete it
77 yourself once you don't use it anymore. The destructor
78 closes the network connection.
82 virtual wxInputStream
* GetInputStream(const wxString
& path
) = 0;
85 Tries to reestablish a previous opened connection (close and renegotiate
88 @return @true, if the connection is established, else @false.
93 Sets the authentication password.
95 virtual void SetPassword(const wxString
& user
);
98 Sets the authentication user.
100 virtual void SetUser(const wxString
& user
);
103 Sets a new default timeout for the network operations.
105 The default timeout is 60 seconds.
107 @see wxSocketBase::SetTimeout
109 void SetDefaultTimeout(wxUint32 Value
);