/* @(#)88    1.14  src/examples/type_mgr/server_type2_ops.c, examples.src, os2dce21.dss, 960602a.1 1/11/96 10:21:51 */
/*
 * COMPONENT_NAME:  examples.src
 *
 * FUNCTIONS:
 *
 * ORIGINS: 27
 *
 * (C) COPYRIGHT International Business Machines Corp. 1992, 1994
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 */

/*********************************************************************
 *  File      :  server_type2_ops.c                                  *
 *********************************************************************
 *                                                                   *
 *  Functions :  RPC routines defined in idl file.                   *
 *                                                                   *
 *  Comments  :  The routines in this file correspond to the RPC     *
 *               interface defined in the idl file for this client/  *
 *               server testcase.                     *
 *                                            *
 *               These routines are similar to those for type1 - see *
 *               the comments in the corresponding type1_ops file    *
 *                                            *
 *********************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <dce/dce_error.h>
#include "cust_if.h"
#include "type_mgr.h"
#include "util.h"

extern char g_server_ns_entry[];

/* definition of the type name */
const char g_type2_name[] = TYPE2_NAME;

/* definition of the type uuid */
const char g_type2_uuid_str[] = "003CF6EA-D2FE-1AD8-A1F9-10005AA8889C";


/*********************************************************************
 *   Function    :  rpc_type2_op_A()                                 *
 *********************************************************************
 *                                                                   *
 *   Description :  Sample routine for the first operation declared  *
 *                 in the idl file for type type2.                   *
 *                                                                   *
 *   Returns     :  the communication error                          *
 *                                                                   *
 *********************************************************************/

error_status_t rpc_type2_op_A( handle_t  h,
                            idl_char *server_name,
                          idl_char  *server_msg )
{

    strcpy( server_name, g_server_ns_entry );
    strcpy( server_msg, "TYPE MANAGER NO. 2 : type_mgr_op_A()" );

    return rpc_s_ok;

}


/*********************************************************************
 *   Function    :  rpc_type2_op_B()                                 *
 *********************************************************************
 *                                                                   *
 *   Description :  Sample routine for the second operation declared *
 *                 in the idl file for type type2.                   *
 *                                                                   *
 *   Returns     :  the communication error                          *
 *                                                                   *
 *********************************************************************/

error_status_t rpc_type2_op_B( handle_t  h,
                          idl_char  *client_uuid,
                          idl_char  *server_msg )
{
    uuid_t            o_uuid;
    char              *uuid_str;
    error_status_t    status;

    strcpy(server_msg,"TYPE MANAGER NO. 2 : type_mgr_op_B()");

    /*
     * get the client's object uuid from the binding handle.
     */

    rpc_binding_inq_object( h,
                            &o_uuid,
                            &status );

    CHECK_STATUS( "MANAGER Error: Can't get the object uuid.\n",
                  status,
                  RETURN );

    uuid_to_string( &o_uuid,
                    &uuid_str,
                    &status );

    CHECK_STATUS( "MANAGER Error: Can't convert_uuid to str.\n",
                  status,
                  RETURN );

    strcpy(client_uuid, uuid_str);

    rpc_string_free( &uuid_str,
                     &status );

    return rpc_s_ok;
}


/*********************************************************************
 *   Function    :  rpc_type2_op_C()                                 *
 *********************************************************************
 *                                                                   *
 *   Description :  Sample routine for the third operation declared  *
 *                 in the idl file for type type2.                   *
 *                                                                   *
 *   Returns     :  the communication error                          *
 *                                                                   *
 *********************************************************************/

error_status_t rpc_type2_op_C( handle_t  h,
                          uuid_t    *client_uuid,
                          idl_char  *server_msg )
{
    error_status_t    status;

    strcpy(server_msg,"TYPE MANAGER NO. 2 : type_mgr_op_C()");

    /*
     * get the client's object uuid from the binding handle.
     */

    rpc_binding_inq_object( h,
                            client_uuid,
                            &status );

    CHECK_STATUS( "MANAGER Error: Can't get the object uuid.\n",
                  status,
                  RETURN );

    return rpc_s_ok;

}

/*
 *  Entry point vector for type2
 */

globaldef type_mgr_v1_0_epv_t  type2_v1_0_manager_epv =
{
    rpc_type2_op_A,
    rpc_type2_op_B,
    rpc_type2_op_C
};

/* EOF server_type2_ops.c */

