libmeter: Distributed and Local Meter Reader

April 11, 2005

2

Contents

1 Installation 5 1.1 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Tools 7

3 API Reference 9 3.1 Agent Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4

Chapter 1

Installation

1.1 Planning

Planning your installation is straightforward, the first decision is to choose a location for the install process. By specifying the installation prefix, all appropriate binaries, man pages, libraries, and header files will be placed into your provided directory. If the prefix is not given, /usr/local is used. It is highly recommended that the software is installed into a location of your choice for future maintenance.

Once installation is complete, binaries are located in the bin directory, libraries in lib, and header files in include.

1.2 Compilation

Compilation for this software is handled by the GNU configure system. For maintainers, the complete system can be rebuilt using the autogen.sh shell script. Modifications, of course, should be made to the configure.ac and Makefile.am files located throughout the project directories.

If you are unfamiliar with GNU configure, see the INSTALL file for general configuration instructions. In addition, the following additions should be considered along with the base options.

–with-tcp-port=PORT Set the default TCP port for network connections in the mlogger and mclient tools. This can also be changed on startup with these tools.

6

Chapter 2 Tools

7 8

Chapter 3

API Reference

3.1 Agent Interface

There are a number of interfaces that are usable by client applications to interface directly with the policy agents. Both remote and local requests are handled similarily, through the agent connection and query interfaces as documented below. Within the same agent connection, multiple requests are possible prior to issuing a disconnect. Thus, state information regarding the connection is persistent and resources are not freed until the connection is explicitly closed.

Function  Arguments  Description

agent connect char *agenthost, unsigned short port, int options This function connects to both the local policy agent or across the network to a global policy agent as applicable. For remote connections, the hostname must be specified. If the port is provided, it will override the compiled in default. The options for the connection are for future enhancements to specify additional negotiation capabilities for requests (i.e., encryption).

agent disconnect none This is the inverse to the connect function. Every connect should be appropriately followed by a disconnect. If a disconnect does not occur, resources are freed automatically based on program termination. Resources are freed earlier if explictly called.

set device pstate int dev, int current state Transition the indicated device to the provided state. In order to transition the device, the state information must already be known