Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51435 - in sandbox/net: . boost boost/net boost/net/detail boost/net/ipv4 boost/net/ipv4/detail boost/net/ipv4/sctp boost/net/ipv4/sctp/detail boost/net/ipv4/tcp boost/net/ipv4/tcp/detail boost/net/ipv4/udp boost/net/ipv6 boost/net/ipv6/detail libs
From: oliver.kowalke_at_[hidden]
Date: 2009-02-24 14:40:54


Author: olli
Date: 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
New Revision: 51435
URL: http://svn.boost.org/trac/boost/changeset/51435

Log:
initial import
Added:
   sandbox/net/
   sandbox/net/boost/
   sandbox/net/boost/net/
   sandbox/net/boost/net/block_sigs.hpp (contents, props changed)
   sandbox/net/boost/net/constants.hpp (contents, props changed)
   sandbox/net/boost/net/detail/
   sandbox/net/boost/net/detail/Makefile.am (contents, props changed)
   sandbox/net/boost/net/detail/Makefile.in (contents, props changed)
   sandbox/net/boost/net/detail/config.hpp (contents, props changed)
   sandbox/net/boost/net/detail/move.hpp (contents, props changed)
   sandbox/net/boost/net/detail/operations.hpp (contents, props changed)
   sandbox/net/boost/net/detail/options.hpp (contents, props changed)
   sandbox/net/boost/net/detail/socket.hpp (contents, props changed)
   sandbox/net/boost/net/error.hpp (contents, props changed)
   sandbox/net/boost/net/ignore_sig.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/
   sandbox/net/boost/net/ipv4/address.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/address_info.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/detail/
   sandbox/net/boost/net/ipv4/detail/operations.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/detail/options.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/ipnumber.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/raw.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/resolve.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/
   sandbox/net/boost/net/ipv4/sctp/address_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/association.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/association_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/association_state.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/default_send_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/detail/
   sandbox/net/boost/net/ipv4/sctp/detail/association_options.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/detail/operations.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/detail/options.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/heartbeat_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/initmsg_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/one2many.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/one2many_listener.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/one2one.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/one2one_listener.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/rto_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/sctp/subscription_params.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/tcp/
   sandbox/net/boost/net/ipv4/tcp/detail/
   sandbox/net/boost/net/ipv4/tcp/detail/options.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/tcp/one2one.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/tcp/one2one_listener.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/udp/
   sandbox/net/boost/net/ipv4/udp/mcast2one.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/udp/one2many.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/udp/one2one.hpp (contents, props changed)
   sandbox/net/boost/net/ipv4/utility.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/
   sandbox/net/boost/net/ipv6/address.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/address_info.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/detail/
   sandbox/net/boost/net/ipv6/detail/operations.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/detail/socket.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/ipnumber.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/resolve.hpp (contents, props changed)
   sandbox/net/boost/net/ipv6/utility.hpp (contents, props changed)
   sandbox/net/boost/net/shutdown_mode.hpp (contents, props changed)
   sandbox/net/boost/net/types.hpp (contents, props changed)
   sandbox/net/libs/

Added: sandbox/net/boost/net/block_sigs.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/block_sigs.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,85 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_BLOCK_SIGS_H
+#define BOOST_NET_BLOCK_SIGS_H
+
+#include <csignal>
+
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <ogx/net/detail/operations.hpp>
+#include <ogx/net/error.hpp>
+#include <ogx/net/types.hpp>
+
+namespace boost { namespace net
+{
+#define BOOST_NET_SIG_ADD_SET_FN(z, n, data) \
+sigaddset( & new_set_, BOOST_PP_CAT( data, n), throw_exception() );
+
+#define BOOST_NET_BLOCK_SIGNALS_CTOR(z, n, data) \
+block_signals( BOOST_PP_ENUM_PARAMS_Z(z, n, int data) ) \
+{ \
+ sigset_type new_set_; \
+ system::error_code ec; \
+ detail::sigemptyset( & new_set_, ec); \
+ if ( ec) throw_exception( system::system_error( ec) ); \
+ BOOST_PP_REPEAT( \
+ n, \
+ BOOST_NET_SIG_ADD_SET_FN, \
+ data \
+ ) \
+ detail::pthread_sigmask( \
+ SIG_BLOCK, \
+ & new_set_, \
+ & old_set_, \
+ ec); \
+ if ( ec) throw_exception( system::system_error( ec) ); \
+}
+
+class block_signals
+: private noncopyable
+{
+private:
+ sigset_type old_set_;
+
+public:
+ block_signals()
+ : old_set_()
+ {
+ sigset_type new_set_;
+ system::error_code ec;
+ detail::sigfillset( & new_set_, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ detail::pthread_sigmask(
+ SIG_BLOCK,
+ & new_set_,
+ & old_set_,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ BOOST_PP_REPEAT_FROM_TO(
+ 1,
+ BOOST_PP_INC(NSIG),
+ BOOST_NET_BLOCK_SIGNALS_CTOR,
+ sig
+ );
+
+ ~block_signals()
+ {
+ system::error_code ec;
+ detail::pthread_sigmask( SIG_SETMASK, & old_set_, 0, ec);
+ }
+};
+#undef BOOST_NET_BLOCK_SIGNALS_CTOR
+#undef BOOST_NET_SIG_ADD_SET_FN
+} }
+
+#endif // BOOST_NET_BLOCK_SIGS_H

Added: sandbox/net/boost/net/constants.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/constants.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,44 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_CONSTANTS_H
+#define BOOST_NET_CONSTANTS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#ifdef BOOST_NET_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#include <sys/uio.h>
+}
+
+#include <cstddef>
+
+#include <boost/net/types.hpp>
+
+namespace boost {
+namespace net
+{
+const native_handle_type invalid_native_handle( -1);
+const std::size_t default_backlog_size( 1024);
+const std::size_t default_mcast_ttl( 255);
+const std::size_t fqdn_size( 255);
+#ifdef BOOST_NET_EPOLL
+const std::size_t max_epoll_events( 30000);
+#endif
+#ifdef BOOST_NET_HAVE_IOVEC_STRUCT
+const std::size_t max_iovecs( IOV_MAX);
+#endif
+const std::size_t max_tmp_name_size( 512);
+// #ifdef BOOST_NET_IPV4
+const std::size_t addrstrlen_ipv4( INET_ADDRSTRLEN);
+// #endif
+// #ifdef BOOST_NET_IPV6
+const std::size_t addrstrlen_ipv6( INET6_ADDRSTRLEN);
+// #endif
+} }
+
+#endif // BOOST_NET_CONSTANTS_H

Added: sandbox/net/boost/net/detail/Makefile.am
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/Makefile.am 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,4 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+noinst_HEADERS = config.hpp move.hpp operations.hpp options.hpp socket.hpp
+_SOURCES = opt_dont_route.hpp

Added: sandbox/net/boost/net/detail/Makefile.in
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/Makefile.in 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,369 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/boost/net/detail
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+noinst_HEADERS = config.hpp move.hpp operations.hpp options.hpp socket.hpp
+_SOURCES = opt_dont_route.hpp
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/boost/net/detail/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/boost/net/detail/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: sandbox/net/boost/net/detail/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/config.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,545 @@
+#ifndef ____SRC_BOOST_NET_DETAIL_CONFIG_HPP
+#define ____SRC_BOOST_NET_DETAIL_CONFIG_HPP 1
+
+/* ../src/boost/net/detail/config.hpp. Generated automatically at end of configure. */
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if /dev/poll is supported */
+/* #undef BOOST_NET_DEVPOLL */
+
+/* Define to 1 if epoll is supported */
+#ifndef BOOST_NET_EPOLL
+#define BOOST_NET_EPOLL 1
+#endif
+
+/* Define to 1 if <netdb.h> defines struct addrinfo */
+#ifndef BOOST_NET_HAVE_ADDRINFO_STRUCT
+#define BOOST_NET_HAVE_ADDRINFO_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#ifndef BOOST_NET_HAVE_ARPA_INET_H
+#define BOOST_NET_HAVE_ARPA_INET_H 1
+#endif
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#ifndef BOOST_NET_HAVE_CTYPE_H
+#define BOOST_NET_HAVE_CTYPE_H 1
+#endif
+
+/* Define to 1 if you have the <devpoll.h> header file. */
+/* #undef BOOST_NET_HAVE_DEVPOLL_H */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#ifndef BOOST_NET_HAVE_DLFCN_H
+#define BOOST_NET_HAVE_DLFCN_H 1
+#endif
+
+/* Define to 1 if <devpoll.h> defines struct dvpoll */
+/* #undef BOOST_NET_HAVE_DVPOLL_STRUCT */
+
+/* Define to 1 if <sys/epoll.h> defines struct epoll_event */
+#ifndef BOOST_NET_HAVE_EPOLL_EVENT_STRUCT
+#define BOOST_NET_HAVE_EPOLL_EVENT_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <errno.h> header file. */
+#ifndef BOOST_NET_HAVE_ERRNO_H
+#define BOOST_NET_HAVE_ERRNO_H 1
+#endif
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#ifndef BOOST_NET_HAVE_FCNTL_H
+#define BOOST_NET_HAVE_FCNTL_H 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct group_req */
+#ifndef BOOST_NET_HAVE_GROUP_REQ_STRUCT
+#define BOOST_NET_HAVE_GROUP_REQ_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct group_source_req */
+#ifndef BOOST_NET_HAVE_GROUP_SOURCE_REQ_STRUCT
+#define BOOST_NET_HAVE_GROUP_SOURCE_REQ_STRUCT 1
+#endif
+
+/* Define to 1 if <netdb.h> defines struct hostent */
+#ifndef BOOST_NET_HAVE_HOSTENT_STRUCT
+#define BOOST_NET_HAVE_HOSTENT_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct in6_addr */
+#ifndef BOOST_NET_HAVE_IN6_ADDR_STRUCT
+#define BOOST_NET_HAVE_IN6_ADDR_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#ifndef BOOST_NET_HAVE_INTTYPES_H
+#define BOOST_NET_HAVE_INTTYPES_H 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct in_addr */
+#ifndef BOOST_NET_HAVE_IN_ADDR_STRUCT
+#define BOOST_NET_HAVE_IN_ADDR_STRUCT 1
+#endif
+
+/* Define to 1 if <sys/uio.h> defines struct iovec */
+#ifndef BOOST_NET_HAVE_IOVEC_STRUCT
+#define BOOST_NET_HAVE_IOVEC_STRUCT 1
+#endif
+
+/* Define to 1 if socket option IPTOS_LOWCOST is supported */
+#ifndef BOOST_NET_HAVE_IPTOS_LOWCOST
+#define BOOST_NET_HAVE_IPTOS_LOWCOST 1
+#endif
+
+/* Define to 1 if socket option IP_RECVDSTADDR is supported */
+/* #undef BOOST_NET_HAVE_IP_RECVDSTADDR */
+
+/* Define to 1 if socket option IP_RECVIF is supported */
+/* #undef BOOST_NET_HAVE_IP_RECVIF */
+
+/* Define to 1 if <ys/event.h> defines struct kevent */
+/* #undef BOOST_NET_HAVE_KEVENT_STRUCT */
+
+/* Define to 1 if <sys/socket.h> defines struct linger */
+#ifndef BOOST_NET_HAVE_LINGER_STRUCT
+#define BOOST_NET_HAVE_LINGER_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <memory.h> header file. */
+#ifndef BOOST_NET_HAVE_MEMORY_H
+#define BOOST_NET_HAVE_MEMORY_H 1
+#endif
+
+/* Define to 1 if <sys/stat.h> defines mode_t */
+#ifndef BOOST_NET_HAVE_MODE_T
+#define BOOST_NET_HAVE_MODE_T 1
+#endif
+
+/* Define to 1 if <sys/socket.h> defines struct msghdr */
+#ifndef BOOST_NET_HAVE_MSGHDR_STRUCT
+#define BOOST_NET_HAVE_MSGHDR_STRUCT 1
+#endif
+
+/* Define to 1 if sendto supports flag MSG_NOSIGNAL */
+#ifndef BOOST_NET_HAVE_MSG_NOSIGNAL
+#define BOOST_NET_HAVE_MSG_NOSIGNAL 1
+#endif
+
+/* Define to 1 if you have the <netconfig.h> header file. */
+/* #undef BOOST_NET_HAVE_NETCONFIG_H */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#ifndef BOOST_NET_HAVE_NETDB_H
+#define BOOST_NET_HAVE_NETDB_H 1
+#endif
+
+/* Define to 1 if you have the <netdir.h> header file. */
+/* #undef BOOST_NET_HAVE_NETDIR_H */
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#ifndef BOOST_NET_HAVE_NETINET_IN_H
+#define BOOST_NET_HAVE_NETINET_IN_H 1
+#endif
+
+/* Define to 1 if you have the <netinet/in_systm.h> header file. */
+#ifndef BOOST_NET_HAVE_NETINET_IN_SYSTM_H
+#define BOOST_NET_HAVE_NETINET_IN_SYSTM_H 1
+#endif
+
+/* Define to 1 if you have the <netinet/ip.h> header file. */
+#ifndef BOOST_NET_HAVE_NETINET_IP_H
+#define BOOST_NET_HAVE_NETINET_IP_H 1
+#endif
+
+/* Define to 1 if you have the <netinet/sctp.h> header file. */
+#ifndef BOOST_NET_HAVE_NETINET_SCTP_H
+#define BOOST_NET_HAVE_NETINET_SCTP_H 1
+#endif
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#ifndef BOOST_NET_HAVE_NETINET_TCP_H
+#define BOOST_NET_HAVE_NETINET_TCP_H 1
+#endif
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#ifndef BOOST_NET_HAVE_NET_IF_H
+#define BOOST_NET_HAVE_NET_IF_H 1
+#endif
+
+/* Define to 1 if <poll.h> defines struct pollfd */
+#ifndef BOOST_NET_HAVE_POLLFD_STRUCT
+#define BOOST_NET_HAVE_POLLFD_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <poll.h> header file. */
+#ifndef BOOST_NET_HAVE_POLL_H
+#define BOOST_NET_HAVE_POLL_H 1
+#endif
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#ifndef BOOST_NET_HAVE_PTHREAD_H
+#define BOOST_NET_HAVE_PTHREAD_H 1
+#endif
+
+/* Define to 1 if you have the <resolv.h> header file. */
+#ifndef BOOST_NET_HAVE_RESOLV_H
+#define BOOST_NET_HAVE_RESOLV_H 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_assocparams */
+#ifndef BOOST_NET_HAVE_SCTP_ASSOCPARAMS_STRUCT
+#define BOOST_NET_HAVE_SCTP_ASSOCPARAMS_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines sctp_assoc_t */
+#ifndef BOOST_NET_HAVE_SCTP_ASSOC_T
+#define BOOST_NET_HAVE_SCTP_ASSOC_T 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_event_subscribe */
+#ifndef BOOST_NET_HAVE_SCTP_EVENT_SUBSCRIBE_STRUCT
+#define BOOST_NET_HAVE_SCTP_EVENT_SUBSCRIBE_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_initmsg */
+#ifndef BOOST_NET_HAVE_SCTP_INITMSG_STRUCT
+#define BOOST_NET_HAVE_SCTP_INITMSG_STRUCT 1
+#endif
+
+/* Define to 1 if socket option SCTP_MAXBURST is supported */
+/* #undef BOOST_NET_HAVE_SCTP_MAXBURST */
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_paddrinfo */
+#ifndef BOOST_NET_HAVE_SCTP_PADDRINFO_STRUCT
+#define BOOST_NET_HAVE_SCTP_PADDRINFO_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_paddrparams */
+#ifndef BOOST_NET_HAVE_SCTP_PADDRPARAMS_STRUCT
+#define BOOST_NET_HAVE_SCTP_PADDRPARAMS_STRUCT 1
+#endif
+
+/* Define to 1 if socket option SCTP_PRIMARY_ADDR is supported */
+#ifndef BOOST_NET_HAVE_SCTP_PRIMARY_ADDR
+#define BOOST_NET_HAVE_SCTP_PRIMARY_ADDR 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_rtoinfo */
+#ifndef BOOST_NET_HAVE_SCTP_RTOINFO_STRUCT
+#define BOOST_NET_HAVE_SCTP_RTOINFO_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_setadaptation */
+#ifndef BOOST_NET_HAVE_SCTP_SETADAPTATION_STRUCT
+#define BOOST_NET_HAVE_SCTP_SETADAPTATION_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_setpeerprim */
+#ifndef BOOST_NET_HAVE_SCTP_SETPEERPRIM_STRUCT
+#define BOOST_NET_HAVE_SCTP_SETPEERPRIM_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_setprim */
+#ifndef BOOST_NET_HAVE_SCTP_SETPRIM_STRUCT
+#define BOOST_NET_HAVE_SCTP_SETPRIM_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_sndrcvinfo */
+#ifndef BOOST_NET_HAVE_SCTP_SNDRCVINFO_STRUCT
+#define BOOST_NET_HAVE_SCTP_SNDRCVINFO_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/sctp.h> defines struct sctp_status */
+#ifndef BOOST_NET_HAVE_SCTP_STATUS_STRUCT
+#define BOOST_NET_HAVE_SCTP_STATUS_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <semaphore.h> header file. */
+#ifndef BOOST_NET_HAVE_SEMAPHORE_H
+#define BOOST_NET_HAVE_SEMAPHORE_H 1
+#endif
+
+/* Define to 1 if <semaphore.h> defines sem_t */
+#ifndef BOOST_NET_HAVE_SEM_T
+#define BOOST_NET_HAVE_SEM_T 1
+#endif
+
+/* Define to 1 if <netdb.h> defines struct servent */
+#ifndef BOOST_NET_HAVE_SERVENT_STRUCT
+#define BOOST_NET_HAVE_SERVENT_STRUCT 1
+#endif
+
+/* Define to 1 if <signal.h> defines struct sigaction */
+#ifndef BOOST_NET_HAVE_SIGACTION_STRUCT
+#define BOOST_NET_HAVE_SIGACTION_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <signal.h> header file. */
+#ifndef BOOST_NET_HAVE_SIGNAL_H
+#define BOOST_NET_HAVE_SIGNAL_H 1
+#endif
+
+/* Define to 1 if <signal.h> defines sigset_t */
+#ifndef BOOST_NET_HAVE_SIGSET_T
+#define BOOST_NET_HAVE_SIGSET_T 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct sockaddr_in6 */
+#ifndef BOOST_NET_HAVE_SOCKADDR_IN6_STRUCT
+#define BOOST_NET_HAVE_SOCKADDR_IN6_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct sockaddr_in */
+#ifndef BOOST_NET_HAVE_SOCKADDR_IN_STRUCT
+#define BOOST_NET_HAVE_SOCKADDR_IN_STRUCT 1
+#endif
+
+/* Define to 1 if <netinet/in.h> defines struct sockaddr_storage */
+#ifndef BOOST_NET_HAVE_SOCKADDR_STORAGE_STRUCT
+#define BOOST_NET_HAVE_SOCKADDR_STORAGE_STRUCT 1
+#endif
+
+/* Define to 1 if <sys/socket.h> defines struct sockaddr */
+#ifndef BOOST_NET_HAVE_SOCKADDR_STRUCT
+#define BOOST_NET_HAVE_SOCKADDR_STRUCT 1
+#endif
+
+/* Define to 1 if <sys/un.h> defines struct sockaddr_un */
+#ifndef BOOST_NET_HAVE_SOCKADDR_UN_STRUCT
+#define BOOST_NET_HAVE_SOCKADDR_UN_STRUCT 1
+#endif
+
+/* Define to 1 if <sys/socket.h> defines socklen_t */
+#ifndef BOOST_NET_HAVE_SOCKLEN_T
+#define BOOST_NET_HAVE_SOCKLEN_T 1
+#endif
+
+/* Define to 1 if socket option SO_REUSEPORT is supported */
+/* #undef BOOST_NET_HAVE_SO_REUSEPORT */
+
+/* Define to 1 if socket option TCP_KEEPALIVE is supported */
+/* #undef BOOST_NET_HAVE_SO_TCP_KEEPALIVE */
+
+/* Define to 1 if socket option TCP_MAXRT is supported */
+/* #undef BOOST_NET_HAVE_SO_TCP_MAXRT */
+
+/* Define to 1 if socket option SO_USELOOPBACK is supported */
+/* #undef BOOST_NET_HAVE_SO_USELOOPBACK */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#ifndef BOOST_NET_HAVE_STDINT_H
+#define BOOST_NET_HAVE_STDINT_H 1
+#endif
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#ifndef BOOST_NET_HAVE_STDIO_H
+#define BOOST_NET_HAVE_STDIO_H 1
+#endif
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#ifndef BOOST_NET_HAVE_STDLIB_H
+#define BOOST_NET_HAVE_STDLIB_H 1
+#endif
+
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef BOOST_NET_HAVE_STRINGS_H
+#define BOOST_NET_HAVE_STRINGS_H 1
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#ifndef BOOST_NET_HAVE_STRING_H
+#define BOOST_NET_HAVE_STRING_H 1
+#endif
+
+/* Define to 1 if you have the <stropts.h> header file. */
+#ifndef BOOST_NET_HAVE_STROPTS_H
+#define BOOST_NET_HAVE_STROPTS_H 1
+#endif
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef BOOST_NET_HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_EPOLL_H
+#define BOOST_NET_HAVE_SYS_EPOLL_H 1
+#endif
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef BOOST_NET_HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef BOOST_NET_HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_IOCTL_H
+#define BOOST_NET_HAVE_SYS_IOCTL_H 1
+#endif
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_SELECT_H
+#define BOOST_NET_HAVE_SYS_SELECT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_SOCKET_H
+#define BOOST_NET_HAVE_SYS_SOCKET_H 1
+#endif
+
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+/* #undef BOOST_NET_HAVE_SYS_SOCKIO_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_STAT_H
+#define BOOST_NET_HAVE_SYS_STAT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_SYSCTL_H
+#define BOOST_NET_HAVE_SYS_SYSCTL_H 1
+#endif
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_TIME_H
+#define BOOST_NET_HAVE_SYS_TIME_H 1
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_TYPES_H
+#define BOOST_NET_HAVE_SYS_TYPES_H 1
+#endif
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_UIO_H
+#define BOOST_NET_HAVE_SYS_UIO_H 1
+#endif
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_UN_H
+#define BOOST_NET_HAVE_SYS_UN_H 1
+#endif
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_UTSNAME_H
+#define BOOST_NET_HAVE_SYS_UTSNAME_H 1
+#endif
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#ifndef BOOST_NET_HAVE_SYS_WAIT_H
+#define BOOST_NET_HAVE_SYS_WAIT_H 1
+#endif
+
+/* Define to 1 if <sys/time.h> defines struct timespec */
+#ifndef BOOST_NET_HAVE_TIMESPEC_STRUCT
+#define BOOST_NET_HAVE_TIMESPEC_STRUCT 1
+#endif
+
+/* Define to 1 if <sys/time.h> defines struct timeval */
+#ifndef BOOST_NET_HAVE_TIMEVAL_STRUCT
+#define BOOST_NET_HAVE_TIMEVAL_STRUCT 1
+#endif
+
+/* Define to 1 if you have the <time.h> header file. */
+#ifndef BOOST_NET_HAVE_TIME_H
+#define BOOST_NET_HAVE_TIME_H 1
+#endif
+
+/* Define to 1 if <sys/types.h> defines uint16_t */
+#ifndef BOOST_NET_HAVE_UINT16_T
+#define BOOST_NET_HAVE_UINT16_T 1
+#endif
+
+/* Define to 1 if <sys/types.h> defines uint32_t */
+#ifndef BOOST_NET_HAVE_UINT32_T
+#define BOOST_NET_HAVE_UINT32_T 1
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef BOOST_NET_HAVE_UNISTD_H
+#define BOOST_NET_HAVE_UNISTD_H 1
+#endif
+
+/* Define to 1 if <sys/types.h> defines u_char */
+#ifndef BOOST_NET_HAVE_U_CHAR
+#define BOOST_NET_HAVE_U_CHAR 1
+#endif
+
+/* Define to 1 if IPv4 is supported */
+/* #undef BOOST_NET_IPV4 */
+
+/* Define to 1 if IPv6 is supported */
+/* #undef BOOST_NET_IPV6 */
+
+/* Define to 1 if kqueue is supported */
+/* #undef BOOST_NET_KQUEUE */
+
+/* Define to 1 if Multicasting is supported */
+#ifndef BOOST_NET_MCAST
+#define BOOST_NET_MCAST 1
+#endif
+
+/* Define to 1 if mkfifo is supported */
+#ifndef BOOST_NET_MKFIFO
+#define BOOST_NET_MKFIFO 1
+#endif
+
+/* Name of package */
+#ifndef BOOST_NET_PACKAGE
+#define BOOST_NET_PACKAGE "net"
+#endif
+
+/* Define to the address where bug reports for this package should be sent. */
+#ifndef BOOST_NET_PACKAGE_BUGREPORT
+#define BOOST_NET_PACKAGE_BUGREPORT ""
+#endif
+
+/* Define to the full name of this package. */
+#ifndef BOOST_NET_PACKAGE_NAME
+#define BOOST_NET_PACKAGE_NAME ""
+#endif
+
+/* Define to the full name and version of this package. */
+#ifndef BOOST_NET_PACKAGE_STRING
+#define BOOST_NET_PACKAGE_STRING ""
+#endif
+
+/* Define to the one symbol short name of this package. */
+#ifndef BOOST_NET_PACKAGE_TARNAME
+#define BOOST_NET_PACKAGE_TARNAME ""
+#endif
+
+/* Define to the version of this package. */
+#ifndef BOOST_NET_PACKAGE_VERSION
+#define BOOST_NET_PACKAGE_VERSION ""
+#endif
+
+/* Define to 1 if SCTP is supported */
+#ifndef BOOST_NET_SCTP
+#define BOOST_NET_SCTP 1
+#endif
+
+/* Define to 1 if sockaddr_in.sin_len is supported */
+/* #undef BOOST_NET_SIN4_LEN */
+
+/* Define to 1 if sockaddr_in6.sin6_len is supported */
+/* #undef BOOST_NET_SIN6_LEN */
+
+/* Define to 1 if you have the ANSI C header files. */
+#ifndef BOOST_NET_STDC_HEADERS
+#define BOOST_NET_STDC_HEADERS 1
+#endif
+
+/* Define to 1 if UNIXDOMAIN is supported */
+#ifndef BOOST_NET_UNIXDOMAIN
+#define BOOST_NET_UNIXDOMAIN 1
+#endif
+
+/* Version number of package */
+#ifndef BOOST_NET_VERSION
+#define BOOST_NET_VERSION "0.1"
+#endif
+
+/* ____SRC_BOOST_NET_DETAIL_CONFIG_HPP */
+#endif

Added: sandbox/net/boost/net/detail/move.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/move.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,33 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_DETAIL_MOVE_H
+#define BOOST_NET_DETAIL_MOVE_H
+
+namespace boost { namespace net {
+namespace detail
+{
+template< typename T >
+class move_type
+{
+private:
+ T & t_;
+
+ void operator=( move_type &);
+
+public:
+ explicit move_type( T & t)
+ : t_( t)
+ {}
+
+ T & operator*() const
+ { return t_; }
+
+ T * operator->() const
+ { return & t_; }
+};
+}}}
+
+#endif // BOOST_NET_DETAIL_MOVE_H
+

Added: sandbox/net/boost/net/detail/operations.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/operations.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,428 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_DETAIL_OPERATIONS_H
+#define BOOST_NET_DETAIL_OPERATIONS_H
+
+#include <cerrno>
+#include <csignal>
+#include <string>
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <fcntl.h>
+#include <net/if.h>
+#include <poll.h>
+#include <pthread.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+}
+
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/error.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace detail
+{
+//------------------------------------------
+
+inline
+void sigaddset(
+ sigset_type * set,
+ int signo,
+ system::error_code & ec)
+{
+ if ( ::sigaddset( set, signo) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sigdelset(
+ sigset_type * set,
+ int signo,
+ system::error_code & ec)
+{
+ if ( ::sigdelset( set, signo) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sigfillset(
+ sigset_type * set,
+ system::error_code & ec)
+{
+ if ( ::sigfillset( set) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sigemptyset(
+ sigset_type * set,
+ system::error_code & ec)
+{
+ if ( ::sigemptyset( set) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sigaction(
+ int signo,
+ sigaction_type const* act,
+ sigaction_type * oact,
+ system::error_code & ec)
+{
+ if ( ::sigaction(
+ signo,
+ act,
+ oact) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sigwait(
+ sigset_type const* se,
+ int * signo,
+ system::error_code & ec)
+{
+ int errno_( ::sigwait( se, signo) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ system::get_system_category() );
+}
+
+inline
+void pthread_sigmask(
+ int how,
+ sigset_type const* set,
+ sigset_type * oset,
+ system::error_code & ec)
+{
+ int errno_(
+ ::pthread_sigmask(
+ how,
+ set,
+ oset) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+native_handle_type create_socket(
+ int family,
+ int socktype,
+ int protocol,
+ system::error_code & ec)
+{
+ native_handle_type handle( invalid_native_handle);
+ handle = ::socket( family, socktype, protocol);
+ if ( handle == invalid_native_handle)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return handle;
+}
+
+inline
+void close_socket( native_handle_type handle, system::error_code & ec)
+{
+ if ( ::close( handle) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+bool non_blocking( native_handle_type handle, system::error_code & ec)
+{
+ int val( ::fcntl( handle, F_GETFL, 0) );
+ if ( val == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return val & O_NONBLOCK;
+}
+
+inline
+void non_blocking( native_handle_type handle, bool mode, system::error_code & ec)
+{
+ int val( ::fcntl( handle, F_GETFL, 0) );
+ if ( val == -1)
+ {
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return;
+ }
+
+ if ( mode)
+ val |= O_NONBLOCK;
+ else
+ val &= ~O_NONBLOCK;
+
+ if ( ::fcntl( handle, F_SETFL, val) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+void shutdown( native_handle_type handle, int mode, system::error_code & ec)
+{
+ if ( ::shutdown( handle, mode) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+void getsockname(
+ native_handle_type handle,
+ sockaddr_type * addr,
+ sockaddr_len_type * len,
+ system::error_code & ec)
+{
+ if ( ::getsockname(
+ handle,
+ addr,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void getpeername(
+ native_handle_type handle,
+ sockaddr_type * addr,
+ sockaddr_len_type * len,
+ system::error_code & ec)
+{
+ if ( ::getpeername(
+ handle,
+ addr,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+void bind(
+ native_handle_type handle,
+ sockaddr_type const* addr,
+ sockaddr_len_type len,
+ system::error_code & ec)
+{
+ if ( ::bind(
+ handle,
+ addr,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+void listen(
+ native_handle_type handle,
+ int backlog,
+ system::error_code & ec)
+{
+ if ( ::listen(
+ handle,
+ backlog) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+native_handle_type accept(
+ native_handle_type handle,
+ sockaddr_type * addr,
+ sockaddr_len_type * len,
+ system::error_code & ec)
+{
+ native_handle_type new_handle(
+ ::accept(
+ handle,
+ addr,
+ len) );
+ if ( new_handle == invalid_native_handle)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return new_handle;
+}
+
+//------------------------------------------
+
+inline
+void connect(
+ native_handle_type handle,
+ sockaddr_type const* addr,
+ sockaddr_len_type len,
+ system::error_code & ec)
+{
+ if ( ::connect(
+ handle,
+ addr,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+char * getenv( std::string const& env)
+{ return ::getenv( env.c_str() ); }
+
+//------------------------------------------
+
+inline
+void is_readable(
+ native_handle_type handle,
+ posix_time::time_duration const& timeout,
+ system::error_code & ec)
+{
+ int ms( timeout.total_milliseconds() );
+
+ pollfd_type pfd;
+ pfd.fd = handle;
+ pfd.events = POLLIN;
+ pfd.revents = 0;
+
+ int nready( ::poll( & pfd, 1, ms) );
+ if ( nready < 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ else if ( nready == 0)
+ ec = system::error_code(
+ ETIMEDOUT,
+ system::get_system_category() );
+}
+
+inline
+void is_writeable(
+ native_handle_type handle,
+ posix_time::time_duration const& timeout,
+ system::error_code & ec)
+{
+ int ms( timeout.total_milliseconds() );
+
+ pollfd_type pfd;
+ pfd.fd = handle;
+ pfd.events = POLLOUT;
+ pfd.revents = 0;
+
+ int nready( ::poll( & pfd, 1, ms) );
+ if ( nready < 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ else if ( nready == 0)
+ ec = system::error_code(
+ ETIMEDOUT,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+void getsockopt(
+ native_handle_type handle,
+ int level,
+ int name,
+ void * value,
+ sockaddr_len_type * len,
+ system::error_code & ec)
+{
+ if ( ::getsockopt(
+ handle,
+ level,
+ name,
+ value,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void setsockopt(
+ native_handle_type handle,
+ int level,
+ int name,
+ void const* value,
+ sockaddr_len_type len,
+ system::error_code & ec)
+{
+ if ( ::setsockopt(
+ handle,
+ level,
+ name,
+ value,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+//------------------------------------------
+
+inline
+u_long_type if_nametoindex(
+ std::string const& ifname,
+ system::error_code & ec)
+{
+ u_long_type ifindex( ::if_nametoindex( ifname.c_str() ) );
+ if ( ifindex == 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return ifindex;
+}
+
+//------------------------------------------
+}}}
+
+#endif // BOOST_NET_DETAIL_OPERATIONS_H

Added: sandbox/net/boost/net/detail/options.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/options.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,469 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_DETAIL_OPTIONS_H
+#define BOOST_NET_DETAIL_OPTIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+#include <sys/socket.h>
+}
+
+#include <cstddef>
+#include <cmath>
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace detail
+{
+class options
+{
+private:
+ socket socket_;
+
+public:
+ options( socket const& socket__)
+ : socket_( socket__)
+ {}
+
+ bool broadcast() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_BROADCAST,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void broadcast( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_BROADCAST,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool keep_alive() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_KEEPALIVE,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void keep_alive( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_KEEPALIVE,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool is_debug() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_DEBUG,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void debug( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_DEBUG,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool dont_route() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_DONTROUTE,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void dont_route( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_DONTROUTE,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool linger( posix_time::time_duration & timeout) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ linger_type value;
+ sockaddr_len_type len( sizeof( linger_type) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_LINGER,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ timeout = posix_time::seconds( value.l_linger);
+ return value.l_onoff != 0;
+ }
+
+ void linger( bool v, posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ linger_type value;
+ value.l_onoff = v ? 1 : 0;
+ value.l_linger = timeout.total_seconds();
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_LINGER,
+ & value,
+ sizeof( linger_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t receive_buffer() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVBUF,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void receive_buffer( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVBUF,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t receive_lowat() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVLOWAT,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void receive_lowat( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVLOWAT,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const posix_time::time_duration receive_timeout() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ timeval_type value;
+ sockaddr_len_type len( sizeof( timeval_type) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVTIMEO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return posix_time::seconds( value.tv_sec) + posix_time::microseconds( value.tv_usec);
+ }
+
+ void receive_timeout( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ timeval_type value;
+ value.tv_sec = timeout.total_seconds();
+ value.tv_usec = numeric_cast< long >(
+ timeout.fractional_seconds() * ::pow( 10, 6 - timeout.num_fractional_digits() ) );
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_RCVTIMEO,
+ & value,
+ sizeof( timeval_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool reuse_address() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_REUSEADDR,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void reuse_address( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_REUSEADDR,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+ std::size_t send_buffer() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDBUF,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void send_buffer( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDBUF,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t send_lowat() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDLOWAT,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void send_lowat( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDLOWAT,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const posix_time::time_duration send_timeout() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ timeval_type value;
+ sockaddr_len_type len( sizeof( timeval_type) );
+ system::error_code ec;
+ detail::getsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDTIMEO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return posix_time::seconds( value.tv_sec) + posix_time::microseconds( value.tv_usec);
+ }
+
+ void send_timeout( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ timeval_type value;
+ value.tv_sec = timeout.total_seconds();
+ value.tv_usec = numeric_cast< long >(
+ timeout.fractional_seconds() * ::pow( 10, 6 - timeout.num_fractional_digits() ) );
+ system::error_code ec;
+ detail::setsockopt(
+ socket_.native_handle(),
+ SOL_SOCKET,
+ SO_SNDTIMEO,
+ & value,
+ sizeof( timeval_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+};
+
+}}}
+
+#endif // BOOST_NET_DETAIL_OPTIONS_H

Added: sandbox/net/boost/net/detail/socket.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/detail/socket.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,190 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_DETAIL_SOCKET_H
+#define BOOST_NET_DETAIL_SOCKET_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <sys/socket.h>
+}
+
+#include <boost/config.hpp>
+
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/move.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace detail
+{
+class socket
+{
+private:
+ class impl
+ {
+ private:
+ native_handle_type handle_;
+
+ public:
+ impl( native_handle_type handle)
+ : handle_( handle)
+ {}
+
+ impl( int family, int type, int protocol)
+ : handle_( invalid_native_handle)
+ {
+ system::error_code ec;
+ handle_ = detail::create_socket( family, type, protocol, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ BOOST_ASSERT( handle_ != invalid_native_handle);
+ }
+
+#ifdef BOOST_HAS_RVALUE_REFS
+ impl( impl && rhs)
+ : handle_( rhs.handle_)
+ { rhs.handle_ = invalid_native_handle; }
+#else
+ impl( detail::move_type< impl > rhs)
+ : handle_( rhs->handle_)
+ { rhs->handle_ = invalid_native_handle; }
+#endif
+
+ ~impl()
+ {
+ system::error_code ec;
+ detail::close_socket( handle_, ec);
+ handle_ = invalid_native_handle;
+ }
+
+#ifdef BOOST_HAS_RVALUE_REFS
+ impl && move()
+ {
+ return static_cast< impl && >( * this);
+ }
+#else
+ detail::move_type< impl > move()
+ {
+ detail::move_type< impl > i( * this);
+ return i;
+ }
+#endif
+
+ native_handle_type native_handle() const
+ { return handle_; }
+
+ bool is_valid() const
+ { return handle_ != invalid_native_handle; }
+
+ void close()
+ {
+ if ( is_valid() )
+ {
+ system::error_code ec;
+ detail::close_socket( native_handle(), ec);
+ handle_ = invalid_native_handle;
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+ }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::getsockopt( native_handle(), SOL_SOCKET, SO_ERROR, & value, & len, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return system::error_code( value, system::get_system_category() );
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ bool result( detail::non_blocking( native_handle(), ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return result;
+ }
+
+ void non_blocking( bool mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ detail::non_blocking( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+ };
+
+ shared_ptr< impl > impl_;
+
+public:
+//------------------------------------------
+ explicit socket( native_handle_type handle)
+ : impl_( new impl( handle) )
+ {}
+
+#ifdef BOOST_HAS_RVALUE_REFS
+ socket( socket && rhs)
+ : impl_()
+ { impl_.reset( new impl( rhs.impl_->move() ) ); }
+#else
+ socket( detail::move_type< socket > rhs)
+ : impl_()
+ { impl_.reset( new impl( rhs->impl_->move() ) ); }
+#endif
+
+ socket( int family, int type, int protocol)
+ : impl_( new impl( family, type, protocol) )
+ { BOOST_ASSERT( impl_->is_valid() ); }
+
+//------------------------------------------
+
+#ifdef BOOST_HAS_RVALUE_REFS
+ socket && move()
+ {
+ return static_cast< socket && >( * this);
+ }
+#else
+ detail::move_type< socket > move()
+ {
+ detail::move_type< socket > s( * this);
+ return s;
+ }
+#endif
+
+ native_handle_type native_handle() const
+ { return impl_->native_handle(); }
+
+ bool is_valid() const
+ { return impl_->is_valid(); }
+
+ void close()
+ { impl_->close(); }
+
+ const system::error_code error() const
+ { return impl_->error(); }
+
+ bool is_non_blocking() const
+ { return impl_->is_non_blocking(); }
+
+ void non_blocking( bool value)
+ { impl_->non_blocking( value); }
+};
+}}}
+
+#endif // BOOST_NET_DETAIL_SOCKET_H

Added: sandbox/net/boost/net/error.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/error.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,91 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_ERROR_H
+#define BOOST_NET_ERROR_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#ifdef BOOST_NET_HAVE_NETDB_H
+#include <netdb.h>
+#endif
+}
+
+#include <cstring>
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/config.hpp>
+#include <boost/system/error_code.hpp>
+
+namespace boost { namespace net
+{
+static system::error_category const& get_eof_category();
+static system::error_category const& eof_error_cat = get_eof_category();
+
+class eof_error_category
+: public system::error_category
+{
+public:
+ const char * name() const
+ { return "eof"; }
+
+ system::error_condition default_error_condition( int ev) const
+ { return system::error_condition( ev, eof_error_cat); }
+
+ std::string message( int ev) const
+ {
+ BOOST_ASSERT( ev == EOF);
+ return "end of file or stream";
+ }
+};
+
+system::error_category const& get_eof_category()
+{
+ static const eof_error_category eof_cat;
+ return eof_cat;
+}
+
+static system::error_category const& get_gai_category();
+static system::error_category const& gai_error_cat = get_gai_category();
+
+class gai_error_category
+: public system::error_category
+{
+public:
+ const char * name() const
+ { return "gai"; }
+
+ system::error_condition default_error_condition( int ev) const
+ { return system::error_condition( ev, gai_error_cat); }
+
+ std::string message( int ev) const
+ { return ::gai_strerror( ev); }
+};
+
+system::error_category const& get_gai_category()
+{
+ static const gai_error_category gai_cat;
+ return gai_cat;
+}
+
+template< typename Result >
+inline Result wrap_error( Result result, system::error_code & ec)
+{
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ ec = system::error_code(
+ ::WSAGetLastError(),
+ system::get_system_category() );
+#else
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+#endif
+ return result;
+}
+} }
+
+#endif // BOOST_NET_ERROR_H

Added: sandbox/net/boost/net/ignore_sig.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ignore_sig.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,57 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IGNORE_SIG_H
+#define BOOST_NET_IGNORE_SIG_H
+
+#include <csignal>
+
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <ogx/net/detail/operations.hpp>
+#include <ogx/net/error.hpp>
+#include <ogx/net/types.hpp>
+
+namespace boost { namespace net
+{
+class ignore_signal
+: private noncopyable
+{
+private:
+ int signo_;
+ sigaction_type old_action_;
+
+public:
+ explicit ignore_signal( int signo)
+ : signo_( signo), old_action_()
+ {
+ sigaction_type new_action;
+
+ system::error_code ec;
+ detail::close( 0, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ new_action.sa_handler = SIG_IGN;
+ detail::sigemptyset( & new_action.sa_mask, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+#ifdef SA_RESTART
+ new_action.sa_flags |= SA_RESTART;
+#else
+ new_action.sa_flags = 0;
+#endif
+ detail::sigaction( signo_, & new_action, & old_action_, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ ~ignore_signal()
+ {
+ system::error_code ec;
+ detail::sigaction( signo_, & old_action_, 0, ec);
+ }
+};
+} }
+
+#endif // BOOST_NET_IGNORE_SIG_H

Added: sandbox/net/boost/net/ipv4/address.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/address.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,233 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_ADDRESS_H
+#define BOOST_NET_IPV4_ADDRESS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <strings.h>
+}
+
+#include <cstddef>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+#include <vector>
+
+#include <boost/array.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/ipnumber.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4
+{
+class address
+{
+private:
+ sockaddr_in4_type addr_;
+
+ address()
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in4_type) );
+ addr_.sin_family = family_ipv4;
+ }
+
+public:
+ address( sockaddr_in4_type const& addr)
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in4_type) );
+ addr_ = addr;
+ }
+
+ address( ipnumber const& ip, unsigned int port)
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in4_type) );
+ addr_.sin_family = family_ipv4;
+ addr_.sin_addr = ip.in4_addr();
+ addr_.sin_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN4_LEN
+ addr_.sin_len = sizeof( sockaddr_in4_type);
+#endif
+ }
+
+ static const address invalid()
+ {
+ address addr;
+ addr.addr_.sin_addr.s_addr = detail::host2network_long(
+ static_cast< u_long_type >( INADDR_NONE) );
+#ifdef BOOST_NET_SIN4_LEN
+ addr.addr_.sin_len = sizeof( sockaddr_in4_type);
+#endif
+ return addr;
+ }
+
+ static const address any( unsigned int port)
+ {
+ address addr;
+ addr.addr_.sin_addr.s_addr =
+ detail::host2network_long( static_cast< u_long_type >( INADDR_ANY) );
+ addr.addr_.sin_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN4_LEN
+ addr.addr_.sin_len = sizeof( sockaddr_in4_type);
+#endif
+ return addr;
+ }
+
+ static const address bcast( unsigned int port)
+ {
+ address addr;
+ addr.addr_.sin_addr.s_addr =
+ detail::host2network_long( static_cast< u_long_type >( INADDR_BROADCAST) );
+ addr.addr_.sin_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN4_LEN
+ addr.addr_.sin_len = sizeof( sockaddr_in4_type);
+#endif
+ return addr;
+ }
+
+ static const address loopback( unsigned int port)
+ {
+ address addr;
+ addr.addr_.sin_addr.s_addr =
+ detail::host2network_long( static_cast< u_long_type >( INADDR_LOOPBACK) );
+ addr.addr_.sin_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN4_LEN
+ addr.addr_.sin_len = sizeof( sockaddr_in4_type);
+#endif
+ return addr;
+ }
+
+ const ipnumber ip_number() const
+ { return ipnumber( addr_.sin_addr); }
+
+ unsigned int port() const
+ { return detail::network2host_short( addr_.sin_port); }
+
+ sockaddr_type const* sockaddr_ptr() const
+ {
+ void const* vp( & addr_);
+ return static_cast< sockaddr_type const* >( vp);
+ }
+
+ sockaddr_len_type size() const
+ { return sizeof( sockaddr_in4_type); }
+};
+
+inline
+bool operator<( address const& l, address const& r)
+{
+ if ( l.ip_number() < r.ip_number() )
+ return true;
+ if ( l.ip_number() != r.ip_number() )
+ return false;
+ return l.port() < r.port();
+}
+
+inline
+bool operator==( address const& l, address const& r)
+{ return l.ip_number() == r.ip_number() && l.port() == r.port(); }
+
+inline
+bool operator!=( address const& l, address const& r)
+{ return ! ( l == r); }
+
+template<
+ typename charT,
+ typename Traits
+>
+std::basic_ostream< charT, Traits > &
+operator<<( std::basic_ostream< charT, Traits > & os, address const& addr)
+{
+ if ( ! os.good() ) return os;
+ try
+ { os << addr.ip_number() << ":" << addr.port(); }
+ catch ( std::bad_alloc &)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( ( exception_mask & std::ios_base::failbit) && ! ( exception_mask & std::ios_base::badbit) )
+ os.setstate( std::ios_base::badbit);
+ else if ( exception_mask & std::ios_base::badbit)
+ {
+ try
+ { os.setstate( std::ios_base::badbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ catch (...)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( exception_mask & std::ios_base::failbit)
+ {
+ try
+ { os.setstate( std::ios_base::failbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ return os;
+}
+
+
+inline
+const std::string fqd_name( address const& addr)
+{
+ boost::array< char, fqdn_size > array;
+ ::bzero( array.c_array(), array.size() );
+ system::error_code ec;
+ detail::getnameinfo(
+ addr.sockaddr_ptr(),
+ addr.size(),
+ array.c_array(),
+ array.size(),
+ 0,
+ 0,
+ NI_NAMEREQD,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return std::string( array.data(), array.size() );
+}
+
+inline
+const std::vector< std::string > aliases( address const& addr)
+{
+ std::vector< std::string > array;
+ std::vector< char > buffer( 8192);
+
+ hostent_type result;
+
+ void const* vp( addr.sockaddr_ptr() );
+ system::error_code ec;
+ sockaddr_in4_type const* in4( static_cast< sockaddr_in4_type const* >( vp) );
+ detail::gethostbyaddr_r(
+ * const_cast< sockaddr_in4_type * >( in4),
+ result,
+ & buffer[0],
+ buffer.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ for ( char ** pptr = result.h_aliases; * pptr != 0; ++pptr)
+ array.push_back( * pptr);
+
+ return array;
+}
+}}}
+
+#endif // BOOST_NET_IPV4_ADDRESS_H

Added: sandbox/net/boost/net/ipv4/address_info.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/address_info.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,79 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_ADDRESS_INFO_H
+#define BOOST_NET_IPV4_ADDRESS_INFO_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4
+{
+class address_info
+{
+private:
+ shared_ptr< addrinfo_type > root_;
+ addrinfo_type * current_;
+
+public:
+ address_info(
+ shared_ptr< addrinfo_type > root,
+ addrinfo_type * current)
+ : root_( root), current_( current)
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ }
+
+ const std::string canonical_name() const
+ {
+ BOOST_ASSERT( root_);
+ return root_->ai_canonname ? root_->ai_canonname : "";
+ }
+
+ socket_type socktype() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ return static_cast< socket_type >( current_->ai_socktype);
+ }
+
+ protocol_type protocol() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ return static_cast< protocol_type >( current_->ai_protocol);
+ }
+
+ const address to_address() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+
+ void * vp( current_->ai_addr);
+ BOOST_ASSERT( current_->ai_family == PF_INET);
+ sockaddr_in4_type * in4( static_cast< sockaddr_in4_type * >( vp) );
+ return address( * in4);
+ }
+
+ operator const address() const
+ { return to_address(); }
+};
+}}}
+
+#endif // BOOST_NET_IPV4_ADDRESS_INFO_H

Added: sandbox/net/boost/net/ipv4/detail/operations.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/detail/operations.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,200 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_DETAIL_OPERATIONS_H
+#define BOOST_NET_IPV4_DETAIL_OPERATIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <arpa/inet.h>
+#include <netinet/in.h>
+}
+
+#include <cerrno>
+
+#include <boost/config.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/error.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace detail
+{
+//---------Address Resolution---------------
+inline
+u_long_type network2host_long( u_long_type value)
+{ return ntohl( value); }
+
+inline
+u_long_type host2network_long( u_long_type value)
+{ return htonl( value); }
+
+inline
+u_short_type network2host_short( u_short_type value)
+{ return ntohs( value); }
+
+inline
+u_short_type host2network_short( u_short_type value)
+{ return htons(value); }
+
+inline
+in4_addr_type inet4_pton(
+ std::string const& ip_number,
+ system::error_code & ec)
+{
+ in4_addr_type addr;
+ ::bzero( & addr, sizeof addr);
+
+ int result(
+ ::inet_pton(
+ PF_INET,
+ ip_number.c_str(),
+ & addr) );
+ if ( result == 0)
+ ec = system::error_code(
+ EFAULT,
+ system::get_system_category() );
+ else if ( result < 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+
+ return addr;
+}
+
+inline
+in6_addr_type inet6_pton(
+ std::string const& ip_number,
+ system::error_code & ec)
+{
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof addr);
+
+ int result(
+ ::inet_pton(
+ PF_INET6,
+ ip_number.c_str(),
+ & addr) );
+ if ( result == 0)
+ ec = system::error_code(
+ EFAULT,
+ system::get_system_category() );
+ else if ( result < 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+
+ return addr;
+}
+
+inline
+const std::string inet_ntop(
+ in4_addr_type const& addr,
+ system::error_code & ec)
+{
+ char buf[addrstrlen_ipv4];
+ ::bzero( buf, addrstrlen_ipv4);
+
+ if ( ::inet_ntop(
+ PF_INET,
+ & addr,
+ buf,
+ sizeof buf) == 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return buf;
+}
+
+
+inline
+void getaddrinfo(
+ char const* host,
+ char const* service,
+ addrinfo_type const* hints,
+ addrinfo_type ** result,
+ system::error_code & ec)
+{
+ int errno_(
+ ::getaddrinfo(
+ host,
+ service,
+ hints,
+ result) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+}
+
+inline
+void getnameinfo(
+ sockaddr_type const* addr,
+ sockaddr_len_type addrlen,
+ char * host,
+ sockaddr_len_type hostlen,
+ char * service,
+ sockaddr_len_type servicelen,
+ int flags,
+ system::error_code & ec)
+{
+ int errno_(
+ ::getnameinfo(
+ addr,
+ addrlen,
+ host,
+ hostlen,
+ service,
+ servicelen,
+ flags) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+}
+
+inline
+void freeaddrinfo( addrinfo_type * result)
+{ ::freeaddrinfo( result); }
+
+inline
+void gethostbyaddr_r(
+ sockaddr_in4_type & addr,
+ hostent_type & ent,
+ char * buf,
+ int buflen,
+ system::error_code & ec)
+{
+ hostent_type * result( 0);
+#if defined(__hpux)
+ void * addr_ = addr;
+ result = ::gethostbyaddr(
+ addr_,
+ len,
+ type);
+#else
+ void * vp( & addr.sin_addr);
+ int errno_( 0);
+ ::gethostbyaddr_r(
+ static_cast< char * >( vp),
+ sizeof( in4_addr_type),
+ PF_INET,
+ & ent,
+ buf,
+ buflen,
+ & result,
+ & errno_);
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+#endif
+}
+}}}}
+
+#endif // BOOST_NET_IPV4_DETAIL_OPERATIONS_H

Added: sandbox/net/boost/net/ipv4/detail/options.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/detail/options.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,661 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_DETAIL_OPTIONS_H
+#define BOOST_NET_IPV4_DETAIL_OPTIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <cstddef>
+#include <cstring>
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/ipnumber.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace detail
+{
+class options
+{
+private:
+ net::detail::socket socket_;
+
+public:
+ options( net::detail::socket const& socket__)
+ : socket_( socket__)
+ {}
+
+ bool include_header() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_HDRINCL,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void include_header( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_HDRINCL,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t ip_options() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_OPTIONS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void ip_options( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_OPTIONS,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t time_to_live() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_TTL,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void time_to_live( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_TTL,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t type_of_service() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_TOS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void type_of_service( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( value > 0);
+
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_TOS,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ int mc_time_to_life() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ u_char_type value( 0);
+ sockaddr_len_type len( sizeof( u_char_type) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_TTL,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return static_cast< int >( value);
+ }
+
+ void mc_time_to_life( int value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ u_char_type value( static_cast< u_char_type >( value_) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_TTL,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool mc_is_loopback() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ u_char_type value( 0);
+ sockaddr_len_type len( sizeof( u_char_type) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_LOOP,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void mc_loopback( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ u_char_type value( value_ ? 1 : 0);
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_LOOP,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const ipnumber mc_interface() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ in4_addr_type in4;
+ sockaddr_len_type len( sizeof( in4_addr_type) );
+ ::bzero( & in4, sizeof( in4_addr_type) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_IF,
+ & in4,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return ipnumber( in4);
+ }
+
+ void mc_interface( ipnumber const& number)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ in4_addr_type in4( number.in4_addr() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ IP_MULTICAST_IF,
+ & in4,
+ sizeof( in4_addr_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_join_group( address const& addr, u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_req_type req;
+ req.gr_interface = ifindex;
+ if ( addr.size() > sizeof( req.gr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gr_group, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_JOIN_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_join_group( address const& addr, std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_req_type req;
+ system::error_code ec;
+ req.gr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ if ( addr.size() > sizeof( req.gr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gr_group, addr.sockaddr_ptr(), addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_JOIN_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_leave_group( address const& addr, u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_req_type req;
+ req.gr_interface = ifindex;
+ if ( addr.size() > sizeof( req.gr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gr_group, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_LEAVE_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_leave_group( address const& addr, std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_req_type req;
+ system::error_code ec;
+ req.gr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ if ( addr.size() > sizeof( req.gr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gr_group, addr.sockaddr_ptr(), addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_LEAVE_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_join_source_group(
+ address const& group_addr,
+ address const& source_addr,
+ u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_source_req_type req;
+ req.gsr_interface = ifindex;
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_JOIN_SOURCE_GROUP,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_join_source_group(
+ address const& group_addr,
+ address const& source_addr,
+ std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_source_req_type req;
+ system::error_code ec;
+ req.gsr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_JOIN_SOURCE_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_leave_source_group(
+ address const& group_addr,
+ address const& source_addr,
+ u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_source_req_type req;
+ req.gsr_interface = ifindex;
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_LEAVE_SOURCE_GROUP,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_leave_source_group(
+ address const& group_addr,
+ address const& source_addr,
+ std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_source_req_type req;
+ system::error_code ec;
+ req.gsr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_LEAVE_SOURCE_GROUP,
+ & req,
+ sizeof( group_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_block_source(
+ address const& group_addr,
+ address const& source_addr,
+ u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_source_req_type req;
+ req.gsr_interface = ifindex;
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_BLOCK_SOURCE,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_block_source(
+ address const& group_addr,
+ address const& source_addr,
+ std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_source_req_type req;
+ system::error_code ec;
+ req.gsr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_BLOCK_SOURCE,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_unblock_source(
+ address const& group_addr,
+ address const& source_addr,
+ u_long_type ifindex = 0)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ group_source_req_type req;
+ req.gsr_interface = ifindex;
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_UNBLOCK_SOURCE,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void mc_unblock_source(
+ address const& group_addr,
+ address const& source_addr,
+ std::string const& ifname)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! ifname.empty() );
+
+ group_source_req_type req;
+ system::error_code ec;
+ req.gsr_interface = net::detail::if_nametoindex( ifname, ec);
+ if ( group_addr.size() > sizeof( req.gsr_group) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ if ( source_addr.size() > sizeof( req.gsr_source) )
+ throw_exception(
+ system::system_error(
+ system::error_code(
+ ENXIO,
+ system::get_system_category() ) ) );
+ std::memcpy( & req.gsr_group, group_addr.sockaddr_ptr(), group_addr.size() );
+ std::memcpy( & req.gsr_source, source_addr.sockaddr_ptr(), source_addr.size() );
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_IP,
+ MCAST_UNBLOCK_SOURCE,
+ & req,
+ sizeof( group_source_req_type),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_DETAIL_OPTIONS_H

Added: sandbox/net/boost/net/ipv4/ipnumber.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/ipnumber.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,158 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_IPNUMBER_H
+#define BOOST_NET_IPV4_IPNUMBER_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <strings.h>
+}
+
+#include <iostream>
+#include <stdexcept>
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4
+{
+class ipnumber
+{
+private:
+ friend bool operator==( ipnumber const&, ipnumber const&);
+ friend bool operator<( ipnumber const&, ipnumber const&);
+
+ in4_addr_type addr_;
+
+ u_long_type to_long_() const
+ { return detail::network2host_long( static_cast< u_long_type >( addr_.s_addr) ); }
+
+public:
+ ipnumber( in4_addr_type const& addr)
+ : addr_( addr)
+ {}
+
+ static const ipnumber invalid()
+ {
+ in4_addr_type addr;
+ ::bzero( & addr, sizeof( in4_addr_type) );
+ addr.s_addr = detail::host2network_long( static_cast< u_long_type >( INADDR_NONE) );
+ return addr;
+ }
+
+ static const ipnumber any()
+ {
+ in4_addr_type addr;
+ ::bzero( & addr, sizeof( in4_addr_type) );
+ addr.s_addr = detail::host2network_long( static_cast< u_long_type >( INADDR_ANY) );
+ return addr;
+ }
+
+ static const ipnumber bcast()
+ {
+ in4_addr_type addr;
+ ::bzero( & addr, sizeof( in4_addr_type) );
+ addr.s_addr = detail::host2network_long( static_cast< u_long_type >( INADDR_BROADCAST) );
+ return addr;
+ }
+
+ static const ipnumber loopback()
+ {
+ in4_addr_type addr;
+ ::bzero( & addr, sizeof( in4_addr_type) );
+ addr.s_addr = detail::host2network_long( static_cast< u_long_type >( INADDR_LOOPBACK) );
+ return addr;
+ }
+
+ bool is_class_a() const
+ { return IN_CLASSA( to_long_() ); }
+
+ bool is_class_b() const
+ { return IN_CLASSB( to_long_() ); }
+
+ bool is_class_c() const
+ { return IN_CLASSC( to_long_() ); }
+
+ bool is_class_d() const
+ { return IN_CLASSD( to_long_() ); }
+
+ bool is_multicast() const
+ { return IN_MULTICAST( to_long_() ); }
+
+ const in4_addr_type in4_addr() const
+ { return addr_; }
+};
+
+inline
+const std::string to_string( ipnumber const& number)
+{
+ system::error_code ec;
+ std::string str( detail::inet_ntop( number.in4_addr(), ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return str;
+}
+
+inline
+bool operator<( ipnumber const& l, ipnumber const& r)
+{ return l.to_long_() < r.to_long_(); }
+
+inline
+bool operator==( ipnumber const& l, ipnumber const& r)
+{ return l.addr_.s_addr == r.addr_.s_addr; }
+
+inline
+bool operator!=( ipnumber const& l, ipnumber const& r)
+{ return ! ( l == r); }
+
+template<
+ typename charT,
+ typename Traits
+>
+std::basic_ostream< charT, Traits > &
+operator<<( std::basic_ostream< charT, Traits > & os, ipnumber const& number)
+{
+ if ( ! os.good() ) return os;
+ try
+ { os << to_string( number); }
+ catch ( std::bad_alloc &)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( ( exception_mask & std::ios_base::failbit) && ! ( exception_mask & std::ios_base::badbit) )
+ os.setstate( std::ios_base::badbit);
+ else if ( exception_mask & std::ios_base::badbit)
+ {
+ try
+ { os.setstate( std::ios_base::badbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ catch (...)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( exception_mask & std::ios_base::failbit)
+ {
+ try
+ { os.setstate( std::ios_base::failbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ return os;
+}
+}}}
+
+#endif // BOOST_NET_IPV4_IPNUMBER_H

Added: sandbox/net/boost/net/ipv4/raw.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/raw.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,133 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_RAW_H
+#define BOOST_NET_IPV4_RAW_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <sys/socket.h>
+}
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/socket.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4
+{
+template< int Protocol >
+class raw
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+ raw()
+ :
+ socket_base_type( family_ipv4, socket_raw, Protocol),
+ net::detail::options( member),
+ ipv4::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_in4_type const& sa( ep.as_sockaddr_in4() );
+ sockaddr_len_type len( sizeof sa);
+ system::error_code ec;
+ net::detail::bind(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+//------------------------------------------
+
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+ using ipv4::detail::options::include_header;
+ using ipv4::detail::options::ip_options;
+};
+}}}
+
+#endif // BOOST_NET_IPV4_RAW_H

Added: sandbox/net/boost/net/ipv4/resolve.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/resolve.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,210 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_RESOLVE_H
+#define BOOST_NET_IPV4_RESOLVE_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <string>
+#include <vector>
+
+#include <boost/lexical_cast.hpp>
+#include <boost/none.hpp>
+#include <boost/optional.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/address_info.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4
+{
+namespace detail
+{
+struct addrinfo_deleter
+{
+ void operator()( addrinfo_type * ptr)
+ {
+ detail::freeaddrinfo( ptr);
+ ptr = 0;
+ }
+};
+}
+
+class resolve_hints
+{
+private:
+ int flags_;
+ int socket_;
+ int protocol_;
+
+public:
+ resolve_hints()
+ :
+ flags_( 0),
+ socket_( socket_unspec),
+ protocol_( protocol_unspec)
+ {}
+
+ resolve_hints operator|( resolve_flags flgs)
+ {
+ flags_ = flgs;
+ return * this;
+ }
+
+ resolve_hints operator|( socket_type sck)
+ {
+ socket_ |= sck;
+ return * this;
+ }
+
+ resolve_hints operator|( protocol_type proto)
+ {
+ protocol_ |= proto;
+ return * this;
+ }
+
+ int flags() const
+ { return flags_; }
+
+ int socket() const
+ { return socket_; }
+
+ int protocol() const
+ { return protocol_; }
+};
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& host,
+ std::string const& service,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! host.empty() );
+ BOOST_ASSERT( ! service.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = family_ipv4;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ host.c_str(),
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& host,
+ unsigned int port,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! host.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = family_ipv4;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+ info_hints.ai_flags |= AI_NUMERICSERV;
+
+ std::string service( boost::lexical_cast< std::string >( port) );
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ host.c_str(),
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& service,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! service.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = family_ipv4;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+ info_hints.ai_flags |= AI_PASSIVE;
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ 0,
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+}}}
+
+#endif // BOOST_NET_IPV4_RESOLVE_H

Added: sandbox/net/boost/net/ipv4/sctp/address_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/address_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,65 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ADDRESS_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_ADDRESS_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+}
+
+#include <cstddef>
+
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{ class options; }
+
+class address_params
+{
+private:
+ friend class detail::options;
+
+ sctp_paddrinfo_type sp_;
+
+ address_params( sctp_paddrinfo_type sp)
+ : sp_( sp)
+ {}
+
+public:
+ const association assoc() const
+ { return association( sp_.spinfo_assoc_id); }
+
+ bool is_active() const
+ { return sp_.spinfo_state == SCTP_ACTIVE; }
+
+ bool is_incative() const
+ { return sp_.spinfo_state == SCTP_INACTIVE; }
+
+ bool is_address_unconfirmed() const
+ { return sp_.spinfo_state == SCTP_UNCONFIRMED; }
+
+ std::size_t congestion_window() const
+ { return sp_.spinfo_cwnd; }
+
+ std::size_t smoothed_rtt() const
+ { return sp_.spinfo_srtt; }
+
+ const posix_time::time_duration retransmission_timeout() const
+ { return posix_time::milliseconds( sp_.spinfo_rto); }
+
+ std::size_t path_mtu() const
+ { return sp_.spinfo_mtu; }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ADDRESS_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/association.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/association.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,39 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ASSOCIATION_H
+#define BOOST_NET_IPV4_SCTP_ASSOCIATION_H
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+class address_params;
+class one2many;
+class one2many_listener;
+
+namespace detail
+{ class association_options; }
+
+class association
+{
+private:
+ friend class address_params;
+ friend class one2many;
+ friend class one2many_listener;
+ friend class detail::association_options;
+
+ sctp_assoc_type assoc_id_;
+
+ association( sctp_assoc_type assoc_id)
+ : assoc_id_( assoc_id)
+ {}
+
+ operator sctp_assoc_type const () const
+ { return assoc_id_; }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ASSOCIATION_H

Added: sandbox/net/boost/net/ipv4/sctp/association_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/association_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,83 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ASSOCIATION_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_ASSOCIATION_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+}
+
+#include <cstddef>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{
+ class options;
+ class association_options;
+}
+
+class association_params
+{
+private:
+ friend class detail::options;
+ friend class detail::association_options;
+
+ sctp_assocparams_type sa_;
+
+ association_params( sctp_assocparams_type sa)
+ : sa_( sa)
+ {}
+
+ operator const sctp_assocparams_type () const
+ { return sa_; }
+
+public:
+ association_params()
+ : sa_()
+ { ::bzero( & sa_, sizeof( sctp_assocparams_type) ); }
+
+ std::size_t max_retransmissions() const
+ { return sa_.sasoc_asocmaxrxt; }
+
+ void max_retransmissions( std::size_t value)
+ {
+ BOOST_ASSERT( value >= 0);
+
+ sa_.sasoc_asocmaxrxt = value;
+ }
+
+ std::size_t peer_destinations() const
+ { return sa_.sasoc_number_peer_destinations; }
+
+ std::size_t peer_receive_window() const
+ { return sa_.sasoc_peer_rwnd; }
+
+ std::size_t local_receive_window() const
+ { return sa_.sasoc_local_rwnd; }
+
+ const posix_time::time_duration cookie_life() const
+ { return posix_time::milliseconds( sa_.sasoc_cookie_life); }
+
+ void cookie_life( posix_time::time_duration const& lifetime)
+ {
+ BOOST_ASSERT( ! lifetime.is_special() );
+ BOOST_ASSERT( ! lifetime.is_negative() );
+
+ sa_.sasoc_cookie_life = lifetime.total_milliseconds();
+ }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ASSOCIATION_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/association_state.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/association_state.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,92 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ASSOCIATION_STATE_H
+#define BOOST_NET_IPV4_SCTP_ASSOCIATION_STATE_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+}
+
+#include <cstddef>
+
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{
+ class options;
+ class association_options;
+}
+
+class association_state
+{
+private:
+ friend class detail::options;
+ friend class detail::association_options;
+
+ sctp_status_type ss_;
+
+ association_state( sctp_status_type ss)
+ : ss_( ss)
+ {}
+
+public:
+ bool is_closed() const
+ { return ss_.sstat_state == SCTP_CLOSED; }
+
+ bool has_send_init() const
+ { return ss_.sstat_state == SCTP_COOKIE_WAIT; }
+
+ bool has_echoed_cookie() const
+ { return ss_.sstat_state == SCTP_COOKIE_ECHOED; }
+
+ bool is_established() const
+ { return ss_.sstat_state == SCTP_ESTABLISHED; }
+
+ bool is_shutdown_pending() const
+ { return ss_.sstat_state == SCTP_SHUTDOWN_PENDING; }
+
+ bool has_shutdown_send() const
+ { return ss_.sstat_state == SCTP_SHUTDOWN_SENT; }
+
+ bool has_shutdown_received() const
+ { return ss_.sstat_state == SCTP_SHUTDOWN_RECEIVED; }
+
+ bool is_waiting_shutdown_complete() const
+ { return ss_.sstat_state == SCTP_SHUTDOWN_ACK_SENT; }
+
+ std::size_t peer_receive_window() const
+ { return ss_.sstat_rwnd; }
+
+ std::size_t peer_nack_data() const
+ { return ss_.sstat_unackdata; }
+
+ std::size_t peer_send_streams() const
+ { return ss_.sstat_instrms; }
+
+ std::size_t local_pending_data() const
+ { return ss_.sstat_penddata; }
+
+ std::size_t local_send_streams() const
+ { return ss_.sstat_outstrms; }
+
+ std::size_t local_fragmentation_point() const
+ { return ss_.sstat_fragmentation_point; }
+
+ const address local_primary_address() const
+ {
+ void const* vp( & ss_.sstat_primary);
+ return address( * static_cast< sockaddr_in4_type const* >( vp) );
+ }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ASSOCIATION_STATE_H

Added: sandbox/net/boost/net/ipv4/sctp/default_send_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/default_send_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,92 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_DEFAULT_SEND_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_DEFAULT_SEND_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+}
+
+#include <cstddef>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{
+ class options;
+ class association_options;
+}
+
+class default_send_params
+{
+private:
+ friend class detail::options;
+ friend class detail::association_options;
+
+ sctp_sndrcvinfo_type sp_;
+
+ default_send_params( sctp_sndrcvinfo_type sp)
+ : sp_( sp)
+ {}
+
+ operator sctp_sndrcvinfo_type const () const
+ { return sp_; }
+
+public:
+ default_send_params()
+ : sp_()
+ { ::bzero( & sp_, sizeof( sctp_sndrcvinfo_type) ); }
+
+ std::size_t default_stream() const
+ { return sp_.sinfo_stream; }
+
+ void default_stream( std::size_t value)
+ { sp_.sinfo_stream = value; }
+
+ std::size_t stream_sequence_number() const
+ { return sp_.sinfo_ssn; }
+
+ void stream_sequence_number( std::size_t value)
+ { sp_.sinfo_ssn = value; }
+
+ std::size_t payload_protocol_identifier() const
+ { return sp_.sinfo_ppid; }
+
+ void payload_protocol_identifier( std::size_t value)
+ { sp_.sinfo_ppid = value; }
+
+ std::size_t context() const
+ { return sp_.sinfo_context; }
+
+ void context( std::size_t value)
+ { sp_.sinfo_context = value; }
+
+ std::size_t time_to_live() const
+ { return sp_.sinfo_timetolive; }
+
+ void time_to_live( std::size_t value)
+ { sp_.sinfo_timetolive = value; }
+
+ std::size_t transport_sequence_number() const
+ { return sp_.sinfo_tsn; }
+
+ void transport_sequence_number( std::size_t value)
+ { sp_.sinfo_tsn = value; }
+
+ std::size_t cumulative_transport_sequence_number() const
+ { return sp_.sinfo_cumtsn; }
+
+ void cumulative_transport_sequence_number( std::size_t value)
+ { sp_.sinfo_cumtsn = value; }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_DEFAULT_SEND_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/detail/association_options.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/detail/association_options.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,329 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_DETAIL_ASSOCIATION_OPTIONS_H
+#define BOOST_NET_IPV4_SCTP_DETAIL_ASSOCIATION_OPTIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+#include <strings.h>
+}
+
+#include <cstring>
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/sctp/address_params.hpp>
+#include <boost/net/ipv4/sctp/association.hpp>
+#include <boost/net/ipv4/sctp/association_params.hpp>
+#include <boost/net/ipv4/sctp/association_state.hpp>
+#include <boost/net/ipv4/sctp/default_send_params.hpp>
+#include <boost/net/ipv4/sctp/detail/operations.hpp>
+#include <boost/net/ipv4/sctp/heartbeat_params.hpp>
+#include <boost/net/ipv4/sctp/initmsg_params.hpp>
+#include <boost/net/ipv4/sctp/rto_params.hpp>
+#include <boost/net/ipv4/sctp/subscription_params.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp {
+namespace detail
+{
+class association_options
+{
+private:
+ net::detail::socket socket_;
+
+public:
+ association_options( net::detail::socket const& socket__)
+ : socket_( socket__)
+ {}
+
+ const association_state association_status( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_status_type value;
+ sockaddr_len_type len( sizeof( sctp_status_type) );
+ ::bzero( & value, len);
+ value.sstat_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_STATUS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return association_state( value);
+ }
+
+ void peer_primary_address( association const& assoc, address const& addr)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setpeerprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setpeerprim_type) );
+ ::bzero( & value, len);
+ value.sspp_assoc_id = assoc;
+ std::memcpy( & value.sspp_addr, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_SET_PEER_PRIMARY_ADDR,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const address local_primary_address( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setprim_type) );
+ ::bzero( & value, len);
+ value.ssp_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_PRIMARY_ADDR,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ void const* vp( & value.ssp_addr);
+ return address( * static_cast< sockaddr_in4_type const* >( vp) );
+ }
+
+ void local_primary_address( association const& assoc, address const& addr)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setprim_type) );
+ ::bzero( & value, len);
+ value.ssp_assoc_id = assoc;
+ std::memcpy( & value.ssp_addr, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PRIMARY_ADDR,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const heartbeat_params heartbeat( association const& assoc, address const& addr) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value;
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ ::bzero( & value, len);
+ value.spp_assoc_id = assoc;
+ std::memcpy( & value.spp_address, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return heartbeat_params( value);
+ }
+
+ const heartbeat_params heartbeat( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value;
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ ::bzero( & value, len);
+ value.spp_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return heartbeat_params( value);
+ }
+
+ void heartbeat( association const& assoc, address const& addr, heartbeat_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ value.spp_assoc_id = assoc;
+ std::memcpy( & value.spp_address, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void heartbeat( association const& assoc, heartbeat_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ value.spp_assoc_id = assoc;
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const rto_params rto_info( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_rtoinfo_type value;
+ sockaddr_len_type len( sizeof( sctp_rtoinfo_type) );
+ ::bzero( & value, len);
+ value.srto_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_RTOINFO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return rto_params( value);
+ }
+
+ void rto_info( association const& assoc, rto_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_rtoinfo_type value( params);
+ sockaddr_len_type len( sizeof( sctp_rtoinfo_type) );
+ value.srto_assoc_id = assoc;
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_RTOINFO,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const association_params association_info( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_assocparams_type value;
+ sockaddr_len_type len( sizeof( sctp_assocparams_type) );
+ ::bzero( & value, len);
+ value.sasoc_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_ASSOCINFO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return association_params( value);
+ }
+
+ void association_info( association const& assoc, association_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_assocparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_assocparams_type) );
+ value.sasoc_assoc_id = assoc;
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_ASSOCINFO,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const default_send_params default_send_parameters( association const& assoc) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_sndrcvinfo_type value;
+ sockaddr_len_type len( sizeof( sctp_sndrcvinfo_type) );
+ ::bzero( & value, len);
+ value.sinfo_assoc_id = assoc;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ assoc,
+ SCTP_DEFAULT_SEND_PARAM,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return default_send_params( value);
+ }
+
+ void default_send_parameters( association const& assoc, default_send_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_sndrcvinfo_type value( params);
+ sockaddr_len_type len( sizeof( sctp_sndrcvinfo_type) );
+ value.sinfo_assoc_id = assoc;
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_DEFAULT_SEND_PARAM,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+};
+}}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_DETAIL_ASSOCIATION_OPTIONS_H

Added: sandbox/net/boost/net/ipv4/sctp/detail/operations.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/detail/operations.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,145 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_DETAIL_OPERATIONS_H
+#define BOOST_NET_IPV4_SCTP_DETAIL_OPERATIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+}
+
+#include <cerrno>
+
+#include <boost/config.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/error.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp {
+namespace detail
+{
+#if defined BOOST_NET_SCTP
+inline
+void sctp_bindx(
+ native_handle_type handle,
+ sockaddr_type const* addr,
+ int count,
+ int flags,
+ system::error_code & ec)
+{
+ if ( ::sctp_bindx(
+ handle,
+ const_cast< sockaddr_type * >( addr),
+ count,
+ flags) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sctp_connectx(
+ native_handle_type handle,
+ sockaddr_type const* addr,
+ int count,
+ system::error_code & ec)
+{
+ if ( ::sctp_connectx(
+ handle,
+ const_cast< sockaddr_type * >( addr),
+ count) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+void sctp_opt_info(
+ native_handle_type handle,
+ sctp_assoc_type assoc_id,
+ int opt,
+ void * arg,
+ sockaddr_len_type * len,
+ system::error_code & ec)
+{
+ if ( ::sctp_opt_info(
+ handle,
+ assoc_id,
+ opt,
+ arg,
+ len) == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+}
+
+inline
+native_handle_type sctp_peeloff(
+ native_handle_type handle,
+ sctp_assoc_type assoc_id,
+ system::error_code & ec)
+{
+ native_handle_type new_handle( ::sctp_peeloff( handle, assoc_id) );
+ if ( new_handle == invalid_native_handle)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return new_handle;
+}
+
+inline
+int sctp_getpaddrs(
+ native_handle_type handle,
+ sctp_assoc_type assoc_id,
+ sockaddr_type ** addrs,
+ system::error_code & ec)
+{
+ int n( ::sctp_getpaddrs(
+ handle,
+ assoc_id,
+ addrs) );
+ if ( n == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return n;
+}
+
+inline
+void sctp_freepaddrs( sockaddr_type * addrs)
+{ ::sctp_freepaddrs( addrs); }
+
+inline
+int sctp_getladdrs(
+ native_handle_type handle,
+ sctp_assoc_type assoc_id,
+ sockaddr_type ** addrs,
+ system::error_code & ec)
+{
+ int n( ::sctp_getladdrs(
+ handle,
+ assoc_id,
+ addrs) );
+ if ( n == -1)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return n;
+}
+
+inline
+void sctp_freeladdrs( sockaddr_type * addrs)
+{ ::sctp_freeladdrs( addrs); }
+#endif
+}}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_DETAIL_OPERATIONS_H

Added: sandbox/net/boost/net/ipv4/sctp/detail/options.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/detail/options.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,635 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_DETAIL_OPTIONS_H
+#define BOOST_NET_IPV4_SCTP_DETAIL_OPTIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+#include <strings.h>
+}
+
+#include <cstring>
+#include <string>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/sctp/address_params.hpp>
+#include <boost/net/ipv4/sctp/association_params.hpp>
+#include <boost/net/ipv4/sctp/association_state.hpp>
+#include <boost/net/ipv4/sctp/default_send_params.hpp>
+#include <boost/net/ipv4/sctp/detail/operations.hpp>
+#include <boost/net/ipv4/sctp/heartbeat_params.hpp>
+#include <boost/net/ipv4/sctp/initmsg_params.hpp>
+#include <boost/net/ipv4/sctp/rto_params.hpp>
+#include <boost/net/ipv4/sctp/subscription_params.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp {
+namespace detail
+{
+class options
+{
+private:
+ net::detail::socket socket_;
+
+public:
+ options( net::detail::socket const& socket__)
+ : socket_( socket__)
+ {}
+
+ bool no_delay() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_NODELAY,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void no_delay( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_NODELAY,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+#ifdef BOOST_NET_HAVE_SCTP_MAXSEG
+ std::size_t max_seg() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_MAX_SEG,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void max_seg( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_MAX_SEG,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+#endif
+#ifdef BOOST_NET_HAVE_SCTP_MAXBURST
+ std::size_t max_burst() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_MAXBURST,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value;
+ }
+
+ void max_burst( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_MAXBURST,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+#endif
+ bool no_fragments() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_DISABLE_FRAGMENTS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void no_fragments( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_DISABLE_FRAGMENTS,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const posix_time::time_duration autoclose() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_AUTOCLOSE,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return posix_time::seconds( value);
+ }
+
+ void autoclose( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ std::size_t value( timeout.total_seconds() );
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_AUTOCLOSE,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void disable_autoclose()
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_AUTOCLOSE,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t adaptation_layer() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setadaptation_type value;
+ sockaddr_len_type len( sizeof( sctp_setadaptation_type) );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_ADAPTATION_LAYER,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value.ssb_adaptation_ind;
+ }
+
+ void adaptation_layer( std::size_t value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setadaptation_type value;
+ sockaddr_len_type len( sizeof( sctp_setadaptation_type) );
+ value.ssb_adaptation_ind = value_;
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_ADAPTATION_LAYER,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void peer_primary_address( address const& addr)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setpeerprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setpeerprim_type) );
+ ::bzero( & value, len);
+ std::memcpy( & value.sspp_addr, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_SET_PEER_PRIMARY_ADDR,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const address local_primary_address() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setprim_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_PRIMARY_ADDR,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ void const* vp( & value.ssp_addr);
+ return address( * static_cast< sockaddr_in4_type const* >( vp) );
+ }
+
+ void local_primary_address( address const& addr)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_setprim_type value;
+ sockaddr_len_type len( sizeof( sctp_setprim_type) );
+ ::bzero( & value, len);
+ std::memcpy( & value.ssp_addr, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PRIMARY_ADDR,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const heartbeat_params heartbeat( address const& addr) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value;
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ ::bzero( & value, len);
+ std::memcpy( & value.spp_address, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return heartbeat_params( value);
+ }
+
+ const heartbeat_params heartbeat() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value;
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ ::bzero( & value, len);;
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return heartbeat_params( value);
+ }
+
+ void heartbeat( address const& addr, heartbeat_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ std::memcpy( & value.spp_address, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void heartbeat( heartbeat_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_paddrparams_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_PEER_ADDR_PARAMS,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const rto_params rto_info() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_rtoinfo_type value;
+ sockaddr_len_type len( sizeof( sctp_rtoinfo_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_RTOINFO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return rto_params( value);
+ }
+
+ void rto_info( rto_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_rtoinfo_type value( params);
+ sockaddr_len_type len( sizeof( sctp_rtoinfo_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_RTOINFO,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const initmsg_params initmsg() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_initmsg_type value;
+ sockaddr_len_type len( sizeof( sctp_initmsg_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_INITMSG,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return initmsg_params( value);
+ }
+
+ void initmsg( initmsg_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_initmsg_type value( params);
+ sockaddr_len_type len( sizeof( sctp_initmsg_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_INITMSG,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const subscription_params subscriptions() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_event_subscribe_type value;
+ sockaddr_len_type len( sizeof( sctp_event_subscribe_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_EVENTS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return subscription_params( value);
+ }
+
+ void subscriptions( subscription_params const& value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_event_subscribe_type value( value_);
+ sockaddr_len_type len( sizeof( sctp_event_subscribe_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_INITMSG,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const address_params peer_address_params( address const& addr) const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_paddrinfo_type value;
+ sockaddr_len_type len( sizeof( sctp_paddrinfo_type) );
+ ::bzero( & value, len);
+ std::memcpy( & value.spinfo_address, addr.sockaddr_ptr(), addr.size() );
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_GET_PEER_ADDR_INFO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address_params( value);
+ }
+
+ const association_state association_status() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_status_type value;
+ sockaddr_len_type len( sizeof( sctp_status_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_STATUS,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return association_state( value);
+ }
+
+ const association_params association_info() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_assocparams_type value;
+ sockaddr_len_type len( sizeof( sctp_assocparams_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_ASSOCINFO,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return association_params( value);
+ }
+
+ void association_info( association_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_assocparams_type value( params);
+ sockaddr_len_type len( sizeof( sctp_assocparams_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_ASSOCINFO,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const default_send_params default_send_parameters() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_sndrcvinfo_type value;
+ sockaddr_len_type len( sizeof( sctp_sndrcvinfo_type) );
+ ::bzero( & value, len);
+ system::error_code ec;
+ detail::sctp_opt_info(
+ socket_.native_handle(),
+ 0,
+ SCTP_DEFAULT_SEND_PARAM,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return default_send_params( value);
+ }
+
+ void default_send_parameters( default_send_params const& params)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ sctp_sndrcvinfo_type value( params);
+ sockaddr_len_type len( sizeof( sctp_sndrcvinfo_type) );
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_SCTP,
+ SCTP_DEFAULT_SEND_PARAM,
+ & value,
+ len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+};
+}}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_DETAIL_OPTIONS_H

Added: sandbox/net/boost/net/ipv4/sctp/heartbeat_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/heartbeat_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,96 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_HEARTBEAT_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_HEARTBEAT_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+}
+
+#include <cstddef>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{
+ class options;
+ class association_options;
+}
+
+class heartbeat_params
+{
+private:
+ friend class detail::options;
+ friend class detail::association_options;
+
+ sctp_paddrparams_type sp_;
+
+ heartbeat_params( sctp_paddrparams_type sp)
+ : sp_( sp)
+ {}
+
+ operator sctp_paddrparams_type const () const
+ { return sp_; }
+
+public:
+ const posix_time::time_duration interval() const
+ { return posix_time::milliseconds( sp_.spp_hbinterval); }
+
+ void interval( posix_time::time_duration const& interv)
+ {
+ BOOST_ASSERT( ! interv.is_special() );
+ BOOST_ASSERT( ! interv.is_negative() );
+
+ sp_.spp_hbinterval = interv.total_milliseconds();
+ }
+
+ bool is_enabled() const
+ { return sp_.spp_flags & SPP_HB_ENABLE; }
+
+ void enable()
+ {
+ sp_.spp_flags |= SPP_HB_ENABLE;
+ sp_.spp_flags &= ~SPP_HB_DISABLE;
+ }
+
+ bool is_disabled() const
+ { return sp_.spp_flags & SPP_HB_DISABLE; }
+
+ void disable()
+ {
+ sp_.spp_flags |= SPP_HB_DISABLE;
+ sp_.spp_flags &= ~SPP_HB_ENABLE;
+ }
+
+ bool is_immediately() const
+ { return sp_.spp_flags & SPP_HB_DEMAND; }
+
+ void immediately()
+ { sp_.spp_flags |= SPP_HB_DEMAND; }
+
+ bool is_zero() const
+ { return sp_.spp_flags & SPP_HB_TIME_IS_ZERO; }
+
+ void zero()
+ { sp_.spp_flags |= SPP_HB_TIME_IS_ZERO; }
+
+ std::size_t beats_before_inactive() const
+ { return sp_.spp_pathmaxrxt; }
+
+ void beats_before_inactive( std::size_t value)
+ { sp_.spp_pathmaxrxt = value; }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_HEARTBEAT_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/initmsg_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/initmsg_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,90 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_INITMSG_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_INITMSG_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+}
+
+#include <cstddef>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{ class options; }
+
+class initmsg_params
+{
+private:
+ friend class detail::options;
+
+ sctp_initmsg_type si_;
+
+ initmsg_params( sctp_initmsg_type si)
+ : si_( si)
+ {}
+
+ operator sctp_initmsg_type const () const
+ { return si_; }
+
+public:
+ initmsg_params()
+ : si_()
+ { ::bzero( & si_, sizeof( sctp_initmsg_type) ); }
+
+ std::size_t outbound_streams() const
+ { return si_.sinit_num_ostreams; }
+
+ void outbound_streams( std::size_t value)
+ {
+ BOOST_ASSERT( value >= 0);
+
+ si_.sinit_num_ostreams = value;
+ }
+
+ std::size_t max_inbound_streams() const
+ { return si_.sinit_max_instreams; }
+
+ void max_inbound_streams( std::size_t value)
+ {
+ BOOST_ASSERT( value >= 0);
+
+ si_.sinit_max_instreams = value;
+ }
+
+ std::size_t max_attempts() const
+ { return si_.sinit_max_attempts; }
+
+ void max_attempts( std::size_t value)
+ {
+ BOOST_ASSERT( value >= 0);
+
+ si_.sinit_max_attempts = value;
+ }
+
+ const posix_time::time_duration max_init_timeout() const
+ { return posix_time::milliseconds( si_.sinit_max_init_timeo); }
+
+ void max_init_timeout( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ si_.sinit_max_init_timeo = timeout.total_milliseconds();
+ }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_INITMSG_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/one2many.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/one2many.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,222 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ONE2MANY_H
+#define BOOST_NET_IPV4_SCTP_ONE2MANY_H
+
+#include <cstddef>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/sctp/association.hpp>
+#include <boost/net/ipv4/sctp/detail/association_options.hpp>
+#include <boost/net/ipv4/sctp/detail/options.hpp>
+#include <boost/net/ipv4/sctp/one2one.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+class one2many
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options,
+private detail::association_options,
+private detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+
+ one2many()
+ :
+ socket_base_type( family_ipv4, socket_seqpacket, protocol_sctp),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::association_options( member),
+ detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const one2one peel_off( association const& assoc)
+ {
+ system::error_code ec;
+ one2one strm( detail::sctp_peeloff( native_handle(), assoc, ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return strm;
+ }
+
+ const association find_association( address const& addr) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return peer_address_params( addr).assoc();
+ }
+
+//------------------------------------------
+
+ const std::vector< address > local_addresses( association const& assoc) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getladdrs(
+ native_handle(),
+ assoc,
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freeladdrs( addr);
+ return addrs;
+ }
+
+ const std::vector< address > peer_addresses( association const& assoc) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getpaddrs(
+ native_handle(),
+ assoc,
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freepaddrs( addr);
+ return addrs;
+ }
+
+//------------------------------------------
+
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+
+//------------------------------------------
+
+ using detail::options::adaptation_layer;
+ using detail::options::association_info;
+ using detail::options::association_status;
+ using detail::options::autoclose;
+ using detail::options::default_send_parameters;
+ using detail::options::disable_autoclose;
+ using detail::options::heartbeat;
+ using detail::options::initmsg;
+ using detail::options::local_primary_address;
+#ifdef BOOST_NET_HAVE_SCTP_MAXSEG
+ using detail::options::max_seg;
+#endif
+#ifdef BOOST_NET_HAVE_SCTP_MAXBURST
+ using detail::options::max_burst
+#endif
+ using detail::options::no_delay;
+ using detail::options::no_fragments;
+ using detail::options::peer_address_params;
+ using detail::options::peer_primary_address;
+ using detail::options::rto_info;
+ using detail::options::subscriptions;
+
+
+ using detail::association_options::association_info;
+ using detail::association_options::association_status;
+ using detail::association_options::default_send_parameters;
+ using detail::association_options::heartbeat;
+ using detail::association_options::local_primary_address;
+ using detail::association_options::peer_primary_address;
+ using detail::association_options::rto_info;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ONE2MANY_H

Added: sandbox/net/boost/net/ipv4/sctp/one2many_listener.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/one2many_listener.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,329 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ONE2MANY_LISTENER_H
+#define BOOST_NET_IPV4_SCTP_ONE2MANY_LISTENER_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+}
+
+#include <cstddef>
+#include <cstring>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/sctp/association.hpp>
+#include <boost/net/ipv4/sctp/detail/association_options.hpp>
+#include <boost/net/ipv4/sctp/detail/options.hpp>
+#include <boost/net/ipv4/sctp/one2one.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+class one2many_listener
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options,
+private detail::association_options,
+private detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+ one2many_listener()
+ :
+ socket_base_type( family_ipv4, socket_seqpacket, protocol_sctp),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::association_options( member),
+ detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ 1,
+ SCTP_BINDX_ADD_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( std::vector< address > const& addrs)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ std::vector< sockaddr_in4_type > tmp;
+ tmp.reserve( addrs.size() );
+ void * vp( & tmp[0]);
+ char * p( static_cast< char * >( vp) );
+ std::vector< address >::const_iterator e( addrs.end() );
+ for (
+ std::vector< address >::const_iterator i( addrs.begin() );
+ i != e;
+ ++i)
+ {
+ std::memcpy( p, i->sockaddr_ptr(), i->size() );
+ p += i->size();
+ }
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ static_cast< sockaddr_type const* >( vp),
+ tmp.size(),
+ SCTP_BINDX_ADD_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void unbind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ 1,
+ SCTP_BINDX_REM_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void unbind( std::vector< address > const& addrs)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ std::vector< sockaddr_in4_type > tmp;
+ tmp.reserve( addrs.size() );
+ void * vp( & tmp[0]);
+ char * p( static_cast< char * >( vp) );
+ std::vector< address >::const_iterator e( addrs.end() );
+ for (
+ std::vector< address >::const_iterator i( addrs.begin() );
+ i != e;
+ ++i)
+ {
+ std::memcpy( p, i->sockaddr_ptr(), i->size() );
+ p += i->size();
+ }
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ static_cast< sockaddr_type const* >( vp),
+ tmp.size(),
+ SCTP_BINDX_REM_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void listen( int backlog = default_backlog_size)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ char * p( 0);
+ if ( ( p = net::detail::getenv("LISTENQ") ) != 0)
+ backlog = lexical_cast< int >( p);
+
+ BOOST_ASSERT( backlog > 0);
+
+ system::error_code ec;
+ net::detail::listen( native_handle(), backlog, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const one2one peel_off( association const& assoc)
+ {
+ system::error_code ec;
+ one2one strm( detail::sctp_peeloff( native_handle(), assoc, ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return strm;
+ }
+
+ const association find_association( address const& addr) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return peer_address_params( addr).assoc();
+ }
+
+//------------------------------------------
+
+ const std::vector< address > local_addresses( association const& assoc) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getladdrs(
+ native_handle(),
+ assoc,
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freeladdrs( addr);
+ return addrs;
+ }
+
+ const std::vector< address > peer_addresses( association const& assoc) const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getpaddrs(
+ native_handle(),
+ assoc,
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freepaddrs( addr);
+ return addrs;
+ }
+
+//------------------------------------------
+
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::reuse_address;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+
+//------------------------------------------
+
+ using detail::options::adaptation_layer;
+ using detail::options::association_info;
+ using detail::options::association_status;
+ using detail::options::autoclose;
+ using detail::options::default_send_parameters;
+ using detail::options::disable_autoclose;
+ using detail::options::heartbeat;
+ using detail::options::initmsg;
+ using detail::options::local_primary_address;
+#ifdef BOOST_NET_HAVE_SCTP_MAXSEG
+ using detail::options::max_seg;
+#endif
+#ifdef BOOST_NET_HAVE_SCTP_MAXBURST
+ using detail::options::max_burst
+#endif
+ using detail::options::no_delay;
+ using detail::options::no_fragments;
+ using detail::options::peer_address_params;
+ using detail::options::peer_primary_address;
+ using detail::options::rto_info;
+ using detail::options::subscriptions;
+
+
+ using detail::association_options::association_info;
+ using detail::association_options::association_status;
+ using detail::association_options::default_send_parameters;
+ using detail::association_options::heartbeat;
+ using detail::association_options::local_primary_address;
+ using detail::association_options::peer_primary_address;
+ using detail::association_options::rto_info;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ONE2MANY_LISTENER_H

Added: sandbox/net/boost/net/ipv4/sctp/one2one.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/one2one.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,284 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ONE2ONE_H
+#define BOOST_NET_IPV4_SCTP_ONE2ONE_H
+
+#include <cstddef>
+#include <cstring>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/sctp/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+class one2one
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options,
+private detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+ friend class one2one_listener;
+ friend class one2many;
+ friend class one2many_listener;
+
+ one2one( native_handle_type handle)
+ :
+ socket_base_type( handle),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::options( member)
+ {}
+
+public:
+//------------------------------------------
+ one2one()
+ :
+ socket_base_type( family_ipv4, socket_stream, protocol_sctp),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool connect( address const& addr)
+ {
+ system::error_code ec;
+ detail::sctp_connectx(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ 1,
+ ec);
+ if ( ec)
+ {
+ if ( ec.value() == system::errc::interrupted ||
+ ec.value() == system::errc::operation_in_progress)
+ return false;
+ else
+ throw_exception( system::system_error( ec) );
+ }
+ return true;
+ }
+
+ bool connect(
+ address const& addr,
+ posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ system::error_code ec;
+ net::detail::is_readable( native_handle(), timeout, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ return connect( addr);
+ }
+
+ bool connect( std::vector< address > const& addrs)
+ {
+ std::vector< sockaddr_in4_type > tmp;
+ tmp.reserve( addrs.size() );
+ void * vp( & tmp[0]);
+ char * p( static_cast< char * >( vp) );
+ std::vector< address >::const_iterator e( addrs.end() );
+ for (
+ std::vector< address >::const_iterator i( addrs.begin() );
+ i != e;
+ ++i)
+ {
+ std::memcpy( p, i->sockaddr_ptr(), i->size() );
+ p += i->size();
+ }
+ system::error_code ec;
+ detail::sctp_connectx(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ addrs.size(),
+ ec);
+ if ( ec)
+ {
+ if ( ec.value() == system::errc::interrupted ||
+ ec.value() == system::errc::operation_in_progress)
+ return false;
+ else
+ throw_exception( system::system_error( ec) );
+ }
+ return true;
+ }
+
+ bool connect(
+ std::vector< address > const& addrs,
+ posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ system::error_code ec;
+ net::detail::is_readable( native_handle(), timeout, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ return connect( addrs);
+ }
+
+//------------------------------------------
+
+ const std::vector< address > local_addresses() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getladdrs(
+ native_handle(),
+ static_cast< sctp_assoc_type >( 0),
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freeladdrs( addr);
+ return addrs;
+ }
+
+ const std::vector< address > peer_addresses() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getpaddrs(
+ native_handle(),
+ static_cast< sctp_assoc_type >( 0),
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freepaddrs( addr);
+ return addrs;
+ }
+
+//------------------------------------------
+
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+
+//------------------------------------------
+
+ using detail::options::adaptation_layer;
+ using detail::options::association_info;
+ using detail::options::association_status;
+ using detail::options::default_send_parameters;
+ using detail::options::disable_autoclose;
+ using detail::options::heartbeat;
+ using detail::options::initmsg;
+ using detail::options::local_primary_address;
+#ifdef BOOST_NET_HAVE_SCTP_MAXSEG
+ using detail::options::max_seg;
+#endif
+#ifdef BOOST_NET_HAVE_SCTP_MAXBURST
+ using detail::options::max_burst
+#endif
+ using detail::options::no_delay;
+ using detail::options::no_fragments;
+ using detail::options::peer_address_params;
+ using detail::options::peer_primary_address;
+ using detail::options::rto_info;
+ using detail::options::subscriptions;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ONE2ONE_H

Added: sandbox/net/boost/net/ipv4/sctp/one2one_listener.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/one2one_listener.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,280 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_ONE2ONE_LISTENER_H
+#define BOOST_NET_IPV4_SCTP_ONE2ONE_LISTENER_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/sctp.h>
+}
+
+#include <cstddef>
+#include <cstring>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/operations.hpp>
+#include <boost/net/ipv4/sctp/one2one.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+class one2one_listener
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+ one2one_listener()
+ :
+ socket_base_type( family_ipv4, socket_stream, protocol_sctp),
+ net::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ 1,
+ SCTP_BINDX_ADD_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( std::vector< address > const& addrs)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ std::vector< sockaddr_in4_type > tmp;
+ tmp.reserve( addrs.size() );
+ void * vp( & tmp[0]);
+ char * p( static_cast< char * >( vp) );
+ std::vector< address >::const_iterator e( addrs.end() );
+ for (
+ std::vector< address >::const_iterator i( addrs.begin() );
+ i != e;
+ ++i)
+ {
+ std::memcpy( p, i->sockaddr_ptr(), i->size() );
+ p += i->size();
+ }
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ static_cast< sockaddr_type const* >( vp),
+ tmp.size(),
+ SCTP_BINDX_ADD_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void unbind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ 1,
+ SCTP_BINDX_REM_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void unbind( std::vector< address > const& addrs)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ std::vector< sockaddr_in4_type > tmp;
+ tmp.reserve( addrs.size() );
+ void * vp( & tmp[0]);
+ char * p( static_cast< char * >( vp) );
+ std::vector< address >::const_iterator e( addrs.end() );
+ for (
+ std::vector< address >::const_iterator i( addrs.begin() );
+ i != e;
+ ++i)
+ {
+ std::memcpy( p, i->sockaddr_ptr(), i->size() );
+ p += i->size();
+ }
+ system::error_code ec;
+ detail::sctp_bindx(
+ native_handle(),
+ static_cast< sockaddr_type const* >( vp),
+ tmp.size(),
+ SCTP_BINDX_REM_ADDR,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void listen( int backlog = default_backlog_size)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ char * p( 0);
+ if ( ( p = net::detail::getenv("LISTENQ") ) != 0)
+ backlog = lexical_cast< int >( p);
+
+ BOOST_ASSERT( backlog > 0);
+
+ system::error_code ec;
+ net::detail::listen( native_handle(), backlog, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool accept( one2one & strm)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ native_handle_type handle( invalid_native_handle);
+ do
+ {
+ ec.clear();
+ handle = net::detail::accept(
+ native_handle(),
+ 0,
+ 0,
+ ec);
+ }
+ while (
+ ec.value() == system::errc::interrupted ||
+ ec.value() == system::errc::connection_aborted ||
+ ec.value() == system::errc::protocol_error);
+
+ if ( ec)
+ {
+ if ( ec.value() == system::errc::operation_would_block ||
+ ec.value() == system::errc::resource_unavailable_try_again)
+ return false;
+ else
+ throw_exception( system::system_error( ec) );
+ }
+
+ strm = one2one( handle);
+ strm.non_blocking( is_non_blocking() );
+ return true;
+ }
+
+ bool accept(
+ sctp::one2one & strm,
+ posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ system::error_code ec;
+ net::detail::is_readable( native_handle(), timeout, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ return accept( strm);
+ }
+
+//------------------------------------------
+
+ const std::vector< address > local_addresses() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ sockaddr_type * addr( 0);
+ system::error_code ec;
+ std::size_t n(
+ detail::sctp_getladdrs(
+ native_handle(),
+ static_cast< sctp_assoc_type >( 0),
+ & addr,
+ ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ void * vp( addr);
+ std::vector< address > addrs;
+ addrs.reserve( n);
+ for ( std::size_t i( 0); i < n; ++i)
+ {
+ addrs.push_back( * static_cast< sockaddr_in4_type * >( vp) );
+ char * cp( static_cast< char * >( vp) );
+ cp += sizeof( sockaddr_in4_type);
+ vp = cp;
+ }
+ detail::sctp_freeladdrs( addr);
+ return addrs;
+ }
+
+//------------------------------------------
+
+ using net::detail::options::reuse_address;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_ONE2ONE_LISTENER_H

Added: sandbox/net/boost/net/ipv4/sctp/rto_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/rto_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,84 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_RTO_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_RTO_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+}
+
+#include <boost/assert.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{
+ class options;
+ class association_options;
+}
+
+class rto_params
+{
+private:
+ friend class detail::options;
+ friend class detail::association_options;
+
+ sctp_rtoinfo_type sr_;
+
+ rto_params( sctp_rtoinfo_type sr)
+ : sr_( sr)
+ {}
+
+ operator sctp_rtoinfo_type const () const
+ { return sr_; }
+
+public:
+ rto_params()
+ : sr_()
+ { ::bzero( & sr_, sizeof( sctp_rtoinfo_type) ); }
+
+ const posix_time::time_duration initial_rto() const
+ { return posix_time::milliseconds( sr_.srto_initial); }
+
+ void initial_rto( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ sr_.srto_initial = timeout.total_milliseconds();
+ }
+
+ const posix_time::time_duration maximum_rto() const
+ { return posix_time::milliseconds( sr_.srto_max); }
+
+ void maximum_rto( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ sr_.srto_max = timeout.total_milliseconds();
+ }
+
+ const posix_time::time_duration minimum_rto() const
+ { return posix_time::milliseconds( sr_.srto_min); }
+
+ void minimum_rto( posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ sr_.srto_min = timeout.total_milliseconds();
+ }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_RTO_PARAMS_H

Added: sandbox/net/boost/net/ipv4/sctp/subscription_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/sctp/subscription_params.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,94 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_SCTP_SUBSCRIPTION_PARAMS_H
+#define BOOST_NET_IPV4_SCTP_SUBSCRIPTION_PARAMS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <strings.h>
+}
+
+#include <cstddef>
+
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace sctp
+{
+namespace detail
+{ class options; }
+
+class subscription_params
+{
+private:
+ friend class detail::options;
+
+ sctp_event_subscribe_type se_;
+
+ subscription_params( sctp_event_subscribe_type se)
+ : se_( se)
+ {}
+
+ operator sctp_event_subscribe_type const () const
+ { return se_; }
+
+public:
+ subscription_params()
+ : se_()
+ { ::bzero( & se_, sizeof( sctp_event_subscribe_type) ); }
+
+ bool is_data_io() const
+ { return se_.sctp_data_io_event == 1; }
+
+ void data_io( bool value)
+ { se_.sctp_data_io_event = value ? 1 : 0; }
+
+ bool is_association() const
+ { return se_.sctp_association_event == 1; }
+
+ void association( bool value)
+ { se_.sctp_association_event = value ? 1 : 0; }
+
+ bool is_address() const
+ { return se_.sctp_address_event == 1; }
+
+ void address( bool value)
+ { se_.sctp_address_event = value ? 1 : 0; }
+
+ bool is_send_failure() const
+ { return se_.sctp_send_failure_event == 1; }
+
+ void send_failure( bool value)
+ { se_.sctp_send_failure_event = value ? 1 : 0; }
+
+ bool is_peer_error() const
+ { return se_.sctp_peer_error_event == 1; }
+
+ void peer_error( bool value)
+ { se_.sctp_peer_error_event = value ? 1 : 0; }
+
+ bool is_shutdown() const
+ { return se_.sctp_shutdown_event == 1; }
+
+ void shutdown( bool value)
+ { se_.sctp_shutdown_event = value ? 1 : 0; }
+
+ bool is_partial_delivery() const
+ { return se_.sctp_partial_delivery_event == 1; }
+
+ void partial_delivery( bool value)
+ { se_.sctp_partial_delivery_event = value ? 1 : 0; }
+
+ bool is_adaptation_layer() const
+ { return se_.sctp_adaptation_layer_event == 1; }
+
+ void adaptation_layer( bool value)
+ { se_.sctp_adaptation_layer_event = value ? 1 : 0; }
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_SCTP_SUBSCRIPTION_PARAMS_H

Added: sandbox/net/boost/net/ipv4/tcp/detail/options.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/tcp/detail/options.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,109 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_TCP_DETAIL_OPTIONS_H
+#define BOOST_NET_IPV4_TCP_DETAIL_OPTIONS_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/tcp.h>
+}
+
+#include <cstddef>
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace tcp {
+namespace detail
+{
+class options
+{
+private:
+ net::detail::socket socket_;
+
+public:
+ options( net::detail::socket const& socket__)
+ : socket_( socket__)
+ {}
+
+ bool no_delay() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( 0);
+ sockaddr_len_type len( sizeof( int) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void no_delay( bool value_)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ int value( value_ ? 1 : 0);
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ & value,
+ sizeof( int),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ std::size_t max_segment_size() const
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ std::size_t value( 0);
+ sockaddr_len_type len( sizeof( std::size_t) );
+ system::error_code ec;
+ net::detail::getsockopt(
+ socket_.native_handle(),
+ IPPROTO_TCP,
+ TCP_MAXSEG,
+ & value,
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return value != 0;
+ }
+
+ void max_segment_size( std::size_t value)
+ {
+ BOOST_ASSERT( socket_.is_valid() );
+
+ system::error_code ec;
+ net::detail::setsockopt(
+ socket_.native_handle(),
+ IPPROTO_TCP,
+ TCP_MAXSEG,
+ & value,
+ sizeof( std::size_t),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+};
+}}}}}
+
+#endif // BOOST_NET_IPV4_TCP_DETAIL_OPTIONS_H

Added: sandbox/net/boost/net/ipv4/tcp/one2one.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/tcp/one2one.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,196 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_TCP_ONE2ONE_H
+#define BOOST_NET_IPV4_TCP_ONE2ONE_H
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/tcp/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace tcp
+{
+class one2one
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options,
+private detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+ friend class one2one_listener;
+
+ one2one( native_handle_type handle)
+ :
+ socket_base_type( handle),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::options( member)
+ {}
+
+public:
+//------------------------------------------
+ one2one()
+ :
+ socket_base_type( family_ipv4, socket_stream, protocol_tcp),
+ net::detail::options( member),
+ ipv4::detail::options( member),
+ detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool connect( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::connect(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec)
+ {
+ if ( ec.value() == system::errc::interrupted ||
+ ec.value() == system::errc::operation_in_progress)
+ return false;
+ else
+ throw_exception( system::system_error( ec) );
+ }
+ return true;
+ }
+
+ bool connect(
+ address const& addr,
+ posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ system::error_code ec;
+ net::detail::is_readable( native_handle(), timeout, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ return connect( addr);
+ }
+
+//------------------------------------------
+
+ const address local_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getsockname(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+ const address peer_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getpeername(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+//-----------------------------------------
+
+ using net::detail::options::debug;
+ using net::detail::options::dont_route;
+ using net::detail::options::keep_alive;
+ using net::detail::options::linger;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//-----------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+
+//-----------------------------------------
+
+ using detail::options::no_delay;
+ using detail::options::max_segment_size;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_TCP_ONE2ONE_H

Added: sandbox/net/boost/net/ipv4/tcp/one2one_listener.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/tcp/one2one_listener.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,188 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_TCP_ONE2ONE_LISTENER_H
+#define BOOST_NET_IPV4_TCP_ONE2ONE_LISTENER_H
+
+#include <boost/assert.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/tcp/one2one.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace tcp
+{
+class one2one_listener
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+ one2one_listener()
+ :
+ socket_base_type( family_ipv4, socket_stream, protocol_tcp),
+ net::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::bind(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void listen( int backlog = default_backlog_size)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ char * p( 0);
+ if ( ( p = net::detail::getenv("LISTENQ") ) != 0)
+ backlog = lexical_cast< int >( p);
+
+ BOOST_ASSERT( backlog > 0);
+
+ system::error_code ec;
+ net::detail::listen( native_handle(), backlog, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ bool accept( one2one & strm)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ native_handle_type handle( invalid_native_handle);
+ do
+ {
+ ec.clear();
+ handle = net::detail::accept(
+ native_handle(),
+ 0,
+ 0,
+ ec);
+ }
+ while (
+ ec.value() == system::errc::interrupted ||
+ ec.value() == system::errc::connection_aborted ||
+ ec.value() == system::errc::protocol_error);
+
+ if ( ec)
+ {
+ if ( ec.value() == system::errc::operation_would_block ||
+ ec.value() == system::errc::resource_unavailable_try_again)
+ return false;
+ else
+ throw_exception( system::system_error( ec) );
+ }
+
+ strm = one2one( handle);
+ strm.non_blocking( is_non_blocking() );
+ return true;
+ }
+
+ bool accept(
+ tcp::one2one & strm,
+ posix_time::time_duration const& timeout)
+ {
+ BOOST_ASSERT( is_valid() );
+ BOOST_ASSERT( ! timeout.is_special() );
+ BOOST_ASSERT( ! timeout.is_negative() );
+
+ system::error_code ec;
+ net::detail::is_readable( native_handle(), timeout, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ return accept( strm);
+ }
+
+//------------------------------------------
+
+ const address local_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getsockname(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+//------------------------------------------
+
+ using net::detail::options::reuse_address;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_TCP_ONE2ONE_LISTENER_H

Added: sandbox/net/boost/net/ipv4/udp/mcast2one.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/udp/mcast2one.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,128 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_UDP_MCAST2ONE_H
+#define BOOST_NET_IPV4_UDP_MCAST2ONE_H
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace udp
+{
+class mcast2one
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+public:
+//------------------------------------------
+ mcast2one()
+ :
+ socket_base_type( family_ipv4, socket_dgram, protocol_udp),
+ net::detail::options( member),
+ ipv4::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::bind(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+//------------------------------------------
+
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::reuse_address;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+
+ using ipv4::detail::options::mc_interface;
+ using ipv4::detail::options::mc_time_to_life;
+ using ipv4::detail::options::mc_is_loopback;
+ using ipv4::detail::options::mc_loopback;
+ using ipv4::detail::options::mc_join_group;
+ using ipv4::detail::options::mc_leave_group;
+ using ipv4::detail::options::mc_join_source_group;
+ using ipv4::detail::options::mc_leave_source_group;
+ using ipv4::detail::options::mc_block_source;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_UDP_MCAST2ONE_H

Added: sandbox/net/boost/net/ipv4/udp/one2many.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/udp/one2many.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,146 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_UDP_ONE2MANY_H
+#define BOOST_NET_IPV4_UDP_ONE2MANY_H
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace udp
+{
+class one2one;
+
+class one2many
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+ friend class one2one;
+
+ one2many( net::detail::socket const&);
+
+public:
+//------------------------------------------
+ one2many()
+ :
+ socket_base_type( family_ipv4, socket_dgram, protocol_udp),
+ net::detail::options( member),
+ ipv4::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::bind(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const one2one connect( address const&);
+
+//------------------------------------------
+
+ const address local_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getsockname(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+//------------------------------------------
+
+ using net::detail::options::broadcast;
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::reuse_address;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_UDP_ONE2MANY_H

Added: sandbox/net/boost/net/ipv4/udp/one2one.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/udp/one2one.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,163 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_UDP_ONE2ONE_H
+#define BOOST_NET_IPV4_UDP_ONE2ONE_H
+
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/detail/options.hpp>
+#include <boost/net/detail/socket.hpp>
+#include <boost/net/ipv4/address.hpp>
+#include <boost/net/ipv4/detail/options.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv4 { namespace udp
+{
+class one2many;
+
+class one2one
+:
+private base_from_member< net::detail::socket >,
+private net::detail::options,
+private ipv4::detail::options
+{
+private:
+ typedef base_from_member< net::detail::socket > socket_base_type;
+
+ friend class one2many;
+
+ one2one( net::detail::socket const&);
+
+public:
+//------------------------------------------
+ one2one()
+ :
+ socket_base_type( family_ipv4, socket_dgram, protocol_udp),
+ net::detail::options( member),
+ ipv4::detail::options( member)
+ {}
+
+//------------------------------------------
+
+ native_handle_type native_handle() const
+ { return member.native_handle(); }
+
+ bool is_valid() const
+ { return member.is_valid(); }
+
+ void close()
+ { member.close(); }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.error();
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ return member.is_non_blocking();
+ }
+
+ void non_blocking( bool value)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ member.non_blocking( value);
+ }
+
+//------------------------------------------
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::shutdown( native_handle(), mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ void bind( address const& addr)
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ net::detail::bind(
+ native_handle(),
+ addr.sockaddr_ptr(),
+ addr.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const one2many disconnect();
+
+//------------------------------------------
+
+ const address local_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getsockname(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+ const address peer_address() const
+ {
+ BOOST_ASSERT( is_valid() );
+
+ system::error_code ec;
+ sockaddr_in4_type sa;
+ sockaddr_len_type len( sizeof( sockaddr_in4_type) );
+ void * vp( & sa);
+ net::detail::getpeername(
+ native_handle(),
+ static_cast< sockaddr_type * >( vp),
+ & len,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return address( sa);
+ }
+
+//------------------------------------------
+
+ using net::detail::options::broadcast;
+ using net::detail::options::dont_route;
+ using net::detail::options::linger;
+ using net::detail::options::reuse_address;
+ using net::detail::options::receive_buffer;
+ using net::detail::options::receive_lowat;
+ using net::detail::options::receive_timeout;
+ using net::detail::options::send_buffer;
+ using net::detail::options::send_lowat;
+ using net::detail::options::send_timeout;
+
+//------------------------------------------
+
+ using ipv4::detail::options::time_to_live;
+ using ipv4::detail::options::type_of_service;
+};
+}}}}
+
+#endif // BOOST_NET_IPV4_UDP_ONE2ONE_H

Added: sandbox/net/boost/net/ipv4/utility.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv4/utility.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,57 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV4_UTILITY_H
+#define BOOST_NET_IPV4_UTILITY_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <netinet/ip.h>
+}
+
+namespace boost { namespace net {
+namespace ipv4
+{
+enum family_type
+{
+ family_unspecified = PF_UNSPEC,
+ family_ipv4 = PF_INET
+};
+
+enum socket_type
+{
+ socket_dgram = SOCK_DGRAM,
+ socket_raw = SOCK_RAW,
+ socket_stream = SOCK_STREAM,
+ socket_seqpacket = SOCK_SEQPACKET,
+ socket_unspec = 0
+};
+
+enum protocol_type
+{
+ protocol_icmp = IPPROTO_ICMP,
+ protocol_sctp = IPPROTO_SCTP,
+ protocol_tcp = IPPROTO_TCP,
+ protocol_udp = IPPROTO_UDP,
+ protocol_unspec = 0
+};
+
+enum resolve_flags
+{
+ canonical_name = AI_CANONNAME
+};
+
+const int low_delay = IPTOS_LOWDELAY;
+const int throughput = IPTOS_THROUGHPUT;
+#ifdef BOOST_NET_HAVE_IPTOS_LOWCOST
+const int low_cost = IPTOS_LOWCOST;
+#endif
+const int reliability = IPTOS_RELIABILITY;
+const int mincost = IPTOS_MINCOST;
+}}}
+
+#endif // BOOST_NET_IPV4_UTILITY_H

Added: sandbox/net/boost/net/ipv6/address.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/address.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,208 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_ADDRESS_H
+#define BOOST_NET_IPV6_ADDRESS_H
+
+#include <cstddef>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+#include <vector>
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <strings.h>
+}
+
+#include <boost/array.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/ipv6/detail/operations.hpp>
+#include <boost/net/ipv6/ipnumber.hpp>
+#include <boost/net/ipv6/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6
+{
+class address
+{
+private:
+ sockaddr_in6_type addr_;
+
+ address()
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in6_type) );
+ addr_.sin_family = PF_INET6;
+ }
+
+public:
+ address( sockaddr_in6_type const& addr)
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in6_type) );
+ addr_ = addr;
+ }
+
+ address( ipnumber const& ip, unsigned int port)
+ : addr_()
+ {
+ ::bzero( & addr_, sizeof( sockaddr_in6_type) );
+ addr_.sin6_family = PF_INET6;
+ addr_.sin6_addr = ip.in6_addr();
+ addr_.sin6_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN6_LEN
+ addr_.sin6_len = sizeof( sockaddr_in6_type);
+#endif
+ }
+
+ static const address any( unsigned int port)
+ {
+ address addr;
+ addr.addr_.sin6_addr = in6addr_any;
+ addr.addr_.sin6_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN6_LEN
+ addr.addr_.sin6_len = sizeof( sockaddr_in6_type);
+#endif
+ return addr;
+ }
+
+ static const address loopback( unsigned int port)
+ {
+ address addr;
+ addr.addr_.sin6_addr = in6addr_loopback;
+ addr.addr_.sin6_port = detail::host2network_short( port);
+#ifdef BOOST_NET_SIN6_LEN
+ addr.addr_.sin6_len = sizeof( sockaddr_in6_type);
+#endif
+ return addr;
+ }
+
+ const ipnumber ip_number() const
+ { return ipnumber_v6( addr_.sin6_addr); }
+
+ unsigned int port() const
+ { return detail::network2host_short( addr_.sin6_port); }
+
+ sockaddr_type const* sockaddr_ptr() const
+ {
+ void const* vp( & addr_);
+ return static_cast< sockaddr_type const* >( vp);
+ }
+
+ sockaddr_len_type size() const
+ { return sizeof( sockaddr_in6_type); }
+};
+
+inline
+bool operator<( address const& l, address const& r)
+{
+ if ( l.ip_number() < r.ip_number() )
+ return true;
+ if ( l.ip_number() != r.ip_number() )
+ return false;
+ return l.port() < r.port();
+}
+
+inline
+bool operator==( address const& l, address const& r)
+{ return l.ip_number() == r.ip_number() && l.port() == r.port(); }
+
+inline
+bool operator!=( address const& l, address const& r)
+{ return ! ( l == r); }
+
+template<
+ typename charT,
+ typename Traits
+>
+std::basic_ostream< charT, Traits > &
+operator<<( std::basic_ostream< charT, Traits > & os, address const& addr)
+{
+ if ( ! os.good() ) return os;
+ try
+ { os << "[" << addr.ip_number() << "]" << ":" << addr.port(); }
+ catch ( std::bad_alloc &)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( ( exception_mask & std::ios_base::failbit) && ! ( exception_mask & std::ios_base::badbit) )
+ os.setstate( std::ios_base::badbit);
+ else if ( exception_mask & std::ios_base::badbit)
+ {
+ try
+ { os.setstate( std::ios_base::badbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ catch (...)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( exception_mask & std::ios_base::failbit)
+ {
+ try
+ { os.setstate( std::ios_base::failbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ return os;
+}
+
+
+inline
+const std::string fqd_name( address const& addr)
+{
+ boost::array< char, fqdn_size > array;
+ ::bzero( array.c_array(), array.size() );
+ system::error_code ec;
+ detail::getnameinfo(
+ addr.sockaddr_ptr(),
+ addr.size(),
+ array.c_array(),
+ array.size(),
+ 0,
+ 0,
+ NI_NAMEREQD,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return std::string( array.data(), array.size() );
+}
+
+inline
+const std::vector< std::string > aliases( address const& addr)
+{
+ std::vector< std::string > array;
+ std::vector< char > buffer( 8192);
+
+ hostent_type result;
+
+ void const* vp( addr.sockaddr_ptr() );
+ system::error_code ec;
+ sockaddr_in6_type const* in6( static_cast< sockaddr_in6_type const* >( vp) );
+ detail::gethostbyaddr_r(
+ * const_cast< sockaddr_in6_type * >( in6),
+ result,
+ & buffer[0],
+ buffer.size(),
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ for ( char ** pptr = result.h_aliases; * pptr != 0; ++pptr)
+ array.push_back( * pptr);
+
+ return array;
+}
+}}}
+
+#endif // BOOST_NET_IPV6_ADDRESS_H

Added: sandbox/net/boost/net/ipv6/address_info.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/address_info.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,78 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_ADDRESS_INFO_H
+#define BOOST_NET_IPV6_ADDRESS_INFO_H
+
+#include <string>
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <boost/net/ipv6/address.hpp>
+#include <boost/net/ipv6/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6
+{
+class address_info
+{
+private:
+ shared_ptr< addrinfo_type > root_;
+ addrinfo_type * current_;
+
+public:
+ address_info(
+ shared_ptr< addrinfo_type > root,
+ addrinfo_type * current)
+ : root_( root), current_( current)
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ }
+
+ const std::string canonical_name() const
+ {
+ BOOST_ASSERT( root_);
+ return root_->ai_canonname ? root_->ai_canonname : "";
+ }
+
+ socket_type socktype() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ return static_cast< socket_type >( current_->ai_socktype);
+ }
+
+ protocol_type protocol() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+ return static_cast< protocol_type >( current_->ai_protocol);
+ }
+
+ const address to_address() const
+ {
+ BOOST_ASSERT( root_);
+ BOOST_ASSERT( current_);
+
+ void * vp( current_->ai_addr);
+ sockaddr_in6_type * in6( static_cast< sockaddr_in6_type * >( vp) );
+ return address( * in6);
+ }
+
+ operator const address() const
+ { return to_address(); }
+};
+}}}
+
+#endif // BOOST_NET_IPV6_ADDRESS_INFO_H

Added: sandbox/net/boost/net/ipv6/detail/operations.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/detail/operations.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,178 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_DETAIL_OPERATIONS_H
+#define BOOST_NET_IPV6_DETAIL_OPERATIONS_H
+
+#include <cerrno>
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#ifdef BOOST_NET_HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+}
+
+#include <boost/config.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/error.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6 { namespace detail
+{
+ inline
+ u_long_type network2host_long( u_long_type value)
+ { return ntohl( value); }
+
+ inline
+ u_long_type host2network_long( u_long_type value)
+ { return htonl( value); }
+
+ inline
+ u_short_type network2host_short( u_short_type value)
+ { return ntohs( value); }
+
+ inline
+ u_short_type host2network_short( u_short_type value)
+ { return htons(value); }
+
+ inline
+ in6_addr_type inet6_pton(
+ std::string const& ip_number,
+ system::error_code & ec)
+ {
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof addr);
+
+ int result(
+ ::inet_pton(
+ PF_INET6,
+ ip_number.c_str(),
+ & addr) );
+ if ( result == 0)
+ ec = system::error_code(
+ EFAULT,
+ system::get_system_category() );
+ else if ( result < 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return addr;
+ }
+
+ inline
+ const std::string inet_ntop(
+ in6_addr_type const& addr,
+ system::error_code & ec)
+ {
+ char buf[addrstrlen_ipv6];
+ ::bzero( buf, addrstrlen_ipv6);
+
+ if ( ::inet_ntop(
+ PF_INET6,
+ & addr,
+ buf,
+ sizeof buf) == 0)
+ ec = system::error_code(
+ errno,
+ system::get_system_category() );
+ return buf;
+ }
+
+
+ inline
+ void getaddrinfo(
+ char const* host,
+ char const* service,
+ addrinfo_type const* hints,
+ addrinfo_type ** result,
+ system::error_code & ec)
+ {
+ int errno_(
+ ::getaddrinfo(
+ host,
+ service,
+ hints,
+ result) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+ }
+
+ inline
+ void getnameinfo(
+ sockaddr_type const* addr,
+ sockaddr_len_type addrlen,
+ char * host,
+ sockaddr_len_type hostlen,
+ char * service,
+ sockaddr_len_type servicelen,
+ int flags,
+ system::error_code & ec)
+ {
+ int errno_(
+ ::getnameinfo(
+ addr,
+ addrlen,
+ host,
+ hostlen,
+ service,
+ servicelen,
+ flags) );
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+ }
+
+ inline
+ void freeaddrinfo( addrinfo_type * result)
+ { ::freeaddrinfo( result); }
+
+ inline
+ void gethostbyaddr_r(
+ sockaddr_in6_type & addr,
+ hostent_type & ent,
+ char * buf,
+ int buflen,
+ system::error_code & ec)
+ {
+ hostent_type * result( 0);
+#if defined(__hpux)
+ void * addr_ = addr;
+ result = ::gethostbyaddr(
+ addr_,
+ len,
+ type);
+#else
+ void * vp( & addr.sin6_addr);
+ int errno_( 0);
+ ::gethostbyaddr_r(
+ static_cast< char * >( vp),
+ sizeof( in6_addr_type),
+ PF_INET6,
+ & ent,
+ buf,
+ buflen,
+ & result,
+ & errno_);
+ if ( errno_ != 0)
+ ec = system::error_code(
+ errno_,
+ get_gai_category() );
+#endif
+ }
+}}}}
+
+#endif // BOOST_NET_IPV6_DETAIL_OPERATIONS_H

Added: sandbox/net/boost/net/ipv6/detail/socket.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/detail/socket.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,143 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_DETAIL_SOCKET_H
+#define BOOST_NET_IPV6_DETAIL_SOCKET_H
+
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/constants.hpp>
+#include <boost/net/detail/operations.hpp>
+#include <boost/net/shutdown_mode.hpp>
+#include <boost/net/ipv4/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6 { namespace detail
+{
+class socket
+{
+private:
+ class impl
+ {
+ private:
+ native_handle_type handle_;
+
+ public:
+ impl( native_handle_type handle)
+ : handle_( handle)
+ { BOOST_ASSERT( handle_ != invalid_native_handle); }
+
+ impl(
+ socket_type socktype,
+ protocol_type protocol)
+ : handle_( invalid_native_handle)
+ {
+ system::error_code ec;
+ handle_ = net::detail::create_socket( PF_INET6, socktype, protocol, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ BOOST_ASSERT( handle_ != invalid_native_handle);
+ }
+
+ ~impl()
+ {
+ system::error_code ec;
+ net::detail::close_socket( handle_, ec);
+ handle_ = invalid_native_handle;
+ }
+
+ native_handle_type native_handle() const
+ { return handle_; }
+
+ bool is_valid() const
+ { return handle_ != invalid_native_handle; }
+
+ void close()
+ {
+ if ( is_valid() )
+ {
+ system::error_code ec;
+ net::detail::close_socket( handle_, ec);
+ handle_ = invalid_native_handle;
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+ }
+
+ void shutdown( shutdown_mode const& mode)
+ {
+ BOOST_ASSERT( is_valid() );
+ system::error_code ec;
+ net::detail::shutdown( handle_, mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+
+ const system::error_code error() const
+ {
+ BOOST_ASSERT( is_valid() );
+ int value( 0);
+ system::error_code ec;
+ net::detail::getsockopt( handle_, SOL_SOCKET, SO_ERROR, ( void *) & value, sizeof( int), ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ return system::error_code( value, system::get_system_category() );
+ }
+
+ bool is_non_blocking() const
+ {
+ BOOST_ASSERT( is_valid() );
+ system::error_code ec;
+ bool result( net::detail::non_blocking( handle_, ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return result;
+ }
+
+ void non_blocking( bool mode)
+ {
+ BOOST_ASSERT( is_valid() );
+ system::error_code ec;
+ net::detail::non_blocking( handle_, mode, ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+ }
+ };
+
+ shared_ptr< impl > impl_;
+
+public:
+ socket(
+ socket_type socktype,
+ protocol_type protocol)
+ : impl_( new impl( socktype, protocol) )
+ { BOOST_ASSERT( impl_->is_valid() ); }
+
+ socket( native_handle_type handle)
+ : impl_( new impl( handle) )
+ { BOOST_ASSERT( impl_->is_valid() ); }
+
+ native_handle_type native_handle() const
+ { return impl_->native_handle(); }
+
+ bool is_valid() const
+ { return impl_->is_valid(); }
+
+ void close()
+ { impl_->close(); }
+
+ void shutdown( shutdown_mode const& mode)
+ { impl_->shutdown( mode); }
+
+ const system::error_code error() const
+ { return impl_->error(); }
+
+ bool is_non_blocking() const
+ { return impl_->is_non_blocking(); }
+
+ void non_blocking( bool value)
+ { impl_->non_blocking( value); }
+};
+}}}}
+
+#endif // BOOST_NET_IPV6_DETAIL_SOCKET_H

Added: sandbox/net/boost/net/ipv6/ipnumber.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/ipnumber.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,205 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_IPNUMBER_V6_H
+#define BOOST_NET_IPV6_IPNUMBER_V6_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <netinet/in.h>
+#include <strings.h>
+}
+
+#include <cstring>
+#include <iostream>
+#include <stdexcept>
+#include <string>
+
+#include <boost/array.hpp>
+#include <boost/assert.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+
+#include <boost/net/ipv4/ipnumber.hpp>
+#include <boost/net/ipv6/detail/operations.hpp>
+#include <boost/net/ipv6/ipnumber.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6
+{
+class ipnumber
+{
+private:
+ friend bool operator<( ipnumber const&, ipnumber const&);
+ friend bool operator==( ipnumber const&, ipnumber const&);
+
+ in6_addr_type addr_;
+
+public:
+ ipnumber( in6_addr_type const& addr)
+ : addr_( addr)
+ {}
+
+ static const ipnumber any()
+ {
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof( in6_addr_type) );
+ addr = in6addr_any;
+ return addr;
+ }
+
+ static const ipnumber loopback()
+ {
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof( in6_addr_type) );
+ addr = in6addr_loopback;
+ return addr;
+ }
+
+ static const ipnumber v4_mapped( ipv4::ipnumber const& number)
+ {
+ array< unsigned char, 4 > buffer;
+ std::memcpy( buffer.elems, & number.in4_addr().s_addr, 4);
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof( in6_addr_type) );
+ addr.s6_addr[10] = 0xFF;
+ addr.s6_addr[11] = 0xFF;
+ addr.s6_addr[12] = buffer[0];
+ addr.s6_addr[13] = buffer[1];
+ addr.s6_addr[14] = buffer[2];
+ addr.s6_addr[15] = buffer[3];
+ return addr;
+ }
+
+ static const ipnumber v4_compatible( ipv4::ipnumber const& number)
+ {
+ array< unsigned char, 4 > buffer;
+ std::memcpy( buffer.elems, & number.in4_addr().s_addr, 4);
+ in6_addr_type addr;
+ ::bzero( & addr, sizeof( in6_addr_type) );
+ addr.s6_addr[12] = buffer[0];
+ addr.s6_addr[13] = buffer[1];
+ addr.s6_addr[14] = buffer[2];
+ addr.s6_addr[15] = buffer[3];
+ return addr;
+ }
+
+ bool is_unspec() const
+ { return IN6_IS_ADDR_UNSPECIFIED( & addr_) != 0; }
+
+ bool is_loopback() const
+ { return IN6_IS_ADDR_LOOPBACK( & addr_) != 0; }
+
+ bool is_multicast() const
+ { return IN6_IS_ADDR_MULTICAST( & addr_) != 0; }
+
+ bool is_link_local() const
+ { return IN6_IS_ADDR_LINKLOCAL( & addr_) != 0; }
+
+ bool is_site_local() const
+ { return IN6_IS_ADDR_SITELOCAL( & addr_) != 0; }
+
+ bool is_v4_mapped() const
+ { return IN6_IS_ADDR_V4MAPPED( & addr_) != 0; }
+
+ bool is_v4_compatible() const
+ { return IN6_IS_ADDR_V4COMPAT( & addr_) != 0; }
+
+ bool is_mc_node_local() const
+ { return IN6_IS_ADDR_MC_NODELOCAL( & addr_) != 0; }
+
+ bool is_mc_link_local() const
+ { return IN6_IS_ADDR_MC_LINKLOCAL( & addr_) != 0; }
+
+ bool is_mc_size_local() const
+ { return IN6_IS_ADDR_MC_SITELOCAL( & addr_) != 0; }
+
+ bool is_mc_org_local() const
+ { return IN6_IS_ADDR_MC_ORGLOCAL( & addr_) != 0; }
+
+ bool is_mc_global() const
+ { return IN6_IS_ADDR_MC_GLOBAL( & addr_) != 0; }
+
+ const ipv4::ipnumber to_v4() const
+ {
+ if ( ! is_v4_mapped() && ! is_v4_compatible() )
+ throw_exception( std::bad_cast() );
+ array< unsigned char, 4 > buffer;
+ buffer[0] = addr_.s6_addr[12];
+ buffer[1] = addr_.s6_addr[13];
+ buffer[2] = addr_.s6_addr[14];
+ buffer[3] = addr_.s6_addr[15];
+ in4_addr_type addr;
+ std::memcpy( & addr.s_addr, buffer.elems, 4);
+ return ipv4::ipnumber( addr);
+ }
+
+ const in6_addr_type in6_addr() const
+ { return addr_; }
+};
+
+const std::string to_string( ipnumber const& number)
+{
+ system::error_code ec;
+ std::string str( detail::inet_ntop( number.in6_addr(), ec) );
+ if ( ec) throw_exception( system::system_error( ec) );
+ return str;
+}
+
+inline
+bool operator<( ipnumber const& l, ipnumber const& r)
+{ return ::memcmp( & l.addr_, & r.addr_, sizeof( in6_addr_type) ) < 0; }
+
+inline
+bool operator==( ipnumber const& l, ipnumber const& r)
+{ return ::memcmp( & l.addr_, & r.addr_, sizeof( in6_addr_type) ) == 0; }
+
+inline
+bool operator!=( ipnumber const& l, ipnumber const& r)
+{ return ! ( l == r); }
+
+template<
+ typename charT,
+ typename Traits
+>
+std::basic_ostream< charT, Traits > &
+operator<<( std::basic_ostream< charT, Traits > & os, ipnumber const& number)
+{
+ if ( ! os.good() ) return os;
+ try
+ { os << to_string( number); }
+ catch ( std::bad_alloc &)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( ( exception_mask & std::ios_base::failbit) && ! ( exception_mask & std::ios_base::badbit) )
+ os.setstate( std::ios_base::badbit);
+ else if ( exception_mask & std::ios_base::badbit)
+ {
+ try
+ { os.setstate( std::ios_base::badbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ catch (...)
+ {
+ std::ios_base::iostate exception_mask( os.exceptions() );
+ if ( exception_mask & std::ios_base::failbit)
+ {
+ try
+ { os.setstate( std::ios_base::failbit); }
+ catch ( std::ios_base::failure &)
+ {}
+ throw;
+ }
+ }
+ return os;
+}
+}}}
+
+#endif // BOOST_NET_IPV6_IPNUMBER_V6_H

Added: sandbox/net/boost/net/ipv6/resolve.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/resolve.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,208 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_RESOLVE_H
+#define BOOST_NET_IPV6_RESOLVE_H
+
+#include <string>
+#include <vector>
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <boost/lexical_cast.hpp>
+#include <boost/none.hpp>
+#include <boost/optional.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/net/ipv6/detail/operations.hpp>
+#include <boost/net/ipv6/address_info.hpp>
+#include <boost/net/ipv6/utility.hpp>
+#include <boost/net/types.hpp>
+
+namespace boost { namespace net {
+namespace ipv6
+{
+namespace detail
+{
+struct addrinfo_deleter
+{
+ void operator()( addrinfo_type * ptr)
+ {
+ detail::freeaddrinfo( ptr);
+ ptr = 0;
+ }
+};
+}
+
+class resolve_hints
+{
+private:
+ int flags_;
+ int socket_;
+ int protocol_;
+
+public:
+ resolve_hints()
+ :
+ flags_( 0),
+ socket_( socket_unspec),
+ protocol_( protocol_unspec)
+ {}
+
+ resolve_hints operator|( resolve_flags flgs)
+ {
+ flags_ = flgs;
+ return * this;
+ }
+
+ resolve_hints operator|( socket_type sck)
+ {
+ socket_ |= sck;
+ return * this;
+ }
+
+ resolve_hints operator|( protocol_type proto)
+ {
+ protocol_ |= proto;
+ return * this;
+ }
+
+ int flags() const
+ { return flags_; }
+
+ int socket() const
+ { return socket_; }
+
+ int protocol() const
+ { return protocol_; }
+};
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& host,
+ std::string const& service,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! host.empty() );
+ BOOST_ASSERT( ! service.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = PF_INET6;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ host.c_str(),
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& host,
+ unsigned int port,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! host.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = PF_INET6;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+ info_hints.ai_flags |= AI_NUMERICSERV;
+
+ std::string service( boost::lexical_cast< std::string >( port) );
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ host.c_str(),
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+
+inline
+const std::vector< address_info > resolve(
+ std::string const& service,
+ optional< resolve_hints > hints = none)
+{
+ BOOST_ASSERT( ! service.empty() );
+
+ addrinfo_type info_hints, * tmp( 0);
+
+ // hints
+ ::bzero( & info_hints, sizeof( addrinfo_type) );
+ info_hints.ai_family = PF_INET6;
+ if ( hints)
+ {
+ info_hints.ai_flags = hints->flags();
+ info_hints.ai_socktype= hints->socket();
+ info_hints.ai_protocol = hints->protocol();
+ }
+ info_hints.ai_flags |= AI_PASSIVE;
+
+ system::error_code ec;
+ detail::getaddrinfo(
+ 0,
+ service.c_str(),
+ & info_hints,
+ & tmp,
+ ec);
+ if ( ec) throw_exception( system::system_error( ec) );
+
+ shared_ptr< addrinfo_type > info_ptr( tmp, detail::addrinfo_deleter() );
+
+ std::vector< address_info > infos;
+
+ if ( ! info_ptr) return infos;
+ for ( addrinfo_type * ptr( info_ptr.get() ); ptr; ptr = ptr->ai_next)
+ infos.push_back( address_info( info_ptr, ptr) );
+ return infos;
+}
+}}}
+
+#endif // BOOST_NET_IPV6_RESOLVE_H

Added: sandbox/net/boost/net/ipv6/utility.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/ipv6/utility.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,44 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_IPV6_UTILITY_H
+#define BOOST_NET_IPV6_UTILITY_H
+
+extern "C"
+{
+#include <netinet/in.h>
+}
+
+#include <boost/mpl/int.hpp>
+
+namespace boost { namespace net {
+namespace ipv6
+{
+enum socket_type
+{
+ socket_dgram = SOCK_DGRAM,
+ socket_raw = SOCK_RAW,
+ socket_stream = SOCK_STREAM,
+ socket_seqpacket = SOCK_SEQPACKET,
+ socket_unspec = 0
+};
+
+enum protocol_type
+{
+ protocol_icmp = IPPROTO_ICMP,
+ protocol_sctp = IPPROTO_SCTP,
+ protocol_tcp = IPPROTO_TCP,
+ protocol_udp = IPPROTO_UDP,
+ protocol_unspec = 0
+};
+
+enum resolve_flags
+{
+ canonical_name = AI_CANONNAME,
+ v4mapped = AI_V4MAPPED,
+ v4mapped_all = AI_ALL
+};
+}}}
+
+#endif // BOOST_NET_IPV6_UTILITY_H

Added: sandbox/net/boost/net/shutdown_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/shutdown_mode.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,53 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_SHUTDOWN_MODE_H
+#define BOOST_NET_SHUTDOWN_MODE_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#include <sys/socket.h>
+}
+
+namespace boost { namespace net
+{
+class shutdown_mode;
+const shutdown_mode shutdown_rd();
+const shutdown_mode shutdown_wr();
+const shutdown_mode shutdown_rdwr();
+
+class shutdown_mode
+{
+private:
+ friend const shutdown_mode shutdown_rd();
+ friend const shutdown_mode shutdown_wr();
+ friend const shutdown_mode shutdown_rdwr();
+
+ int mode_;
+
+ explicit shutdown_mode( int mode)
+ : mode_( mode)
+ {}
+
+public:
+ operator int () const
+ { return mode_; }
+};
+
+inline
+const shutdown_mode shutdown_rd()
+{ return shutdown_mode( SHUT_RD); }
+
+inline
+const shutdown_mode shutdown_wr()
+{ return shutdown_mode( SHUT_WR); }
+
+inline
+const shutdown_mode shutdown_rdwr()
+{ return shutdown_mode( SHUT_RDWR); }
+} }
+
+#endif // BOOST_NET_SHUTDOWN_MODE_H

Added: sandbox/net/boost/net/types.hpp
==============================================================================
--- (empty file)
+++ sandbox/net/boost/net/types.hpp 2009-02-24 14:40:47 EST (Tue, 24 Feb 2009)
@@ -0,0 +1,256 @@
+// Copyright (c) 2001-2008 Oliver Kowalke. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_NET_TYPES_H
+#define BOOST_NET_TYPES_H
+
+#include <boost/net/detail/config.hpp>
+
+extern "C"
+{
+#ifdef BOOST_NET_HAVE_DEVPOLL_H
+#include <devpoll.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_NETINET_SCTP_H
+#include <netinet/sctp.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_POLL_H
+#include <poll.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SEMAPHORE_H
+#include <semaphore.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_EPOLL_H
+#include <sys/epoll.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_EVENT_H
+#include <sys/event.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#ifdef BOOST_NET_HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+}
+
+#include <csignal>
+
+namespace boost { namespace net
+{
+typedef int native_handle_type;
+
+#ifdef BOOST_NET_HAVE_MODE_T
+typedef mode_t mode_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_ASSOC_T
+typedef sctp_assoc_t sctp_assoc_type;
+#endif
+
+
+#ifdef BOOST_NET_HAVE_SEM_T
+typedef sem_t sem_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SIGSET_T
+typedef sigset_t sigset_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKLEN_T
+typedef socklen_t sockaddr_len_type;
+#else
+typedef unsigned int sockaddr_len_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_UINT32_T
+typedef uint32_t u_long_type;
+#else
+typedef unsigned int u_long_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_UINT16_T
+typedef uint16_t u_short_type;
+#else
+typedef unsigned short u_short_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_U_CHAR
+typedef u_char u_char_type;
+#else
+typedef unsigned char u_char_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_ADDRINFO_STRUCT
+typedef addrinfo addrinfo_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_DVPOLL_STRUCT
+typedef dvpoll dvpoll_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_EPOLL_EVENT_STRUCT
+typedef epoll_event epoll_event_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_GROUP_REQ_STRUCT
+typedef group_req group_req_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_GROUP_SOURCE_REQ_STRUCT
+typedef group_source_req group_source_req_type;
+#endif
+
+typedef sa_family_t family_type;
+
+#ifdef BOOST_NET_HAVE_HOSTENT_STRUCT
+typedef hostent hostent_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_IN_ADDR_STRUCT
+typedef in_addr in4_addr_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_IN6_ADDR_STRUCT
+typedef in6_addr in6_addr_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_IP_MREQ_STRUCT
+typedef ip_mreq ip4_mreq_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_IOVEC_STRUCT
+typedef iovec iovec_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_KEVENT_STRUCT
+typedef kevent kevent_type;
+#endif
+
+
+#ifdef BOOST_NET_HAVE_LINGER_STRUCT
+typedef linger linger_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_MSGHDR_STRUCT
+typedef msghdr msghdr_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_POLLFD_STRUCT
+typedef pollfd pollfd_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_ASSOCPARAMS_STRUCT
+typedef sctp_assocparams sctp_assocparams_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_EVENT_SUBSCRIBE_STRUCT
+typedef sctp_event_subscribe sctp_event_subscribe_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_INITMSG_STRUCT
+typedef sctp_initmsg sctp_initmsg_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_PADDRINFO_STRUCT
+typedef sctp_paddrinfo sctp_paddrinfo_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_PADDRPARAMS_STRUCT
+typedef sctp_paddrparams sctp_paddrparams_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_RTOINFO_STRUCT
+typedef sctp_rtoinfo sctp_rtoinfo_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_SETADAPTATION_STRUCT
+typedef sctp_setadaptation sctp_setadaptation_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_SETPEERPRIM_STRUCT
+typedef sctp_setpeerprim sctp_setpeerprim_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_SETPRIM_STRUCT
+typedef sctp_setprim sctp_setprim_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_SNDRCVINFO_STRUCT
+typedef sctp_sndrcvinfo sctp_sndrcvinfo_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SCTP_STATUS_STRUCT
+typedef sctp_status sctp_status_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SERVENT_STRUCT
+typedef servent servent_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SIGACTION_STRUCT
+typedef struct sigaction sigaction_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKADDR_STRUCT
+typedef sockaddr sockaddr_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKADDR_IN_STRUCT
+typedef sockaddr_in sockaddr_in4_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKADDR_IN6_STRUCT
+typedef sockaddr_in6 sockaddr_in6_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKADDR_STORAGE_STRUCT
+typedef sockaddr_storage sockaddr_storage_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_SOCKADDR_UN_STRUCT
+typedef sockaddr_un sockaddr_un_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_TIMESPEC_STRUCT
+typedef timespec timespec_type;
+#endif
+
+#ifdef BOOST_NET_HAVE_TIMEVAL_STRUCT
+typedef timeval timeval_type;
+#endif
+} }
+
+#endif // BOOST_NET_TYPES_H


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk