NEESgrid logo

Introducing the C gateway plugin

The C gateway plugin is an NTCP control plugin designed to allow another class of control systems to run via NTCP: Anything written in the C programming language.

This is a large class of controllers, and also includes C++ via the usual extern "C" method.

The instructions for this plugin are only slightly different from those using Java, so this page is mainly a list of extra notes and differences. Many thanks to Xin Feng of UC Davis for these.

More information on the C gateway plugin can be found in the complete API documentation (PDF)

Getting the code

The sample C plugin is part of the NEES-POP distribution. While it's also in CVS as part of the NTCP package, building it requires gpt-build and such from the Globus Toolkit. For this reason, I'm only going to cover building the code from the NEES-POP; it's just too much work otherwise.

The code can be found at:

	/usr/local/nees/components/ntcp/tarfiles/sample_plugin-1.0.tar.gz    
which you will have to unpack with
	cd {working directory}
tar xzf /usr/local/nees/components/ntcp/tarfiles/sample_plugin-1.0.tar.gz

Building the code

To compile it, follow the last two pages of NTCP Sample Plugin Documentation (PDF). Then run
	gpt-build -force gcc32dbgpthr 
to get the libntcp_sample_plugin_gcc32dbgpthr.so" compiled and installed to $GLOBUS_LOCATION/lib.

Configuring the OGSA container

Edit $GLOBUS_LOCATION/server-config.wsdd.

Change ntcpBackendFactory parameter to org.nees.ntcp.plugins.gateway.GatewayPluginFactory:

  <parameter name="ntcpBackendFactory" value="org.nees.ntcp.plugins.gateway.GatewayPluginFactory"/>

Add "org.nees.ntcp.plugins.gateway.module" parameter right after it:

 <parameter name="org.nees.ntcp.plugins.gateway.module" value="/usr/local/nees/opt/grid/lib/libntcp_sample_plugin_gcc32dbgpthr.so"/>

This will tell NTCP to load the C gateway and the sample C plugin.

Running and testing the code

As is normal, start the container with
    cd $GLOBUS_LOCATION
ant startContainer -Dservice.port=8090

nclient changes required to test

The sample plugin uses a different control point name than the dummy plugin, so you'll need to change the name from "dummy" to "result1", "result2" or "result3".

Run the client

    ant run
in the nclient directory should see something like this:

Terminal screenshot of success