Skip to content

osdp-dev/libosdp

LibOSDP - Open Supervised Device Protocol Library

Latest Release Build CI PyPI Version PlatformIO Registry Vcpkg Version Crates.io LibOSDP version Crates.io osdpctl version

This is a cross-platform open source implementation of IEC 60839-11-5 Open Supervised Device Protocol (OSDP). The protocol is intended to improve interoperability among access control and security products. It supports Secure Channel (SC) for encrypted and authenticated communication between configured devices.

OSDP describes the communication protocol for interfacing one or more Peripheral Devices (PD) to a Control Panel (CP) over a two-wire RS-485 multi-drop serial communication channel. Nevertheless, this protocol can be used to transfer secure data over any stream based physical channel. Read more about OSDP here.

This protocol is developed and maintained by Security Industry Association (SIA).

Salient Features of LibOSDP

  • Supports secure channel communication (AES-128) by default and provides a custom init-time flag to enforce a higher level of security not mandated by the specification (see)
  • Can be used to setup a PD or CP mode of operation (see examples).
  • Exposes a well defined contract though a single header file.
  • Cross-platform; can be built to run on bare-metal embedded devices, Linux, Mac, and Windows.
  • No run-time memory allocation. All memory is allocated at init-time
  • No external dependencies (for ease of cross compilation)
  • Fully non-blocking, asynchronous design
  • Provides Rust, Python3, and C++ bindings for the C library for faster integration into various development phases.
  • Includes dozens of integration and unit tests which are incorporated in CI to ensure higher quality of releases.
  • Built-in, sophisticated, debugging infrastructure and tools (see).
  • Packaged and distributed through various package repositories such as Cargo crates, PyPI, Vcpkg, PlatformIO, etc.,

Usage Overview

An OSDP bus has exactly one CP talking to one or more PDs; LibOSDP can act as either. Your application interacts through three constructs (not to be confused with the protocol's own terminology):

  • Channel - the transport that lets two OSDP devices talk to each other
  • Commands - a call for action from a CP to one of its PDs
  • Events - a call for action from a PD to its CP

You implement the osdp_channel interface, describe the device with osdp_pd_info_t, create an osdp_t context, and call osdp_cp/pd_refresh() at least once every 50ms to meet the protocol's timing requirements. From there a CP sends commands and receives events, while a PD notifies events and handles commands.

See the API documentation and examples for the full workflow.

Language Support

C/C++ API

LibOSDP core is written in C. It exposes a minimal set of API to setup and manage the life-cycle of OSDP devices. See include/osdp.h or include/osdp.hpp for more details.

Rust API

LibOSDP is available via crates.io. See rust/README.md for more info and usage examples.

Python API

LibOSDP is available as a python package. See python/README.md for more info and usage examples.

Supported Commands and Replies

OSDP has certain command and reply IDs pre-registered. This implementation of the protocol support only the most common among them. You can see a list of commands and replies and their support status in LibOSDP here.

Build & Install

You need a C compiler and CMake 3.14 or newer. Clone with submodules and build:

git clone https://github.com/osdp-dev/libosdp --recurse-submodules
cd libosdp
cmake -B build .
cmake --build build --parallel

This produces libosdp.so and libosdpstatic.a; downstream CMake projects can consume the library with find_package(libosdp CONFIG REQUIRED) and link against the libosdp::libosdp target. LibOSDP also ships a lean Make-based build for cross-compile and embedded targets that needs nothing but a C compiler.

The Build and Install guide on doc.osdp.dev is the full source of truth: it covers setting up the build environment on Linux, macOS, and Windows, the crypto backend and compile-time options, cross-compilation, running the test suite, and consuming LibOSDP from your own CMake, pkg-config, or vcpkg project.

Contributions, Issues and Bugs

The Github issue tracker doubles up as TODO list for this project. Have a look at the open issues, PRs in those directions are welcome.

If you have a idea, find bugs, or other issues, please open a new issue in the github page of this project https://github.com/osdp-dev/libosdp.

You can read more on this here.

License

This software is distributed under the terms of Apache-2.0 license. If you don't know what that means/implies, you can consider it is as "free as in beer".

OSDP protocol is also open for consumption into any product. There is no need to,

  • obtain permission from SIA
  • pay royalty to SIA
  • become SIA member

The OSDP specification can be obtained from SIA for a cost. Read more at our FAQ page.

Support the development

Since this is no longer a hobby project, it takes time and effort to develop and maintain this project. If you are a user and are happy with it, consider supporting the development by donations though my GitHub sponsors page. Your support will ensure sustained development of LibOSDP.

About

OSDP (Open Supervised Device Protocol) library; this project provides a C library for OSDP with bindings/glues for various platforms and languages

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

191 stars

Watchers

16 watching

Forks

Sponsor this project

 

Contributors