1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Protocol base class
4 // Author: Guilhem Lavaux
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PROTOCOL_PROTOCOL_H
12 #define _WX_PROTOCOL_PROTOCOL_H
21 #include "wx/object.h"
22 #include "wx/string.h"
23 #include "wx/stream.h"
26 #include "wx/socket.h"
43 #define DECLARE_PROTOCOL(class) \
45 static wxProtoInfo g_proto_##class;
47 #define IMPLEMENT_PROTOCOL(class, name, serv, host) \
48 wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class));
50 class WXDLLEXPORT wxProtoInfo
: public wxObject
{
51 DECLARE_DYNAMIC_CLASS(wxProtoInfo
)
62 wxProtoInfo(const wxChar
*name
, const wxChar
*serv_name
, const bool need_host1
,
66 class WXDLLEXPORT wxProtocol
68 : public wxSocketClient
{
72 DECLARE_ABSTRACT_CLASS(wxProtocol
)
78 virtual bool Connect( const wxString
& WXUNUSED(host
) ) { return FALSE
; }
79 virtual bool Connect( wxSockAddress
& addr
, bool WXUNUSED(wait
) = TRUE
) { return wxSocketClient::Connect(addr
); }
82 virtual bool Abort() = 0;
83 virtual wxInputStream
*GetInputStream(const wxString
& path
) = 0;
84 virtual wxProtocolError
GetError() = 0;
85 virtual wxString
GetContentType() { return wxEmptyString
; }
86 virtual void SetUser(const wxString
& WXUNUSED(user
)) {}
87 virtual void SetPassword(const wxString
& WXUNUSED(passwd
) ) {}
91 wxProtocolError WXDLLEXPORT
GetLine(wxSocketBase
*sock
, wxString
& result
);
94 #endif // _WX_PROTOCOL_PROTOCOL_H