Changeset 6840


Ignore:
Timestamp:
10/17/16 14:26:41 (3 years ago)
Author:
chad
Message:

slink2ew: update libslink to 2.6

Location:
trunk/src/data_exchange/slink2ew
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/data_exchange/slink2ew/ChangeLog

    r6331 r6840  
     12016.10.17: version 2.8 
     2        - Update libslink to version 2.6. 
     3        - from libslink: Always send packet time with request if available. 
     4        - from libslink: Improved support for building on Windows. 
     5 
    162015.5.1: version 2.7 
    27        - Use slp_dtime() instead of gettimeofday() in MaxRate logic handling 
  • trunk/src/data_exchange/slink2ew/libslink/ChangeLog

    r6839 r6840  
     12016.290: version 2.6 
     2        - Change host name resolution to use getaddrinfo() on all platforms 
     3        except Windows.  Support is now nearly ubiquitous.  Still limited to 
     4        IPv4 addresses. 
     5        - Add Cygwin target to platforms and cleanup platform support. 
     6 
    172016.288: 
    28        - Replace data sample unpacking routines from qlib2 with new routines 
  • trunk/src/data_exchange/slink2ew/libslink/Makefile

    r6839 r6840  
    33# environment variables: 
    44#   CC : Specify the C compiler to use 
    5 #   GLOBALFLAGS : Specify compiler options to use 
    6  
    7 CFLAGS = $(GLOBALFLAGS) 
     5#   CFLAGS : Specify compiler options to use 
    86 
    97MAJOR_VER = 2 
  • trunk/src/data_exchange/slink2ew/libslink/Makefile.win

    r6839 r6840  
    11# 
    2 # 
    3 # Nmake File For libslink - MS Visual C++ version 
     2# Nmake file For libslink - MS Visual C/C++ 
    43# Use 'nmake -f Makefile.win' 
    54 
  • trunk/src/data_exchange/slink2ew/libslink/config.c

    r6839 r6840  
    4949  int count; 
    5050  int stacount; 
    51   int addret; 
    5251 
    5352  net[0]       = '\0'; 
     
    9796    else 
    9897    { 
    99       addret = sl_addstream (slconn, net, sta, defselect, -1, NULL); 
     98      sl_addstream (slconn, net, sta, defselect, -1, NULL); 
    10099      stacount++; 
    101100    } 
  • trunk/src/data_exchange/slink2ew/libslink/example/Makefile

    r4078 r6840  
    1414LDFLAGS = -L.. 
    1515LDLIBS = -lslink 
     16 
     17# For Windows w/ Unix-like build environments uncomment the following line 
     18# This is needed for MinGW but not for Cygwin 
     19#LDLIBS = -lslink -lws2_32 
    1620 
    1721# For SunOS/Solaris uncomment the following line 
  • trunk/src/data_exchange/slink2ew/libslink/example/Makefile.win

    r6839 r6840  
    1 # 
    21# 
    32# Nmake file for libslink example client - Windows version 
     
    109 
    1110OBJS =  slclient.obj 
    12  
    13 cflags = $(cflags) -DWIN32 
    1411 
    1512all: slclient 
  • trunk/src/data_exchange/slink2ew/libslink/libslink.h

    r6839 r6840  
    3232#include "slplatform.h" 
    3333 
    34 #define LIBSLINK_VERSION "2.6dev" 
    35 #define LIBSLINK_RELEASE "2016.288" 
     34#define LIBSLINK_VERSION "2.6" 
     35#define LIBSLINK_RELEASE "2016.290" 
    3636 
    3737#define SLRECSIZE           512      /* Default Mini-SEED record size */ 
  • trunk/src/data_exchange/slink2ew/libslink/slplatform.c

    r6839 r6840  
    44 * Platform portability routines. 
    55 * 
    6  * modified: 2016.288 
     6 * modified: 2016.290 
    77 ***************************************************************************/ 
    88 
     
    2121 * 
    2222 * Startup the network socket layer.  At the moment this is only meaningful 
    23  * for the WIN32 platform. 
     23 * for the WIN platform. 
    2424 * 
    2525 * Returns -1 on errors and 0 on success. 
     
    2828slp_sockstartup (void) 
    2929{ 
    30 #if defined(SLP_WIN32) 
     30#if defined(SLP_WIN) 
    3131  WORD wVersionRequested; 
    3232  WSADATA wsaData; 
     
    5353slp_sockconnect (SOCKET sock, struct sockaddr *inetaddr, int addrlen) 
    5454{ 
    55 #if defined(SLP_WIN32) 
     55#if defined(SLP_WIN) 
    5656  if ((connect (sock, inetaddr, addrlen)) == SOCKET_ERROR) 
    5757  { 
     
    8080slp_sockclose (SOCKET sock) 
    8181{ 
    82 #if defined(SLP_WIN32) 
     82#if defined(SLP_WIN) 
    8383  return closesocket (sock); 
    8484#else 
     
    9797slp_socknoblock (SOCKET sock) 
    9898{ 
    99 #if defined(SLP_WIN32) 
     99#if defined(SLP_WIN) 
    100100  u_long flag = 1; 
    101101 
     
    124124slp_noblockcheck (void) 
    125125{ 
    126 #if defined(SLP_WIN32) 
     126#if defined(SLP_WIN) 
    127127  if (WSAGetLastError () != WSAEWOULDBLOCK) 
    128128    return -1; 
     
    142142 * 
    143143 * Resolve IP addresses and provide parameters needed for connect(). 
    144  * On Win32 this will use gethostbyname() for portability (only newer 
    145  * Windows platforms support getaddrinfo).  On Linux (glibc2) and 
    146  * Solaris the reentrant gethostbyname_r() is used. 
    147  * 
    148  * The real solution to name resolution is to use POSIX 1003.1g 
    149  * getaddrinfo() because it is standardized, thread-safe and protocol 
    150  * independent (i.e. IPv4, IPv6, etc.).  Unfortunately it is not 
    151  * supported on many older platforms. 
    152  * 
    153  * Return 0 on success and non-zero on error. 
     144 * 
     145 * On WIN this will use the older gethostbyname() for consistent 
     146 * compatibility with older OS versions.  In the future we should be 
     147 * able to use getaddrinfo() even on Windows. 
     148 * 
     149 * On all other platforms use POSIX 1003.1g getaddrinfo() because it 
     150 * is standardized, thread-safe and protocol independent (i.e. IPv4, 
     151 * IPv6, etc.) and has broad support. 
     152 * 
     153 * Currently, this routine is limited to IPv4 addresses. 
     154 * 
     155 * Return 0 on success and non-zero on error.  On everything but WIN 
     156 * an error value is the return value of getaddrinfo(). 
    154157 ***************************************************************************/ 
    155158int 
     
    157160                 struct sockaddr *addr, size_t *addrlen) 
    158161{ 
    159 #if defined(SLP_WIN32) 
     162#if defined(SLP_WIN) 
    160163  struct hostent *result; 
    161164  struct sockaddr_in inet_addr; 
     
    175178  inet_addr.sin_addr   = *(struct in_addr *)result->h_addr_list[0]; 
    176179 
    177   *addr    = *((struct sockaddr *)&inet_addr); 
     180  memcpy (addr, &inet_addr, sizeof (struct sockaddr)); 
    178181  *addrlen = sizeof (inet_addr); 
    179182 
    180 #elif defined(SLP_GLIBC2) || defined(SLP_SOLARIS) 
    181   /* 1024 bytes should be enough for the vast majority of cases.  If 
    182      not (e.g. the node has a lot of aliases) this call will fail. */ 
    183  
    184   char buffer[1024]; 
    185   struct hostent *result; 
    186   struct hostent result_buffer; 
    187   struct sockaddr_in inet_addr; 
    188   int my_error; 
    189   long int nport; 
    190   char *tail; 
    191  
    192 #if defined(SLP_GLIBC2) 
    193   gethostbyname_r (nodename, &result_buffer, 
    194                    buffer, sizeof (buffer) - 1, 
    195                    &result, &my_error); 
    196 #endif 
    197  
    198 #if defined(SLP_SOLARIS) 
    199   result = gethostbyname_r (nodename, &result_buffer, 
    200                             buffer, sizeof (buffer) - 1, 
    201                             &my_error); 
    202 #endif 
    203  
    204   if (!result) 
    205     return my_error; 
    206  
    207   nport = strtoul (nodeport, &tail, 0); 
    208  
    209   memset (&inet_addr, 0, sizeof (inet_addr)); 
    210   inet_addr.sin_family = AF_INET; 
    211   inet_addr.sin_port   = htons ((unsigned short int)nport); 
    212   inet_addr.sin_addr   = *(struct in_addr *)result->h_addr_list[0]; 
    213  
    214   *addr       = *((struct sockaddr *)&inet_addr); 
    215   *addrlen    = sizeof (inet_addr); 
    216  
    217 #else 
    218   /* This will be used by all others, it is not properly supported 
    219      by some but this is the future of name resolution. */ 
    220  
    221   struct addrinfo *result; 
     183#else 
     184  /* getaddrinfo() will be used by all others */ 
     185  struct addrinfo *ptr    = NULL; 
     186  struct addrinfo *result = NULL; 
    222187  struct addrinfo hints; 
     188  int rv; 
    223189 
    224190  memset (&hints, 0, sizeof (hints)); 
    225   hints.ai_family   = PF_INET; 
     191  hints.ai_family   = AF_INET; 
    226192  hints.ai_socktype = SOCK_STREAM; 
    227193 
    228   if (getaddrinfo (nodename, nodeport, &hints, &result)) 
    229   { 
    230     return -1; 
    231   } 
    232  
    233   *addr    = *(result->ai_addr); 
    234   *addrlen = result->ai_addrlen; 
     194  if ((rv = getaddrinfo (nodename, nodeport, &hints, &result))) 
     195  { 
     196    return rv; 
     197  } 
     198 
     199  for (ptr = result; ptr != NULL; ptr = ptr->ai_next) 
     200  { 
     201    if (ptr->ai_family == AF_INET) 
     202    { 
     203      memcpy (addr, ptr->ai_addr, sizeof (struct sockaddr)); 
     204      *addrlen = (size_t)ptr->ai_addrlen; 
     205      break; 
     206    } 
     207  } 
    235208 
    236209  freeaddrinfo (result); 
     
    257230slp_openfile (const char *filename, char perm) 
    258231{ 
    259 #if defined(SLP_WIN32) 
     232#if defined(SLP_WIN) 
    260233  int flags = (perm == 'w') ? (_O_RDWR | _O_CREAT | _O_BINARY) : (_O_RDONLY | _O_BINARY); 
    261234  int mode  = (_S_IREAD | _S_IWRITE); 
     
    277250slp_strerror (void) 
    278251{ 
    279 #if defined(SLP_WIN32) 
     252#if defined(SLP_WIN) 
    280253  static char errorstr[100]; 
    281254 
     
    293266 * 
    294267 * Get the current time from the system as Unix/POSIX epoch time with double 
    295  * precision.  On the WIN32 platform this function has millisecond 
     268 * precision.  On the WIN platform this function has millisecond 
    296269 * resulution, on *nix platforms this function has microsecond resolution. 
    297270 * 
     
    301274slp_dtime (void) 
    302275{ 
    303 #if defined(SLP_WIN32) 
     276#if defined(SLP_WIN) 
    304277 
    305278  static const __int64 SECS_BETWEEN_EPOCHS = 11644473600; 
     
    351324slp_usleep (unsigned long int useconds) 
    352325{ 
    353 #if defined(SLP_WIN32) 
     326#if defined(SLP_WIN) 
    354327 
    355328  SleepEx ((useconds / 1000), 1); 
  • trunk/src/data_exchange/slink2ew/libslink/slplatform.h

    r6839 r6840  
    3939#endif 
    4040 
    41 #if defined(__linux__) || defined(__linux) 
     41/* C99 standard headers */ 
     42#include <stdlib.h> 
     43#include <stdio.h> 
     44#include <stdarg.h> 
     45#include <time.h> 
     46#include <string.h> 
     47#include <ctype.h> 
     48 
     49#if defined(__linux__) || defined(__linux) || defined(__CYGWIN__) 
    4250  #define SLP_LINUX 1 
     51  #define SLP_GLIBC2 1 /* Deprecated */ 
    4352 
    44   #include <stdlib.h> 
    4553  #include <unistd.h> 
    46   #include <stdarg.h> 
    4754  #include <inttypes.h> 
     55  #include <sys/time.h> 
     56  #include <sys/socket.h> 
     57  #include <netinet/in.h> 
     58  #include <errno.h> 
     59  #include <netdb.h> 
     60 
     61#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) 
     62  #define SLP_BSD 
     63  #define SLP_DARWIN 1 /* Deprecated */ 
     64 
     65  #include <unistd.h> 
     66  #include <inttypes.h> 
     67  #include <sys/time.h> 
     68  #include <errno.h> 
     69  #include <sys/types.h> 
    4870  #include <sys/socket.h> 
    4971  #include <netinet/in.h> 
    5072  #include <netdb.h> 
    51   #include <sys/time.h> 
    5273 
    5374#elif defined(__sun__) || defined(__sun) 
    5475  #define SLP_SOLARIS 1 
    5576 
    56   #include <stdlib.h> 
    5777  #include <unistd.h> 
    58   #include <stdarg.h> 
    5978  #include <inttypes.h> 
     79  #include <sys/time.h> 
    6080  #include <errno.h> 
    6181  #include <sys/types.h> 
     
    6484  #include <netinet/in.h> 
    6585  #include <netdb.h> 
    66   #include <sys/time.h> 
    6786 
    6887#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 
    69   #define SLP_WIN32 1 
     88  #define SLP_WIN 1 
     89  #define SLP_WIN32 1 /* Deprecated */ 
    7090 
    7191  #include <winsock2.h> 
     92  #include <ws2tcpip.h> 
    7293  #include <windows.h> 
    73   #include <stdarg.h> 
    7494  #include <io.h> 
     95 
     96  /* For MSVC 2012 and earlier define standard int types, otherwise use inttypes.h */ 
     97  #if defined(_MSC_VER) && _MSC_VER <= 1700 
     98    typedef signed char int8_t; 
     99    typedef unsigned char uint8_t; 
     100    typedef signed short int int16_t; 
     101    typedef unsigned short int uint16_t; 
     102    typedef signed int int32_t; 
     103    typedef unsigned int uint32_t; 
     104    typedef signed __int64 int64_t; 
     105    typedef unsigned __int64 uint64_t; 
     106  #else 
     107    #include <inttypes.h> 
     108  #endif 
     109 
     110  #if defined(_MSC_VER) 
     111    #if !defined(PRId64) 
     112      #define PRId64 "I64d" 
     113    #endif 
     114    #if !defined(SCNd64) 
     115      #define SCNd64 "I64d" 
     116    #endif 
     117  #endif 
    75118 
    76119  #define snprintf _snprintf 
    77120  #define vsnprintf _vsnprintf 
    78121  #define strncasecmp _strnicmp 
    79  
    80   typedef signed char int8_t; 
    81   typedef unsigned char uint8_t; 
    82   typedef signed short int int16_t; 
    83   typedef unsigned short int uint16_t; 
    84   typedef signed int int32_t; 
    85   typedef unsigned int uint32_t; 
    86   typedef signed __int64 int64_t; 
    87   typedef unsigned __int64 uint64_t; 
    88  
    89 #elif defined(__APPLE__) 
    90   #define SLP_DARWIN 1 
    91  
    92   #include <stdlib.h> 
    93   #include <unistd.h> 
    94   #include <stdarg.h> 
    95   #include <inttypes.h> 
    96   #include <errno.h> 
    97   #include <sys/types.h> 
    98   #include <sys/socket.h> 
    99   #include <netinet/in.h> 
    100   #include <netdb.h> 
    101   #include <sys/time.h> 
    102122 
    103123#else 
  • trunk/src/data_exchange/slink2ew/slink2ew.h

    r6331 r6840  
    55#define __SLINK2EW__ 
    66 
    7 #define VERSION "2.7" 
     7#define VERSION "2.8" 
    88 
    99#define MAXMESSAGELEN   160     /* Maximum length of a status or error  */ 
Note: See TracChangeset for help on using the changeset viewer.