man1/inet_dbmod

Table of Contents

Name

inet_dbmod - send a list of parameter values to the database

Synopsis

inet_dbmod <dbman_host>

Description

inet_dbmod is a service provider program written for use with inetd or xinetd.

It’s purpose is to provide a way to set parameter values in the AccelNET control system from other types of programs, perhaps running on other computers using other operating systems without having to compile special bits of code for those systems.

inet_dbmod reads stdin for a Label-RefName-Value triple. When a Label-RefName-Value triple is received an update request is formatted and sent to dbman to set the value of the parameter.

It is expected that the user will write a program to utilize the services provided by this program. Since all information is exchanged in ascii writing programs in various languages on various types of systems shouldn’t be difficult as long as the language of choice can establish network connections and process strings.

After this program is properly installed it may be tested by using telnet. See the "testing the connection" section below for an example of this.

See the "inetd and xinetd overview" section in the inet_reqpar(1) manual page for more information about inetd and xinetd and programs like this one.

See the appropriate configuration section below for information about configuring inetd and xinetd for use with this program.

Arguments

dbman_host

The host where dbman is running.

Available commands

The commands listed below are available to be sent by the client to inet_dbmod for processing.

A "|" is used to separate fields within the the command.

A line feed, a carriage return, or a line feed carriage return combination may be used to terminate a command. All commands must be terminated.

parameter value setting requests

A parameter tagname-value triple is taken as a command to set the value of the parameter.

For example "SETUP|ChgState|1<lf>".

quit

This causes inet_dbmod to exit thus closing the connection.

The client closing the connection will also cause inet_dbmod to exit.

See the "testing the connection" section below for an example using this command.

terminator

The default terminator string for responses from int_dbmod is a LF. This may changed using this command. Choice of terminator are: lf, cr, crlf.

For example, "terminator|cr<lf>" sets the response terminator to a CR.

"terminator<lf>" queries for the current terminator setting.

xinetd setup

If your system uses xinetd follow this set of instructions. Generally this means systems with RedHat 7 or newer Linux distributions.

First you must add an entry to /etc/services. This is used to associated a port number with a name so that the port number can be used elsewhere without having to remember the numeric value.

In testing at NEC we used "dbmod" as the name and 6181 as the port number. The port number (and name) may be changed to fit the needs of the target system.

The services entry should look like this:

dbmod 6181/tcp

Next change directories to /etc/xinetd.d and create a file called "dbmod".

The file should have the following contents at a minimum:

service dbmod
{
socket_type = stream

wait = no

user = csadmin

log_on_success += USERID

log_on_failure += USERID

server = /AccelNET/ubin/inet_dbmod

server_args = localhost

only_from = localhost

disable = no

}

The only_from directive limits access to connections originating from the local computer. If you wish to use this service from another box you should change this directive appropriately. See the xinetd(8) manual pages for more information.

Next restart xinetd by typing:

/etc/rc.d/init.d/xinetd restart.

Test the dbmod service using the instructions given below in the section "testing the connection".

inetd setup

If your system uses inetd follow this set of instructions. Generally systems older than RedHat 7 use inetd.

inetd requires entries be added to /etc/services.

Follow the instructions given in "xinetd setup" for adding the required entries to /etc/services.

Next you need to add a line to /etc/inetd.conf. The line should look like this:

dbmod stream tcp nowait csadmin /AccelNET/ubin/inet_dbmod inet_dbmod localhost

Note that the line may be wrapped in the manual page due to it’s length.

Next you must restart inetd for the changes to take effect.

Type: /etc/rc.d/init.d/inet restart

If you type "netstat -ta" you should see an entry similiar to "*.dbmod" in the "Local Address" column. This shows the listener connection has been established.

Test the dbmod service using the instructions given below in the section "testing the connection".

testing the connection

It is expected that the user will want to write a program utilizing this service. This is of course why the program was created in the first place.

However, before that job may be begun the service may need to be tested to ensure that it is working properly and to demonstrate it’s capabilities. Telnet may be used for this purpose.

This section demonstrates setting up a connection with telnet and performing the various commands.

We will use the "SETUP ChgState" parameter for this demonstration because they are generally available on all AccelNET systems.

Connect to the service by typing: "telnet localhost dbmod". If connecting remotely replace "localhost" with the hostname of the target machine.

The third argument "dbmod" is the port number and is looked for in the /etc/services file to determine the integer port number.

If you are running remotely you may need to replace this parameter with the integer value (i.e. "telnet some_host 6181") if the copy of the /etc/services file on the remote machine has not been editted to add the information.

After connecting you can set "SETUP TotPartE" parameter value by typing:

SETUP|ChgState|new_value<lf>

The program responds with "ERRok" if the command succeeded.

The program may be exited by typing "quit<lf>".

Error codes emitted by this program

These are general error codes from the AccelNET system. For a complete listing of all possible AccelNET error codes see the errcodes(7) manual page.
ERRok

No error.
ERRfail

This error is returned for various reasons. One possibility is the command didn’t contain enough fields.

Notes

When ERRok is returned after a parameter value command is executed it indicates that the transaction was sent to dbman(8) for processing. It does not guarantee the value was actually committed to the database. Database commitment may fail for various reasons such as the parameter value being out of range or the parameter name being invalid.

Manual Page Revision

$Id: inet_dbmod.1,v 1.0 2004/12/13 15:29:26 kitchen Exp $


Table of Contents