Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further revise NUT public API headers #1641

Merged
merged 6 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ https://github.com/networkupstools/nut/milestone/8
last reported themselves as "stale" (and might later crash) so their
connections would be terminated if really no longer active [#1626]

- Further revision of public headers delivered by NUT was done, particularly
to address lack of common data types (`size_t`, `ssize_t`, `uint16_t`,
`time_t` etc.) in third-party client code that earlier sufficed to only
include NUT headers. Sort of regression by NUT 2.8.0 (note those consumers
still have to re-declare some numeric variable types used) [#1638, #1615]

---------------------------------------------------------------------------
Release notes for NUT 2.8.0 - what's new since 2.7.4:

Expand Down
9 changes: 9 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ Changes from 2.8.0 to 2.8.1

- PLANNED: Keep track of any further API clean-up?

- Further revision of public headers delivered by NUT was done, particularly
to address lack of common data types (`size_t`, `ssize_t`, `uint16_t`,
`time_t` etc.) in third-party client code that earlier sufficed to only
include NUT headers. Sort of regression by NUT 2.8.0 (note those consumers
still have to re-declare some numeric variable types used) [#1638]

* For practical example of NUT consumer adaptation (to cater to both old and
new API types) please see https://github.com/collectd/collectd/pull/4043

- Added support for `make install` of PyNUT module and NUT-Monitor desktop
application -- such activity was earlier done by packages directly; now
the packaging recipes may use NUT source-code facilities and package just
Expand Down
2 changes: 2 additions & 0 deletions clients/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ if HAVE_CXX11
lib_LTLIBRARIES += libnutclient.la
lib_LTLIBRARIES += libnutclientstub.la
endif

# Optionally deliverable as part of NUT public API:
if WITH_DEV
include_HEADERS = upsclient.h
if HAVE_CXX11
Expand Down
12 changes: 12 additions & 0 deletions clients/upsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
#include <limits.h>
#endif

/* Not including NUT timehead.h because this is part of end-user API */
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif

#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dist_noinst_HEADERS = attribute.h common.h extstate.h proto.h \
state.h str.h timehead.h upsconf.h nut_float.h nut_stdint.h nut_platform.h

# Optionally deliverable as part of NUT public API:
if WITH_DEV
include_HEADERS = parseconf.h
else
Expand Down
13 changes: 13 additions & 0 deletions include/parseconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@

#include <stdio.h>

/* Not including nut_stdint.h because this is part of end-user API */
#if defined HAVE_INTTYPES_H
#include <inttypes.h>
#endif

#if defined HAVE_STDINT_H
#include <stdint.h>
#endif

#if defined HAVE_LIMITS_H
#include <limits.h>
#endif

#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions tools/nut-scanner/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ endif
# C is not a header, but there is no dist_noinst_SOURCES
dist_noinst_HEADERS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C)

# Optionally deliverable as part of NUT public API:
if WITH_DEV
include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h
else
Expand Down
12 changes: 12 additions & 0 deletions tools/nut-scanner/nut-scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
# include <limits.h>
#endif

/* Ensure useconds_t et al: */
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif

#include "nutscan-init.h"
#include "nutscan-device.h"
#include "nutscan-ip.h"
Expand Down