]> git.saurik.com Git - wxWidgets.git/blame - include/wx/sckaddr.h
Replaced typedef with #define for VC++ 1.5, to prevent 'no constructor' error
[wxWidgets.git] / include / wx / sckaddr.h
CommitLineData
f4ada568
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: sckaddr.h
3// Purpose: Network address classes
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 26/04/1997
7// RCS-ID: $Id$
8// Copyright: (c) 1997, 1998 Guilhem Lavaux
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
2df7be7f 11
f4ada568
GL
12#ifndef _WX_NETWORK_ADDRESS_H
13#define _WX_NETWORK_ADDRESS_H
14
2df7be7f
RR
15#ifdef __GNUG__
16#pragma interface
17#endif
18
19#include "wx/defs.h"
20
21#if wxUSE_SOCKETS
22
2df7be7f 23#include "wx/string.h"
65ccd2b8 24#include "wx/gsocket.h"
a324a7bc 25
f4ada568
GL
26
27class WXDLLEXPORT wxSockAddress : public wxObject {
28 DECLARE_ABSTRACT_CLASS(wxSockAddress)
29public:
30 typedef enum { IPV4=1, IPV6=2, UNIX=3 } Addr;
31
a324a7bc
GL
32 wxSockAddress();
33 virtual ~wxSockAddress();
34
35 virtual void Clear();
36 virtual int Type() = 0;
f4ada568 37
a324a7bc
GL
38 GAddress *GetAddress() const { return m_address; }
39 void SetAddress(GAddress *address);
40 const wxSockAddress& operator =(const wxSockAddress& addr);
f4ada568 41
a324a7bc 42 void CopyObject(wxObject& dest) const;
f4ada568 43
a324a7bc
GL
44protected:
45 GAddress *m_address;
f4ada568
GL
46};
47
48class WXDLLEXPORT wxIPV4address : public wxSockAddress {
49 DECLARE_DYNAMIC_CLASS(wxIPV4address)
f4ada568
GL
50public:
51 wxIPV4address();
52 virtual ~wxIPV4address();
53
a324a7bc
GL
54 bool Hostname(const wxString& name);
55 bool Hostname(unsigned long addr);
56 bool Service(const wxString& name);
57 bool Service(unsigned short port);
58 bool LocalHost();
636c47a7 59 bool AnyAddress();
f4ada568
GL
60
61 wxString Hostname();
62 unsigned short Service();
63
f4ada568
GL
64 inline int Type() { return wxSockAddress::IPV4; }
65};
66
67#ifdef ENABLE_IPV6
68class WXDLLEXPORT wxIPV6address : public wxSockAddress {
69 DECLARE_DYNAMIC_CLASS(wxIPV6address)
70private:
71 struct sockaddr_in6 *m_addr;
72public:
73 wxIPV6address();
74 ~wxIPV6address();
75
f4ada568
GL
76 bool Hostname(const wxString& name);
77 bool Hostname(unsigned char addr[16]);
78 bool Service(const wxString& name);
79 bool Service(unsigned short port);
80 bool LocalHost();
81
82 wxString Hostname() const;
83 unsigned short Service() const;
84
f4ada568
GL
85 inline int Type() { return wxSockAddress::IPV6; }
86};
87#endif
88
03e11df5 89#if defined(__UNIX__) && !defined(__APPLE__)
fd9811b1 90#include <sys/socket.h>
e1c70641
JJ
91#ifndef __VMS__
92# include <sys/un.h>
93#endif
f4ada568
GL
94
95class WXDLLEXPORT wxUNIXaddress : public wxSockAddress {
96 DECLARE_DYNAMIC_CLASS(wxUNIXaddress)
97private:
98 struct sockaddr_un *m_addr;
99public:
100 wxUNIXaddress();
101 ~wxUNIXaddress();
102
f4ada568
GL
103 void Filename(const wxString& name);
104 wxString Filename();
105
f4ada568
GL
106 inline int Type() { return wxSockAddress::UNIX; }
107};
108#endif
2df7be7f 109 // __UNIX__
f4ada568
GL
110
111#endif
2df7be7f 112 // wxUSE_SOCKETS
65ccd2b8 113
2df7be7f
RR
114#endif
115 // _WX_NETWORK_ADDRESS_H