Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/socket/qnativesocketengine_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtNetwork module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5353// We mean it.
    5454//
    55 
    5655#include "QtNetwork/qhostaddress.h"
    5756#include "private/qabstractsocketengine_p.h"
    5857#ifndef Q_OS_WIN
    59 #include "qplatformdefs.h"
     58#  include "qplatformdefs.h"
     59#else
     60#  include <winsock2.h>
     61#endif
     62
     63#ifdef Q_OS_SYMBIAN
     64#include <private/qeventdispatcher_symbian_p.h>
     65#include <unistd.h>
    6066#endif
    6167
    6268QT_BEGIN_NAMESPACE
    6369
    64 #ifndef Q_OS_WIN
    65 // Almost always the same. If not, specify in qplatformdefs.h.
    66 #if !defined(QT_SOCKOPTLEN_T)
    67 # define QT_SOCKOPTLEN_T QT_SOCKLEN_T
    68 #endif
    69 
    70 // Tru64 redefines accept -> _accept with _XOPEN_SOURCE_EXTENDED
    71 static inline int qt_socket_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen)
    72 { return ::accept(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen)); }
    73 #if defined(accept)
    74 # undef accept
    75 #endif
    76 
    77 // UnixWare 7 redefines listen -> _listen
    78 static inline int qt_socket_listen(int s, int backlog)
    79 { return ::listen(s, backlog); }
    80 #if defined(listen)
    81 # undef listen
    82 #endif
    83 
    84 // UnixWare 7 redefines socket -> _socket
    85 static inline int qt_socket_socket(int domain, int type, int protocol)
    86 { return ::socket(domain, type, protocol); }
    87 #if defined(socket)
    88 # undef socket
    89 #endif
    90 
    91 #endif
     70// Use our own defines and structs which we know are correct
     71#  define QT_SS_MAXSIZE 128
     72#  define QT_SS_ALIGNSIZE (sizeof(qint64))
     73#  define QT_SS_PAD1SIZE (QT_SS_ALIGNSIZE - sizeof (short))
     74#  define QT_SS_PAD2SIZE (QT_SS_MAXSIZE - (sizeof (short) + QT_SS_PAD1SIZE + QT_SS_ALIGNSIZE))
     75struct qt_sockaddr_storage {
     76      short ss_family;
     77      char __ss_pad1[QT_SS_PAD1SIZE];
     78      qint64 __ss_align;
     79      char __ss_pad2[QT_SS_PAD2SIZE];
     80};
     81
     82// sockaddr_in6 size changed between old and new SDK
     83// Only the new version is the correct one, so always
     84// use this structure.
     85struct qt_in6_addr {
     86    quint8 qt_s6_addr[16];
     87};
     88struct qt_sockaddr_in6 {
     89    short   sin6_family;            /* AF_INET6 */
     90    quint16 sin6_port;              /* Transport level port number */
     91    quint32 sin6_flowinfo;          /* IPv6 flow information */
     92    struct  qt_in6_addr sin6_addr;  /* IPv6 address */
     93    quint32 sin6_scope_id;          /* set of interfaces for a scope */
     94};
     95
     96union qt_sockaddr {
     97    sockaddr a;
     98    sockaddr_in a4;
     99    qt_sockaddr_in6 a6;
     100    qt_sockaddr_storage storage;
     101};
    92102
    93103class QNativeSocketEnginePrivate;
     
    125135    bool hasPendingDatagrams() const;
    126136    qint64 pendingDatagramSize() const;
     137
     138
    127139
    128140    qint64 receiveBufferSize() const;
Note: See TracChangeset for help on using the changeset viewer.