OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ut_sa.c versions 1.11 and 1.12
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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;
 }

CVSTrac 2.0.1