Files
zoneminder/onvif
nicandClaude Opus 5.5 07179d7eae fix: set the WS-Discovery probe's interface before sending (#5257)
WSDiscovery::TransportUDP::send_multi opened its socket with PeerAddr,
which connects it, and called mcast_if afterwards. A connected UDP
socket keeps the route chosen at connect time, so on a host with more
than one network the Probe left through the default route whatever
interface was chosen: the web UI's ONVIF probe (zmonvif-probe.pl probe
<version> <interface>) found no camera on a second network.

Open the socket unconnected, set mcast_if first, and send to the group
with mcast_send. The destination is passed as a packed sockaddr_in:
given as "addr:port", mcast_send in IO::Socket::Multicast 1.12 (Debian
trixie) ends up with port 0 and the send fails with EINVAL. Without an
interface nothing changes: the probe goes out the default route as
before.

tests/perl/test_wsdiscovery_mcast_if.pl records the socket calls and
checks the order and the destination.

fixes #5256

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:26:40 -04:00
..
2014-11-14 17:00:16 +01:00
2023-08-13 18:57:36 +02:00
2014-11-14 17:00:16 +01:00
2016-12-26 10:33:03 -06:00

ZoneMinder ONVIF support

Copyright (C) 2016  Jan M. Hochstein

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------

1. PURPOSE
----------

The files in this folder and its subfolders add ONVIF support to zoneminder. 
The ONVIF consortium (www.onvif.org) publishes the ONVIF specifications. These 
specifications describe ways of connecting to and communicating with network 
video devices. Hardware and software that adhere to these specifications are 
meant to be interoperable.


2. SUBFOLDERS
-------------

doc/      - Documentation
modules/  - perl modules necessary for SOAP communication
proxy/    - perl SOAP proxy modules generated according to the ONVIF 
            specifications
scripts/  - application logic
wsdl/     - (empty) this is only used during the proxy generation process


3. LICENSE
----------
Any files in this folder and its subfolders are published under the same 
license as this file if they do not carry additional license information.


4. PROXY GENERATION
-------------------

SOAP messages use XML format and need to comply to the schema expected by the 
receiver. While it is possible to build messages through string concatenation 
it is impractical for all but testing purposes.
Here we use SOAP proxy modules generated by the script wsdl2perl.pl from the 
SOAP::WSDL module (http://search.cpan.org/~mkutter/SOAP-WSDL-2.00.10/) 
version 2.00.10. 

A - Get the input files.

    Download these files and any web service (.wsdl) or schema (.xsd) 
    files referenced therein into the wsdl/ subfolder.

    http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
    http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl
    http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl
    http://www.onvif.org/onvif/ver20/analytics/wsdl/analytics.wsdl

    The complete list of files we have during build is:
    
    analytics.wsdl
    b-2.xsd
    bf-2.xsd
    br-2.xsd
    brw-2.wsdl
    bw-2.wsdl
    devicemgmt.wsdl
    media.wsdl
    onvif.xsd
    ptz.wsdl
    r-2.xsd
    rw-2.wsdl
    soap-envelop.xsd
    t-1.xsd
    wsdd-discovery-1.1-schema-os.xsd
    wsdd-discovery-1.1-wsdl-os.wsdl
    wsdiscovery-udp.wsdl
    wsdl11soap12.xsd
    wsdl.xsd
    wsnotification.wsdl
    xmlmime.xsd
    xop-include.xsd

B - Generate the proxy modules using these commands.

    wsdl2perl.pl -p ONVIF::Device:: -b proxy/lib file:wsdl/devicemgmt.wsdl
    wsdl2perl.pl -p ONVIF::Media:: -b proxy/lib file:wsdl/media.wsdl
    wsdl2perl.pl -p ONVIF::PTZ:: -b proxy/lib file:wsdl/ptz.wsdl
    wsdl2perl.pl -p ONVIF::Event:: -b proxy/lib file:wsdl/event.wsdl
    wsdl2perl.pl -p ONVIF::Analytics:: -b proxy/lib file:wsdl/analytics.wsdl
    wsdl2perl.pl -p WSDiscovery:: -b proxy/lib file:wsdl/wsdiscovery-udp.wsdl
    wsdl2perl.pl -p WSNotification:: -b proxy/lib file:wsdl/wsnotification.wsdl

    I had to tweak SOAP::WSDL a little bit to get correct proxies.