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 char *name
, const char *serv_name
, const bool need_host1
,
60 class WXDLLEXPORT wxProtocol
: public wxSocketClient
{
61 DECLARE_ABSTRACT_CLASS(wxProtocol
)
66 virtual bool Connect(const wxString
& host
) { return FALSE
; }
67 virtual bool Connect(wxSockAddress
& addr
) { 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 (char *)NULL
; }
73 virtual void SetUser(const wxString
& user
) {}
74 virtual void SetPassword(const wxString
& passwd
) {}
77 wxProtocolError WXDLLEXPORT
GetLine(wxSocketBase
*sock
, wxString
& result
);