Annotation of 43BSDReno/sys/nfs/TEST/billboard/src/bb_list.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  ******************************************************************************
                      3:  *
                      4:  * Module: bb_list.c
                      5:  *
                      6:  * Functions: 
                      7:  *         bb_alist_1() - Return list of servers successfully tested against
                      8:  *         bb_blist_1() - Return list of servers unsuccessfully tested against
                      9:  *         bb_clist_1() - Return list of clients successfully tested against
                     10:  *         bb_dlist_1() - Return list of clients unsuccessfully tested against
                     11:  *
                     12:  *
                     13:  ******************************************************************************
                     14:  */
                     15: 
                     16: /*
                     17:  ******************************************************************************
                     18:  * Include Files
                     19:  ******************************************************************************
                     20:  */
                     21: #include <stdio.h>
                     22: #include <rpc/rpc.h>
                     23: #include "common.h"
                     24: #include "protocol.h"
                     25: #include "server.h"
                     26: 
                     27: 
                     28: 
                     29: /*************************************************************************
                     30: **                                                                     **
                     31: **  bb_alist_1() - Given the identifier get the list of servers this   **
                     32: **  client has successfully tested against.                            **
                     33: **                                                                     **
                     34: *************************************************************************/
                     35: BB_list_out *
                     36: bb_alist_1( p_in)
                     37:   BB_list_in   *p_in;          /* The list input structure.            */
                     38: {
                     39:     static BB_list_out result; /* The result of the list operation.    */
                     40:     int                        imp_cnt;/* The number of implementations.       */
                     41:     int                        i;      /* Nice loop variable name.             */
                     42:     int                        j;      /* The number of vendors found.         */
                     43:     BB_row             list;   /* The list of tests in the database.   */
                     44:     BB_co_data         codata; /* The company data returned.           */
                     45:     BB_vendor          vendors[BB_MAX_IMP];    /* Place to store output*/
                     46: 
                     47:     result.status = BB_SUCCESS;
                     48:     result.data.data_len = 0;
                     49: 
                     50:     /*
                     51:     **  If the machine being used to send this request is not one
                     52:     **  of the ones owned by this client group then a password must
                     53:     **  be specified.
                     54:     */
                     55:     if ( bb_check_ip( p_in->id) != BB_SUCCESS )
                     56:     {
                     57:        if ( (result.status=bb_check_passwd( p_in->id, p_in->passwd))
                     58:             != BB_SUCCESS )
                     59:        {
                     60:            result.status = BB_BAD_PASSWD;
                     61:            return &result;
                     62:        }
                     63:     }
                     64: 
                     65:     /*
                     66:     **  Passed verification so get the data.
                     67:     */
                     68:     imp_cnt = bb_get_imp_cnt();
                     69:     if ( bb_get_servers( p_in->id, list) != BB_SUCCESS )
                     70:     {
                     71:        result.status = BB_FAILURE;
                     72:        return &result;
                     73:     }
                     74: 
                     75:     /*
                     76:     **  For each implementation check to see if the tests have
                     77:     **  been passed and if so get the company data for that index.
                     78:     */
                     79:     j = 0;
                     80:     for( i = 0; i < imp_cnt; i++ )
                     81:     {
                     82:        if ( list[i] == BB_BOARD_SET )
                     83:        {
                     84:            /*
                     85:            **  If can't get the company data just skip it.
                     86:            */
                     87:            if ( bb_get_codata( i, &codata) == BB_SUCCESS )
                     88:            {
                     89:                vendors[j].booth = codata.booth;
                     90:                strncpy( vendors[j].company, codata.company,
                     91:                         BB_COMPANY_NAME_LEN);
                     92:                strncpy( vendors[j].imp, codata.imp, BB_IMP_NAME_LEN);
                     93:                strncpy( vendors[j].id, codata.id, BB_ID_NAME_LEN);
                     94:                j++;
                     95:            }
                     96:        }
                     97:     }
                     98:     result.data.data_len = j;
                     99:     result.data.data_val = vendors;
                    100:     return &result;
                    101: }
                    102: 
                    103: 
                    104: /*************************************************************************
                    105: **                                                                     **
                    106: **  bb_blist_1() - Given the identifier get the list of servers this   **
                    107: **  client has not successfully tested against.                                **
                    108: **                                                                     **
                    109: *************************************************************************/
                    110: BB_list_out *
                    111: bb_blist_1( p_in)
                    112:   BB_list_in   *p_in;          /* The list input structure.            */
                    113: {
                    114:     static BB_list_out result; /* The result of the list operation.    */
                    115:     int                        imp_cnt;/* The number of implementations.       */
                    116:     int                        i;      /* Nice loop variable name.             */
                    117:     int                        j;      /* The number of vendors found.         */
                    118:     BB_row             list;   /* The list of tests in the database.   */
                    119:     BB_co_data         codata; /* The company data returned.           */
                    120:     BB_vendor          vendors[BB_MAX_IMP];    /* Place to store output*/
                    121: 
                    122:     result.status = BB_SUCCESS;
                    123:     result.data.data_len = 0;
                    124: 
                    125:     /*
                    126:     **  If the machine being used to send this request is not one
                    127:     **  of the ones owned by this client group then a password must
                    128:     **  be specified.
                    129:     */
                    130:     if ( bb_check_ip( p_in->id) != BB_SUCCESS )
                    131:     {
                    132:        if ( (result.status=bb_check_passwd( p_in->id, p_in->passwd))
                    133:             != BB_SUCCESS )
                    134:        {
                    135:            return &result;
                    136:        }
                    137:     }
                    138: 
                    139:     /*
                    140:     **  Passed verification so get the data.
                    141:     */
                    142:     imp_cnt = bb_get_imp_cnt();
                    143:     if ( bb_get_servers( p_in->id, list) != BB_SUCCESS )
                    144:     {
                    145:        result.status = BB_FAILURE;
                    146:        return &result;
                    147:     }
                    148: 
                    149:     /*
                    150:     **  For each implementation check to see if the tests have
                    151:     **  been passed and if so get the company data for that index.
                    152:     */
                    153:     j = 0;
                    154:     for( i = 0; i < imp_cnt; i++ )
                    155:     {
                    156:        if ( list[i] == BB_BOARD_UNSET )
                    157:        {
                    158:            /*
                    159:            **  If can't get the company data just skip it.
                    160:            */
                    161:            if ( bb_get_codata( i, &codata) == BB_SUCCESS )
                    162:            {
                    163:                vendors[j].booth = codata.booth;
                    164:                strncpy( vendors[j].company, codata.company,
                    165:                         BB_COMPANY_NAME_LEN);
                    166:                strncpy( vendors[j].imp, codata.imp, BB_IMP_NAME_LEN);
                    167:                strncpy( vendors[j].id, codata.id, BB_ID_NAME_LEN);
                    168:                j++;
                    169:            }
                    170:        }
                    171:     }
                    172:     result.data.data_len = j;
                    173:     result.data.data_val = vendors;
                    174:     return &result;
                    175: }
                    176: 
                    177: 
                    178: /*************************************************************************
                    179: **                                                                     **
                    180: **  bb_clist_1() - Given the identifier get the list of clients this   **
                    181: **  server has successfully tested against.                            **
                    182: **                                                                     **
                    183: *************************************************************************/
                    184: BB_list_out *
                    185: bb_clist_1( p_in)
                    186:   BB_list_in   *p_in;          /* The list input structure.            */
                    187: {
                    188:     static BB_list_out result; /* The result of the list operation.    */
                    189:     int                        imp_cnt;/* The number of implementations.       */
                    190:     int                        i;      /* Nice loop variable name.             */
                    191:     int                        j;      /* The number of vendors found.         */
                    192:     BB_row             list;   /* The list of tests in the database.   */
                    193:     BB_co_data         codata; /* The company data returned.           */
                    194:     BB_vendor          vendors[BB_MAX_IMP];    /* Place to store output*/
                    195: 
                    196:     result.status = BB_SUCCESS;
                    197:     result.data.data_len = 0;
                    198: 
                    199:     /*
                    200:     **  If the machine being used to send this request is not one
                    201:     **  of the ones owned by this client group then a password must
                    202:     **  be specified.
                    203:     */
                    204:     if ( bb_check_ip( p_in->id) != BB_SUCCESS )
                    205:     {
                    206:        if ( (result.status=bb_check_passwd( p_in->id, p_in->passwd))
                    207:             != BB_SUCCESS )
                    208:        {
                    209:            return &result;
                    210:        }
                    211:     }
                    212: 
                    213:     /*
                    214:     **  Passed verification so get the data.
                    215:     */
                    216:     imp_cnt = bb_get_imp_cnt();
                    217:     if ( bb_get_clients( p_in->id, list) != BB_SUCCESS )
                    218:     {
                    219:        result.status = BB_FAILURE;
                    220:        return &result;
                    221:     }
                    222: 
                    223:     /*
                    224:     **  For each implementation check to see if the tests have
                    225:     **  been passed and if so get the company data for that index.
                    226:     */
                    227:     j = 0;
                    228:     for( i = 0; i < imp_cnt; i++ )
                    229:     {
                    230:        if ( list[i] == BB_BOARD_SET )
                    231:        {
                    232:            /*
                    233:            **  If can't get the company data just skip it.
                    234:            */
                    235:            if ( bb_get_codata( i, &codata) == BB_SUCCESS )
                    236:            {
                    237:                vendors[j].booth = codata.booth;
                    238:                strncpy( vendors[j].company, codata.company,
                    239:                         BB_COMPANY_NAME_LEN);
                    240:                strncpy( vendors[j].imp, codata.imp, BB_IMP_NAME_LEN);
                    241:                strncpy( vendors[j].id, codata.id, BB_ID_NAME_LEN);
                    242:                j++;
                    243:            }
                    244:        }
                    245:     }
                    246:     result.data.data_len = j;
                    247:     result.data.data_val = vendors;
                    248:     return &result;
                    249: }
                    250: 
                    251: 
                    252: /*************************************************************************
                    253: **                                                                     **
                    254: **  bb_dlist_1() - Given the identifier get the list of clients this   **
                    255: **  server has not successfully tested against.                                **
                    256: **                                                                     **
                    257: *************************************************************************/
                    258: BB_list_out *
                    259: bb_dlist_1( p_in)
                    260:   BB_list_in   *p_in;          /* The list input structure.            */
                    261: {
                    262:     static BB_list_out result; /* The result of the list operation.    */
                    263:     int                        imp_cnt;/* The number of implementations.       */
                    264:     int                        i;      /* Nice loop variable name.             */
                    265:     int                        j;      /* The number of vendors found.         */
                    266:     BB_row             list;   /* The list of tests in the database.   */
                    267:     BB_co_data         codata; /* The company data returned.           */
                    268:     BB_vendor          vendors[BB_MAX_IMP];    /* Place to store output*/
                    269: 
                    270:     result.status = BB_SUCCESS;
                    271:     result.data.data_len = 0;
                    272: 
                    273:     /*
                    274:     **  If the machine being used to send this request is not one
                    275:     **  of the ones owned by this client group then a password must
                    276:     **  be specified.
                    277:     */
                    278:     if ( bb_check_ip( p_in->id) != BB_SUCCESS )
                    279:     {
                    280:        if ( (result.status=bb_check_passwd( p_in->id, p_in->passwd))
                    281:             != BB_SUCCESS )
                    282:        {
                    283:            return &result;
                    284:        }
                    285:     }
                    286: 
                    287:     /*
                    288:     **  Passed verification so get the data.
                    289:     */
                    290:     imp_cnt = bb_get_imp_cnt();
                    291:     if ( bb_get_clients( p_in->id, list) != BB_SUCCESS )
                    292:     {
                    293:        result.status = BB_FAILURE;
                    294:        return &result;
                    295:     }
                    296: 
                    297:     /*
                    298:     **  For each implementation check to see if the tests have
                    299:     **  been passed and if so get the company data for that index.
                    300:     */
                    301:     j = 0;
                    302:     for( i = 0; i < imp_cnt; i++ )
                    303:     {
                    304:        if ( list[i] == BB_BOARD_UNSET )
                    305:        {
                    306:            /*
                    307:            **  If can't get the company data just skip it.
                    308:            */
                    309:            if ( bb_get_codata( i, &codata) == BB_SUCCESS )
                    310:            {
                    311:                vendors[j].booth = codata.booth;
                    312:                strncpy( vendors[j].company, codata.company,
                    313:                         BB_COMPANY_NAME_LEN);
                    314:                strncpy( vendors[j].imp, codata.imp, BB_IMP_NAME_LEN);
                    315:                strncpy( vendors[j].id, codata.id, BB_ID_NAME_LEN);
                    316:                j++;
                    317:            }
                    318:        }
                    319:     }
                    320:     result.data.data_len = j;
                    321:     result.data.data_val = vendors;
                    322:     return &result;
                    323: }
                    324: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.