OSSP CVS Repository

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

Check-in Number: 1015
Date: 2001-Sep-14 21:06:40 (local)
2001-Sep-14 19:06:40 (UTC)
User:rse
Branch:
Comment: Upgrade to the latest version of the Socket Abstraction (SA) library which is now maintained externally and will be comitted into its own module soon. This upgrade fixes the UDP protocol handling.
Tickets:
Inspections:
Files:
ossp-pkg/l2/configure.ac      1.9 -> 1.10     2 inserted, 0 deleted
ossp-pkg/l2/l2_ut_sa.ac      added-> 1.1
ossp-pkg/l2/l2_ut_sa.c      1.11 -> 1.12     14 inserted, 6 deleted
ossp-pkg/l2/l2_ut_sa.h      1.6 -> 1.7     14 inserted, 10 deleted

ossp-pkg/l2/configure.ac 1.9 -> 1.10

--- configure.ac 2001/09/14 07:44:19     1.9
+++ configure.ac 2001/09/14 19:06:40     1.10
@@ -83,6 +83,8 @@
 
 AC_CHECK_FUNCS(inet_aton inet_pton inet_ntoa inet_ntop snprintf vsnprintf)
 
+sinclude(l2_ut_sa.ac)
+
 AC_CHECK_EXTLIB([Dmalloc], dmalloc, dmalloc_debug, dmalloc.h, AC_DEFINE(WITH_DMALLOC))
 
 AC_OUTPUT(dnl


ossp-pkg/l2/l2_ut_sa.ac -> 1.1

*** /dev/null    Sat Nov 23 01:25:52 2024
--- -    Sat Nov 23 01:26:03 2024
***************
*** 0 ****
--- 1,41 ----
+ ##
+ ##  SA - OSSP Socket Abstraction Library
+ ##  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
+ ##
+ 
+ AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h netinet/in.h)
+ 
+ AC_CHECK_LIB(nsl, gethostname)
+ if test ".`echo $LIBS | grep nsl`" = .; then
+     AC_CHECK_LIB(nsl, gethostbyname)
+ fi  
+ AC_CHECK_LIB(socket, accept)
+ 
+ AC_CHECK_FUNCS(inet_aton inet_pton)
+ AC_CHECK_FUNCS(inet_ntoa inet_ntop)
+ AC_CHECK_FUNCS(snprintf vsnprintf)
+ 


ossp-pkg/l2/l2_ut_sa.c 1.11 -> 1.12

--- l2_ut_sa.c   2001/09/14 10:22:37     1.11
+++ l2_ut_sa.c   2001/09/14 19:06:40     1.12
@@ -1,10 +1,10 @@
 /*
-**  L2 - OSSP Logging Library
+**  SA - OSSP Socket Abstraction Library
 **  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 L2, a flexible logging library which
-**  can be found at http://www.ossp.org/pkg/l2/.
+**  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
@@ -24,7 +24,7 @@
 **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 **  SUCH DAMAGE.
 **
-**  l2_ut_sa.c: socket abstraction library
+**  sa.c: socket abstraction library
 */
 
 /* system headers */
@@ -46,7 +46,7 @@
 #include <arpa/inet.h>
 
 /* own headers */
-#include "l2_p.h"
+#include "l2_config.h"
 #include "l2_ut_sa.h"
 
 struct sa_addr_st {
@@ -376,11 +376,19 @@
 
 static sa_rc_t sa_socket_init(sa_t *sa, int family, int proto)
 {
+    int type;
+
     if (sa == NULL)
         return SA_ERR_ARG;
+    if (proto == IPPROTO_TCP)
+        type = SOCK_STREAM;
+    else if (proto == IPPROTO_UDP)
+        type = SOCK_DGRAM;
+    else
+        return SA_ERR_ARG;
     if (sa->sSocket != -1)
         return SA_ERR_USE;
-    if ((sa->sSocket = socket(family, SOCK_STREAM, proto)) == -1)
+    if ((sa->sSocket = socket(family, type, proto)) == -1)
         return SA_ERR_SYS;
     return SA_OK;
 }


ossp-pkg/l2/l2_ut_sa.h 1.6 -> 1.7

--- l2_ut_sa.h   2001/09/13 20:27:56     1.6
+++ l2_ut_sa.h   2001/09/14 19:06:40     1.7
@@ -1,10 +1,10 @@
 /*
-**  L2 - OSSP Logging Library
+**  SA - OSSP Socket Abstraction Library
 **  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 L2, a flexible logging library which
-**  can be found at http://www.ossp.org/pkg/l2/.
+**  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
@@ -24,11 +24,11 @@
 **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 **  SUCH DAMAGE.
 **
-**  l2_ut_sa.h: socket abstraction library
+**  sa.h: socket abstraction API
 */
 
-#ifndef __L2_UT_SA_H__
-#define __L2_UT_SA_H__
+#ifndef __SA_H__
+#define __SA_H__
 
 #include <string.h>
 #include <sys/types.h>
@@ -49,25 +49,30 @@
     SA_ERR_INT
 } sa_rc_t;
 
-sa_rc_t sa_u2a      (sa_addr_t **asaa, const char *uri, ...);
+/* address operations */
+sa_rc_t sa_u2a      (sa_addr_t **saa, const char *uri, ...);
 sa_rc_t sa_s2a      (sa_addr_t **saa, const struct sockaddr *sabuf, socklen_t salen);
 sa_rc_t sa_a2u      (const sa_addr_t *saa, char **uri);
 sa_rc_t sa_a2s      (const sa_addr_t *saa, struct sockaddr **sabuf, socklen_t *salen);
 
+/* object operations */
 sa_rc_t sa_create   (sa_t **sa);
 sa_rc_t sa_destroy  (sa_t *sa);
 
+/* parameter operations */
 sa_rc_t sa_timeout  (sa_t *sa, long sec, long usec);
 sa_rc_t sa_buffers  (sa_t *sa, size_t rsize, size_t wsize);
 
+/* 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_shutdown (sa_t *sa, char *flags);
 
+/* input/output operations */
 sa_rc_t sa_read     (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
 sa_rc_t sa_readfrom (sa_t *sa, char *buf, size_t buflen, size_t *bufdone, sa_addr_t **raddr);
 sa_rc_t sa_readline (sa_t *sa, char *buf, size_t buflen, size_t *bufdone);
@@ -75,7 +80,6 @@
 sa_rc_t sa_writeto  (sa_t *sa, const char *buf, size_t buflen, size_t *bufdone, sa_addr_t *raddr);
 sa_rc_t sa_printf   (sa_t *sa, const char *fmt, ...);
 sa_rc_t sa_flush    (sa_t *sa);
-sa_rc_t sa_shutdown (sa_t *sa, char *flags);
 
-#endif /* __L2_UT_SA_H__ */
+#endif /* __SA_H__ */
 

CVSTrac 2.0.1