The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

GPIB::rmt - Perl-GPIB interface for GPIB access on a remote host

SYNOPSIS

  use GPIB::rmt;

DESCRIPTION

GPIB::rmt is an interface module for making a network connection to a remote server machine and executing GPIB commands. This module is not normally called directly, but is called by the GPIB.pm module according to an entry in /etc/pgpib.conf.

The design goal is that an application program can access GPIB devices on a remote server identically to local devices, the only difference being the configuration in /etc/pgpib.conf. This module has been tested on both Linux and NT4.0. The Perl script that acts as the server on the remote machine is pretty Unix oriented, but it can probably be ported to NT without too much difficulty. This client code runs equally well on NT and Linux.

The author's typical usage is to use a Linux machine with an NI GPIB card as a server for a collection of test equipment. The Linux machine runs a server program and listens for requests from clients. The clients are a collection of NT4.0 and Linux machines that use GPIB::rmt to access the GPIB devices.

A /etc/pgpib.conf entry for a GPIB::rmt device is as follows:

  # name     interface  Host             user   password  remote name
  HP3585A    GPIB::rmt  sparky.mock.com  jeff   fiddle    HP3585A

The name field is the identifier used on the local machine for accessing the device. The host can be a domain name as shown above, an IP address, or include a port number in form foo.bar:90. The module uses port 90 by default.

The remote name parameter is the name of the /etc/pgpib.conf entry on the remote server machine. Typically the local name and remote name will be the same.

Once configured in /etc/pgpib.conf, the module is used the same as any other GPIB module:

  use GPIB;

  $g = GPIB->new("HP3585A");
  $g->ibwrt("Command to remote machine");

SECURITY

The server keeps a list of user names and passwords. The password is never sent as clear text over the network, it is hashed with a random number using MD5. Just the same, the username and passwords are kept as clear text on each machine and this authentication is probably no better than the tiny lock on the top drawer of your desk.

I do not recommend exposing the server to the Internet. It's great for access within a local network, but should not be considered secure in unfriendly environments.

SERVER

The sever is included in the distribution as a Perl script called pgpibproxy. This is a very simple script designed to run as a daemon on a Linux machine. The script keeps a list of users and passwords in the file /etc/pgpibusers. Because of the system and security issues the server is not installed by default.

You should look at the script, change any parameters for the local configuration and install the script someplace where you keep important system files. I put it in /etc. I start the script up automatically from /etc/rc.d/rc.local. It runs as a daemon. Before starting the script you need to setup a list of users. You can live on the edge and set $passwordcheck to 0 in the server and no authentication is done, but that's probably not wise. You need to make a file called /etc/pgpibusers that has one user per line, a username followed by a password separated by white space. Once you have created the password file and modified the server for you can start up the server. If you change the password file you do not need to restart the server, it will re-read pgpibusers.

The script listens for connections and forks a process when it gets a connection from a client machine. If the client machine authenticates correctly then GPIB calls made on the client machine are translated into GPIB calls on the server. The server and client use the MD5 module to hash the password and the Storable module to pack Perl data structures for transmission across the network.

Again, I suggest you make sure that the server is not directly accessable from the Internet.

AUTHOR

Jeff Mock, jeff@mock.com

SEE ALSO

perl(1), GPIB(3), GPIB::ni(3), GPIB::hpserial(3).