GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

endpoint_adaptor.c

Go to the documentation of this file.
00001 /** @file endpoint_adaptor.c
00002  *  Source file for the endpoint_adaptor class.
00003  *
00004  *  @date $Date: 2004/05/13 09:52:23 $
00005  *
00006  *  @version $Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/endpoint__adaptor_8c-source.html,v 1.6 2004/05/13 09:52:23 merzky Exp $
00007  *
00008  *  Copyright (C) Kelly Davis
00009  *  This file is part of the GAT Engine.
00010  *  Contributed by Kelly Davis <kdavis@aei.mpg.de>.
00011  *
00012  *  Use, modification and distribution is subject to the Gridlab Software
00013  *  License. (See accompanying file GLlicense.txt or copy at
00014  *  http://www.gridlab.org/GLlicense.txt)
00015  */
00016  
00017 static const char *rcsid = "$Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/endpoint__adaptor_8c-source.html,v 1.6 2004/05/13 09:52:23 merzky Exp $";
00018  
00019 /* System Header Files */
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023 
00024 /* GAT Header Files */
00025 #include <GATCPI.h>
00026 
00027 #include "pipe.h"
00028 #include "endpoint.h"
00029 
00030 /* Macros */
00031 
00032 /* Structures, unions and enums */
00033 
00034 /* Static function prototypes */
00035 
00036 /* File scope variables */
00037 
00038 /* External functions */
00039 /** endpoint_adaptor_register
00040  *  Registers all CPIs this adaptor provides.
00041  *  This function is invoked by the loader in the GATEngine when
00042  *  an instance of this adaptor is loaded.  Each instance has its
00043  *  own private configuration table.
00044  *
00045  *  @param registry The registry the adaptor should register its CPIs with.
00046  *  @param system_config The system configuration table.
00047  *  @param instance_config The configuration table for this instance.
00048  *  @param token An arbitrary token used by the loader to identify this adaptor 
00049  *        instance
00050  *
00051  *  @return An error code.
00052  */
00053 GATResult 
00054 endpoint_adaptor_register(GATContext error_context, GATRegistry registry, 
00055   GATTable_const system_config, GATTable_const instance_config, void *token)
00056 {
00057   GAT_USES_STATUS(error_context, "endpoint_adaptor_register");
00058   
00059   int load_pipe_cpi = 0;
00060   int load_endpoint_cpi = 0;
00061   
00062   if (!GATVERSION_ISCOMPATIBLE())
00063   {
00064     GAT_CREATE_STATUS(GAT_UNKNOWN_VERSION);
00065   }
00066   else
00067   {
00068     /* Check if the user has disabled the creation of a EndpointCPI */
00069     GATResult retval = GATTable_Get_int(instance_config, "Endpoint", 
00070       &load_endpoint_cpi);
00071     if (GAT_FAILED(retval))
00072     {
00073       load_endpoint_cpi = 1;
00074     }
00075 
00076     /* Check if the user has disabled the creation of a PipeCPI */
00077     retval = GATTable_Get_int(instance_config, "Pipe", &load_pipe_cpi);
00078     if (GAT_FAILED(retval))
00079     {
00080       load_pipe_cpi = 1;
00081     }
00082 
00083     /* load CPI's if appropriate */
00084     if (load_endpoint_cpi)
00085     {
00086       GAT_CREATE_STATUS(endpoint_adaptor_register_endpoint(error_context, 
00087         registry, system_config, instance_config, token));
00088     }
00089     if (load_pipe_cpi)
00090     {
00091       GAT_CREATE_STATUS(pipe_adaptor_register_pipe(error_context, registry, 
00092         system_config, instance_config, token));
00093     }
00094   }
00095   return GAT_RETURN_STATUS();
00096 }