EPATH Utilities

Name

EPATH Utilities -- Entity Path Utility Functions

Synopsis


#include <SaHpi.h>
#include <glib.h>


int         string2entitypath               (const gchar *epathstr,
                                                SaHpiEntityPathT *epathptr);
int         entitypath2string               (const SaHpiEntityPathT *epathptr,
                                                gchar *epathstr,
                                                gint strsize);
int         ep_concat                       (SaHpiEntityPathT *dest,
                                                const SaHpiEntityPathT *append);
int         set_epath_instance              (SaHpiEntityPathT *ep,
                                                SaHpiEntityTypeT et,
                                                SaHpiEntityInstanceT ei);
int         append_root                     (SaHpiEntityPathT *ep);

Description

This interface was created to manage entity paths with ease. It lets you convert an SaHpi entity path to its canonical string form and back, among other things like concatenating two entity paths. Plugin developers will mostly want to use string2entitypath() since entity paths are feeded to plugins in string form from the plugin configuration file (/etc/openhpi/openhpi.conf).

Details

string2entitypath ()

int    string2entitypath       (const gchar *epathstr,
                                 SaHpiEntityPathT *epathptr);

Converts an entity path canonical string into a SaHpiEntityPathT structure.

epathstr :

IN. Pointer to canonical entity path string

epathptr :

OUT. Pointer to HPI's entity path structure

Returns :

0 Successful return, -1 Error return

entitypath2string ()

int    entitypath2string       (const SaHpiEntityPathT *epathptr,
                                 gchar *epathstr,
                                 gint strsize);

Converts an entity path structure into its canonical string version.

epathptr :

IN. Pointer to HPI's entity path structure

epathstr :

OUT. Pointer to canonical entity path string

strsize :

IN. Canonical string length

Returns :

>0 Number of characters written to canonical entity path string, -1 Error return

ep_concat ()

int    ep_concat       (SaHpiEntityPathT *dest,
                         const SaHpiEntityPathT *append);

Concatenate two entity path structures (SaHpiEntityPathT). dest is assumed to be the least significant entity path in the operation. append will be truncated into dest, if it doesn't fit completely in the space that dest has available relative to SAHPI_MAX_ENTITY_PATH.

dest :

IN,OUT Left-hand entity path. Gets appended with append.

append :

IN Right-hand entity path. Pointer entity path to be appended.

Returns :

0 on Success, -1 if dest is NULL.

set_epath_instance ()

int    set_epath_instance      (SaHpiEntityPathT *ep,
                                 SaHpiEntityTypeT et,
                                 SaHpiEntityInstanceT ei);

Set an instance number in the entity path given at the first position (from least significant to most) the specified entity type is found.

ep :

Pointer to entity path to work on

et :

entity type to look for

ei :

entity instance to set when entity type is found

Returns :

0 on Success, -1 if the entity type was not found.

append_root ()

int    append_root             (SaHpiEntityPathT *ep);

Append the SAHPI_ENT_ROOT element to an entity path structure. If an entity path already has a root element, the function returns without making any changes and reporting success.

ep :

IN,OUT Pointer to entity path. SAHPI_ENT_ROOT will be appended to it.

Returns :

0 on Success, -1 if ep is NULL.