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
18 #include "wx/object.h"
19 #include "wx/string.h"
20 #include "wx/stream.h"
21 #include "wx/socket.h"
37 #define DECLARE_PROTOCOL(class) \
39 static wxProtoInfo g_proto_##class;
41 #define IMPLEMENT_PROTOCOL(class, name, serv, host) \
42 wxProtoInfo class::g_proto_##class(name, serv, host, CLASSINFO(class));
44 class WXDLLEXPORT wxProtoInfo
: public wxObject
{
45 DECLARE_DYNAMIC_CLASS(wxProtoInfo
)
56 wxProtoInfo(const wxChar
*name
, const wxChar
*serv_name
, const bool need_host1
,
60 class WXDLLEXPORT wxProtocol
: public wxSocketClient
{
61 DECLARE_ABSTRACT_CLASS(wxProtocol
)
66 virtual bool Connect( const wxString
& WXUNUSED(host
) ) { return FALSE
; }
67 virtual bool Connect( wxSockAddress
& addr
, bool WXUNUSED(wait
) = TRUE
) { return wxSocketClient::Connect(addr
); }
69 virtual bool Abort() = 0;
70 virtual wxInputStream
*GetInputStream(const wxString
& path
) = 0;
71 virtual wxProtocolError
GetError() = 0;
72 virtual wxString
GetContentType() { return wxEmptyString
; }
73 virtual void SetUser(const wxString
& WXUNUSED(user
)) {}
74 virtual void SetPassword(const wxString
& WXUNUSED(passwd
) ) {}
77 wxProtocolError WXDLLEXPORT
GetLine(wxSocketBase
*sock
, wxString
& result
);