Specifications
114 Data Path Routing (DPR) HighWire MTP-2 - 1.2, September 4, 2002
DPR_CONN_RPT. Gets a report of the connections.
The putmsg control buffer is a structure of type dpr_func_t, which contains
only the command. The getmsg control buffer returned is also a dpr_func_t
structure with the error code in the df_err element, which is zero on success.
The text strings for the report are returned in the data buffer. It may take
several getmsg calls to get all of the data as shown in the following example:
char buf[512]; /* print buffer */
int err; /* err code */
int flag; /* flag, set to non-priority msg */
int more; /* more data flag */
struct strbuf prctl; /* structure for control part of msg */
struct strbuf prdata; /* structure for data part of msg */
dpr_func_t prproto; /* request/response control structure */
/*
* Set up the DPR_CONN_RPT command and send it to the board.
*/
prproto.df_fun = (DPR_PROTO_CODE << 8) | DPR_CONN_RPT;
prctl.maxlen = sizeof (prproto);
prctl.len = sizeof (prproto);
prctl.buf = (char *)&prproto;
if (!(err = putmsg (fd, &prctl, 0, 0))) {
/*
* Get response from the board and output to stdout.
*/
do {
prctl.maxlen = sizeof (prproto);
prctl.len = 0;
prctl.buf = (char *)&prproto;
prdata.maxlen = sizeof (buf);
prdata.len = 0;
prdata.buf = buf;
flag = 0;
more = getmsg (fd, &prctl, &prdata, &flag);
/*
* Quit on a getmsg error.
*/
if (more < 0) {
err = more;
break;
}
/*
* Retain any error returned.
*/
if (prctl.len)
err = prproto.df_err;
/*
* Print out all data received.
*/
fwrite (buf, prdata.len, 1, stdout);
}while (more) ;
}