1PMPARSEHOSTSPEC(3)         Library Functions Manual         PMPARSEHOSTSPEC(3)
2
3
4

NAME

6       __pmParseHostSpec, __pmFreeHostSpec - uniform host specification parser
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10
11       int  __pmParseHostSpec(const  char  *string,  pmHostSpec  **rsltp,  int
12       *count, char **errmsg)
13
14       void __pmFreeHostSpec(pmHostSpec *rslt, int count)
15
16       cc ... -lpcp
17

DESCRIPTION

19       __pmParseHostSpec accepts a string specifying the  location  of  a  PCP
20       performance metric collector daemon.  The syntax of the various formats
21       of this string is described in PCPIntro(1) where several  examples  are
22       also presented.
23
24       The  syntax  allows  the initial pmcd(1) hostname to be optionally fol‐
25       lowed by a list of port numbers, which will be tried in order when con‐
26       necting to pmcd on that host.  The portlist is separated from the host‐
27       name using a colon, and each port in the list is comma-separated.
28
29       In addition, one or more optional pmproxy(1)  hosts  can  be  specified
30       (currently,  only  one  proxy  host is supported by the PCP protocols).
31       These are separated from each other and from the pmcd  component  using
32       the  @ character.  These may also be followed by an optional port list,
33       using the same comma-separated syntax as before.
34
35       __pmParseHostSpec takes a null-terminated host specification string and
36       returns  an  array  of pmHostSpec structures, where the array has count
37       entries.
38
39       These pmHostSpec structures that are returned via rsltp represent  each
40       individual  host in the specification string and has the following dec‐
41       laration:
42
43           typedef struct {
44               char    *name;       /* hostname (always valid) */
45               int     *ports;      /* array of host port numbers */
46               int     nports;      /* number of ports in host port array */
47           } pmHostSpec;
48
49       __pmParseHostSpec returns  0  if  the  given  string  was  successfully
50       parsed.   In  this  case all the storage allocated by __pmParseHostSpec
51       can be released by calling __pmFreeHostSpec using the address  returned
52       from __pmParseHostSpec via rsltp.
53
54       __pmParseHostSpec  returns  PM_ERR_GENERIC  and a dynamically allocated
55       error message string in errmsg, if the given string does not parse, and
56       the  user-supplied errmsg pointer is non-null.  Be sure to free(3C) the
57       error message string in this situation.
58
59       In the case of an error, rsltp is undefined.  In the case  of  success,
60       errmsg is undefined.
61

SEE ALSO

63       pmcd(1), pmproxy(1), pmchart(1), PMAPI(3) and pmNewContext(3).
64
65
66
67Performance Co-Pilot                Aconex                  PMPARSEHOSTSPEC(3)
Impressum