tests/auto/qtcpsocket/stressTest/Test.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the test suite of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    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.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 #ifndef TEST_H
       
    42 #define TEST_H
       
    43 
       
    44 //------------------------------------------------------------------------------
       
    45 // Qt
       
    46 #ifdef QT3_SUPPORT
       
    47 #include <Q3ServerSocket>
       
    48 #include <Q3Socket>
       
    49 #endif
       
    50 
       
    51 #include <QTcpServer>
       
    52 #include <QTcpSocket>
       
    53 
       
    54 //------------------------------------------------------------------------------
       
    55 #ifdef QT3_SUPPORT
       
    56 class My3Socket : public Q3Socket
       
    57 {
       
    58     Q_OBJECT
       
    59 public:
       
    60     My3Socket(QObject *parent);
       
    61 
       
    62     void sendTest(Q_UINT32 num);
       
    63     bool safeShutDown;
       
    64 
       
    65 private slots:
       
    66     void read();
       
    67     void closed();
       
    68 };
       
    69 
       
    70 //------------------------------------------------------------------------------
       
    71 class My3Server : public Q3ServerSocket
       
    72 {
       
    73     Q_OBJECT
       
    74 public:
       
    75     My3Server(QObject *parent = 0);
       
    76 
       
    77     void newConnection(int socket);
       
    78 
       
    79 private slots:
       
    80     void stopServer();
       
    81 
       
    82 private:
       
    83     My3Socket *m_socket;
       
    84 };
       
    85 #endif
       
    86 
       
    87 //------------------------------------------------------------------------------
       
    88 class My4Socket : public QTcpSocket
       
    89 {
       
    90     Q_OBJECT
       
    91 public:
       
    92     My4Socket(QObject *parent);
       
    93 
       
    94     void sendTest(quint32 num);
       
    95     bool safeShutDown;
       
    96 
       
    97 private slots:
       
    98     void read();
       
    99     void closed();
       
   100 };
       
   101 
       
   102 //------------------------------------------------------------------------------
       
   103 class My4Server : public QTcpServer
       
   104 {
       
   105     Q_OBJECT
       
   106 public:
       
   107     My4Server(QObject *parent = 0);
       
   108 
       
   109 protected:
       
   110     void incomingConnection(int socket);
       
   111 
       
   112 private slots:
       
   113     void stopServer();
       
   114 
       
   115 private:
       
   116     My4Socket *m_socket;
       
   117 };
       
   118 
       
   119 //------------------------------------------------------------------------------
       
   120 class Test : public QObject
       
   121 {
       
   122     Q_OBJECT
       
   123 
       
   124 public:
       
   125     enum Type {
       
   126         Qt4Client,
       
   127         Qt4Server,
       
   128 #ifdef QT3_SUPPORT
       
   129         Qt3Client,
       
   130         Qt3Server
       
   131 #endif
       
   132     };
       
   133     Test(Type type);
       
   134 };
       
   135 
       
   136 //------------------------------------------------------------------------------
       
   137 #endif	// TEST_H