summaryrefslogtreecommitdiff
path: root/systemd/daemon.py
diff options
context:
space:
mode:
Diffstat (limited to 'systemd/daemon.py')
-rw-r--r--systemd/daemon.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/systemd/daemon.py b/systemd/daemon.py
index 82011ca..5d398f2 100644
--- a/systemd/daemon.py
+++ b/systemd/daemon.py
@@ -5,6 +5,7 @@ from ._daemon import (__version__,
_is_fifo,
_is_socket,
_is_socket_inet,
+ _is_socket_sockaddr,
_is_socket_unix,
_is_mq,
LISTEN_FDS_START)
@@ -28,6 +29,20 @@ def is_socket_inet(fileobj, family=_AF_UNSPEC, type=0, listening=-1, port=0):
fd = _convert_fileobj(fileobj)
return _is_socket_inet(fd, family, type, listening, port)
+def is_socket_sockaddr(fileobj, address, type=0, flowinfo=0, listening=-1):
+ """Check socket type, address and/or port, flowinfo, listening state.
+
+ Wraps sd_is_socket_inet_sockaddr(3).
+
+ `address` is a systemd-style numerical IPv4 or IPv6 address as used in
+ ListenStream=. A port may be included after a colon (":").
+ See systemd.socket(5) for details.
+
+ Constants for `family` are defined in the socket module.
+ """
+ fd = _convert_fileobj(fileobj)
+ return _is_socket_sockaddr(fd, address, type, flowinfo, listening)
+
def is_socket_unix(fileobj, type=0, listening=-1, path=None):
fd = _convert_fileobj(fileobj)
return _is_socket_unix(fd, type, listening, path)