Compare commits
10 commits
79936bfa0c
...
217eb50b76
Author | SHA1 | Date | |
---|---|---|---|
|
217eb50b76 | ||
|
3af0de3f6e | ||
|
f417546646 | ||
|
4fa30c8a21 | ||
|
d07ea0c651 | ||
|
fe9ea981c9 | ||
|
60c1ad9248 | ||
|
f3ed74b84f | ||
|
5328e4aa85 | ||
|
9d1d0214e5 |
19 changed files with 239 additions and 75 deletions
17
Makefile.am
17
Makefile.am
|
@ -1,3 +1,16 @@
|
||||||
SUBDIRS = src
|
SUBDIRS = lib
|
||||||
|
|
||||||
|
m4datadir = $(datadir)/aclocal
|
||||||
|
m4data_DATA = xsock.m4
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = xsock.pc
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
xsock.pc.in \
|
||||||
|
doc \
|
||||||
|
INSTALL \
|
||||||
|
README \
|
||||||
|
Doxyfile \
|
||||||
|
autogen.sh
|
||||||
|
|
||||||
EXTRA_DIST = doc INSTALL README Doxyfile autogen.sh
|
|
||||||
|
|
22
configure.in
22
configure.in
|
@ -1,14 +1,14 @@
|
||||||
|
|
||||||
AC_INIT([xsock], [0.5], [shamox@free.fr,glenux@gmail.com])
|
AC_INIT([xsock], [0.9.0], [shamox@free.fr,glenux@gmail.com])
|
||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([xsock],[0.5])
|
AM_INIT_AUTOMAKE([xsock],[0.9.0])
|
||||||
|
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
AC_CONFIG_SRCDIR([src/XSock.h])
|
AC_CONFIG_SRCDIR([lib/xsock.h])
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
|
@ -26,10 +26,22 @@ AC_HEADER_STDC([stdio.h stdlib.h string.h unistd.h math.h time.h fcntl.h sys/sta
|
||||||
|
|
||||||
AC_CHECK_HEADERS([iostream sstream],,AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
|
AC_CHECK_HEADERS([iostream sstream],,AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
|
||||||
|
|
||||||
|
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile src/Makefile])
|
XSOCK_LIB_CURRENT=0
|
||||||
|
XSOCK_LIB_REVISION=9
|
||||||
|
XSOCK_LIB_AGE=0
|
||||||
|
|
||||||
|
AC_SUBST(XSOCK_LIB_CURRENT)
|
||||||
|
AC_SUBST(XSOCK_LIB_REVISION)
|
||||||
|
AC_SUBST(XSOCK_LIB_AGE)
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
lib/Makefile
|
||||||
|
xsock.pc
|
||||||
|
])
|
||||||
|
#libvorbis.spec
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
|
28
lib/Makefile.am
Normal file
28
lib/Makefile.am
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
SUBDIRS = .
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libxsock.la
|
||||||
|
|
||||||
|
INCLUDES= \
|
||||||
|
-I$(top_srcdir)/include
|
||||||
|
|
||||||
|
#bin_PROGRAMS = libulm.o
|
||||||
|
|
||||||
|
libxsock_la_SOURCES = \
|
||||||
|
xsock.cpp \
|
||||||
|
xsock_tcp.cpp \
|
||||||
|
xsock_udp.cpp \
|
||||||
|
xsock_udp_reliable.cpp
|
||||||
|
|
||||||
|
libxsock_la_SOURCES += \
|
||||||
|
xsock.h \
|
||||||
|
xsock_errors.h \
|
||||||
|
xsock_global.h \
|
||||||
|
xsock_iface.h
|
||||||
|
|
||||||
|
libxsock_la_CFLAGS = -DTRACE -static
|
||||||
|
|
||||||
|
libxsock_la_LDFLAGS = \
|
||||||
|
-no-undefined \
|
||||||
|
-version-info @XSOCK_LIB_CURRENT@:@XSOCK_LIB_REVISION@:@XSOCK_LIB_AGE@
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "XSock.h"
|
#include "xsock.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \def VERBOSE Active ou pas le mode verbeux
|
* \def VERBOSE Active ou pas le mode verbeux
|
|
@ -6,9 +6,9 @@
|
||||||
#ifndef _XIONFS_XSOCK
|
#ifndef _XIONFS_XSOCK
|
||||||
#define _XIONFS_XSOCK 1
|
#define _XIONFS_XSOCK 1
|
||||||
|
|
||||||
#include "XSock_errors.h"
|
#include "xsock_errors.h"
|
||||||
#include "XSock_global.h"
|
#include "xsock_global.h"
|
||||||
#include "XSock_iface.h"
|
#include "xsock_iface.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace XSockExcept;
|
using namespace XSockExcept;
|
35
lib/xsock_errors.h
Normal file
35
lib/xsock_errors.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#ifndef _XSOCK_ERRORS
|
||||||
|
#define _XSOCK_ERRORS 1
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
namespace XSockExcept {
|
||||||
|
class eXSockExcept : public std::exception { };
|
||||||
|
class eInvalidSocket : public eXSockExcept { };
|
||||||
|
class eUnknownProtocol : public eXSockExcept { };
|
||||||
|
class eUnableToListen : public eXSockExcept { };
|
||||||
|
class eUnableToConnect : public eXSockExcept { };
|
||||||
|
class eUnableToAccept : public eXSockExcept { };
|
||||||
|
class eUnableToBind : public eXSockExcept { };
|
||||||
|
class eSockUnreadable : public eXSockExcept { };
|
||||||
|
class eSockUnwritable : public eXSockExcept { };
|
||||||
|
class eUnknownXSockRole : public eXSockExcept { };
|
||||||
|
class eUnableToResolveName : public eXSockExcept { };
|
||||||
|
class eXSockNotReady : public eXSockExcept { };
|
||||||
|
class eConnectionClosedByPeer : public eXSockExcept { };
|
||||||
|
class eDeadLock : public eXSockExcept { };
|
||||||
|
class eUnableToLock : public eXSockExcept { };
|
||||||
|
class eUnableToUnlock : public eXSockExcept { };
|
||||||
|
class eUnableToCloseFile : public eXSockExcept { };
|
||||||
|
class eUnableToOpenFile : public eXSockExcept { };
|
||||||
|
class eUnableToStatFile : public eXSockExcept { };
|
||||||
|
class eUnableToOpen2ndFile : public eXSockExcept { };
|
||||||
|
class eUnableToCreateFile : public eXSockExcept { };
|
||||||
|
class eUnableToDeleteFile : public eXSockExcept { };
|
||||||
|
class eUnableToReadFile : public eXSockExcept { };
|
||||||
|
class eUnableToWriteFile : public eXSockExcept { };
|
||||||
|
/* définition des exceptions ici */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "XSock.h"
|
#include "xsock.h"
|
||||||
|
|
||||||
#define VERBOSE 0
|
#define VERBOSE 0
|
||||||
#define VERBOSETCP 0
|
#define VERBOSETCP 0
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "XSock.h"
|
#include "xsock.h"
|
||||||
|
|
||||||
// constantes utilisées dans XSock.cpp et dans XSockUDP.cpp
|
// constantes utilisées dans XSock.cpp et dans XSockUDP.cpp
|
||||||
#define NBPORTSPUB 64512
|
#define NBPORTSPUB 64512
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#include "XSock.h"
|
#include "xsock.h"
|
||||||
|
|
||||||
// constantes utilisées dans XSock.cpp et dans XSockUDP_RELIABLE.cpp
|
// constantes utilisées dans XSock.cpp et dans XSockUDP_RELIABLE.cpp
|
||||||
#define NBPORTSPUB 64512
|
#define NBPORTSPUB 64512
|
13
libxsock.spec
Normal file
13
libxsock.spec
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Name: libxsock
|
||||||
|
Version: 0.9.1
|
||||||
|
Release: 0.lsr.1
|
||||||
|
Summary: The XSock ...
|
||||||
|
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
License: LGPL
|
||||||
|
URL: http://repository.glenux.ath.cx/
|
||||||
|
Vendor: LSR <lsr-devel@...>
|
||||||
|
Source: http://www....
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||||
|
|
||||||
|
#
|
|
@ -1,28 +0,0 @@
|
||||||
SUBDIRS = .
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libXSock.la
|
|
||||||
|
|
||||||
#bin_PROGRAMS = libulm.o
|
|
||||||
|
|
||||||
libXSock_la_SOURCES = \
|
|
||||||
XSock.cpp \
|
|
||||||
XSockTCP.cpp \
|
|
||||||
XSockUDP.cpp \
|
|
||||||
XSockUDP_RELIABLE.cpp
|
|
||||||
|
|
||||||
libXSock_la_SOURCES += \
|
|
||||||
xsock.h \
|
|
||||||
introspect.h \
|
|
||||||
command.h \
|
|
||||||
macrocommand.h \
|
|
||||||
singleton.h \
|
|
||||||
identifiable.h
|
|
||||||
|
|
||||||
libXSock_la_CFLAGS = -DTRACE -static
|
|
||||||
|
|
||||||
libXSock_la_LDFLAGS = \
|
|
||||||
-version-info 0:1:0 -no-undefined
|
|
||||||
|
|
||||||
INCLUDES= \
|
|
||||||
-I../
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
#ifndef _XSOCK_ERRORS
|
|
||||||
#define _XSOCK_ERRORS 1
|
|
||||||
|
|
||||||
namespace XSockExcept {
|
|
||||||
class eXSockExcept { };
|
|
||||||
class eInvalidSocket : eXSockExcept { };
|
|
||||||
class eUnknownProtocol : eXSockExcept { };
|
|
||||||
class eUnableToListen : eXSockExcept { };
|
|
||||||
class eUnableToConnect : eXSockExcept { };
|
|
||||||
class eUnableToAccept : eXSockExcept { };
|
|
||||||
class eUnableToBind : eXSockExcept { };
|
|
||||||
class eSockUnreadable : eXSockExcept { };
|
|
||||||
class eSockUnwritable : eXSockExcept { };
|
|
||||||
class eUnknownXSockRole : eXSockExcept { };
|
|
||||||
class eUnableToResolveName : eXSockExcept { };
|
|
||||||
class eXSockNotReady : eXSockExcept { };
|
|
||||||
class eConnectionClosedByPeer : eXSockExcept { };
|
|
||||||
class eDeadLock : eXSockExcept { };
|
|
||||||
class eUnableToLock : eXSockExcept { };
|
|
||||||
class eUnableToUnlock : eXSockExcept { };
|
|
||||||
class eUnableToCloseFile : eXSockExcept { };
|
|
||||||
class eUnableToOpenFile : eXSockExcept { };
|
|
||||||
class eUnableToStatFile : eXSockExcept { };
|
|
||||||
class eUnableToOpen2ndFile : eXSockExcept { };
|
|
||||||
class eUnableToCreateFile : eXSockExcept { };
|
|
||||||
class eUnableToDeleteFile : eXSockExcept { };
|
|
||||||
class eUnableToReadFile : eXSockExcept { };
|
|
||||||
class eUnableToWriteFile : eXSockExcept { };
|
|
||||||
/* définition des exceptions ici */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
110
xsock.m4
Normal file
110
xsock.m4
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
# Configure paths for libxsock
|
||||||
|
# Glenn Rolland <glenux@gmail.com> 2006-01-10
|
||||||
|
# Shamelessly inspired from libvorbis-1.1.2
|
||||||
|
|
||||||
|
dnl GYR_PATH_XSOCK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||||
|
dnl Test for libxsock, and define XSOCK_CFLAGS and XSOCK_LIBS
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([GYR_PATH_XSOCK],
|
||||||
|
[dnl
|
||||||
|
dnl Get the cflags and libraries
|
||||||
|
dnl
|
||||||
|
AC_ARG_WITH(xsock,[ --with-xsock=PFX Prefix where libxsock is installed (optional)], xsock_prefix="$withval", xsock_prefix="")
|
||||||
|
AC_ARG_WITH(xsock-libraries,[ --with-xsock-libraries=DIR Directory where libxsock is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
|
||||||
|
AC_ARG_WITH(xsock-includes,[ --with-xsock-includes=DIR Directory where libxsock header files are installed (optional)], xsock_includes="$withval", xsock_includes="")
|
||||||
|
AC_ARG_ENABLE(xsocktest, [ --disable-xsocktest Do not try to compile and run a test XSock program],, enable_xsocktest=yes)
|
||||||
|
|
||||||
|
if test "x$xsock_libraries" != "x" ; then
|
||||||
|
XSOCK_LIBS="-L$xsock_libraries"
|
||||||
|
elif test "x$sock_prefix" != "x" ; then
|
||||||
|
XSOCK_LIBS="-L$xsock_prefix/lib"
|
||||||
|
elif test "x$prefix" != "xNONE" ; then
|
||||||
|
XSOCK_LIBS="-L$prefix/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
XSOCK_LIBS="$XSOCK_LIBS -lxsock"
|
||||||
|
|
||||||
|
if test "x$xsock_includes" != "x" ; then
|
||||||
|
XSOCK_CFLAGS="-I$xsock_includes"
|
||||||
|
elif test "x$xsock_prefix" != "x" ; then
|
||||||
|
XSOCK_CFLAGS="-I$xsock_prefix/include"
|
||||||
|
elif test "x$prefix" != "xNONE"; then
|
||||||
|
XSOCK_CFLAGS="-I$prefix/include"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for XSock)
|
||||||
|
no_xsock=""
|
||||||
|
|
||||||
|
if test "x$enable_xsock" = "xyes" ; then
|
||||||
|
ac_save_CFLAGS="$CFLAGS"
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
CFLAGS="$CFLAGS $XSOCK_CFLAGS"
|
||||||
|
LIBS="$LIBS $XSOCK_LIBS"
|
||||||
|
dnl
|
||||||
|
dnl New check if the installed XSock is sufficiently new
|
||||||
|
dnl
|
||||||
|
rm -f conf.xsocktest
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xsock/xsock.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
XSock sock_serv_tcp(XSock::CLIENT, XSock::TCP);
|
||||||
|
sock_serv_tcp.port(20500);
|
||||||
|
sock_serv_tcp.ip(INADDR_LOOPBACK);
|
||||||
|
sock_serv_tcp.launch();
|
||||||
|
|
||||||
|
// XSock sock_serv_udp_std(XSock::CLIENT, XSock::UDP);
|
||||||
|
//XSock sock_serv_udp_reliable(XSock::CLIENT, XSock::UDP);
|
||||||
|
|
||||||
|
system("touch conf.xsocktest");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
],, no_xsock=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||||
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$no_xsock" = "x" ; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
ifelse([$1], , :, [$1])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
if test -f conf.xsocktest ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "*** Could not run XSock test program, checking why..."
|
||||||
|
CFLAGS="$CFLAGS $XSOCK_CFLAGS"
|
||||||
|
LIBS="$LIBS $XSOCK_LIBS"
|
||||||
|
AC_TRY_LINK([
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <xsock/xsock.h>
|
||||||
|
], [ return 0; ],
|
||||||
|
[ echo "*** The test program compiled, but dit not run. This usually means"
|
||||||
|
echo "*** that the run-time linker is not finding XSock or finding the wrong"
|
||||||
|
echo "*** version of XSock. If it is not finding XSock, you'll need to set your"
|
||||||
|
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||||
|
echo "*** to the installed location. Also, make sure you have run ldconfig if that"
|
||||||
|
echo "*** is required on your system"
|
||||||
|
echo "***"
|
||||||
|
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||||
|
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||||
|
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||||
|
echo "*** exact error that occured. This usually means XSock was incorrectly installed"
|
||||||
|
echo "*** or that you have moved XSock since it was installed." ])
|
||||||
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
fi
|
||||||
|
XSOCK_CFLAGS=""
|
||||||
|
XSOCK_LIBS=""
|
||||||
|
ifelse([$2], , :, [$2])
|
||||||
|
fi
|
||||||
|
AC_SUBST(XSOCK_CFLAGS)
|
||||||
|
AC_SUBST(XSOCK_LIBS)
|
||||||
|
rm -f conf.xsocktest
|
||||||
|
])
|
||||||
|
|
14
xsock.pc.in
Normal file
14
xsock.pc.in
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# libxsock pkg-config source file
|
||||||
|
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: xsock
|
||||||
|
Description: xsock is an object implementation of C sockets
|
||||||
|
Version: @VERSION@
|
||||||
|
Requires:
|
||||||
|
Conflicts:
|
||||||
|
Libs: -L${libdir} -lxsock
|
||||||
|
Cflags: -I${includedir}
|
Loading…
Add table
Reference in a new issue