testexecmgmt/ucc/Source/Uccs.v2/ServiceStubs/GenericStub/GenericStub_clnt.c
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <rpc/rpc.h>
       
    22 #include "GenericStub.h"
       
    23 
       
    24 /* Default timeout can be changed using clnt_control() */
       
    25 static struct timeval TIMEOUT = { 25, 0 };
       
    26 static struct timeval RUNCMD_TIMEOUT = { 3600, 0 }; // One hour (should be plenty)
       
    27 
       
    28 int *
       
    29 ss_startuprpcservice_11(argp, clnt)
       
    30 	TStartupInfo *argp;
       
    31 	CLIENT *clnt;
       
    32 {
       
    33 	static int res;
       
    34 
       
    35 	bzero((char *)&res, sizeof(res));
       
    36 	clnt_call(clnt, SS_STARTUPRPCSERVICE, xdr_GenericStub_TStartupInfo, argp, xdr_int, &res, TIMEOUT);
       
    37 	return (&res);
       
    38 }
       
    39 
       
    40 
       
    41 int *
       
    42 sc_shutdownrpcservice_11(argp, clnt)
       
    43 	int *argp;
       
    44 	CLIENT *clnt;
       
    45 {
       
    46 	static int res;
       
    47 
       
    48 	bzero((char *)&res, sizeof(res));
       
    49 	clnt_call(clnt, SC_SHUTDOWNRPCSERVICE, xdr_int, argp, xdr_int, &res, TIMEOUT);
       
    50 	return (&res);
       
    51 }
       
    52 
       
    53 
       
    54 TComponentList *
       
    55 list_connections_11(argp, clnt)
       
    56 	void *argp;
       
    57 	CLIENT *clnt;
       
    58 {
       
    59 	static TComponentList res;
       
    60 
       
    61 	bzero((char *)&res, sizeof(res));
       
    62 	clnt_call(clnt, LIST_CONNECTIONS, xdr_void, argp, xdr_GenericStub_TComponentList, &res, TIMEOUT);
       
    63 	return (&res);
       
    64 }
       
    65 
       
    66 
       
    67 int *
       
    68 cstr_startprocess_11(argp, clnt)
       
    69 	char **argp;
       
    70 	CLIENT *clnt;
       
    71 {
       
    72 	static int res;
       
    73 
       
    74 	bzero((char *)&res, sizeof(res));
       
    75 	clnt_call(clnt, CSTR_STARTPROCESS, xdr_wrapstring, argp, xdr_int, &res, TIMEOUT);
       
    76 	return (&res);
       
    77 }
       
    78 
       
    79 
       
    80 int *
       
    81 dstr_removeprocess_11(argp, clnt)
       
    82 	int *argp;
       
    83 	CLIENT *clnt;
       
    84 {
       
    85 	static int res;
       
    86 
       
    87 	bzero((char *)&res, sizeof(res));
       
    88 	clnt_call(clnt, DSTR_REMOVEPROCESS, xdr_int, argp, xdr_int, &res, TIMEOUT);
       
    89 	return (&res);
       
    90 }
       
    91 
       
    92 
       
    93 int *
       
    94 run_command_11(argp, clnt)
       
    95 	TCall *argp;
       
    96 	CLIENT *clnt;
       
    97 {
       
    98 	static int res;
       
    99 
       
   100 	// Increase the timeout for this call
       
   101 	clnt_control(clnt, CLSET_TIMEOUT, &RUNCMD_TIMEOUT);
       
   102 
       
   103 	bzero((char *)&res, sizeof(res));
       
   104 	clnt_call(clnt, RUN_COMMAND, xdr_GenericStub_TCall, argp, xdr_int, &res, RUNCMD_TIMEOUT);
       
   105 
       
   106 	// Revert back to the default timeout 
       
   107 	clnt_control(clnt, CLSET_TIMEOUT, &TIMEOUT);
       
   108 	
       
   109 	return (&res);
       
   110 }
       
   111