2001-10-06 14:13:28 +00:00
|
|
|
#ifndef XSOCKET_H
|
|
|
|
#define XSOCKET_H
|
|
|
|
|
|
|
|
#include "XBase.h"
|
2002-06-10 22:06:45 +00:00
|
|
|
#include "CString.h"
|
2001-10-06 14:13:28 +00:00
|
|
|
#include "BasicTypes.h"
|
|
|
|
|
|
|
|
class XSocket : public XBase { };
|
|
|
|
|
|
|
|
class XSocketAddress : public XSocket {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-10-06 14:13:28 +00:00
|
|
|
enum Error { kUnknown, kNotFound, kNoAddress, kBadPort };
|
|
|
|
|
2002-06-09 16:53:25 +00:00
|
|
|
XSocketAddress(Error, const CString& hostname, UInt16 port) throw();
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
virtual Error getError() const throw();
|
|
|
|
virtual CString getHostname() const throw();
|
2002-06-09 16:53:25 +00:00
|
|
|
virtual UInt16 getPort() const throw();
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
protected:
|
2001-10-06 14:13:28 +00:00
|
|
|
// XBase overrides
|
|
|
|
virtual CString getWhat() const throw();
|
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2001-10-06 14:13:28 +00:00
|
|
|
Error m_error;
|
|
|
|
CString m_hostname;
|
2002-06-09 16:53:25 +00:00
|
|
|
UInt16 m_port;
|
2001-10-06 14:13:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class XSocketErrno : public XSocket, public MXErrno {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-10-06 14:13:28 +00:00
|
|
|
XSocketErrno();
|
|
|
|
XSocketErrno(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
class XSocketBind : public XSocketErrno {
|
2002-04-29 14:40:01 +00:00
|
|
|
protected:
|
2001-10-06 14:13:28 +00:00
|
|
|
// XBase overrides
|
|
|
|
virtual CString getWhat() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
class XSocketAddressInUse : public XSocketBind { };
|
|
|
|
|
|
|
|
class XSocketConnect : public XSocketErrno {
|
2002-04-29 14:40:01 +00:00
|
|
|
protected:
|
2001-10-06 14:13:28 +00:00
|
|
|
// XBase overrides
|
|
|
|
virtual CString getWhat() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
class XSocketCreate : public XSocketErrno {
|
2002-04-29 14:40:01 +00:00
|
|
|
protected:
|
2001-10-06 14:13:28 +00:00
|
|
|
// XBase overrides
|
|
|
|
virtual CString getWhat() const throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|