Blame README.daemon

Packit db01ca
====================================
Packit db01ca
Readme for the OpenHPI Client/Daemon
Packit db01ca
====================================
Packit db01ca
Packit db01ca
This file documents the OpenHPI daemon and client libraries for the current
Packit db01ca
release.
Packit db01ca
Packit db01ca
The OpenHPI daemon runs as a background process and accepts connections from
Packit db01ca
remote clients to perform OpenHPI library function calls. The daemon wraps the
Packit db01ca
standard OpenHPI function library with a sockets-based API that is archicture
Packit db01ca
neutral for all types of clients.
Packit db01ca
Packit db01ca
The OpenHPI client library provides all the connection functionality needed by
Packit db01ca
the client application to connect to the OpenHPI daemon running on the local or
Packit db01ca
remote server.
Packit db01ca
Packit db01ca
Packit db01ca
Three ways of starting the OpenHPI daemon:
Packit db01ca
=========================================
Packit db01ca
There are three methods for starting the daemon at this point; manually 
Packit db01ca
calling the installed init.d script,  manually starting the daemon in 
Packit db01ca
the foreground, or automatically by installing the init script in one of
Packit db01ca
the system run levels.
Packit db01ca
Packit db01ca
1. Manually Calling Init Script:
Packit db01ca
-----------------------------------
Packit db01ca
You can START and STOP the daemon with the 'openhpid' init script.
Packit db01ca
Packit db01ca
This script can be found in $sysconfdir/init.d/openhpid (where the default
Packit db01ca
sysconfdir value expands to /usr/local/etc). 
Packit db01ca
You can change sysconfdir's value when you run configure using the
Packit db01ca
--sysconfdir=<mysysconfdir> argument. We recommend setting it to /etc.
Packit db01ca
Packit db01ca
Example To Start:
Packit db01ca
$sudo /usr/local/etc/init.d/openhpid start
Packit db01ca
Starting openhpid:			[  OK  ]
Packit db01ca
$
Packit db01ca
Packit db01ca
Example To Stop:
Packit db01ca
$sudo /usr/local/etc/init.d/openhpid stop
Packit db01ca
Stopping openhpid:			[  OK  ]
Packit db01ca
$
Packit db01ca
Packit db01ca
2. Installing Daemon into a Run Level:
Packit db01ca
--------------------------------------------
Packit db01ca
How you get the daemon to start automatically when the system boots
Packit db01ca
depends on your Linux distribution:
Packit db01ca
- Fedora/Mandriva: chkconfig --add openhpid; chkconfig openhpid on
Packit db01ca
- SuSE: yast
Packit db01ca
- Gentoo: rc-update -a openhpid default
Packit db01ca
- Debian: update-rc.d openhpid defaults
Packit db01ca
Packit db01ca
Manually Starting The Daemon:
Packit db01ca
---------------------------------------------
Packit db01ca
After performing 'make install' the init.d script will reside 
Packit db01ca
at $sysconfdir/init.d/openhpid and the executable itself at
Packit db01ca
$prefix/sbin/openhpid.
Packit db01ca
Packit db01ca
Usage of the openhpid executable:
Packit db01ca
Packit db01ca
openhpid [options] [-c <path to openhpi.conf>]
Packit db01ca
Packit db01ca
To start the daemon in the foreground use the '-n' option.
Packit db01ca
For more info 'openhpid -h'.
Packit db01ca
Packit db01ca
Example: 'openhpid -n -c /etc/openhpi/openhpi.conf'
Packit db01ca
Packit db01ca
More information on daemon parameters and evironment variables is given below.
Packit db01ca
Packit db01ca
The OpenHPI Daemon
Packit db01ca
==================
Packit db01ca
Packit db01ca
The daemon is compiled as a standalone application and can be run as either
Packit db01ca
a foreground or background application.
Packit db01ca
The daemon application and client libraries will be located in the openhpid
Packit db01ca
subdirectory.
Packit db01ca
Packit db01ca
When you run the daemon the standard method for locating the OpenHPI configuration
Packit db01ca
file is used. However, the daemon will accept a configuration file as a command
Packit db01ca
line option to override the default file.
Packit db01ca
Packit db01ca
An option in the configuration file determines the port number the daemon will
Packit db01ca
listen on for client connections. If a configuration file is not found the
Packit db01ca
the daemon will listen on port 4743 by default.
Packit db01ca
Packit db01ca
Currently, if you are not running as the root user, you must override the default
Packit db01ca
PID file location. Normally the PID file is created in the /var/run subdirectory.
Packit db01ca
This directory is not writable by normal users and only the root user can write
Packit db01ca
to this location. Thus the daemon will fail when run as a normal user if the PID
Packit db01ca
file location is not overridden. To override the PID file location you can use
Packit db01ca
the command line option.
Packit db01ca
Packit db01ca
     ./openhpid -f ./openhpid.pid
Packit db01ca
Packit db01ca
Packit db01ca
The OpenHPI Client Library
Packit db01ca
==========================
Packit db01ca
Packit db01ca
The easiect method to use to link to the client library is to first run the
Packit db01ca
OpenHPI installation script.
Packit db01ca
Packit db01ca
     make install
Packit db01ca
Packit db01ca
This will install the client library in the standard system locations. You can
Packit db01ca
now use the following link flags to link the client library to your application.
Packit db01ca
Packit db01ca
     -lopenhpi 
Packit db01ca
Packit db01ca
When you run your application the client library uses two environment variables
Packit db01ca
to locate the daemon service.
Packit db01ca
Packit db01ca
   OPENHPI_DAEMON_HOST - URL for the host running the daemon. This can be
Packit db01ca
                         "localhost" if the daemon is running on the local host
Packit db01ca
			 or an ip address.
Packit db01ca
   OPENHPI_DAEMON_PORT - The port number the host is listening on for clent
Packit db01ca
                         connections.
Packit db01ca
		
Packit db01ca
If the OPENHPI_DAEMON_HOST variable is not found the client library uses
Packit db01ca
localhost as the default. If the OPENHPI_DAEMON_PORT variable is not found then
Packit db01ca
the client library uses port 4743 as the default.
Packit db01ca
Packit db01ca
Packit db01ca
General Information
Packit db01ca
-------------------
Packit db01ca
Packit db01ca
The client and the daemon do not have to be on the same hardware architecture.
Packit db01ca
The daemon could be running on a P-series processor and the client running on an
Packit db01ca
x86-series processor. The client library and daemon use a marshaling technique
Packit db01ca
to resolve architecture and structure padding conflicts. The user does not need
Packit db01ca
to concern themselves with architectureal differences between the client and
Packit db01ca
daemon. The one exception to this rule is 64-bit architectures. The client and
Packit db01ca
daemon currently cannot resolve differences between 32-bit and 64-bit
Packit db01ca
architectures. DO NOT MIX THESE TYPES OF ARCHITECTURES!
Packit db01ca
Packit db01ca
It is important that data passed to the client library OpenHPI functions is
Packit db01ca
correct. Passing incorrect data could cause the client library or the daemon
Packit db01ca
to crash. The client library performs an extensive set of data validation
Packit db01ca
functions for each OpenHPI function, but it is still possible for bad data to be
Packit db01ca
missed by those functions. BE CAREFUL!.
Packit db01ca
Packit db01ca
Packit db01ca