1 /*
   2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * BSD 3 Clause License
   8  *
   9  * Redistribution and use in source and binary forms, with or without
  10  * modification, are permitted provided that the following conditions are met:
  11  *      - Redistributions of source code must retain the above copyright
  12  *      notice, this list of conditions and the following disclaimer.
  13  *
  14  *      - Redistributions in binary form must reproduce the above copyright
  15  *      notice, this list of conditions and the following disclaimer in the
  16  *      documentation and/or other materials provided with the distribution.
  17  *
  18  *      - Neither the name of Sun Microsystems, Inc. nor the
  19  *      names of its contributors may be used to endorse or promote products
  20  *      derived from this software without specific prior written permission.
  21  *
  22  * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ''AS IS'' AND ANY
  23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25  * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
  26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32  */
  33 
  34 /*
  35  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  36  */
  37 
  38 #ifndef _TSET_SAMPLE_H
  39 #define _TSET_SAMPLE_H
  40 
  41 /*
  42  * Sample function declarations
  43  */
  44 
  45 #ifdef __cplusplus
  46 extern "C" {
  47 #endif
  48 
  49 #define SHORT_TIME      10
  50 
  51 extern  int     TsetSampleStartup();
  52 extern  int     TsetSampleCleanup();
  53 
  54 extern  int     TsetSampleStartupReboot();
  55 extern  int     TsetSampleCleanupReboot();
  56 
  57 extern  void    PrintSpecificVariables(void);
  58 
  59 extern  int     num_of_remote_machines;
  60 extern  int     num_of_clients;
  61 
  62 extern  int     management_server;
  63 extern  int     remote_machine;
  64 extern  int     client;
  65 
  66 extern  int     management_server_sysno;
  67 extern  int     *remote_machines_sysno_array;
  68 extern  int     *clients_sysno_array;
  69 
  70 extern  int     management_server_sysid;
  71 extern  int     *remote_machines_sysid_array;
  72 extern  int     *clients_sysid_array;
  73 
  74 extern  char    *management_server_sysname;
  75 extern  char    **remote_machines_sysname_array;
  76 extern  char    **clients_sysname_array;
  77 
  78 extern  int     first_remote_machine;
  79 extern  int     second_remote_machine;
  80 extern  int     third_remote_machine;
  81 extern  int     fourth_remote_machine;
  82 
  83 extern  int     first_client;
  84 extern  int     second_client;
  85 extern  int     third_client;
  86 extern  int     fourth_client;
  87 
  88 extern  int     SampleReboot(char *node_name, int timeout);
  89 extern  int     SampleWaitForReboot(char *node_name, int timeout);
  90 
  91 extern  int     IsManagementServer(int rem_sysno);
  92 extern  int     IsRemoteMachine(int rem_sysno);
  93 extern  int     IsClient(int rem_sysno);
  94 
  95 #define TEST_PANIC              0x00000001
  96 #define TEST_HANG               0x00000002
  97 #define TEST_FAIL               0x00000004
  98 #define TEST_SU                 0x00000008
  99 #define TEST_NONSU              0x00000010
 100 
 101 #define TEST_MASTER             0x00000040
 102 
 103 #define TEST_MANAGEMENT_SERVER  0x00000080
 104 
 105 #define TEST_1_REMOTE_MACHINE   0x00000100
 106 #define TEST_2_REMOTE_MACHINE   0x00000200
 107 #define TEST_3_REMOTE_MACHINE   0x00000400
 108 #define TEST_4_REMOTE_MACHINE   0x00000800
 109 
 110 #define TEST_1_CLIENT           0x00001000
 111 #define TEST_2_CLIENT           0x00002000
 112 #define TEST_3_CLIENT           0x00004000
 113 #define TEST_4_CLIENT           0x00008000
 114 
 115 extern int  CheckCondition(int condition);
 116 
 117 #define TestConditions(cond)    if (CheckCondition(cond)) { \
 118                                         return; \
 119                                 }
 120 
 121 #ifdef __cplusplus
 122 }
 123 #endif
 124 
 125 #endif /* _TSET_SAMPLE_H */