Streamline wxSocket code: wxSocketBase now uses wxSocketImpl (previously known
as GSocket) which is a base class with various wxSocketImplXXX implementations provided by different wxSocketManagers. Share more code between ports (still not finished). Refactor some code inside wxSocketImpl itself to be less redundant and fixed a couple of minor bugs in the process. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56994 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
110
Makefile.in
110
Makefile.in
@@ -27,7 +27,6 @@ STRIP = @STRIP@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_DIR = @INSTALL_DIR@
|
||||
ICC_PCH_USE_SWITCH = @ICC_PCH_USE_SWITCH@
|
||||
BK_DEPS = @BK_DEPS@
|
||||
BK_MAKE_PCH = @BK_MAKE_PCH@
|
||||
srcdir = @srcdir@
|
||||
@@ -817,6 +816,7 @@ ALL_BASE_SOURCES = \
|
||||
src/common/socket.cpp \
|
||||
src/common/url.cpp \
|
||||
src/unix/gsocket.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/msw/gsocket.cpp \
|
||||
src/msw/gsockmsw.cpp \
|
||||
src/msw/urlmsw.cpp \
|
||||
@@ -1959,7 +1959,6 @@ COND_TOOLKIT__BASE_OSX_SRC = \
|
||||
src/unix/utilsunx.cpp \
|
||||
src/unix/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -1980,7 +1979,6 @@ COND_TOOLKIT_COCOA_BASE_OSX_SRC = \
|
||||
src/unix/utilsunx.cpp \
|
||||
src/unix/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -2001,7 +1999,6 @@ COND_TOOLKIT_GTK_BASE_OSX_SRC = \
|
||||
src/unix/utilsunx.cpp \
|
||||
src/unix/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -2022,7 +2019,6 @@ COND_TOOLKIT_MOTIF_BASE_OSX_SRC = \
|
||||
src/unix/utilsunx.cpp \
|
||||
src/unix/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -2030,7 +2026,6 @@ COND_TOOLKIT_MOTIF_BASE_OSX_SRC = \
|
||||
COND_TOOLKIT_OSX_CARBON_BASE_OSX_SRC = \
|
||||
src/osx/core/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp \
|
||||
@@ -2051,7 +2046,6 @@ COND_TOOLKIT_OSX_CARBON_BASE_OSX_SRC = \
|
||||
COND_TOOLKIT_OSX_COCOA_BASE_OSX_SRC = \
|
||||
src/osx/core/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp \
|
||||
@@ -2085,7 +2079,6 @@ COND_TOOLKIT_X11_BASE_OSX_SRC = \
|
||||
src/unix/utilsunx.cpp \
|
||||
src/unix/mimetype.cpp \
|
||||
src/osx/core/cfstring.cpp \
|
||||
src/osx/core/gsockosx.cpp \
|
||||
src/osx/core/stdpaths_cf.cpp \
|
||||
src/osx/core/strconv_cf.cpp \
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -3951,7 +3944,7 @@ COND_WINDOWS_IMPLIB_1___monodll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__monodll___importlib = $(COND_WINDOWS_IMPLIB_1___monodll___importlib)
|
||||
@COND_GCC_PCH_1@__monodll_PCH_INC = -I./.pch/wxprec_monodll
|
||||
@COND_ICC_PCH_1@__monodll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__monodll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_monodll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_monodll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_monodll/wx/wxprec.h.gch
|
||||
@@ -3988,7 +3981,6 @@ COND_USE_SOSYMLINKS_1___monodll___so_symlinks_uninst_cmd = rm -f \
|
||||
COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS = \
|
||||
monodll_core_mimetype.o \
|
||||
monodll_cfstring.o \
|
||||
monodll_gsockosx.o \
|
||||
monodll_stdpaths_cf.o \
|
||||
monodll_strconv_cf.o \
|
||||
monodll_utilsexc_base.o \
|
||||
@@ -4069,7 +4061,8 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS = \
|
||||
@COND_TOOLKIT_OSX_CARBON@ = monodll_carbon_utils.o monodll_uma.o
|
||||
@COND_TOOLKIT_OSX_COCOA@__BASE_AND_GUI_TOOLKIT_SRC_OBJECTS \
|
||||
@COND_TOOLKIT_OSX_COCOA@ = monodll_osx_cocoa_utils.o
|
||||
@COND_PLATFORM_MACOSX_1@__NET_PLATFORM_SRC_OBJECTS = monodll_unix_gsocket.o
|
||||
@COND_PLATFORM_MACOSX_1@__NET_PLATFORM_SRC_OBJECTS \
|
||||
@COND_PLATFORM_MACOSX_1@ = monodll_unix_gsocket.o monodll_gsockosx.o
|
||||
@COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS = monodll_unix_gsocket.o
|
||||
@COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS = monodll_unix_gsocket.o
|
||||
COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS = \
|
||||
@@ -5793,14 +5786,13 @@ COND_MONOLITHIC_1_SHARED_0___monolib___depname = \
|
||||
@COND_MONOLITHIC_1_SHARED_0@__uninstall_monolib___depname \
|
||||
@COND_MONOLITHIC_1_SHARED_0@ = uninstall_monolib
|
||||
@COND_GCC_PCH_1@__monolib_PCH_INC = -I./.pch/wxprec_monolib
|
||||
@COND_ICC_PCH_1@__monolib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__monolib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_monolib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_monolib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_monolib/wx/wxprec.h.gch
|
||||
COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
|
||||
monolib_core_mimetype.o \
|
||||
monolib_cfstring.o \
|
||||
monolib_gsockosx.o \
|
||||
monolib_stdpaths_cf.o \
|
||||
monolib_strconv_cf.o \
|
||||
monolib_utilsexc_base.o \
|
||||
@@ -5882,7 +5874,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
|
||||
@COND_TOOLKIT_OSX_COCOA@__BASE_AND_GUI_TOOLKIT_SRC_OBJECTS_1 \
|
||||
@COND_TOOLKIT_OSX_COCOA@ = monolib_osx_cocoa_utils.o
|
||||
@COND_PLATFORM_MACOSX_1@__NET_PLATFORM_SRC_OBJECTS_1 \
|
||||
@COND_PLATFORM_MACOSX_1@ = monolib_unix_gsocket.o
|
||||
@COND_PLATFORM_MACOSX_1@ = monolib_unix_gsocket.o monolib_gsockosx.o
|
||||
@COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_1 = monolib_unix_gsocket.o
|
||||
@COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_1 = monolib_unix_gsocket.o
|
||||
COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_1 = \
|
||||
@@ -7612,7 +7604,7 @@ COND_WINDOWS_IMPLIB_1___basedll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__basedll___importlib = $(COND_WINDOWS_IMPLIB_1___basedll___importlib)
|
||||
@COND_GCC_PCH_1@__basedll_PCH_INC = -I./.pch/wxprec_basedll
|
||||
@COND_ICC_PCH_1@__basedll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__basedll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_basedll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_basedll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_basedll/wx/wxprec.h.gch
|
||||
@@ -7650,7 +7642,6 @@ COND_USE_SOSYMLINKS_1___basedll___so_symlinks_uninst_cmd = rm -f \
|
||||
COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_2 = \
|
||||
basedll_core_mimetype.o \
|
||||
basedll_cfstring.o \
|
||||
basedll_gsockosx.o \
|
||||
basedll_stdpaths_cf.o \
|
||||
basedll_strconv_cf.o \
|
||||
basedll_utilsexc_base.o \
|
||||
@@ -7738,14 +7729,13 @@ COND_MONOLITHIC_0_SHARED_0___baselib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0@__uninstall_baselib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0@ = uninstall_baselib
|
||||
@COND_GCC_PCH_1@__baselib_PCH_INC = -I./.pch/wxprec_baselib
|
||||
@COND_ICC_PCH_1@__baselib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__baselib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_baselib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_baselib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_baselib/wx/wxprec.h.gch
|
||||
COND_PLATFORM_MACOSX_1___BASE_PLATFORM_SRC_OBJECTS_3 = \
|
||||
baselib_core_mimetype.o \
|
||||
baselib_cfstring.o \
|
||||
baselib_gsockosx.o \
|
||||
baselib_stdpaths_cf.o \
|
||||
baselib_strconv_cf.o \
|
||||
baselib_utilsexc_base.o \
|
||||
@@ -7843,7 +7833,7 @@ COND_WINDOWS_IMPLIB_1___netdll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__netdll___importlib = $(COND_WINDOWS_IMPLIB_1___netdll___importlib)
|
||||
@COND_GCC_PCH_1@__netdll_PCH_INC = -I./.pch/wxprec_netdll
|
||||
@COND_ICC_PCH_1@__netdll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__netdll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_netdll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_netdll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_netdll/wx/wxprec.h.gch
|
||||
@@ -7879,7 +7869,7 @@ COND_USE_SOSYMLINKS_1___netdll___so_symlinks_uninst_cmd = rm -f \
|
||||
@COND_USE_SOSYMLINKS_1@__netdll___so_symlinks_uninst_cmd = $(COND_USE_SOSYMLINKS_1___netdll___so_symlinks_uninst_cmd)
|
||||
@COND_PLATFORM_WIN32_1@__netdll___win32rc = netdll_version_rc.o
|
||||
@COND_PLATFORM_MACOSX_1@__NET_PLATFORM_SRC_OBJECTS_2 \
|
||||
@COND_PLATFORM_MACOSX_1@ = netdll_unix_gsocket.o
|
||||
@COND_PLATFORM_MACOSX_1@ = netdll_unix_gsocket.o netdll_gsockosx.o
|
||||
@COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_2 = netdll_unix_gsocket.o
|
||||
@COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_2 = netdll_unix_gsocket.o
|
||||
COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_2 = \
|
||||
@@ -7895,12 +7885,12 @@ COND_MONOLITHIC_0_SHARED_0___netlib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0@__install_netlib___depname = install_netlib
|
||||
@COND_MONOLITHIC_0_SHARED_0@__uninstall_netlib___depname = uninstall_netlib
|
||||
@COND_GCC_PCH_1@__netlib_PCH_INC = -I./.pch/wxprec_netlib
|
||||
@COND_ICC_PCH_1@__netlib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__netlib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_netlib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_netlib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_netlib/wx/wxprec.h.gch
|
||||
@COND_PLATFORM_MACOSX_1@__NET_PLATFORM_SRC_OBJECTS_3 \
|
||||
@COND_PLATFORM_MACOSX_1@ = netlib_unix_gsocket.o
|
||||
@COND_PLATFORM_MACOSX_1@ = netlib_unix_gsocket.o netlib_gsockosx.o
|
||||
@COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_3 = netlib_unix_gsocket.o
|
||||
@COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_3 = netlib_unix_gsocket.o
|
||||
COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_3 = \
|
||||
@@ -7929,7 +7919,7 @@ COND_WINDOWS_IMPLIB_1___coredll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__coredll___importlib = $(COND_WINDOWS_IMPLIB_1___coredll___importlib)
|
||||
@COND_GCC_PCH_1@__coredll_PCH_INC = -I./.pch/wxprec_coredll
|
||||
@COND_ICC_PCH_1@__coredll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__coredll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_coredll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_coredll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_coredll/wx/wxprec.h.gch
|
||||
@@ -9464,7 +9454,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___corelib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@__uninstall_corelib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@ = uninstall_corelib
|
||||
@COND_GCC_PCH_1@__corelib_PCH_INC = -I./.pch/wxprec_corelib
|
||||
@COND_ICC_PCH_1@__corelib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__corelib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_corelib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_corelib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_corelib/wx/wxprec.h.gch
|
||||
@@ -10979,7 +10969,7 @@ COND_WINDOWS_IMPLIB_1___advdll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__advdll___importlib = $(COND_WINDOWS_IMPLIB_1___advdll___importlib)
|
||||
@COND_GCC_PCH_1@__advdll_PCH_INC = -I./.pch/wxprec_advdll
|
||||
@COND_ICC_PCH_1@__advdll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__advdll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_advdll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_advdll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_advdll/wx/wxprec.h.gch
|
||||
@@ -11100,7 +11090,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1___advlib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@__uninstall_advlib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1@ = uninstall_advlib
|
||||
@COND_GCC_PCH_1@__advlib_PCH_INC = -I./.pch/wxprec_advlib
|
||||
@COND_ICC_PCH_1@__advlib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__advlib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_advlib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_advlib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_advlib/wx/wxprec.h.gch
|
||||
@@ -11201,7 +11191,7 @@ COND_WINDOWS_IMPLIB_1___mediadll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_media-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__mediadll___importlib = $(COND_WINDOWS_IMPLIB_1___mediadll___importlib)
|
||||
@COND_GCC_PCH_1@__mediadll_PCH_INC = -I./.pch/wxprec_mediadll
|
||||
@COND_ICC_PCH_1@__mediadll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__mediadll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_mediadll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_mediadll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_mediadll/wx/wxprec.h.gch
|
||||
@@ -11268,7 +11258,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_MEDIA_1___medialib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_MEDIA_1@__uninstall_medialib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_MEDIA_1@ = uninstall_medialib
|
||||
@COND_GCC_PCH_1@__medialib_PCH_INC = -I./.pch/wxprec_medialib
|
||||
@COND_ICC_PCH_1@__medialib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__medialib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_medialib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_medialib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_medialib/wx/wxprec.h.gch
|
||||
@@ -11315,7 +11305,7 @@ COND_WINDOWS_IMPLIB_1___htmldll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__htmldll___importlib = $(COND_WINDOWS_IMPLIB_1___htmldll___importlib)
|
||||
@COND_GCC_PCH_1@__htmldll_PCH_INC = -I./.pch/wxprec_htmldll
|
||||
@COND_ICC_PCH_1@__htmldll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__htmldll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_htmldll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_htmldll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_htmldll/wx/wxprec.h.gch
|
||||
@@ -11361,7 +11351,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_HTML_1___htmllib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_HTML_1@__uninstall_htmllib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_HTML_1@ = uninstall_htmllib
|
||||
@COND_GCC_PCH_1@__htmllib_PCH_INC = -I./.pch/wxprec_htmllib
|
||||
@COND_ICC_PCH_1@__htmllib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__htmllib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_htmllib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_htmllib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_htmllib/wx/wxprec.h.gch
|
||||
@@ -11387,7 +11377,7 @@ COND_WINDOWS_IMPLIB_1___qadll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_qa-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__qadll___importlib = $(COND_WINDOWS_IMPLIB_1___qadll___importlib)
|
||||
@COND_GCC_PCH_1@__qadll_PCH_INC = -I./.pch/wxprec_qadll
|
||||
@COND_ICC_PCH_1@__qadll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__qadll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_qadll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_qadll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_qadll/wx/wxprec.h.gch
|
||||
@@ -11430,7 +11420,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_QA_1___qalib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_QA_1@__uninstall_qalib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_GUI_1_USE_QA_1@ = uninstall_qalib
|
||||
@COND_GCC_PCH_1@__qalib_PCH_INC = -I./.pch/wxprec_qalib
|
||||
@COND_ICC_PCH_1@__qalib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__qalib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_qalib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_qalib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_qalib/wx/wxprec.h.gch
|
||||
@@ -11451,7 +11441,7 @@ COND_WINDOWS_IMPLIB_1___xmldll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__xmldll___importlib = $(COND_WINDOWS_IMPLIB_1___xmldll___importlib)
|
||||
@COND_GCC_PCH_1@__xmldll_PCH_INC = -I./.pch/wxprec_xmldll
|
||||
@COND_ICC_PCH_1@__xmldll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__xmldll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_xmldll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_xmldll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_xmldll/wx/wxprec.h.gch
|
||||
@@ -11492,7 +11482,7 @@ COND_MONOLITHIC_0_SHARED_0___xmllib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0@__install_xmllib___depname = install_xmllib
|
||||
@COND_MONOLITHIC_0_SHARED_0@__uninstall_xmllib___depname = uninstall_xmllib
|
||||
@COND_GCC_PCH_1@__xmllib_PCH_INC = -I./.pch/wxprec_xmllib
|
||||
@COND_ICC_PCH_1@__xmllib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__xmllib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_xmllib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_xmllib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_xmllib/wx/wxprec.h.gch
|
||||
@@ -11515,7 +11505,7 @@ COND_WINDOWS_IMPLIB_1___xrcdll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xrc-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__xrcdll___importlib = $(COND_WINDOWS_IMPLIB_1___xrcdll___importlib)
|
||||
@COND_GCC_PCH_1@__xrcdll_PCH_INC = -I./.pch/wxprec_xrcdll
|
||||
@COND_ICC_PCH_1@__xrcdll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__xrcdll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_xrcdll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_xrcdll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_xrcdll/wx/wxprec.h.gch
|
||||
@@ -11558,7 +11548,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_XRC_1___xrclib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_XRC_1@__uninstall_xrclib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_XRC_1@ = uninstall_xrclib
|
||||
@COND_GCC_PCH_1@__xrclib_PCH_INC = -I./.pch/wxprec_xrclib
|
||||
@COND_ICC_PCH_1@__xrclib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__xrclib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_xrclib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_xrclib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_xrclib/wx/wxprec.h.gch
|
||||
@@ -11581,7 +11571,7 @@ COND_WINDOWS_IMPLIB_1___auidll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__auidll___importlib = $(COND_WINDOWS_IMPLIB_1___auidll___importlib)
|
||||
@COND_GCC_PCH_1@__auidll_PCH_INC = -I./.pch/wxprec_auidll
|
||||
@COND_ICC_PCH_1@__auidll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__auidll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_auidll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_auidll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_auidll/wx/wxprec.h.gch
|
||||
@@ -11624,7 +11614,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_AUI_1___auilib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_AUI_1@__uninstall_auilib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_AUI_1@ = uninstall_auilib
|
||||
@COND_GCC_PCH_1@__auilib_PCH_INC = -I./.pch/wxprec_auilib
|
||||
@COND_ICC_PCH_1@__auilib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__auilib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_auilib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_auilib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_auilib/wx/wxprec.h.gch
|
||||
@@ -11647,8 +11637,7 @@ COND_WINDOWS_IMPLIB_1___propgriddll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__propgriddll___importlib = $(COND_WINDOWS_IMPLIB_1___propgriddll___importlib)
|
||||
@COND_GCC_PCH_1@__propgriddll_PCH_INC = -I./.pch/wxprec_propgriddll
|
||||
@COND_ICC_PCH_1@__propgriddll_PCH_INC = \
|
||||
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__propgriddll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_propgriddll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_propgriddll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_propgriddll/wx/wxprec.h.gch
|
||||
@@ -11692,8 +11681,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_PROPGRID_1___propgridlib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_PROPGRID_1@__uninstall_propgridlib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_PROPGRID_1@ = uninstall_propgridlib
|
||||
@COND_GCC_PCH_1@__propgridlib_PCH_INC = -I./.pch/wxprec_propgridlib
|
||||
@COND_ICC_PCH_1@__propgridlib_PCH_INC = \
|
||||
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__propgridlib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_propgridlib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_propgridlib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_propgridlib/wx/wxprec.h.gch
|
||||
@@ -11716,8 +11704,7 @@ COND_WINDOWS_IMPLIB_1___richtextdll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_richtext-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__richtextdll___importlib = $(COND_WINDOWS_IMPLIB_1___richtextdll___importlib)
|
||||
@COND_GCC_PCH_1@__richtextdll_PCH_INC = -I./.pch/wxprec_richtextdll
|
||||
@COND_ICC_PCH_1@__richtextdll_PCH_INC = \
|
||||
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__richtextdll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_richtextdll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_richtextdll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_richtextdll/wx/wxprec.h.gch
|
||||
@@ -11761,8 +11748,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_RICHTEXT_1___richtextlib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_RICHTEXT_1@__uninstall_richtextlib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_RICHTEXT_1@ = uninstall_richtextlib
|
||||
@COND_GCC_PCH_1@__richtextlib_PCH_INC = -I./.pch/wxprec_richtextlib
|
||||
@COND_ICC_PCH_1@__richtextlib_PCH_INC = \
|
||||
@COND_ICC_PCH_1@ $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__richtextlib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_richtextlib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_richtextlib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_richtextlib/wx/wxprec.h.gch
|
||||
@@ -11785,7 +11771,7 @@ COND_WINDOWS_IMPLIB_1___stcdll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__stcdll___importlib = $(COND_WINDOWS_IMPLIB_1___stcdll___importlib)
|
||||
@COND_GCC_PCH_1@__stcdll_PCH_INC = -I./.pch/wxprec_stcdll
|
||||
@COND_ICC_PCH_1@__stcdll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__stcdll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_stcdll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_stcdll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_stcdll/wx/wxprec.h.gch
|
||||
@@ -11828,7 +11814,7 @@ COND_MONOLITHIC_0_SHARED_0_USE_STC_1___stclib___depname = \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_STC_1@__uninstall_stclib___depname \
|
||||
@COND_MONOLITHIC_0_SHARED_0_USE_STC_1@ = uninstall_stclib
|
||||
@COND_GCC_PCH_1@__stclib_PCH_INC = -I./.pch/wxprec_stclib
|
||||
@COND_ICC_PCH_1@__stclib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__stclib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_stclib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_stclib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_stclib/wx/wxprec.h.gch
|
||||
@@ -11851,7 +11837,7 @@ COND_WINDOWS_IMPLIB_1___gldll___importlib = \
|
||||
-Wl,--out-implib=$(LIBDIRNAME)/$(LIBPREFIX)wx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX).$(DLLIMP_SUFFIX)
|
||||
@COND_WINDOWS_IMPLIB_1@__gldll___importlib = $(COND_WINDOWS_IMPLIB_1___gldll___importlib)
|
||||
@COND_GCC_PCH_1@__gldll_PCH_INC = -I./.pch/wxprec_gldll
|
||||
@COND_ICC_PCH_1@__gldll_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__gldll_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_gldll/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_gldll_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_gldll/wx/wxprec.h.gch
|
||||
@@ -11920,7 +11906,7 @@ COND_SHARED_0_USE_GUI_1_USE_OPENGL_1___gllib___depname = \
|
||||
@COND_SHARED_0_USE_GUI_1_USE_OPENGL_1@__uninstall_gllib___depname \
|
||||
@COND_SHARED_0_USE_GUI_1_USE_OPENGL_1@ = uninstall_gllib
|
||||
@COND_GCC_PCH_1@__gllib_PCH_INC = -I./.pch/wxprec_gllib
|
||||
@COND_ICC_PCH_1@__gllib_PCH_INC = $(ICC_PCH_USE_SWITCH) \
|
||||
@COND_ICC_PCH_1@__gllib_PCH_INC = -use_pch \
|
||||
@COND_ICC_PCH_1@ ./.pch/wxprec_gllib/wx/wxprec.h.gch
|
||||
@COND_USE_PCH_1@_____pch_wxprec_gllib_wx_wxprec_h_gch___depname \
|
||||
@COND_USE_PCH_1@ = ./.pch/wxprec_gllib/wx/wxprec.h.gch
|
||||
@@ -14445,9 +14431,6 @@ monodll_core_mimetype.o: $(srcdir)/src/osx/core/mimetype.cpp $(MONODLL_ODEP)
|
||||
monodll_cfstring.o: $(srcdir)/src/osx/core/cfstring.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/cfstring.cpp
|
||||
|
||||
monodll_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
monodll_stdpaths_cf.o: $(srcdir)/src/osx/core/stdpaths_cf.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/stdpaths_cf.cpp
|
||||
|
||||
@@ -14559,6 +14542,9 @@ monodll_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(MONODLL_ODEP)
|
||||
monodll_net.o: $(srcdir)/src/msw/wince/net.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/wince/net.cpp
|
||||
|
||||
monodll_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
monodll_graphicc.o: $(srcdir)/src/generic/graphicc.cpp $(MONODLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/graphicc.cpp
|
||||
|
||||
@@ -19125,9 +19111,6 @@ monolib_core_mimetype.o: $(srcdir)/src/osx/core/mimetype.cpp $(MONOLIB_ODEP)
|
||||
monolib_cfstring.o: $(srcdir)/src/osx/core/cfstring.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/cfstring.cpp
|
||||
|
||||
monolib_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
monolib_stdpaths_cf.o: $(srcdir)/src/osx/core/stdpaths_cf.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/stdpaths_cf.cpp
|
||||
|
||||
@@ -19239,6 +19222,9 @@ monolib_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(MONOLIB_ODEP)
|
||||
monolib_net.o: $(srcdir)/src/msw/wince/net.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/wince/net.cpp
|
||||
|
||||
monolib_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
monolib_graphicc.o: $(srcdir)/src/generic/graphicc.cpp $(MONOLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/graphicc.cpp
|
||||
|
||||
@@ -23805,9 +23791,6 @@ basedll_core_mimetype.o: $(srcdir)/src/osx/core/mimetype.cpp $(BASEDLL_ODEP)
|
||||
basedll_cfstring.o: $(srcdir)/src/osx/core/cfstring.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/osx/core/cfstring.cpp
|
||||
|
||||
basedll_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
basedll_stdpaths_cf.o: $(srcdir)/src/osx/core/stdpaths_cf.cpp $(BASEDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/osx/core/stdpaths_cf.cpp
|
||||
|
||||
@@ -24270,9 +24253,6 @@ baselib_core_mimetype.o: $(srcdir)/src/osx/core/mimetype.cpp $(BASELIB_ODEP)
|
||||
baselib_cfstring.o: $(srcdir)/src/osx/core/cfstring.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/osx/core/cfstring.cpp
|
||||
|
||||
baselib_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
baselib_stdpaths_cf.o: $(srcdir)/src/osx/core/stdpaths_cf.cpp $(BASELIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/osx/core/stdpaths_cf.cpp
|
||||
|
||||
@@ -24486,6 +24466,9 @@ netdll_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(NETDLL_ODEP)
|
||||
netdll_net.o: $(srcdir)/src/msw/wince/net.cpp $(NETDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/msw/wince/net.cpp
|
||||
|
||||
netdll_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(NETDLL_ODEP)
|
||||
$(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
@COND_PLATFORM_UNIX_1@netdll_unix_gsocket.o: $(srcdir)/src/unix/gsocket.cpp $(NETDLL_ODEP)
|
||||
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/unix/gsocket.cpp
|
||||
|
||||
@@ -24537,6 +24520,9 @@ netlib_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(NETLIB_ODEP)
|
||||
netlib_net.o: $(srcdir)/src/msw/wince/net.cpp $(NETLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/msw/wince/net.cpp
|
||||
|
||||
netlib_gsockosx.o: $(srcdir)/src/osx/core/gsockosx.cpp $(NETLIB_ODEP)
|
||||
$(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/osx/core/gsockosx.cpp
|
||||
|
||||
@COND_PLATFORM_UNIX_1@netlib_unix_gsocket.o: $(srcdir)/src/unix/gsocket.cpp $(NETLIB_ODEP)
|
||||
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/unix/gsocket.cpp
|
||||
|
||||
|
@@ -184,7 +184,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
<!-- Used on Mac OS X wxMac base, and Mac OS X darwin base -->
|
||||
<set var="BASE_COREFOUNDATION_SRC" hints="files">
|
||||
src/osx/core/cfstring.cpp
|
||||
src/osx/core/gsockosx.cpp
|
||||
src/osx/core/stdpaths_cf.cpp
|
||||
src/osx/core/strconv_cf.cpp
|
||||
src/osx/core/utilsexc_base.cpp
|
||||
@@ -547,6 +546,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/unix/gsockunx.h
|
||||
</set>
|
||||
|
||||
<set var="NET_OSX_SRC" hints="files">
|
||||
src/osx/core/gsockosx.cpp
|
||||
</set>
|
||||
|
||||
<set var="NET_WIN32_SRC" hints="files">
|
||||
src/msw/gsocket.cpp
|
||||
src/msw/gsockmsw.cpp
|
||||
@@ -3615,7 +3618,7 @@ src/osx/iphone/window.mm
|
||||
<set var="NET_PLATFORM_SRC" hints="files">
|
||||
<if cond="PLATFORM_UNIX=='1'">$(NET_UNIX_SRC)</if>
|
||||
<if cond="PLATFORM_WIN32=='1'">$(NET_WIN32_SRC) $(NET_WINCE_SRC)</if>
|
||||
<if cond="PLATFORM_MACOSX=='1'">$(NET_UNIX_SRC)</if>
|
||||
<if cond="PLATFORM_MACOSX=='1'">$(NET_UNIX_SRC) $(NET_OSX_SRC)</if>
|
||||
<if cond="PLATFORM_OS2=='1'">$(NET_OS2_SRC)</if>
|
||||
</set>
|
||||
<set var="NET_PLATFORM_HDR" hints="files">
|
||||
@@ -3828,7 +3831,8 @@ src/osx/iphone/window.mm
|
||||
$(BASE_AND_GUI_OSX_CARBON_SRC)
|
||||
$(BASE_AND_GUI_OSX_COCOA_SRC)
|
||||
$(BASE_AND_GUI_WIN32_SRC)
|
||||
$(NET_CMN_SRC) $(NET_UNIX_SRC) $(NET_WIN32_SRC) $(NET_WINCE_SRC)
|
||||
$(NET_CMN_SRC) $(NET_UNIX_SRC) $(NET_OSX_SRC)
|
||||
$(NET_WIN32_SRC) $(NET_WINCE_SRC)
|
||||
$(XML_SRC)
|
||||
</set>
|
||||
|
||||
|
@@ -30,7 +30,7 @@ class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
class WXDLLIMPEXP_FWD_BASE wxTimer;
|
||||
class WXDLLIMPEXP_FWD_BASE wxTimerImpl;
|
||||
|
||||
class GSocketManager;
|
||||
class wxSocketManager;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -116,9 +116,21 @@ public:
|
||||
virtual void RemoveFromPendingDelete(wxObject *object) = 0;
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
// this function is used by wxNet library to set the default socket manager
|
||||
// to use: doing it like this allows us to keep all socket-related code in
|
||||
// wxNet instead of having to pull it in wxBase itself as we'd have to do
|
||||
// if we really implemented wxSocketManager here
|
||||
//
|
||||
// we don't take ownership of this pointer, it should have a lifetime
|
||||
// greater than that of any socket (e.g. be a pointer to a static object)
|
||||
static void SetDefaultSocketManager(wxSocketManager *manager)
|
||||
{
|
||||
ms_manager = manager;
|
||||
}
|
||||
|
||||
// return socket manager: this is usually different for console and GUI
|
||||
// applications (although some ports use the same implementation for both)
|
||||
virtual GSocketManager *GetSocketManager() = 0;
|
||||
virtual wxSocketManager *GetSocketManager() { return ms_manager; }
|
||||
#endif
|
||||
|
||||
// create a new, port specific, instance of the event loop used by wxApp
|
||||
@@ -169,6 +181,9 @@ protected:
|
||||
// utility function: returns the stack frame as a plain wxString
|
||||
virtual wxString GetAssertStackTrace();
|
||||
#endif
|
||||
|
||||
private:
|
||||
static wxSocketManager *ms_manager;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -46,26 +46,6 @@ public:
|
||||
virtual WXDWORD WaitForThread(WXHANDLE hThread) = 0;
|
||||
|
||||
|
||||
// wxSocket support
|
||||
// ----------------
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
// this function is used by wxNet library to set the default socket manager
|
||||
// to use: doing it like this allows us to keep all socket-related code in
|
||||
// wxNet instead of having to pull it in wxBase itself as we'd have to do
|
||||
// if we really implemented GSocketManager here
|
||||
//
|
||||
// we don't take ownership of this pointer, it should have a lifetime
|
||||
// greater than that of any socket (e.g. be a pointer to a static object)
|
||||
static void SetDefaultSocketManager(GSocketManager *manager)
|
||||
{
|
||||
ms_manager = manager;
|
||||
}
|
||||
|
||||
virtual GSocketManager *GetSocketManager() { return ms_manager; }
|
||||
#endif // wxUSE_SOCKETS
|
||||
|
||||
|
||||
#ifndef __WXWINCE__
|
||||
// console helpers
|
||||
// ---------------
|
||||
@@ -86,8 +66,6 @@ protected:
|
||||
// implementation of WaitForThread() for the console applications which is
|
||||
// also used by the GUI code if it doesn't [yet|already} dispatch events
|
||||
WXDWORD DoSimpleWaitForThread(WXHANDLE hThread);
|
||||
|
||||
static GSocketManager *ms_manager;
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_APPTBASE_H_
|
||||
|
@@ -1,12 +1,15 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket) for WX
|
||||
* Name: gsockmsw.h
|
||||
* Copyright: (c) Guilhem Lavaux
|
||||
* Licence: wxWindows Licence
|
||||
* Purpose: GSocket MSW header
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/gsockmsw.h
|
||||
// Purpose: MSW-specific socket implementation
|
||||
// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin
|
||||
// Created: April 1997
|
||||
// Copyright: (C) 1999-1997, Guilhem Lavaux
|
||||
// (C) 1999-2000, Guillermo Rodriguez Garcia
|
||||
// (C) 2008 Vadim Zeitlin
|
||||
// RCS_ID: $Id$
|
||||
// License: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef _WX_MSW_GSOCKMSW_H_
|
||||
#define _WX_MSW_GSOCKMSW_H_
|
||||
@@ -23,50 +26,47 @@
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
/* Definition of GSocket */
|
||||
class GSocket : public GSocketBase
|
||||
// ----------------------------------------------------------------------------
|
||||
// MSW-specific socket implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxSocketImplMSW : public wxSocketImpl
|
||||
{
|
||||
public:
|
||||
GSocket(wxSocketBase& wxsocket)
|
||||
: GSocketBase(wxsocket)
|
||||
{
|
||||
m_msgnumber = 0;
|
||||
}
|
||||
wxSocketImplMSW(wxSocketBase& wxsocket);
|
||||
|
||||
virtual GSocket *WaitConnection(wxSocketBase& wxsocket);
|
||||
virtual ~wxSocketImplMSW();
|
||||
|
||||
virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket);
|
||||
|
||||
|
||||
GSocketError SetServer();
|
||||
|
||||
// not used under MSW
|
||||
void Notify(bool) { }
|
||||
bool SetReusable();
|
||||
bool SetBroadcast();
|
||||
bool DontDoBind();
|
||||
GSocketError Connect(GSocketStream stream);
|
||||
GSocketError SetNonOriented();
|
||||
int Read(char *buffer, int size);
|
||||
int Write(const char *buffer, int size);
|
||||
void SetNonBlocking(bool non_block);
|
||||
GSocketError WXDLLIMPEXP_NET GetError();
|
||||
GSocketError GetSockOpt(int level, int optname,
|
||||
void *optval, int *optlen);
|
||||
GSocketError SetSockOpt(int level, int optname,
|
||||
const void *optval, int optlen);
|
||||
|
||||
protected:
|
||||
GSocketError Input_Timeout();
|
||||
GSocketError Output_Timeout();
|
||||
GSocketError Connect_Timeout();
|
||||
private:
|
||||
virtual wxSocketError DoHandleConnect(int ret);
|
||||
virtual void DoClose();
|
||||
|
||||
virtual void UnblockAndRegisterWithEventLoop()
|
||||
{
|
||||
// no need to make the socket non-blocking, Install_Callback() will do
|
||||
// it
|
||||
wxSocketManager::Get()->Install_Callback(this);
|
||||
}
|
||||
|
||||
wxSocketError Input_Timeout();
|
||||
wxSocketError Output_Timeout();
|
||||
wxSocketError Connect_Timeout();
|
||||
int Recv_Stream(char *buffer, int size);
|
||||
int Recv_Dgram(char *buffer, int size);
|
||||
int Send_Stream(const char *buffer, int size);
|
||||
int Send_Dgram(const char *buffer, int size);
|
||||
|
||||
/* TODO: Make these protected */
|
||||
public:
|
||||
|
||||
int m_msgnumber;
|
||||
|
||||
friend class wxSocketMSWManager;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxSocketImplMSW)
|
||||
};
|
||||
|
||||
#endif /* _WX_MSW_GSOCKMSW_H_ */
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
// returns the select()-based socket manager for console applications which
|
||||
// is also used by some ports (wxX11, wxDFB) in the GUI build (hence it is
|
||||
// here and not in wxConsoleAppTraits)
|
||||
virtual GSocketManager *GetSocketManager();
|
||||
virtual wxSocketManager *GetSocketManager();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
virtual wxString GetDesktopEnvironment() const;
|
||||
#endif
|
||||
#if wxUSE_SOCKETS
|
||||
virtual GSocketManager *GetSocketManager();
|
||||
virtual wxSocketManager *GetSocketManager();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/private/gsocket.h
|
||||
// Purpose: GSocket implementation
|
||||
// Purpose: wxSocketImpl nd related declarations
|
||||
// Authors: Guilhem Lavaux, Vadim Zeitlin
|
||||
// Created: April 1997
|
||||
// RCS-ID: $Id$
|
||||
@@ -9,6 +9,31 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
Brief overview of different socket classes:
|
||||
|
||||
- wxSocketBase is the public class representing a socket ("Base" here
|
||||
refers to the fact that wxSocketClient and wxSocketServer are derived
|
||||
from it and predates the convention of using "Base" for common base
|
||||
classes for platform-specific classes in wxWidgets) with implementation
|
||||
common to all platforms and forwarding methods whose implementation
|
||||
differs between platforms to wxSocketImpl which it contains.
|
||||
|
||||
- wxSocketImpl is actually just an abstract base class having only code
|
||||
common to all platforms, the concrete implementation classes derive from
|
||||
it and are created by wxSocketManager::CreateSocket().
|
||||
|
||||
- Some socket operations have different implementations in console-mode and
|
||||
GUI applications. wxSocketManager class exists to abstract this in such
|
||||
way that console applications (using wxBase) don't depend on wxNet. An
|
||||
object of this class is made available via wxApp and GUI applications set
|
||||
up a different kind of global socket manager from console ones.
|
||||
|
||||
TODO: it looks like wxSocketManager could be eliminated by providing
|
||||
methods for registering/unregistering sockets directly in
|
||||
wxEventLoop.
|
||||
*/
|
||||
|
||||
#ifndef _WX_PRIVATE_GSOCKET_H_
|
||||
#define _WX_PRIVATE_GSOCKET_H_
|
||||
|
||||
@@ -16,9 +41,7 @@
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
|
||||
#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */
|
||||
|
||||
class WXDLLIMPEXP_FWD_NET wxSocketBase;
|
||||
#include "wx/socket.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -43,61 +66,48 @@ class WXDLLIMPEXP_FWD_NET wxSocketBase;
|
||||
#include <sys/time.h> // for timeval
|
||||
#endif
|
||||
|
||||
// these definitions are for MSW when we don't use configure, otherwise these
|
||||
// symbols are defined by configure
|
||||
#ifndef WX_SOCKLEN_T
|
||||
#define WX_SOCKLEN_T int
|
||||
#endif
|
||||
|
||||
#ifndef SOCKOPTLEN_T
|
||||
#define SOCKOPTLEN_T int
|
||||
#endif
|
||||
|
||||
// define some symbols which winsock.h defines but traditional BSD headers
|
||||
// don't
|
||||
#ifndef SOCKET
|
||||
#define SOCKET int
|
||||
#endif
|
||||
|
||||
#ifndef INVALID_SOCKET
|
||||
#define INVALID_SOCKET (-1)
|
||||
#endif
|
||||
|
||||
#ifndef SOCKET_ERROR
|
||||
#define SOCKET_ERROR (-1)
|
||||
#endif
|
||||
|
||||
#if wxUSE_IPV6
|
||||
typedef struct sockaddr_storage wxSockAddr;
|
||||
#else
|
||||
typedef struct sockaddr wxSockAddr;
|
||||
#endif
|
||||
|
||||
enum GAddressType
|
||||
{
|
||||
GSOCK_NOFAMILY = 0,
|
||||
GSOCK_INET,
|
||||
GSOCK_INET6,
|
||||
GSOCK_UNIX
|
||||
wxSOCKET_NOFAMILY = 0,
|
||||
wxSOCKET_INET,
|
||||
wxSOCKET_INET6,
|
||||
wxSOCKET_UNIX
|
||||
};
|
||||
|
||||
enum GSocketStream
|
||||
{
|
||||
GSOCK_STREAMED,
|
||||
GSOCK_UNSTREAMED
|
||||
};
|
||||
|
||||
enum GSocketError
|
||||
{
|
||||
GSOCK_NOERROR = 0,
|
||||
GSOCK_INVOP,
|
||||
GSOCK_IOERR,
|
||||
GSOCK_INVADDR,
|
||||
GSOCK_INVSOCK,
|
||||
GSOCK_NOHOST,
|
||||
GSOCK_INVPORT,
|
||||
GSOCK_WOULDBLOCK,
|
||||
GSOCK_TIMEDOUT,
|
||||
GSOCK_MEMERR,
|
||||
GSOCK_OPTERR
|
||||
};
|
||||
|
||||
/* See below for an explanation on how events work.
|
||||
*/
|
||||
enum GSocketEvent
|
||||
{
|
||||
GSOCK_INPUT = 0,
|
||||
GSOCK_OUTPUT = 1,
|
||||
GSOCK_CONNECTION = 2,
|
||||
GSOCK_LOST = 3,
|
||||
GSOCK_MAX_EVENT = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT,
|
||||
GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT,
|
||||
GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION,
|
||||
GSOCK_LOST_FLAG = 1 << GSOCK_LOST
|
||||
};
|
||||
|
||||
typedef int GSocketEventFlags;
|
||||
typedef int wxSocketEventFlags;
|
||||
|
||||
struct GAddress;
|
||||
class GSocket;
|
||||
|
||||
typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event,
|
||||
char *cdata);
|
||||
class wxSocketImpl;
|
||||
|
||||
/*
|
||||
Class providing hooks abstracting the differences between console and GUI
|
||||
@@ -108,23 +118,23 @@ typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event,
|
||||
its existence is that we want the same socket code work differently
|
||||
depending on whether it's used from a console or a GUI program. This is
|
||||
achieved by implementing the virtual methods of this class differently in
|
||||
the objects returned by wxConsoleAppTraits::GetSocketFunctionsTable() and
|
||||
the same method in wxGUIAppTraits.
|
||||
the objects returned by wxConsoleAppTraits::GetSocketManager() and the same
|
||||
method in wxGUIAppTraits.
|
||||
*/
|
||||
class GSocketManager
|
||||
class wxSocketManager
|
||||
{
|
||||
public:
|
||||
// set the manager to use, we don't take ownership of it
|
||||
//
|
||||
// this should be called before GSocket_Init(), i.e. before the first
|
||||
// wxSocket object is created, otherwise the manager returned by
|
||||
// wxAppTraits::GetSocketManager() will be used
|
||||
static void Set(GSocketManager *manager);
|
||||
// this should be called before creating the first wxSocket object,
|
||||
// otherwise the manager returned by wxAppTraits::GetSocketManager() will
|
||||
// be used
|
||||
static void Set(wxSocketManager *manager);
|
||||
|
||||
// return the manager to use
|
||||
//
|
||||
// this initializes the manager at first use
|
||||
static GSocketManager *Get()
|
||||
static wxSocketManager *Get()
|
||||
{
|
||||
if ( !ms_manager )
|
||||
Init();
|
||||
@@ -135,29 +145,20 @@ public:
|
||||
// called before the first wxSocket is created and should do the
|
||||
// initializations needed in order to use the network
|
||||
//
|
||||
// return true if initialized successfully
|
||||
// return true if initialized successfully; if this returns false sockets
|
||||
// can't be used at all
|
||||
virtual bool OnInit() = 0;
|
||||
|
||||
// undo the initializations of OnInit()
|
||||
virtual void OnExit() = 0;
|
||||
|
||||
|
||||
// do manager-specific socket initializations: called in the beginning of
|
||||
// the socket initialization
|
||||
virtual bool Init_Socket(GSocket *socket) = 0;
|
||||
|
||||
// called when the socket is being closed
|
||||
// create a concrete socket implementation associated with the given
|
||||
// wxSocket object
|
||||
//
|
||||
// TODO: merge this with Destroy_Socket(), currently 2 separate functions
|
||||
// are needed because Init_Socket() always allocates manager-specific
|
||||
// resources in GSocket and Destroy_Socket() must be called even if
|
||||
// the socket has never been opened, but if the allocation were done
|
||||
// on demand, then Destroy_Socket() could be called from
|
||||
// GSocket::Close() and we wouldn't need Close_Socket() at all
|
||||
virtual void Close_Socket(GSocket *socket) = 0;
|
||||
// the returned object must be deleted by the caller
|
||||
virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) = 0;
|
||||
|
||||
// undo Init_Socket(): called from GSocket dtor
|
||||
virtual void Destroy_Socket(GSocket *socket) = 0;
|
||||
|
||||
|
||||
// these functions enable or disable monitoring of the given socket for the
|
||||
@@ -165,77 +166,134 @@ public:
|
||||
// that both BSD and Winsock implementations actually use socket->m_server
|
||||
// value to determine what exactly should be monitored so it needs to be
|
||||
// set before calling these functions)
|
||||
virtual void Install_Callback(GSocket *socket,
|
||||
GSocketEvent event = GSOCK_MAX_EVENT) = 0;
|
||||
virtual void Uninstall_Callback(GSocket *socket,
|
||||
GSocketEvent event = GSOCK_MAX_EVENT) = 0;
|
||||
virtual void Install_Callback(wxSocketImpl *socket,
|
||||
wxSocketNotify event = wxSOCKET_MAX_EVENT) = 0;
|
||||
virtual void Uninstall_Callback(wxSocketImpl *socket,
|
||||
wxSocketNotify event = wxSOCKET_MAX_EVENT) = 0;
|
||||
|
||||
virtual ~GSocketManager() { }
|
||||
virtual ~wxSocketManager() { }
|
||||
|
||||
private:
|
||||
// get the manager to use if we don't have it yet
|
||||
static void Init();
|
||||
|
||||
static GSocketManager *ms_manager;
|
||||
static wxSocketManager *ms_manager;
|
||||
};
|
||||
|
||||
/*
|
||||
Base class providing functionality common to BSD and Winsock sockets.
|
||||
Base class for all socket implementations providing functionality common to
|
||||
BSD and Winsock sockets.
|
||||
|
||||
TODO: merge this in wxSocket itself, there is no reason to maintain the
|
||||
separation between wxSocket and GSocket.
|
||||
Objects of this class are not created directly but only via its static
|
||||
Create() method which in turn forwards to wxSocketManager::CreateSocket().
|
||||
*/
|
||||
class GSocketBase
|
||||
class wxSocketImpl
|
||||
{
|
||||
public:
|
||||
// static factory function: creates the low-level socket associated with
|
||||
// the given wxSocket (and inherits its attributes such as timeout)
|
||||
static GSocket *Create(wxSocketBase& wxsocket);
|
||||
static wxSocketImpl *Create(wxSocketBase& wxsocket);
|
||||
|
||||
virtual ~GSocketBase();
|
||||
virtual ~wxSocketImpl();
|
||||
|
||||
// set various socket properties: all of those can only be called before
|
||||
// creating the socket
|
||||
void SetTimeout(unsigned long millisec);
|
||||
|
||||
GSocketError SetLocal(GAddress *address);
|
||||
GSocketError SetPeer(GAddress *address);
|
||||
GAddress *GetLocal();
|
||||
GAddress *GetPeer();
|
||||
|
||||
GSocketEventFlags Select(GSocketEventFlags flags);
|
||||
|
||||
virtual GSocket *WaitConnection(wxSocketBase& wxsocket) = 0;
|
||||
|
||||
void Close();
|
||||
virtual void Shutdown();
|
||||
|
||||
void SetNonBlocking(bool non_blocking) { m_non_blocking = non_blocking; }
|
||||
void SetReusable() { m_reusable = true; }
|
||||
void SetBroadcast() { m_broadcast = true; }
|
||||
void DontDoBind() { m_dobind = false; }
|
||||
void SetInitialSocketBuffers(int recv, int send)
|
||||
{
|
||||
m_initialRecvBufferSize = recv;
|
||||
m_initialSendBufferSize = send;
|
||||
}
|
||||
|
||||
wxSocketError SetLocal(GAddress *address);
|
||||
wxSocketError SetPeer(GAddress *address);
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
GAddress *GetLocal();
|
||||
GAddress *GetPeer();
|
||||
|
||||
wxSocketError GetError() const { return m_error; }
|
||||
bool IsOk() const { return m_error == wxSOCKET_NOERROR; }
|
||||
|
||||
|
||||
// creating/closing the socket
|
||||
// --------------------------
|
||||
|
||||
// notice that SetLocal() must be called before creating the socket using
|
||||
// any of the functions below
|
||||
//
|
||||
// all of Create() functions return wxSOCKET_NOERROR if the operation
|
||||
// completed successfully or one of:
|
||||
// wxSOCKET_INVSOCK - the socket is in use.
|
||||
// wxSOCKET_INVADDR - the local (server) or peer (client) address has not
|
||||
// been set.
|
||||
// wxSOCKET_IOERR - any other error.
|
||||
|
||||
// create a socket listening on the local address specified by SetLocal()
|
||||
// (notice that DontDoBind() is ignored by this function)
|
||||
wxSocketError CreateServer();
|
||||
|
||||
// create a socket connected to the peer address specified by SetPeer()
|
||||
// (notice that DontDoBind() is ignored by this function)
|
||||
//
|
||||
// this function may return wxSOCKET_WOULDBLOCK in addition to the return
|
||||
// values listed above
|
||||
wxSocketError CreateClient();
|
||||
|
||||
// create (and bind unless DontDoBind() had been called) an UDP socket
|
||||
// associated with the given local address
|
||||
wxSocketError CreateUDP();
|
||||
|
||||
// may be called whether the socket was created or not, calls DoClose() if
|
||||
// it was indeed created
|
||||
void Close();
|
||||
|
||||
virtual void Shutdown();
|
||||
|
||||
|
||||
// IO operations
|
||||
// -------------
|
||||
|
||||
virtual int Read(char *buffer, int size) = 0;
|
||||
virtual int Write(const char *buffer, int size) = 0;
|
||||
|
||||
wxSocketEventFlags Select(wxSocketEventFlags flags);
|
||||
|
||||
virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket) = 0;
|
||||
|
||||
|
||||
// notifications
|
||||
// -------------
|
||||
|
||||
// notify m_wxsocket about the given socket event by calling its (inaptly
|
||||
// named) OnRequest() method
|
||||
void NotifyOnStateChange(GSocketEvent event);
|
||||
void NotifyOnStateChange(wxSocketNotify event);
|
||||
|
||||
// FIXME: making these functions virtual is a hack necessary to make the
|
||||
// wxBase library link without requiring wxNet under Unix where
|
||||
// GSocketSelectManager (part of wxBase) uses them, they don't
|
||||
// wxSocketSelectManager (part of wxBase) uses them, they don't
|
||||
// really need to be virtual at all
|
||||
virtual void Detected_Read() { }
|
||||
virtual void Detected_Write() { }
|
||||
virtual void Notify(bool WXUNUSED(notify)) { }
|
||||
|
||||
// this is officially SOCKET (unsigned int) under Windows but we don't want
|
||||
// to include winsock.h which defines SOCKET from here so just use int
|
||||
// under all platforms
|
||||
int m_fd;
|
||||
// TODO: make these fields protected and provide accessors for those of
|
||||
// them that wxSocketBase really needs
|
||||
//protected:
|
||||
SOCKET m_fd;
|
||||
|
||||
int m_initialRecvBufferSize;
|
||||
int m_initialSendBufferSize;
|
||||
|
||||
GAddress *m_local;
|
||||
GAddress *m_peer;
|
||||
GSocketError m_error;
|
||||
wxSocketError m_error;
|
||||
|
||||
bool m_non_blocking;
|
||||
bool m_server;
|
||||
@@ -247,37 +305,71 @@ public:
|
||||
|
||||
struct timeval m_timeout;
|
||||
|
||||
GSocketEventFlags m_detected;
|
||||
wxSocketEventFlags m_detected;
|
||||
|
||||
protected:
|
||||
GSocketBase(wxSocketBase& wxsocket);
|
||||
wxSocketImpl(wxSocketBase& wxsocket);
|
||||
|
||||
private:
|
||||
// handle the given connect() return value (which may be 0 or EWOULDBLOCK
|
||||
// or something else)
|
||||
virtual wxSocketError DoHandleConnect(int ret) = 0;
|
||||
|
||||
// called by Close() if we have a valid m_fd
|
||||
virtual void DoClose() = 0;
|
||||
|
||||
// put this socket into non-blocking mode and enable monitoring this socket
|
||||
// as part of the event loop
|
||||
virtual void UnblockAndRegisterWithEventLoop() = 0;
|
||||
|
||||
// check that the socket wasn't created yet and that the given address
|
||||
// (either m_local or m_peer depending on the socket kind) is valid and
|
||||
// set m_error and return false if this is not the case
|
||||
bool PreCreateCheck(GAddress *addr);
|
||||
|
||||
// set the given socket option: this just wraps setsockopt(SOL_SOCKET)
|
||||
int SetSocketOption(int optname, int optval)
|
||||
{
|
||||
// although modern Unix systems use "const void *" for the 4th
|
||||
// parameter here, old systems and Winsock still use "const char *"
|
||||
return setsockopt(m_fd, SOL_SOCKET, optname,
|
||||
reinterpret_cast<const char *>(&optval),
|
||||
sizeof(optval));
|
||||
}
|
||||
|
||||
// set the given socket option to true value: this is an even simpler
|
||||
// wrapper for setsockopt(SOL_SOCKET) for boolean options
|
||||
int EnableSocketOption(int optname)
|
||||
{
|
||||
return SetSocketOption(optname, 1);
|
||||
}
|
||||
|
||||
// apply the options to the (just created) socket and register it with the
|
||||
// event loop by calling UnblockAndRegisterWithEventLoop()
|
||||
void PostCreation();
|
||||
|
||||
// update local address after binding/connecting
|
||||
wxSocketError UpdateLocalAddress();
|
||||
|
||||
|
||||
// set in ctor and never changed except that it's reset to NULL when the
|
||||
// socket is shut down
|
||||
wxSocketBase *m_wxsocket;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(GSocketBase)
|
||||
DECLARE_NO_COPY_CLASS(wxSocketImpl)
|
||||
};
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/gsockmsw.h"
|
||||
#else
|
||||
#include "wx/unix/gsockunx.h"
|
||||
#endif
|
||||
|
||||
/* Global initializers */
|
||||
|
||||
/* GSocket_Init() must be called at the beginning (but after calling
|
||||
* GSocketManager::Set() if a custom manager should be used) */
|
||||
bool GSocket_Init();
|
||||
|
||||
/* GSocket_Cleanup() must be called at the end */
|
||||
void GSocket_Cleanup();
|
||||
|
||||
|
||||
/* GAddress */
|
||||
|
||||
// TODO: make GAddress a real class instead of this mix of C and C++
|
||||
|
||||
// Represents a socket endpoint, i.e. -- in spite of its name -- not an address
|
||||
// but an (address, port) pair
|
||||
struct GAddress
|
||||
@@ -288,7 +380,7 @@ struct GAddress
|
||||
GAddressType m_family;
|
||||
int m_realfamily;
|
||||
|
||||
GSocketError m_error;
|
||||
wxSocketError m_error;
|
||||
};
|
||||
|
||||
GAddress *GAddress_new();
|
||||
@@ -303,48 +395,48 @@ GAddressType GAddress_GetFamily(GAddress *address);
|
||||
* address family will be implicitly set to AF_INET.
|
||||
*/
|
||||
|
||||
GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname);
|
||||
GSocketError GAddress_INET_SetBroadcastAddress(GAddress *address);
|
||||
GSocketError GAddress_INET_SetAnyAddress(GAddress *address);
|
||||
GSocketError GAddress_INET_SetHostAddress(GAddress *address,
|
||||
wxSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname);
|
||||
wxSocketError GAddress_INET_SetBroadcastAddress(GAddress *address);
|
||||
wxSocketError GAddress_INET_SetAnyAddress(GAddress *address);
|
||||
wxSocketError GAddress_INET_SetHostAddress(GAddress *address,
|
||||
unsigned long hostaddr);
|
||||
GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port,
|
||||
wxSocketError GAddress_INET_SetPortName(GAddress *address, const char *port,
|
||||
const char *protocol);
|
||||
GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port);
|
||||
wxSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port);
|
||||
|
||||
GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname,
|
||||
wxSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname,
|
||||
size_t sbuf);
|
||||
unsigned long GAddress_INET_GetHostAddress(GAddress *address);
|
||||
unsigned short GAddress_INET_GetPort(GAddress *address);
|
||||
|
||||
GSocketError _GAddress_translate_from(GAddress *address,
|
||||
wxSocketError _GAddress_translate_from(GAddress *address,
|
||||
struct sockaddr *addr, int len);
|
||||
GSocketError _GAddress_translate_to (GAddress *address,
|
||||
wxSocketError _GAddress_translate_to (GAddress *address,
|
||||
struct sockaddr **addr, int *len);
|
||||
GSocketError _GAddress_Init_INET(GAddress *address);
|
||||
wxSocketError _GAddress_Init_INET(GAddress *address);
|
||||
|
||||
#if wxUSE_IPV6
|
||||
|
||||
GSocketError GAddress_INET6_SetHostName(GAddress *address, const char *hostname);
|
||||
GSocketError GAddress_INET6_SetAnyAddress(GAddress *address);
|
||||
GSocketError GAddress_INET6_SetHostAddress(GAddress *address,
|
||||
wxSocketError GAddress_INET6_SetHostName(GAddress *address, const char *hostname);
|
||||
wxSocketError GAddress_INET6_SetAnyAddress(GAddress *address);
|
||||
wxSocketError GAddress_INET6_SetHostAddress(GAddress *address,
|
||||
struct in6_addr hostaddr);
|
||||
GSocketError GAddress_INET6_SetPortName(GAddress *address, const char *port,
|
||||
wxSocketError GAddress_INET6_SetPortName(GAddress *address, const char *port,
|
||||
const char *protocol);
|
||||
GSocketError GAddress_INET6_SetPort(GAddress *address, unsigned short port);
|
||||
wxSocketError GAddress_INET6_SetPort(GAddress *address, unsigned short port);
|
||||
|
||||
GSocketError GAddress_INET6_GetHostName(GAddress *address, char *hostname,
|
||||
wxSocketError GAddress_INET6_GetHostName(GAddress *address, char *hostname,
|
||||
size_t sbuf);
|
||||
GSocketError GAddress_INET6_GetHostAddress(GAddress *address,struct in6_addr *hostaddr);
|
||||
wxSocketError GAddress_INET6_GetHostAddress(GAddress *address,struct in6_addr *hostaddr);
|
||||
unsigned short GAddress_INET6_GetPort(GAddress *address);
|
||||
|
||||
#endif // wxUSE_IPV6
|
||||
|
||||
// these functions are available under all platforms but only implemented under
|
||||
// Unix ones, elsewhere they just return GSOCK_INVADDR
|
||||
GSocketError _GAddress_Init_UNIX(GAddress *address);
|
||||
GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path);
|
||||
GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf);
|
||||
// Unix ones, elsewhere they just return wxSOCKET_INVADDR
|
||||
wxSocketError _GAddress_Init_UNIX(GAddress *address);
|
||||
wxSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path);
|
||||
wxSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf);
|
||||
|
||||
#endif /* wxUSE_SOCKETS */
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/private/gsocketiohandler.h
|
||||
// Purpose: class for registering GSocket in wxSelectDispatcher
|
||||
// Purpose: class for registering sockets with wxSelectDispatcher
|
||||
// Authors: Lukasz Michalski
|
||||
// Created: December 2006
|
||||
// Copyright: (c) Lukasz Michalski
|
||||
@@ -18,10 +18,10 @@
|
||||
#include "wx/private/selectdispatcher.h"
|
||||
#include "wx/private/gsocket.h"
|
||||
|
||||
class WXDLLIMPEXP_BASE wxGSocketIOHandler : public wxFDIOHandler
|
||||
class WXDLLIMPEXP_BASE wxSocketIOHandler : public wxFDIOHandler
|
||||
{
|
||||
public:
|
||||
wxGSocketIOHandler(GSocket* socket)
|
||||
wxSocketIOHandler(wxSocketImpl *socket)
|
||||
{
|
||||
m_socket = socket;
|
||||
m_flags = 0;
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
virtual void OnExceptionWaiting() { m_socket->Detected_Read(); }
|
||||
|
||||
private:
|
||||
GSocket* m_socket;
|
||||
wxSocketImpl *m_socket;
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
|
@@ -22,49 +22,54 @@
|
||||
|
||||
#include "wx/event.h"
|
||||
#include "wx/sckaddr.h"
|
||||
#include "wx/private/gsocket.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
class wxSocketImpl;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Types and constants
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Types of different socket notifications or events.
|
||||
//
|
||||
// NB: the values here should be consecutive and start with 0 as they are
|
||||
// used to construct the wxSOCKET_XXX_FLAG bit mask values below
|
||||
enum wxSocketNotify
|
||||
{
|
||||
wxSOCKET_INPUT = GSOCK_INPUT,
|
||||
wxSOCKET_OUTPUT = GSOCK_OUTPUT,
|
||||
wxSOCKET_CONNECTION = GSOCK_CONNECTION,
|
||||
wxSOCKET_LOST = GSOCK_LOST
|
||||
wxSOCKET_INPUT,
|
||||
wxSOCKET_OUTPUT,
|
||||
wxSOCKET_CONNECTION,
|
||||
wxSOCKET_LOST,
|
||||
wxSOCKET_MAX_EVENT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wxSOCKET_INPUT_FLAG = GSOCK_INPUT_FLAG,
|
||||
wxSOCKET_OUTPUT_FLAG = GSOCK_OUTPUT_FLAG,
|
||||
wxSOCKET_CONNECTION_FLAG = GSOCK_CONNECTION_FLAG,
|
||||
wxSOCKET_LOST_FLAG = GSOCK_LOST_FLAG
|
||||
wxSOCKET_INPUT_FLAG = 1 << wxSOCKET_INPUT,
|
||||
wxSOCKET_OUTPUT_FLAG = 1 << wxSOCKET_OUTPUT,
|
||||
wxSOCKET_CONNECTION_FLAG = 1 << wxSOCKET_CONNECTION,
|
||||
wxSOCKET_LOST_FLAG = 1 << wxSOCKET_LOST
|
||||
};
|
||||
|
||||
typedef GSocketEventFlags wxSocketEventFlags;
|
||||
// this is a combination of the bit masks defined above
|
||||
typedef int wxSocketEventFlags;
|
||||
|
||||
enum wxSocketError
|
||||
{
|
||||
// from GSocket
|
||||
wxSOCKET_NOERROR = GSOCK_NOERROR,
|
||||
wxSOCKET_INVOP = GSOCK_INVOP,
|
||||
wxSOCKET_IOERR = GSOCK_IOERR,
|
||||
wxSOCKET_INVADDR = GSOCK_INVADDR,
|
||||
wxSOCKET_INVSOCK = GSOCK_INVSOCK,
|
||||
wxSOCKET_NOHOST = GSOCK_NOHOST,
|
||||
wxSOCKET_INVPORT = GSOCK_INVPORT,
|
||||
wxSOCKET_WOULDBLOCK = GSOCK_WOULDBLOCK,
|
||||
wxSOCKET_TIMEDOUT = GSOCK_TIMEDOUT,
|
||||
wxSOCKET_MEMERR = GSOCK_MEMERR,
|
||||
|
||||
// wxSocket-specific (not yet implemented)
|
||||
wxSOCKET_DUMMY
|
||||
wxSOCKET_NOERROR = 0,
|
||||
wxSOCKET_INVOP,
|
||||
wxSOCKET_IOERR,
|
||||
wxSOCKET_INVADDR,
|
||||
wxSOCKET_INVSOCK,
|
||||
wxSOCKET_NOHOST,
|
||||
wxSOCKET_INVPORT,
|
||||
wxSOCKET_WOULDBLOCK,
|
||||
wxSOCKET_TIMEDOUT,
|
||||
wxSOCKET_MEMERR,
|
||||
wxSOCKET_OPTERR
|
||||
};
|
||||
|
||||
// socket options/flags bit masks
|
||||
enum
|
||||
{
|
||||
wxSOCKET_NONE = 0,
|
||||
@@ -76,6 +81,9 @@ enum
|
||||
wxSOCKET_NOBIND = 32
|
||||
};
|
||||
|
||||
typedef int wxSocketFlags;
|
||||
|
||||
// socket kind values (badly defined, don't use)
|
||||
enum wxSocketType
|
||||
{
|
||||
wxSOCKET_UNINIT,
|
||||
@@ -85,8 +93,6 @@ enum wxSocketType
|
||||
wxSOCKET_DATAGRAM
|
||||
};
|
||||
|
||||
typedef int wxSocketFlags;
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -111,14 +117,14 @@ public:
|
||||
|
||||
// state
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return (m_socket != NULL); }
|
||||
bool IsOk() const { return m_impl != NULL; }
|
||||
bool Error() const { return m_error; }
|
||||
bool IsClosed() const { return m_closed; }
|
||||
bool IsConnected() const { return m_connected; }
|
||||
bool IsData() { return WaitForRead(0, 0); }
|
||||
bool IsDisconnected() const { return !IsConnected(); }
|
||||
wxUint32 LastCount() const { return m_lcount; }
|
||||
wxSocketError LastError() const { return (wxSocketError)m_socket->GetError(); }
|
||||
wxSocketError LastError() const;
|
||||
void SaveState();
|
||||
void RestoreState();
|
||||
|
||||
@@ -182,7 +188,7 @@ public:
|
||||
// Implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// do not use, should be private (called from GSocket)
|
||||
// do not use, should be private (called from wxSocketImpl only)
|
||||
void OnRequest(wxSocketNotify notify);
|
||||
|
||||
// do not use, not documented nor supported
|
||||
@@ -201,7 +207,7 @@ private:
|
||||
// wait until the given flags are set for this socket or the given timeout
|
||||
// (or m_timeout) expires
|
||||
//
|
||||
// notice that GSOCK_LOST_FLAG is always taken into account but the return
|
||||
// notice that wxSOCKET_LOST_FLAG is always taken into account but the return
|
||||
// value depends on whether it is included in flags or not: if it is, and the
|
||||
// connection is indeed lost, true is returned, but if it isn't then the
|
||||
// function returns false in this case
|
||||
@@ -215,7 +221,7 @@ private:
|
||||
|
||||
private:
|
||||
// socket
|
||||
GSocket *m_socket; // GSocket
|
||||
wxSocketImpl *m_impl; // port-specific implementation
|
||||
wxSocketType m_type; // wxSocket type
|
||||
|
||||
// state
|
||||
|
@@ -52,6 +52,4 @@ private:
|
||||
// the signal handlers
|
||||
WX_DECLARE_HASH_MAP(int, SignalHandler, wxIntegerHash, wxIntegerEqual, SignalHandlerHash);
|
||||
SignalHandlerHash m_signalHandlerHash;
|
||||
|
||||
friend class GSocketGUIFunctionsTableBase;
|
||||
};
|
||||
|
@@ -46,13 +46,13 @@ public:
|
||||
// wxThread helpers
|
||||
// ----------------
|
||||
|
||||
// TODO
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
// Darwin uses the same wxSocketManager in console and GUI and, like MSW,
|
||||
// uses SetDefaultSocketManager() to initialize it
|
||||
#if wxUSE_SOCKETS && !defined(__DARWIN__)
|
||||
// returns the select()-based socket manager for console applications which
|
||||
// is also used by some ports (wxX11, wxDFB) in the GUI build (hence it is
|
||||
// here and not in wxConsoleAppTraits)
|
||||
virtual GSocketManager *GetSocketManager();
|
||||
virtual wxSocketManager *GetSocketManager();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@@ -81,7 +81,7 @@ public:
|
||||
#endif
|
||||
|
||||
#if wxUSE_SOCKETS && defined(wxHAS_GUI_SOCKET_MANAGER)
|
||||
virtual GSocketManager *GetSocketManager();
|
||||
virtual wxSocketManager *GetSocketManager();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -1,51 +1,62 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket) for WX
|
||||
* Name: gsockunx.h
|
||||
* Copyright: (c) Guilhem Lavaux
|
||||
* Licence: wxWindows Licence
|
||||
* Purpose: GSocket Unix header
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/unix/gsockunx.h
|
||||
// Purpose: wxSocketImpl implementation for Unix systems
|
||||
// Authors: Guilhem Lavaux, Vadim Zeitlin
|
||||
// Created: April 1997
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Guilhem Lavaux
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIX_GSOCKUNX_H_
|
||||
#define _WX_UNIX_GSOCKUNX_H_
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
class wxGSocketIOHandler;
|
||||
class wxSocketIOHandler;
|
||||
|
||||
class GSocket : public GSocketBase
|
||||
class wxSocketImplUnix : public wxSocketImpl
|
||||
{
|
||||
public:
|
||||
GSocket(wxSocketBase& wxsocket);
|
||||
virtual ~GSocket();
|
||||
wxSocketImplUnix(wxSocketBase& wxsocket);
|
||||
|
||||
virtual void Shutdown();
|
||||
virtual GSocket *WaitConnection(wxSocketBase& wxsocket);
|
||||
virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket);
|
||||
|
||||
GSocketError SetServer();
|
||||
bool SetReusable();
|
||||
bool SetBroadcast();
|
||||
bool DontDoBind();
|
||||
GSocketError Connect(GSocketStream stream);
|
||||
GSocketError SetNonOriented();
|
||||
int Read(char *buffer, int size);
|
||||
int Write(const char *buffer, int size);
|
||||
void SetNonBlocking(bool non_block);
|
||||
GSocketError WXDLLIMPEXP_NET GetError();
|
||||
GSocketError GetSockOpt(int level, int optname, void *optval, int *optlen);
|
||||
GSocketError SetSockOpt(int level, int optname,
|
||||
const void *optval, int optlen);
|
||||
//attach or detach from main loop
|
||||
void Notify(bool flag);
|
||||
void Detected_Read();
|
||||
void Detected_Write();
|
||||
|
||||
private:
|
||||
virtual wxSocketError DoHandleConnect(int ret);
|
||||
virtual void DoClose()
|
||||
{
|
||||
wxSocketManager * const manager = wxSocketManager::Get();
|
||||
if ( manager )
|
||||
{
|
||||
manager->Uninstall_Callback(this, wxSOCKET_INPUT);
|
||||
manager->Uninstall_Callback(this, wxSOCKET_OUTPUT);
|
||||
}
|
||||
|
||||
close(m_fd);
|
||||
}
|
||||
|
||||
virtual void UnblockAndRegisterWithEventLoop()
|
||||
{
|
||||
int trueArg = 1;
|
||||
ioctl(m_fd, FIONBIO, &trueArg);
|
||||
|
||||
EnableEvents();
|
||||
}
|
||||
|
||||
// enable or disable notifications for socket input/output events but only
|
||||
// if m_use_events is true; do nothing otherwise
|
||||
void EnableEvents()
|
||||
virtual void EnableEvents()
|
||||
{
|
||||
if ( m_use_events )
|
||||
DoEnableEvents(true);
|
||||
@@ -67,38 +78,36 @@ private:
|
||||
//
|
||||
// notice that these functions also update m_detected: EnableEvent() clears
|
||||
// the corresponding bit in it and DisableEvent() sets it
|
||||
void EnableEvent(GSocketEvent event);
|
||||
void DisableEvent(GSocketEvent event);
|
||||
void EnableEvent(wxSocketNotify event);
|
||||
void DisableEvent(wxSocketNotify event);
|
||||
|
||||
|
||||
GSocketError Input_Timeout();
|
||||
GSocketError Output_Timeout();
|
||||
wxSocketError Input_Timeout();
|
||||
wxSocketError Output_Timeout();
|
||||
int Recv_Stream(char *buffer, int size);
|
||||
int Recv_Dgram(char *buffer, int size);
|
||||
int Send_Stream(const char *buffer, int size);
|
||||
int Send_Dgram(const char *buffer, int size);
|
||||
public:
|
||||
/* DFE: We can't protect these data member until the GUI code is updated */
|
||||
/* protected: */
|
||||
wxGSocketIOHandler *m_handler;
|
||||
|
||||
protected:
|
||||
// true if socket should fire events
|
||||
bool m_use_events;
|
||||
|
||||
// pointer for storing extra (usually GUI-specific) data
|
||||
void *m_gui_dependent;
|
||||
// descriptors for input and output event notification channels associated
|
||||
// with the socket
|
||||
int m_fds[2];
|
||||
|
||||
private:
|
||||
// notify the associated wxSocket about a change in socket state and shut
|
||||
// down the socket if the event is GSOCK_LOST
|
||||
void OnStateChange(GSocketEvent event);
|
||||
// down the socket if the event is wxSOCKET_LOST
|
||||
void OnStateChange(wxSocketNotify event);
|
||||
|
||||
// give it access to our m_fds
|
||||
friend class wxSocketFDBasedManager;
|
||||
};
|
||||
|
||||
// A version of GSocketManager which uses FDs for socket IO
|
||||
//
|
||||
// This class uses GSocket::m_gui_dependent field to store the 2 (for input and
|
||||
// output) FDs associated with the socket.
|
||||
class GSocketFDBasedManager : public GSocketManager
|
||||
// A version of wxSocketManager which uses FDs for socket IO
|
||||
class wxSocketFDBasedManager : public wxSocketManager
|
||||
{
|
||||
public:
|
||||
// no special initialization/cleanup needed when using FDs
|
||||
@@ -106,28 +115,9 @@ public:
|
||||
virtual void OnExit() { }
|
||||
|
||||
// allocate/free the storage we need
|
||||
virtual bool Init_Socket(GSocket *socket)
|
||||
virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket)
|
||||
{
|
||||
socket->m_gui_dependent = malloc(sizeof(int)*2);
|
||||
int * const fds = static_cast<int *>(socket->m_gui_dependent);
|
||||
|
||||
fds[0] = -1;
|
||||
fds[1] = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void Close_Socket(GSocket *socket)
|
||||
{
|
||||
Uninstall_Callback(socket, GSOCK_INPUT);
|
||||
Uninstall_Callback(socket, GSOCK_OUTPUT);
|
||||
|
||||
close(socket->m_fd);
|
||||
}
|
||||
|
||||
virtual void Destroy_Socket(GSocket *socket)
|
||||
{
|
||||
free(socket->m_gui_dependent);
|
||||
return new wxSocketImplUnix(wxsocket);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -140,8 +130,8 @@ protected:
|
||||
FD_OUTPUT
|
||||
};
|
||||
|
||||
// get the FD index corresponding to the given GSocketEvent
|
||||
SocketDir GetDirForEvent(GSocket *socket, GSocketEvent event)
|
||||
// get the FD index corresponding to the given wxSocketNotify
|
||||
SocketDir GetDirForEvent(wxSocketImpl *socket, wxSocketNotify event)
|
||||
{
|
||||
switch ( event )
|
||||
{
|
||||
@@ -149,34 +139,34 @@ protected:
|
||||
wxFAIL_MSG( "unexpected socket event" );
|
||||
// fall through
|
||||
|
||||
case GSOCK_LOST:
|
||||
case wxSOCKET_LOST:
|
||||
// fall through
|
||||
|
||||
case GSOCK_INPUT:
|
||||
case wxSOCKET_INPUT:
|
||||
return FD_INPUT;
|
||||
|
||||
case GSOCK_OUTPUT:
|
||||
case wxSOCKET_OUTPUT:
|
||||
return FD_OUTPUT;
|
||||
|
||||
case GSOCK_CONNECTION:
|
||||
case wxSOCKET_CONNECTION:
|
||||
// FIXME: explain this?
|
||||
return socket->m_server ? FD_INPUT : FD_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
// access the FDs we store
|
||||
int& FD(GSocket *socket, SocketDir d)
|
||||
int& FD(wxSocketImpl *socket, SocketDir d)
|
||||
{
|
||||
return static_cast<int *>(socket->m_gui_dependent)[d];
|
||||
return static_cast<wxSocketImplUnix *>(socket)->m_fds[d];
|
||||
}
|
||||
};
|
||||
|
||||
// Common base class for all ports using X11-like (and hence implemented in
|
||||
// X11, Motif and GTK) AddInput() and RemoveInput() functions
|
||||
class GSocketInputBasedManager : public GSocketFDBasedManager
|
||||
class wxSocketInputBasedManager : public wxSocketFDBasedManager
|
||||
{
|
||||
public:
|
||||
virtual void Install_Callback(GSocket *socket, GSocketEvent event)
|
||||
virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event)
|
||||
{
|
||||
wxCHECK_RET( socket->m_fd != -1,
|
||||
"shouldn't be called on invalid socket" );
|
||||
@@ -190,7 +180,7 @@ public:
|
||||
fd = AddInput(socket, d);
|
||||
}
|
||||
|
||||
virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event)
|
||||
virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event)
|
||||
{
|
||||
const SocketDir d = GetDirForEvent(socket, event);
|
||||
|
||||
@@ -205,7 +195,7 @@ public:
|
||||
private:
|
||||
// these functions map directly to XtAdd/RemoveInput() or
|
||||
// gdk_input_add/remove()
|
||||
virtual int AddInput(GSocket *socket, SocketDir d) = 0;
|
||||
virtual int AddInput(wxSocketImpl *socket, SocketDir d) = 0;
|
||||
virtual void RemoveInput(int fd) = 0;
|
||||
};
|
||||
|
||||
|
@@ -111,6 +111,8 @@ wxAppConsole *wxAppConsoleBase::ms_appInstance = NULL;
|
||||
|
||||
wxAppInitializerFunction wxAppConsoleBase::ms_appInitFn = NULL;
|
||||
|
||||
wxSocketManager *wxAppTraitsBase::ms_manager = NULL;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxEventLoopPtr
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/gsocketiohandler.cpp
|
||||
// Purpose: implementation of wxFDIOHandler for GSocket
|
||||
// Purpose: implementation of wxFDIOHandler for wxSocket
|
||||
// Author: Angel Vidal, Lukasz Michalski
|
||||
// Created: 08.24.06
|
||||
// RCS-ID: $Id$
|
||||
@@ -31,19 +31,47 @@
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GSocketSelectManager
|
||||
// wxSocketImplFDIO
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class GSocketSelectManager : public GSocketFDBasedManager
|
||||
class wxSocketImplFDIO : public wxSocketImplUnix
|
||||
{
|
||||
public:
|
||||
virtual void Install_Callback(GSocket *socket, GSocketEvent event);
|
||||
virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event);
|
||||
wxSocketImplFDIO(wxSocketBase& wxsocket)
|
||||
: wxSocketImplUnix(wxsocket)
|
||||
{
|
||||
m_handler = NULL;
|
||||
}
|
||||
|
||||
virtual ~wxSocketImplFDIO()
|
||||
{
|
||||
delete m_handler;
|
||||
}
|
||||
|
||||
wxSocketIOHandler *m_handler;
|
||||
};
|
||||
|
||||
void GSocketSelectManager::Install_Callback(GSocket *socket,
|
||||
GSocketEvent event)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSocketSelectManager
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxSocketSelectManager : public wxSocketFDBasedManager
|
||||
{
|
||||
public:
|
||||
virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket)
|
||||
{
|
||||
return new wxSocketImplFDIO(wxsocket);
|
||||
}
|
||||
|
||||
virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
};
|
||||
|
||||
void wxSocketSelectManager::Install_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify event)
|
||||
{
|
||||
wxSocketImplFDIO * const socket = static_cast<wxSocketImplFDIO *>(socket_);
|
||||
|
||||
const int fd = socket->m_fd;
|
||||
|
||||
if ( fd == -1 )
|
||||
@@ -55,7 +83,7 @@ void GSocketSelectManager::Install_Callback(GSocket *socket,
|
||||
if ( !dispatcher )
|
||||
return;
|
||||
|
||||
wxGSocketIOHandler *& handler = socket->m_handler;
|
||||
wxSocketIOHandler *& handler = socket->m_handler;
|
||||
|
||||
// we should register the new handlers but modify the existing ones in place
|
||||
bool registerHandler;
|
||||
@@ -66,7 +94,7 @@ void GSocketSelectManager::Install_Callback(GSocket *socket,
|
||||
else // no existing handler
|
||||
{
|
||||
registerHandler = true;
|
||||
handler = new wxGSocketIOHandler(socket);
|
||||
handler = new wxSocketIOHandler(socket);
|
||||
}
|
||||
|
||||
FD(socket, d) = fd;
|
||||
@@ -85,9 +113,11 @@ void GSocketSelectManager::Install_Callback(GSocket *socket,
|
||||
dispatcher->ModifyFD(fd, handler, handler->GetFlags());
|
||||
}
|
||||
|
||||
void GSocketSelectManager::Uninstall_Callback(GSocket *socket,
|
||||
GSocketEvent event)
|
||||
void wxSocketSelectManager::Uninstall_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify event)
|
||||
{
|
||||
wxSocketImplFDIO * const socket = static_cast<wxSocketImplFDIO *>(socket_);
|
||||
|
||||
const SocketDir d = GetDirForEvent(socket, event);
|
||||
|
||||
const int fd = FD(socket, d);
|
||||
@@ -103,7 +133,7 @@ void GSocketSelectManager::Uninstall_Callback(GSocket *socket,
|
||||
if ( !dispatcher )
|
||||
return;
|
||||
|
||||
wxGSocketIOHandler *& handler = socket->m_handler;
|
||||
wxSocketIOHandler *& handler = socket->m_handler;
|
||||
if ( handler )
|
||||
{
|
||||
handler->RemoveFlag(flag);
|
||||
@@ -125,9 +155,9 @@ void GSocketSelectManager::Uninstall_Callback(GSocket *socket,
|
||||
}
|
||||
}
|
||||
|
||||
GSocketManager *wxAppTraits::GetSocketManager()
|
||||
wxSocketManager *wxAppTraits::GetSocketManager()
|
||||
{
|
||||
static GSocketSelectManager s_manager;
|
||||
static wxSocketSelectManager s_manager;
|
||||
|
||||
return &s_manager;
|
||||
}
|
||||
|
@@ -145,12 +145,12 @@ bool wxIPV4address::Hostname(const wxString& name)
|
||||
return false;
|
||||
}
|
||||
m_origHostname = name;
|
||||
return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetHostName(m_address, name.mb_str()) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV4address::Hostname(unsigned long addr)
|
||||
{
|
||||
bool rv = (GAddress_INET_SetHostAddress(m_address, addr) == GSOCK_NOERROR);
|
||||
bool rv = (GAddress_INET_SetHostAddress(m_address, addr) == wxSOCKET_NOERROR);
|
||||
if (rv)
|
||||
m_origHostname = Hostname();
|
||||
else
|
||||
@@ -160,17 +160,17 @@ bool wxIPV4address::Hostname(unsigned long addr)
|
||||
|
||||
bool wxIPV4address::Service(const wxString& name)
|
||||
{
|
||||
return (GAddress_INET_SetPortName(m_address, name.mb_str(), "tcp") == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetPortName(m_address, name.mb_str(), "tcp") == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV4address::Service(unsigned short port)
|
||||
{
|
||||
return (GAddress_INET_SetPort(m_address, port) == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetPort(m_address, port) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV4address::LocalHost()
|
||||
{
|
||||
return (GAddress_INET_SetHostName(m_address, "localhost") == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetHostName(m_address, "localhost") == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV4address::IsLocalHost() const
|
||||
@@ -180,12 +180,12 @@ bool wxIPV4address::IsLocalHost() const
|
||||
|
||||
bool wxIPV4address::BroadcastAddress()
|
||||
{
|
||||
return (GAddress_INET_SetBroadcastAddress(m_address) == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetBroadcastAddress(m_address) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV4address::AnyAddress()
|
||||
{
|
||||
return (GAddress_INET_SetAnyAddress(m_address) == GSOCK_NOERROR);
|
||||
return (GAddress_INET_SetAnyAddress(m_address) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
wxString wxIPV4address::Hostname() const
|
||||
@@ -253,7 +253,7 @@ bool wxIPV6address::Hostname(const wxString& name)
|
||||
return false;
|
||||
}
|
||||
m_origHostname = name;
|
||||
return (GAddress_INET6_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR);
|
||||
return (GAddress_INET6_SetHostName(m_address, name.mb_str()) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV6address::Hostname(unsigned char addr[16])
|
||||
@@ -273,17 +273,17 @@ bool wxIPV6address::Hostname(unsigned char addr[16])
|
||||
|
||||
bool wxIPV6address::Service(const wxString& name)
|
||||
{
|
||||
return (GAddress_INET6_SetPortName(m_address, name.mb_str(), "tcp") == GSOCK_NOERROR);
|
||||
return (GAddress_INET6_SetPortName(m_address, name.mb_str(), "tcp") == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV6address::Service(unsigned short port)
|
||||
{
|
||||
return (GAddress_INET6_SetPort(m_address, port) == GSOCK_NOERROR);
|
||||
return (GAddress_INET6_SetPort(m_address, port) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV6address::LocalHost()
|
||||
{
|
||||
return (GAddress_INET6_SetHostName(m_address, "localhost") == GSOCK_NOERROR);
|
||||
return (GAddress_INET6_SetHostName(m_address, "localhost") == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
bool wxIPV6address::IsLocalHost() const
|
||||
@@ -306,7 +306,7 @@ bool wxIPV6address::BroadcastAddress()
|
||||
|
||||
bool wxIPV6address::AnyAddress()
|
||||
{
|
||||
return (GAddress_INET6_SetAnyAddress(m_address) == GSOCK_NOERROR);
|
||||
return (GAddress_INET6_SetAnyAddress(m_address) == wxSOCKET_NOERROR);
|
||||
}
|
||||
|
||||
wxString wxIPV6address::IPAddress() const
|
||||
@@ -356,7 +356,7 @@ wxString wxIPV6address::Hostname() const
|
||||
|
||||
if ( GAddress_INET6_GetHostName(m_address,
|
||||
hostname,
|
||||
WXSIZEOF(hostname)) != GSOCK_NOERROR )
|
||||
WXSIZEOF(hostname)) != wxSOCKET_NOERROR )
|
||||
return wxEmptyString;
|
||||
|
||||
return wxString::FromAscii(hostname);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -24,11 +24,11 @@
|
||||
|
||||
extern "C" {
|
||||
static
|
||||
void _GSocket_GDK_Input(gpointer data,
|
||||
void wxSocket_GDK_Input(gpointer data,
|
||||
gint WXUNUSED(source),
|
||||
GdkInputCondition condition)
|
||||
{
|
||||
GSocket *socket = (GSocket *)data;
|
||||
wxSocketImpl * const socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
if ( condition & GDK_INPUT_READ )
|
||||
socket->Detected_Read();
|
||||
@@ -37,16 +37,16 @@ void _GSocket_GDK_Input(gpointer data,
|
||||
}
|
||||
}
|
||||
|
||||
class GTKSocketManager : public GSocketInputBasedManager
|
||||
class GTKSocketManager : public wxSocketInputBasedManager
|
||||
{
|
||||
public:
|
||||
virtual int AddInput(GSocket *socket, SocketDir d)
|
||||
virtual int AddInput(wxSocketImpl *socket, SocketDir d)
|
||||
{
|
||||
return gdk_input_add
|
||||
(
|
||||
socket->m_fd,
|
||||
d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
|
||||
_GSocket_GDK_Input,
|
||||
wxSocket_GDK_Input,
|
||||
socket
|
||||
);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
GSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
wxSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
{
|
||||
static GTKSocketManager s_manager;
|
||||
return &s_manager;
|
||||
|
@@ -24,11 +24,11 @@
|
||||
|
||||
extern "C" {
|
||||
static
|
||||
void _GSocket_GDK_Input(gpointer data,
|
||||
void wxSocket_GDK_Input(gpointer data,
|
||||
gint WXUNUSED(source),
|
||||
GdkInputCondition condition)
|
||||
{
|
||||
GSocket *socket = (GSocket *)data;
|
||||
wxSocketImpl const *socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
if ( condition & GDK_INPUT_READ )
|
||||
socket->Detected_Read();
|
||||
@@ -37,16 +37,16 @@ void _GSocket_GDK_Input(gpointer data,
|
||||
}
|
||||
}
|
||||
|
||||
class GTKSocketManager : public GSocketInputBasedManager
|
||||
class GTKSocketManager : public wxSocketInputBasedManager
|
||||
{
|
||||
public:
|
||||
virtual int AddInput(GSocket *socket, SocketDir d)
|
||||
virtual int AddInput(wxSocketImpl *socket, SocketDir d)
|
||||
{
|
||||
return gdk_input_add
|
||||
(
|
||||
socket->m_fd,
|
||||
d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
|
||||
_GSocket_GDK_Input,
|
||||
wxSocket_GDK_Input,
|
||||
socket
|
||||
);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
GSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
wxSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
{
|
||||
static GTKSocketManager s_manager;
|
||||
return &s_manager;
|
||||
|
@@ -20,28 +20,28 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
static void _GSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
|
||||
static void wxSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
|
||||
XtInputId *WXUNUSED(id))
|
||||
{
|
||||
GSocket *socket = (GSocket *)data;
|
||||
wxSocketImpl * const socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
socket->Detected_Read();
|
||||
}
|
||||
|
||||
static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
|
||||
static void wxSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
|
||||
XtInputId *WXUNUSED(id))
|
||||
{
|
||||
GSocket *socket = (GSocket *)data;
|
||||
wxSocketImpl * const socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
socket->Detected_Write();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MotifSocketManager : public GSocketInputBasedManager
|
||||
class MotifSocketManager : public wxSocketInputBasedManager
|
||||
{
|
||||
public:
|
||||
virtual int AddInput(GSocket *socket, SocketDir d)
|
||||
virtual int AddInput(wxSocketImpl *socket, SocketDir d)
|
||||
{
|
||||
return XtAppAddInput
|
||||
(
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
socket->m_fd,
|
||||
(XtPointer)(d == FD_OUTPUT ? XtInputWriteMask
|
||||
: XtInputReadMask),
|
||||
d == FD_OUTPUT ? _GSocket_Motif_Output
|
||||
: _GSocket_Motif_Input,
|
||||
d == FD_OUTPUT ? wxSocket_Motif_Output
|
||||
: wxSocket_Motif_Input,
|
||||
socket
|
||||
);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
GSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
wxSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
{
|
||||
static MotifSocketManager s_manager;
|
||||
return &s_manager;
|
||||
|
@@ -42,8 +42,6 @@
|
||||
// wxAppTraits implementation
|
||||
// ============================================================================
|
||||
|
||||
GSocketManager *wxAppTraits::ms_manager = NULL;
|
||||
|
||||
WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread)
|
||||
{
|
||||
return ::WaitForSingleObject((HANDLE)hThread, INFINITE);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,15 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket)
|
||||
* Name: src/msw/gsockmsw.cpp
|
||||
* Copyright: (c) Guilhem Lavaux
|
||||
* Licence: wxWindows Licence
|
||||
* Author: Guillermo Rodriguez Garcia <guille@iies.es>
|
||||
* Purpose: GSocket GUI-specific MSW code
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/msw/gsockmsw.cpp
|
||||
// Purpose: MSW-specific socket support
|
||||
// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia
|
||||
// Created: April 1997
|
||||
// Copyright: (C) 1999-1997, Guilhem Lavaux
|
||||
// (C) 1999-2000, Guillermo Rodriguez Garcia
|
||||
// (C) 2008 Vadim Zeitlin
|
||||
// RCS_ID: $Id$
|
||||
// License: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
@@ -64,13 +66,13 @@ WX_DECLARE_HASH_MAP(int,bool,wxIntegerHash,wxIntegerEqual,SocketHash);
|
||||
# pragma warning(default:4115) /* named type definition in parentheses */
|
||||
#endif
|
||||
|
||||
#define CLASSNAME TEXT("_GSocket_Internal_Window_Class")
|
||||
#define CLASSNAME TEXT("_wxSocket_Internal_Window_Class")
|
||||
|
||||
/* implemented in utils.cpp */
|
||||
extern "C" WXDLLIMPEXP_BASE HWND
|
||||
wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc);
|
||||
|
||||
/* Maximum number of different GSocket objects at a given time.
|
||||
/* Maximum number of different wxSocket objects at a given time.
|
||||
* This value can be modified at will, but it CANNOT be greater
|
||||
* than (0x7FFF - WM_USER + 1)
|
||||
*/
|
||||
@@ -95,13 +97,13 @@ typedef int (PASCAL *WSAWaitForMultipleEventsFunc)(long,HANDLE,BOOL,long,BOOL);
|
||||
typedef int (PASCAL *WSAEnumNetworkEventsFunc)(SOCKET,HANDLE,LPWSANETWORKEVENTS);
|
||||
#endif //__WXWINCE__
|
||||
|
||||
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK wxSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
/* Global variables */
|
||||
|
||||
static HWND hWin;
|
||||
static CRITICAL_SECTION critical;
|
||||
static GSocket* socketList[MAXSOCKETS];
|
||||
static wxSocketImplMSW *socketList[MAXSOCKETS];
|
||||
static int firstAvailable;
|
||||
|
||||
#ifndef __WXWINCE__
|
||||
@@ -175,32 +177,32 @@ DWORD WINAPI SocketThread(LPVOID data)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MSW implementation of GSocketManager
|
||||
// MSW implementation of wxSocketManager
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class GSocketMSWManager : public GSocketManager
|
||||
class wxSocketMSWManager : public wxSocketManager
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual void OnExit();
|
||||
|
||||
virtual bool Init_Socket(GSocket *socket);
|
||||
virtual void Close_Socket(GSocket *socket);
|
||||
virtual void Destroy_Socket(GSocket *socket);
|
||||
|
||||
virtual void Install_Callback(GSocket *socket, GSocketEvent event);
|
||||
virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event);
|
||||
virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket)
|
||||
{
|
||||
return new wxSocketImplMSW(wxsocket);
|
||||
}
|
||||
virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
};
|
||||
|
||||
/* Global initializers */
|
||||
|
||||
bool GSocketMSWManager::OnInit()
|
||||
bool wxSocketMSWManager::OnInit()
|
||||
{
|
||||
static LPCTSTR pclassname = NULL;
|
||||
int i;
|
||||
|
||||
/* Create internal window for event notifications */
|
||||
hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, _GSocket_Internal_WinProc);
|
||||
hWin = wxCreateHiddenWindow(&pclassname, CLASSNAME, wxSocket_Internal_WinProc);
|
||||
if (!hWin)
|
||||
return false;
|
||||
|
||||
@@ -253,10 +255,12 @@ bool GSocketMSWManager::OnInit()
|
||||
currSocket = 0;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
// finally initialize WinSock
|
||||
WSADATA wsaData;
|
||||
return WSAStartup((1 << 8) | 1, &wsaData) == 0;
|
||||
}
|
||||
|
||||
void GSocketMSWManager::OnExit()
|
||||
void wxSocketMSWManager::OnExit()
|
||||
{
|
||||
#ifdef __WXWINCE__
|
||||
/* Delete the threads here */
|
||||
@@ -276,18 +280,19 @@ void GSocketMSWManager::OnExit()
|
||||
|
||||
/* Delete critical section */
|
||||
DeleteCriticalSection(&critical);
|
||||
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
/* Per-socket GUI initialization / cleanup */
|
||||
|
||||
bool GSocketMSWManager::Init_Socket(GSocket *socket)
|
||||
wxSocketImplMSW::wxSocketImplMSW(wxSocketBase& wxsocket)
|
||||
: wxSocketImpl(wxsocket)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Allocate a new message number for this socket */
|
||||
EnterCriticalSection(&critical);
|
||||
|
||||
i = firstAvailable;
|
||||
int i = firstAvailable;
|
||||
while (socketList[i] != NULL)
|
||||
{
|
||||
i = (i + 1) % MAXSOCKETS;
|
||||
@@ -295,41 +300,32 @@ bool GSocketMSWManager::Init_Socket(GSocket *socket)
|
||||
if (i == firstAvailable) /* abort! */
|
||||
{
|
||||
LeaveCriticalSection(&critical);
|
||||
return false;
|
||||
m_msgnumber = 0; // invalid
|
||||
return;
|
||||
}
|
||||
}
|
||||
socketList[i] = socket;
|
||||
socketList[i] = this;
|
||||
firstAvailable = (i + 1) % MAXSOCKETS;
|
||||
socket->m_msgnumber = (i + WM_USER);
|
||||
m_msgnumber = (i + WM_USER);
|
||||
|
||||
LeaveCriticalSection(&critical);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSocketMSWManager::Close_Socket(GSocket *socket)
|
||||
{
|
||||
Uninstall_Callback(socket, GSOCK_MAX_EVENT /* unused anyhow */);
|
||||
|
||||
closesocket(socket->m_fd);
|
||||
}
|
||||
|
||||
void GSocketMSWManager::Destroy_Socket(GSocket *socket)
|
||||
wxSocketImplMSW::~wxSocketImplMSW()
|
||||
{
|
||||
/* Remove the socket from the list */
|
||||
EnterCriticalSection(&critical);
|
||||
|
||||
const int msgnum = socket->m_msgnumber;
|
||||
if ( msgnum )
|
||||
if ( m_msgnumber )
|
||||
{
|
||||
// we need to remove any pending messages for this socket to avoid having
|
||||
// them sent to a new socket which could reuse the same message number as
|
||||
// soon as we destroy this one
|
||||
MSG msg;
|
||||
while ( ::PeekMessage(&msg, hWin, msgnum, msgnum, PM_REMOVE) )
|
||||
while ( ::PeekMessage(&msg, hWin, m_msgnumber, m_msgnumber, PM_REMOVE) )
|
||||
;
|
||||
|
||||
socketList[msgnum - WM_USER] = NULL;
|
||||
socketList[m_msgnumber - WM_USER] = NULL;
|
||||
}
|
||||
//else: the socket has never been created successfully
|
||||
|
||||
@@ -338,19 +334,19 @@ void GSocketMSWManager::Destroy_Socket(GSocket *socket)
|
||||
|
||||
/* Windows proc for asynchronous event handling */
|
||||
|
||||
LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd,
|
||||
LRESULT CALLBACK wxSocket_Internal_WinProc(HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
GSocket *socket;
|
||||
GSocketEvent event;
|
||||
wxSocketImplMSW *socket;
|
||||
wxSocketNotify event;
|
||||
|
||||
if (uMsg >= WM_USER && uMsg <= (WM_USER + MAXSOCKETS - 1))
|
||||
{
|
||||
EnterCriticalSection(&critical);
|
||||
socket = socketList[(uMsg - WM_USER)];
|
||||
event = (GSocketEvent) -1;
|
||||
event = (wxSocketNotify) -1;
|
||||
|
||||
/* Check that the socket still exists (it has not been
|
||||
* destroyed) and for safety, check that the m_fd field
|
||||
@@ -360,24 +356,24 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd,
|
||||
{
|
||||
switch WSAGETSELECTEVENT(lParam)
|
||||
{
|
||||
case FD_READ: event = GSOCK_INPUT; break;
|
||||
case FD_WRITE: event = GSOCK_OUTPUT; break;
|
||||
case FD_ACCEPT: event = GSOCK_CONNECTION; break;
|
||||
case FD_READ: event = wxSOCKET_INPUT; break;
|
||||
case FD_WRITE: event = wxSOCKET_OUTPUT; break;
|
||||
case FD_ACCEPT: event = wxSOCKET_CONNECTION; break;
|
||||
case FD_CONNECT:
|
||||
{
|
||||
if (WSAGETSELECTERROR(lParam) != 0)
|
||||
event = GSOCK_LOST;
|
||||
event = wxSOCKET_LOST;
|
||||
else
|
||||
event = GSOCK_CONNECTION;
|
||||
event = wxSOCKET_CONNECTION;
|
||||
break;
|
||||
}
|
||||
case FD_CLOSE: event = GSOCK_LOST; break;
|
||||
case FD_CLOSE: event = wxSOCKET_LOST; break;
|
||||
}
|
||||
|
||||
if (event != -1)
|
||||
{
|
||||
if (event == GSOCK_LOST)
|
||||
socket->m_detected = GSOCK_LOST_FLAG;
|
||||
if (event == wxSOCKET_LOST)
|
||||
socket->m_detected = wxSOCKET_LOST_FLAG;
|
||||
else
|
||||
socket->m_detected |= (1 << event);
|
||||
}
|
||||
@@ -399,9 +395,11 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd,
|
||||
* events for internal processing, but we will only notify users
|
||||
* when an appropriate callback function has been installed.
|
||||
*/
|
||||
void GSocketMSWManager::Install_Callback(GSocket *socket,
|
||||
GSocketEvent WXUNUSED(event))
|
||||
void wxSocketMSWManager::Install_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify WXUNUSED(event))
|
||||
{
|
||||
wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_);
|
||||
|
||||
if (socket->m_fd != INVALID_SOCKET)
|
||||
{
|
||||
/* We could probably just subscribe to all events regardless
|
||||
@@ -431,9 +429,11 @@ void GSocketMSWManager::Install_Callback(GSocket *socket,
|
||||
/*
|
||||
* Disable event notifications (used when shutting down the socket)
|
||||
*/
|
||||
void GSocketMSWManager::Uninstall_Callback(GSocket *socket,
|
||||
GSocketEvent WXUNUSED(event))
|
||||
void wxSocketMSWManager::Uninstall_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify WXUNUSED(event))
|
||||
{
|
||||
wxSocketImplMSW * const socket = static_cast<wxSocketImplMSW *>(socket_);
|
||||
|
||||
if (socket->m_fd != INVALID_SOCKET)
|
||||
{
|
||||
#ifndef __WXWINCE__
|
||||
@@ -445,15 +445,15 @@ void GSocketMSWManager::Uninstall_Callback(GSocket *socket,
|
||||
}
|
||||
}
|
||||
|
||||
// set the wxBase variable to point to our GSocketManager implementation
|
||||
// set the wxBase variable to point to our wxSocketManager implementation
|
||||
//
|
||||
// see comments in wx/msw/apptbase.h for the explanation of why do we do it
|
||||
// see comments in wx/apptrait.h for the explanation of why do we do it
|
||||
// like this
|
||||
static struct ManagerSetter
|
||||
{
|
||||
ManagerSetter()
|
||||
{
|
||||
static GSocketMSWManager s_manager;
|
||||
static wxSocketMSWManager s_manager;
|
||||
wxAppTraits::SetDefaultSocketManager(&s_manager);
|
||||
}
|
||||
} gs_managerSetter;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket) for WX
|
||||
* Project: wxSocketImpl (Generic Socket) for WX
|
||||
* Name: gsockpm.c
|
||||
* Purpose: GSocket: PM part
|
||||
* Purpose: wxSocketImpl: PM part
|
||||
* Licence: The wxWindows licence
|
||||
* CVSID: $Id$
|
||||
* ------------------------------------------------------------------------- */
|
||||
@@ -19,30 +19,32 @@
|
||||
#define wxSockReadMask 0x01
|
||||
#define wxSockWriteMask 0x02
|
||||
|
||||
static void _GSocket_PM_Input(void *data)
|
||||
static void wxSocket_PM_Input(void *data)
|
||||
{
|
||||
GSocket *socket = (GSocket *) data;
|
||||
wxSocketImpl *socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
socket->Detected_Read();
|
||||
}
|
||||
|
||||
static void _GSocket_PM_Output(void *data)
|
||||
static void wxSocket_PM_Output(void *data)
|
||||
{
|
||||
GSocket *socket = (GSocket *) data;
|
||||
wxSocketImpl *socket = static_cast<wxSocketImpl *>(data);
|
||||
|
||||
socket->Detected_Write();
|
||||
}
|
||||
|
||||
class PMSocketManager : public GSocketInputBasedManager
|
||||
class PMSocketManager : public wxSocketInputBasedManager
|
||||
{
|
||||
public:
|
||||
virtual int AddInput(GSocket *socket, SocketDir d)
|
||||
virtual int AddInput(wxSocketImpl *socket, SocketDir d)
|
||||
{
|
||||
|
||||
if (d == FD_OUTPUT)
|
||||
return wxTheApp->AddSocketHandler(socket->m_fd, wxSockWriteMask,
|
||||
_GSocket_PM_Output, (void *)socket);
|
||||
wxSocket_PM_Output, (void *)socket);
|
||||
else
|
||||
return wxTheApp->AddSocketHandler(socket->m_fd, wxSockReadMask,
|
||||
_GSocket_PM_Input, (void *)socket);
|
||||
wxSocket_PM_Input, (void *)socket);
|
||||
}
|
||||
|
||||
virtual void RemoveInput(int fd)
|
||||
@@ -51,7 +53,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
GSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
wxSocketManager *wxGUIAppTraits::GetSocketManager()
|
||||
{
|
||||
static PMSocketManager s_manager;
|
||||
return &s_manager;
|
||||
|
@@ -1,16 +1,20 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket) for WX
|
||||
* Name: src/osx/corefoundation/gsockosx.c
|
||||
* Purpose: GSocket: Mac OS X mach-o part
|
||||
* CVSID: $Id$
|
||||
* Mac code by Brian Victor, February 2002. Email comments to bhv1@psu.edu
|
||||
* ------------------------------------------------------------------------- */
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: osx/core/gsockosx.cpp
|
||||
// Purpose: wxSocketImpl implementation for OS X
|
||||
// Authors: Brian Victor, Vadim Zeitlin
|
||||
// Created: February 2002
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2002 Brian Victor
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
|
||||
#include "wx/private/gsocket.h"
|
||||
#include "wx/unix/gsockunx.h"
|
||||
#include "wx/apptrait.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
@@ -27,32 +31,63 @@ namespace
|
||||
static CFRunLoopRef gs_mainRunLoop = NULL;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Mac-specific data associated with each socket by GSocketCFManager
|
||||
// Mac-specific socket implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class MacGSocketData
|
||||
class wxSocketImplMac : public wxSocketImplUnix
|
||||
{
|
||||
public:
|
||||
// default ctor creates the object in uninitialized state, use Initialize()
|
||||
// later to make it usable
|
||||
MacGSocketData()
|
||||
wxSocketImplMac(wxSocketBase& wxsocket)
|
||||
: wxSocketImplUnix(wxsocket)
|
||||
{
|
||||
m_socket = NULL;
|
||||
m_source = NULL;
|
||||
}
|
||||
|
||||
// initialize the data associated with the given socket
|
||||
bool Initialize(GSocket *socket)
|
||||
virtual ~wxSocketImplMac()
|
||||
{
|
||||
wxASSERT_MSG( !IsInitialized(), "shouldn't be called twice" );
|
||||
wxASSERT_MSG( !m_source && !m_socket, "forgot to call Close()?" );
|
||||
}
|
||||
|
||||
// get the underlying socket: creates it on demand
|
||||
CFSocketRef GetSocket() /* const */
|
||||
{
|
||||
if ( !m_socket )
|
||||
Initialize();
|
||||
|
||||
return m_socket;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void DoClose()
|
||||
{
|
||||
wxSocketManager * const manager = wxSocketManager::Get();
|
||||
if ( manager )
|
||||
{
|
||||
manager->Uninstall_Callback(this, wxSOCKET_INPUT);
|
||||
manager->Uninstall_Callback(this, wxSOCKET_OUTPUT);
|
||||
}
|
||||
|
||||
// VZ: CFRunLoopRemoveSource() is probably unnecessary as
|
||||
// CFSocketInvalidate() seems to do it internally from reading the
|
||||
// docs, please remove it (and this comment) after testing
|
||||
CFRunLoopRemoveSource(gs_mainRunLoop, m_source, kCFRunLoopCommonModes);
|
||||
CFSocketInvalidate(m_socket);
|
||||
|
||||
CFRelease(m_source);
|
||||
CFRelease(m_socket);
|
||||
}
|
||||
|
||||
// initialize the data associated with the given socket
|
||||
bool Initialize()
|
||||
{
|
||||
// we need a valid Unix socket to create a CFSocket
|
||||
if ( socket->m_fd < 0 )
|
||||
if ( m_fd < 0 )
|
||||
return false;
|
||||
|
||||
CFSocketContext cont;
|
||||
cont.version = 0; // this currently must be 0
|
||||
cont.info = socket; // pointer passed to our callback
|
||||
cont.info = this; // pointer passed to our callback
|
||||
cont.retain = NULL; // no need to retain/release/copy the
|
||||
cont.release = NULL; // socket pointer, so all callbacks
|
||||
cont.copyDescription = NULL; // can be left NULL
|
||||
@@ -60,7 +95,7 @@ public:
|
||||
m_socket = CFSocketCreateWithNative
|
||||
(
|
||||
NULL, // default allocator
|
||||
socket->m_fd,
|
||||
m_fd,
|
||||
kCFSocketReadCallBack |
|
||||
kCFSocketWriteCallBack |
|
||||
kCFSocketConnectCallBack,
|
||||
@@ -83,55 +118,13 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
// close the socket if it was opened
|
||||
void Close()
|
||||
{
|
||||
// VZ: CFRunLoopRemoveSource() is probably unnecessary as
|
||||
// CFSocketInvalidate() seems to do it internally from reading the
|
||||
// docs, please remove it (and this comment) after testing
|
||||
CFRunLoopRemoveSource(gs_mainRunLoop, m_source, kCFRunLoopCommonModes);
|
||||
CFSocketInvalidate(m_socket);
|
||||
|
||||
CFRelease(m_source);
|
||||
CFRelease(m_socket);
|
||||
}
|
||||
|
||||
~MacGSocketData()
|
||||
{
|
||||
wxASSERT_MSG( !m_source && !m_socket, "forgot to call Close()?" );
|
||||
}
|
||||
|
||||
// return true if Initialize() had already been called successfully
|
||||
bool IsInitialized() const { return m_source && m_socket; }
|
||||
|
||||
|
||||
// accessors: should only be called if IsInitialized()
|
||||
CFSocketRef GetSocket() const
|
||||
{
|
||||
wxASSERT( IsInitialized() );
|
||||
|
||||
return m_socket;
|
||||
}
|
||||
|
||||
CFRunLoopSourceRef GetSource() const
|
||||
{
|
||||
wxASSERT( IsInitialized() );
|
||||
|
||||
return m_source;
|
||||
}
|
||||
|
||||
private:
|
||||
static void SocketCallback(CFSocketRef WXUNUSED(s),
|
||||
CFSocketCallBackType callbackType,
|
||||
CFDataRef WXUNUSED(address),
|
||||
const void* data,
|
||||
void* info)
|
||||
{
|
||||
GSocket * const socket = static_cast<GSocket *>(info);
|
||||
MacGSocketData * const
|
||||
macdata = static_cast<MacGSocketData *>(socket->m_gui_dependent);
|
||||
if ( !macdata )
|
||||
return;
|
||||
wxSocketImplMac * const socket = static_cast<wxSocketImplMac *>(info);
|
||||
|
||||
switch (callbackType)
|
||||
{
|
||||
@@ -163,66 +156,39 @@ private:
|
||||
CFSocketRef m_socket;
|
||||
CFRunLoopSourceRef m_source;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(MacGSocketData);
|
||||
DECLARE_NO_COPY_CLASS(wxSocketImplMac)
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CoreFoundation implementation of GSocketManager
|
||||
// CoreFoundation implementation of wxSocketManager
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class GSocketCFManager : public GSocketManager
|
||||
class wxSocketManagerMac : public wxSocketManager
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
virtual void OnExit();
|
||||
|
||||
virtual bool Init_Socket(GSocket *socket);
|
||||
virtual void Close_Socket(GSocket *socket);
|
||||
virtual void Destroy_Socket(GSocket *socket);
|
||||
virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket)
|
||||
{
|
||||
return new wxSocketImplMac(wxsocket);
|
||||
}
|
||||
|
||||
virtual void Install_Callback(GSocket *socket, GSocketEvent event);
|
||||
virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event);
|
||||
virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
|
||||
private:
|
||||
// retrieve our custom data associated with the given socket
|
||||
//
|
||||
// this is a low level function, use GetInitializedData() instead if the
|
||||
// data pointer should also be correctly initialized if it hadn't been done
|
||||
// yet
|
||||
//
|
||||
// may return NULL if we hadn't created the data for this socket yet
|
||||
MacGSocketData *GetData(GSocket *socket) const
|
||||
{
|
||||
return static_cast<MacGSocketData *>(socket->m_gui_dependent);
|
||||
}
|
||||
|
||||
// return the custom data pointer initializing it if it hadn't been done
|
||||
// yet
|
||||
//
|
||||
// may return NULL if there is no associated data
|
||||
MacGSocketData *GetInitializedData(GSocket *socket) const
|
||||
{
|
||||
MacGSocketData * const data = GetData(socket);
|
||||
if ( data && !data->IsInitialized() )
|
||||
{
|
||||
if ( !data->Initialize(socket) )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// return CFSocket callback mask corresponding to the given event (the
|
||||
// socket parameter is needed because some events are interpreted
|
||||
// differently depending on whether they happen on a server or on a client
|
||||
// socket)
|
||||
static int GetCFCallback(GSocket *socket, GSocketEvent event);
|
||||
static int GetCFCallback(wxSocketImpl *socket, wxSocketNotify event);
|
||||
};
|
||||
|
||||
bool GSocketCFManager::OnInit()
|
||||
bool wxSocketManagerMac::OnInit()
|
||||
{
|
||||
// No need to store the main loop again
|
||||
if (gs_mainRunLoop != NULL)
|
||||
@@ -240,88 +206,66 @@ bool GSocketCFManager::OnInit()
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSocketCFManager::OnExit()
|
||||
void wxSocketManagerMac::OnExit()
|
||||
{
|
||||
// Release the reference count, and set the reference back to NULL
|
||||
CFRelease(gs_mainRunLoop);
|
||||
gs_mainRunLoop = NULL;
|
||||
}
|
||||
|
||||
bool GSocketCFManager::Init_Socket(GSocket *socket)
|
||||
{
|
||||
socket->m_gui_dependent = new MacGSocketData;
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSocketCFManager::Close_Socket(GSocket *socket)
|
||||
{
|
||||
Uninstall_Callback(socket, GSOCK_INPUT);
|
||||
Uninstall_Callback(socket, GSOCK_OUTPUT);
|
||||
|
||||
MacGSocketData * const data = GetData(socket);
|
||||
if ( data )
|
||||
data->Close();
|
||||
}
|
||||
|
||||
void GSocketCFManager::Destroy_Socket(GSocket *socket)
|
||||
{
|
||||
MacGSocketData * const data = GetData(socket);
|
||||
if ( data )
|
||||
{
|
||||
delete data;
|
||||
socket->m_gui_dependent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
int GSocketCFManager::GetCFCallback(GSocket *socket, GSocketEvent event)
|
||||
int wxSocketManagerMac::GetCFCallback(wxSocketImpl *socket, wxSocketNotify event)
|
||||
{
|
||||
switch ( event )
|
||||
{
|
||||
case GSOCK_CONNECTION:
|
||||
case wxSOCKET_CONNECTION:
|
||||
return socket->m_server ? kCFSocketReadCallBack
|
||||
: kCFSocketConnectCallBack;
|
||||
|
||||
case GSOCK_LOST:
|
||||
case GSOCK_INPUT:
|
||||
case wxSOCKET_LOST:
|
||||
case wxSOCKET_INPUT:
|
||||
return kCFSocketReadCallBack;
|
||||
|
||||
case GSOCK_OUTPUT:
|
||||
case wxSOCKET_OUTPUT:
|
||||
return kCFSocketWriteCallBack;
|
||||
|
||||
case GSOCK_MAX_EVENT:
|
||||
wxFAIL_MSG( "invalid GSocketEvent" );
|
||||
case wxSOCKET_MAX_EVENT:
|
||||
wxFAIL_MSG( "invalid wxSocketNotify" );
|
||||
return 0;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "unknown GSocketEvent" );
|
||||
wxFAIL_MSG( "unknown wxSocketNotify" );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GSocketCFManager::Install_Callback(GSocket *socket, GSocketEvent event)
|
||||
void wxSocketManagerMac::Install_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify event)
|
||||
{
|
||||
const MacGSocketData * const data = GetInitializedData(socket);
|
||||
if ( !data )
|
||||
return;
|
||||
wxSocketImplMac * const socket = static_cast<wxSocketImplMac *>(socket_);
|
||||
|
||||
CFSocketEnableCallBacks(data->GetSocket(), GetCFCallback(socket, event));
|
||||
CFSocketEnableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
|
||||
}
|
||||
|
||||
void GSocketCFManager::Uninstall_Callback(GSocket *socket, GSocketEvent event)
|
||||
void wxSocketManagerMac::Uninstall_Callback(wxSocketImpl *socket_,
|
||||
wxSocketNotify event)
|
||||
{
|
||||
const MacGSocketData * const data = GetInitializedData(socket);
|
||||
if ( !data )
|
||||
return;
|
||||
wxSocketImplMac * const socket = static_cast<wxSocketImplMac *>(socket_);
|
||||
|
||||
CFSocketDisableCallBacks(data->GetSocket(), GetCFCallback(socket, event));
|
||||
CFSocketDisableCallBacks(socket->GetSocket(), GetCFCallback(socket, event));
|
||||
}
|
||||
|
||||
GSocketManager *wxAppTraits::GetSocketManager()
|
||||
// set the wxBase variable to point to our wxSocketManager implementation
|
||||
//
|
||||
// see comments in wx/apptrait.h for the explanation of why do we do it
|
||||
// like this
|
||||
static struct ManagerSetter
|
||||
{
|
||||
static GSocketCFManager s_manager;
|
||||
|
||||
return &s_manager;
|
||||
};
|
||||
ManagerSetter()
|
||||
{
|
||||
static wxSocketManagerMac s_manager;
|
||||
wxAppTraits::SetDefaultSocketManager(&s_manager);
|
||||
}
|
||||
} gs_managerSetter;
|
||||
|
||||
#endif // wxUSE_SOCKETS
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user