(file) Return to Network.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

File: [Pegasus] / pegasus / src / Pegasus / Common / Network.h (download)
Revision: 1.6, Wed Oct 4 10:20:36 2006 UTC (17 years, 9 months ago) by thilo.boehm
Branch: MAIN
CVS Tags: TASK-TASK-BUG4011_WinLocalConnect-branch-New-root, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_to_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_out_from_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_to_trunk, TASK-TASK-BUG4011_WinLocalConnect-branch-New-merged_in_from_branch, TASK-TASK-BUG4011_WinLocalConnect-branch-New-branch, TASK-PEP268_SSLClientCertificatePropagation-root, TASK-PEP268_SSLClientCertificatePropagation-merged_out_to_branch, TASK-PEP268_SSLClientCertificatePropagation-merged_out_from_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_to_trunk, TASK-PEP268_SSLClientCertificatePropagation-merged_in_from_branch, TASK-PEP268_SSLClientCertificatePropagation-branch, TASK-PEP267_SLPReregistrationSupport-root, TASK-PEP267_SLPReregistrationSupport-merging_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_to_branch, TASK-PEP267_SLPReregistrationSupport-merged_out_from_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_to_trunk, TASK-PEP267_SLPReregistrationSupport-merged_in_from_branch, TASK-PEP267_SLPReregistrationSupport-branch, TASK-Bugs5690_3913_RemoteCMPI-root, TASK-Bugs5690_3913_RemoteCMPI-merged_out_to_branch, TASK-Bugs5690_3913_RemoteCMPI-merged_out_from_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_to_trunk, TASK-Bugs5690_3913_RemoteCMPI-merged_in_from_branch, TASK-Bugs5690_3913_RemoteCMPI-branch, TASK-BUG4011_WinLocalConnect-branch-New
Changes since 1.5: +47 -3 lines
BUG#: 5638
TITLE: z/OS: Cimserver does not reconnect after restart of the TCPIP stack

DESCRIPTION: If an acceptor connection is broken, the socket is new created.

//%2006////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_Network_h
#define Pegasus_Network_h

#include <Pegasus/Common/Config.h>

//==============================================================================
//
// Network.h
//
//     This file includes network-related system-header files. Please include
//     this file directly rather than including system headers directly. If
//     special inclusions are necessary for any platform, please add them to
//     this file rather than other files. The reason for this file is to limit 
//     platform-specific conditional compilation expressions to only a few 
//     well-known header files.
// 
//==============================================================================

//------------------------------------------------------------------------------
//
// PEGASUS_OS_TYPE_WINDOWS network system header files
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_TYPE_WINDOWS
#   ifdef FD_SETSIZE
#       error 
	    "<Pegasus/Common/Network.h>: FD_SETSIZE is already defined. This "
	    "file must be included prior to any header file that defines "
	    "FD_SETSIZE, such as <windows.h>, <winsock.h>, or winsock2.h>."
#   endif
#   define FD_SETSIZE 1024
#   include <windows.h>
#   ifndef _WINSOCKAPI_
#       include <winsock2.h>
#   endif
#   include <wincrypt.h>
#endif

//------------------------------------------------------------------------------
//
// PEGASUS_OS_TYPE_UNIX or PEGASUS_OS_VMS network system header files.
//
//------------------------------------------------------------------------------

#if defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS)
#   include <errno.h>
#   include <sys/types.h>
#   include <fcntl.h>
#   include <netdb.h>
#   include <netinet/in.h>
#   include <arpa/inet.h>
#   include <sys/socket.h>
#   include <sys/time.h>
#   include <net/if.h>
#   include <sys/ioctl.h>
#   ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
#       include <unistd.h>
#       include <sys/un.h>
#   endif
#   ifdef PEGASUS_OS_OS400
#       include <unistd.cleinc>
#   else
#       include <unistd.h>
#   endif
#   ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
#       ifndef TCP_NODELAY
#           define TCP_NODELAY 1
#       endif
#   else
#       include <netinet/tcp.h>
#   endif
#endif

//------------------------------------------------------------------------------
//
// PEGASUS_SOCKET_ERROR
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_TYPE_WINDOWS
#   define PEGASUS_SOCKET_ERROR SOCKET_ERROR
#else
#   define PEGASUS_SOCKET_ERROR (-1)
#endif

//------------------------------------------------------------------------------
//
// PEGASUS_NETWORK_TCPIP_STOPPED
// 
// This return code indicates that the transpor layer is 
// stopped and the socket is invalid. The socket must created again.
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_ZOS
#   define PEGASUS_NETWORK_TCPIP_STOPPED EIO
#else
#   define PEGASUS_NETWORK_TCPIP_STOPPED 0
#endif

//------------------------------------------------------------------------------
//
// PEGASUS_NETWORK_TCPIP_TRYAGAIN
//  
// This return code indicates that the transport layer is
// temporary unavailable and the program can try again.
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_ZOS
#   define PEGASUS_NETWORK_TCPIP_TRYAGAIN EAGAIN
#else
#   define PEGASUS_NETWORK_TCPIP_TRYAGAIN 0
#endif

//------------------------------------------------------------------------------
//
// PEGASUS_NETWORK_TRYAGAIN
//  
// This return code indicates that the network function 
// should be tried again by the program.
//
//------------------------------------------------------------------------------

#if !defined(PEGASUS_OS_TYPE_WINDOWS)
#   define PEGASUS_NETWORK_TRYAGAIN EAGAIN
#else
#   define PEGASUS_NETWORK_TRYAGAIN 0
#endif

////////////////////////////////////////////////////////////////////////////////
//
// getSocketError()
//
////////////////////////////////////////////////////////////////////////////////

static inline int getSocketError()
{
#ifdef PEGASUS_OS_TYPE_WINDOWS
    return WSAGetLastError();
#else
    return errno;
#endif
}

//------------------------------------------------------------------------------
//
// PEGASUS_INVALID_SOCKET
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_TYPE_WINDOWS
#   define PEGASUS_INVALID_SOCKET INVALID_SOCKET
#else
#   define PEGASUS_INVALID_SOCKET (-1)
#endif

//------------------------------------------------------------------------------
//
// SocketHandle
//
//------------------------------------------------------------------------------

#ifdef PEGASUS_OS_TYPE_WINDOWS
typedef SOCKET SocketHandle;
#else
typedef int SocketHandle;
#endif

//------------------------------------------------------------------------------
//
// SocketLength
//
//------------------------------------------------------------------------------

#if defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) || \
    defined(PEGASUS_PLATFORM_SOLARIS_SPARC_GNU) || \
    defined(PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX) || \
    defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC)
    typedef int SocketLength;
#elif defined(PEGASUS_PLATFORM_VMS_ALPHA_DECCXX) || \
    defined(PEGASUS_PLATFORM_VMS_IA64_DECCXX) || \
    defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
    typedef size_t SocketLength;
#elif defined(PEGASUS_PLATFORM_HPUX_IA64_ACC) && \
    !defined(_XOPEN_SOURCE_EXTENDED)
    typedef int SocketLength;
#elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) && \
    !defined(_XOPEN_SOURCE_EXTENDED)
    typedef int SocketLength;
#elif defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) && \
    defined(SUNOS_5_6)
    typedef int SocketLength;
#else
    typedef socklen_t SocketLength;
#endif

#endif  /* Pegasus_Network_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2