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.
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.
For example "SETUP|ChgState|1<lf>".
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.
For example, "terminator|cr<lf>" sets the response terminator to a CR.
"terminator<lf>" queries for the current terminator setting.
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 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".
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>".