The Network UPS Tools (NUT) \fBnutscan\fR library provides the same discovery related features that are also offered by \fBnut-scanner\fR(8)\&.
.sp
It allows to discover supported NUT devices (USB, SNMP, Eaton XML/HTTP and IPMI) and NUT servers (using Avahi or the classic connection method)\&.
.SH"DISCOVERY FUNCTIONS"
.sp
First, include the needed header file:
.sp
.ifn\{\
.RS4
.\}
.nf
#include <nut\-scan\&.h>
.fi
.ifn\{\
.RE
.\}
.sp
Then, to discover new devices, use the appropriate function:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_usb\fR(3)
for supported USB devices,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_snmp\fR(3)
for supported SNMP agents,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_xml_http\fR(3)
for Eaton Network Management Card,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_nut\fR(3)
for NUT servers (upsd), using the classic method,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_avahi\fR(3)
for NUT servers (upsd), using the mDNS (Avahi) method,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_scan_ipmi\fR(3)
for supported IPMI PSU\&.
.RE
.sp
All these functions return a list of devices found, using the nutscan_device_t structure\&. This one is described in \fBnutscan_add_device_to_device\fR(3)\&.
.sp
Helper functions are also provided to output data using standard format:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_display_parsable\fR(3)
for parsable output,
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBnutscan_display_ups_conf\fR(3)
for ups\&.conf style\&.
.RE
.SH"ERROR HANDLING"
.sp
There is currently no specific mechanism around error handling\&.