OSSP CVS Repository

ossp - Check-in [1106]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1106
Date: 2001-Oct-08 16:47:30 (local)
2001-Oct-08 14:47:30 (UTC)
User:rse
Branch:
Comment: make SA more portable (now also works under Tru64 5.0)
Tickets:
Inspections:
Files:
ossp-pkg/sa/.cvsignore      1.3 -> 1.4     1 inserted, 0 deleted
ossp-pkg/sa/acconfig.h      added-> 1.1
ossp-pkg/sa/configure.ac      1.4 -> 1.5     3 inserted, 3 deleted
ossp-pkg/sa/sa.ac      1.3 -> 1.4     84 inserted, 30 deleted
ossp-pkg/sa/sa.h      1.13 -> 1.14    
ossp-pkg/sa/sa.h.in      added-> 1.1

ossp-pkg/sa/.cvsignore 1.3 -> 1.4

--- .cvsignore   2001/10/08 11:38:38     1.3
+++ .cvsignore   2001/10/08 14:47:30     1.4
@@ -9,3 +9,4 @@
 config.h
 sa_test
 sa-config
+sa.h


ossp-pkg/sa/acconfig.h -> 1.1

*** /dev/null    Sat Nov 23 01:12:03 2024
--- -    Sat Nov 23 01:12:05 2024
***************
*** 0 ****
--- 1,4 ----
+ 
+ /* whether socklen_t exists */
+ #undef HAVE_SOCKLEN_T
+ 


ossp-pkg/sa/configure.ac 1.4 -> 1.5

--- configure.ac 2001/10/08 11:38:38     1.4
+++ configure.ac 2001/10/08 14:47:30     1.5
@@ -30,7 +30,7 @@
 
 AC_PREREQ(2.52)
 AC_REVISION(1.0)
-AC_INIT(sa.h)
+AC_INIT(README)
 
 AC_DIVERT_PUSH(NOTICE)
 V=`./shtool version -l txt -d long VERSION`
@@ -45,10 +45,10 @@
 AC_PROG_LIBTOOL
 
 sinclude(sa.ac)
-AC_CHECK_SA
+SA_CHECK_ALL
 
 AC_CONFIG_HEADERS(config.h)
-AC_CONFIG_FILES(Makefile sa-config)
+AC_CONFIG_FILES(sa.h Makefile sa-config)
 AC_OUTPUT
 
 chmod a+x sa-config


ossp-pkg/sa/sa.ac 1.3 -> 1.4

--- sa.ac        2001/10/08 10:03:54     1.3
+++ sa.ac        2001/10/08 14:47:30     1.4
@@ -1,34 +1,85 @@
-##
-##  SA - OSSP Socket Abstraction Library
-##  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com>
-##  Copyright (c) 2001 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001 Cable & Wireless Deutschland <http://www.cw.com/de/>
-##
-##  This file is part of OSSP SA, a socket abstraction library which
-##  can be found at http://www.ossp.org/pkg/sa/.
-##
-##  Permission to use, copy, modify, and distribute this software for
-##  any purpose with or without fee is hereby granted, provided that
-##  the above copyright notice and this permission notice appear in all
-##  copies.
-##
-##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
-##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-##  SUCH DAMAGE.
-##
-##  sa.ac: socket abstraction Autoconf checks
-##
+dnl ##
+dnl ##  SA - OSSP Socket Abstraction Library
+dnl ##  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com>
+dnl ##  Copyright (c) 2001 The OSSP Project <http://www.ossp.org/>
+dnl ##  Copyright (c) 2001 Cable & Wireless Deutschland <http://www.cw.com/de/>
+dnl ##
+dnl ##  This file is part of OSSP SA, a socket abstraction library which
+dnl ##  can be found at http://www.ossp.org/pkg/sa/.
+dnl ##
+dnl ##  Permission to use, copy, modify, and distribute this software for
+dnl ##  any purpose with or without fee is hereby granted, provided that
+dnl ##  the above copyright notice and this permission notice appear in all
+dnl ##  copies.
+dnl ##
+dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+dnl ##  SUCH DAMAGE.
+dnl ##
+dnl ##  sa.ac: socket abstraction Autoconf checks
+dnl ##
 
-AC_DEFUN(AC_CHECK_SA,[
+dnl #   Check for an ANSI C typedef in a header
+dnl #   configure.in:
+dnl #     SA_CHECK_TYPEDEF(<typedef>, <header>)
+dnl #   acconfig.h:
+dnl #     #undef HAVE_<typedef>
+
+AC_DEFUN(SA_CHECK_TYPEDEF,[dnl
+    AC_REQUIRE([AC_HEADER_STDC])dnl
+    AC_MSG_CHECKING(for typedef $1)
+    AC_CACHE_VAL(ac_cv_typedef_$1,[
+        AC_EGREP_CPP(dnl
+changequote(<<,>>)dnl
+<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
+changequote([,]), [
+#include <$2>], 
+            ac_cv_typedef_$1=yes, 
+            ac_cv_typedef_$1=no
+        )
+    ])dnl
+    AC_MSG_RESULT($ac_cv_typedef_$1)
+    if test $ac_cv_typedef_$1 = yes; then
+        AC_DEFINE(HAVE_[]translit($1, [a-z], [A-Z]))
+    fi
+])
+
+dnl #   Check for socklen_t
+dnl #   configure.in:
+dnl #     SA_CHECK_SOCKLENTYPE
+
+AC_DEFUN(SA_CHECK_SOCKLENTYPE,[dnl
+    SA_CHECK_TYPEDEF(socklen_t, sys/socket.h)
+    AC_MSG_CHECKING(for fallback socklen_t)
+    AC_CACHE_VAL(ac_cv_check_socklentype, [
+        if test ".$ac_cv_typedef_socklen_t" = .yes; then
+            ac_cv_check_socklentype='socklen_t'
+        else
+            ac_cv_check_socklentype='int'
+        fi
+    ])
+    AC_MSG_RESULT([$ac_cv_check_socklentype])
+    SA_FALLBACK_SOCKLEN_T="typedef ${ac_cv_check_socklentype} socklen_t;"
+    if test ".$ac_cv_check_socklentype" = ".socklen_t"; then
+        SA_FALLBACK_SOCKLEN_T="/* $SA_FALLBACK_SOCKLEN_T */"
+    fi
+    AC_SUBST(SA_FALLBACK_SOCKLEN_T)
+])
+
+dnl #   Check for anything OSSP SA wants to know
+dnl #   configure.in:
+dnl #     SA_CHECK_ALL
+
+AC_DEFUN(SA_CHECK_ALL,[
     #   make sure libnsl and libsocket are linked in if they exist
     AC_CHECK_LIB(nsl, gethostname)
     if test ".`echo $LIBS | grep nsl`" = .; then
@@ -41,5 +92,8 @@
 
     #   check for system functions
     AC_CHECK_FUNCS(inet_aton inet_pton inet_ntoa inet_ntop snprintf)
+
+    dnl # check for network/socket size type
+    SA_CHECK_SOCKLENTYPE
 ])
 


ossp-pkg/sa/sa.h 1.13 -> 1.14



ossp-pkg/sa/sa.h.in -> 1.1

*** /dev/null    Sat Nov 23 01:12:03 2024
--- -    Sat Nov 23 01:12:05 2024
***************
*** 0 ****
--- 1,176 ----
+ /*
+ **  SA - OSSP Socket Abstraction Library
+ **  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2001 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP SA, a socket abstraction library which
+ **  can be found at http://www.ossp.org/pkg/sa/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  sa.h: socket abstraction API
+ */
+ 
+ #ifndef __SA_H__
+ #define __SA_H__
+ 
+ /* system definitions of "size_t", "socklen_t", "struct sockaddr *" */
+ #include <string.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ 
+ /* embedding support */
+ #ifdef SA_PREFIX
+ #if defined(__STDC__) || defined(__cplusplus)
+ #define __SA_CONCAT(x,y) x ## y
+ #define SA_CONCAT(x,y) __SA_CONCAT(x,y)
+ #else
+ #define __SA_CONCAT(x) x
+ #define SA_CONCAT(x,y) __SA_CONCAT(x)y
+ #endif
+ #define sa_addr_st      SA_CONCAT(SA_PREFIX,sa_addr_st)
+ #define sa_addr_t       SA_CONCAT(SA_PREFIX,sa_addr_t)
+ #define sa_rc_t         SA_CONCAT(SA_PREFIX,sa_rc_t)
+ #define sa_st           SA_CONCAT(SA_PREFIX,sa_st)
+ #define sa_t            SA_CONCAT(SA_PREFIX,sa_t)
+ #define sa_addr_create  SA_CONCAT(SA_PREFIX,sa_addr_create)
+ #define sa_addr_destroy SA_CONCAT(SA_PREFIX,sa_addr_destroy)
+ #define sa_addr_u2a     SA_CONCAT(SA_PREFIX,sa_addr_u2a)
+ #define sa_addr_s2a     SA_CONCAT(SA_PREFIX,sa_addr_s2a)
+ #define sa_addr_a2u     SA_CONCAT(SA_PREFIX,sa_addr_a2u)
+ #define sa_addr_a2s     SA_CONCAT(SA_PREFIX,sa_addr_a2s)
+ #define sa_create       SA_CONCAT(SA_PREFIX,sa_create)
+ #define sa_destroy      SA_CONCAT(SA_PREFIX,sa_destroy)
+ #define sa_type         SA_CONCAT(SA_PREFIX,sa_type)
+ #define sa_timeout      SA_CONCAT(SA_PREFIX,sa_timeout)
+ #define sa_buffers      SA_CONCAT(SA_PREFIX,sa_buffers)
+ #define sa_bind         SA_CONCAT(SA_PREFIX,sa_bind)
+ #define sa_connect      SA_CONCAT(SA_PREFIX,sa_connect)
+ #define sa_listen       SA_CONCAT(SA_PREFIX,sa_listen)
+ #define sa_accept       SA_CONCAT(SA_PREFIX,sa_accept)
+ #define sa_getremote    SA_CONCAT(SA_PREFIX,sa_getremote)
+ #define sa_getlocal     SA_CONCAT(SA_PREFIX,sa_getlocal)
+ #define sa_getfd        SA_CONCAT(SA_PREFIX,sa_getfd)
+ #define sa_shutdown     SA_CONCAT(SA_PREFIX,sa_shutdown)
+ #define sa_read         SA_CONCAT(SA_PREFIX,sa_read)
+ #define sa_readln       SA_CONCAT(SA_PREFIX,sa_readln)
+ #define sa_write        SA_CONCAT(SA_PREFIX,sa_write)
+ #define sa_writef       SA_CONCAT(SA_PREFIX,sa_writef)
+ #define sa_flush        SA_CONCAT(SA_PREFIX,sa_flush)
+ #define sa_recv         SA_CONCAT(SA_PREFIX,sa_recv)
+ #define sa_send         SA_CONCAT(SA_PREFIX,sa_send)
+ #endif
+ 
+ /* fallback for POSIX socklen_t */
+ @SA_FALLBACK_SOCKLEN_T@
+ 
+ /* socket address abstraction object type */
+ struct sa_addr_st;
+ typedef struct sa_addr_st sa_addr_t;
+ 
+ /* socket abstraction object type */
+ struct sa_st;
+ typedef struct sa_st sa_t;
+ 
+ /* socket connection types */
+ typedef enum {
+     SA_TYPE_STREAM,
+     SA_TYPE_DATAGRAM
+ } sa_type_t;
+ 
+ /* return codes */
+ typedef enum {
+     SA_OK,      /* everything ok */
+     SA_ERR_ARG, /* invalid argument (wrong parameter) */
+     SA_ERR_USE, /* invalid use (wrong context) */
+     SA_ERR_MEM, /* out of memory */
+     SA_ERR_SYS, /* system error (see errno) */
+     SA_ERR_EOF, /* end of file/socket communication */
+     SA_ERR_INT  /* internal error */
+ } sa_rc_t;
+ 
+ /* list of timeouts */
+ typedef enum {
+     SA_TIMEOUT_ALL      = -1,
+     SA_TIMEOUT_ACCEPT   = 0,
+     SA_TIMEOUT_CONNECT  = 1,
+     SA_TIMEOUT_READ     = 2,
+     SA_TIMEOUT_WRITE    = 3,
+     SA_TIMEOUT_RECV     = 4,
+     SA_TIMEOUT_SEND     = 5
+ } sa_timeout_t;
+ 
+ /* list of system calls */
+ typedef enum {
+     SA_SYSCALL_CONNECT,
+     SA_SYSCALL_ACCEPT,
+     SA_SYSCALL_SELECT,
+     SA_SYSCALL_READ,
+     SA_SYSCALL_WRITE,
+     SA_SYSCALL_RECVFROM,
+     SA_SYSCALL_SENDTO
+ } sa_syscall_t;
+ 
+ /* error handling operations */
+ sa_rc_t sa_error        (sa_t *sa, sa_rc_t rv, char **str);
+ 
+ /* address object operations */
+ sa_rc_t sa_addr_create  (sa_addr_t **saa);
+ sa_rc_t sa_addr_destroy (sa_addr_t *saa);
+ 
+ /* address operations */
+ sa_rc_t sa_addr_u2a     (sa_addr_t *saa, const char *uri, ...);
+ sa_rc_t sa_addr_s2a     (sa_addr_t *saa, const struct sockaddr *sabuf, socklen_t salen);
+ sa_rc_t sa_addr_a2u     (sa_addr_t *saa, char **uri);
+ sa_rc_t sa_addr_a2s     (sa_addr_t *saa, struct sockaddr **sabuf, socklen_t *salen);
+ 
+ /* socket object operations */
+ sa_rc_t sa_create       (sa_t **sa);
+ sa_rc_t sa_destroy      (sa_t *sa);
+ 
+ /* socket parameter operations */
+ sa_rc_t sa_type         (sa_t *sa, sa_type_t type);
+ sa_rc_t sa_timeout      (sa_t *sa, sa_timeout_t id, long sec, long usec);
+ sa_rc_t sa_buffers      (sa_t *sa, size_t rsize, size_t wsize);
+ sa_rc_t sa_syscall      (sa_t *sa, sa_syscall_t id, void (*fptr)(), void *fctx);
+ 
+ /* socket connection operations */
+ sa_rc_t sa_bind         (sa_t *sa, sa_addr_t *laddr);
+ sa_rc_t sa_connect      (sa_t *sa, sa_addr_t *raddr);
+ sa_rc_t sa_listen       (sa_t *sa, int backlog);
+ sa_rc_t sa_accept       (sa_t *sa, sa_addr_t **caddr, sa_t **csa);
+ sa_rc_t sa_getremote    (sa_t *sa, sa_addr_t **raddr);
+ sa_rc_t sa_getlocal     (sa_t *sa, sa_addr_t **laddr);
+ sa_rc_t sa_getfd        (sa_t *sa, int *fd);
+ sa_rc_t sa_shutdown     (sa_t *sa, char *flags);
+ 
+ /* socket input/output operations (stream communication) */
+ sa_rc_t sa_read         (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
+ sa_rc_t sa_readln       (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
+ sa_rc_t sa_write        (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone);
+ sa_rc_t sa_writef       (sa_t *sa, const char *fmt, ...);
+ sa_rc_t sa_flush        (sa_t *sa);
+ 
+ /* socket input/output operations (datagram communication) */
+ sa_rc_t sa_recv         (sa_t *sa, char *buf, size_t buflen, size_t *bufdone, sa_addr_t **raddr);
+ sa_rc_t sa_send         (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone, sa_addr_t *raddr);
+ 
+ #endif /* __SA_H__ */
+ 

CVSTrac 2.0.1