/* automatically generated by rust-bindgen 0.72.1 */
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2Y: u32 = 0;
pub const __GLIBC_USE_ISOC23: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __TIMESIZE: u32 = 64;
pub const __USE_TIME_BITS64: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const __GLIBC_USE_C23_STRTOL: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_60559_BFP__: u32 = 201404;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 41;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 0;
pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const _BITS_STDINT_LEAST_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub const __bool_true_false_are_defined: u32 = 1;
pub const true_: u32 = 1;
pub const false_: u32 = 0;
pub const OSDP_FLAG_ENFORCE_SECURE: u32 = 65536;
pub const OSDP_FLAG_INSTALL_MODE: u32 = 131072;
pub const OSDP_FLAG_IGN_UNSOLICITED: u32 = 262144;
pub const OSDP_FLAG_ENABLE_NOTIFICATION: u32 = 524288;
pub const OSDP_FLAG_CAPTURE_PACKETS: u32 = 1048576;
pub const OSDP_FLAG_ALLOW_EMPTY_ENCRYPTED_DATA_BLOCK: u32 = 2097152;
pub const OSDP_STATUS_REPORT_MAX_LEN: u32 = 64;
pub const OSDP_CMD_TEXT_MAX_LEN: u32 = 32;
pub const OSDP_CMD_KEYSET_KEY_MAX_LEN: u32 = 32;
pub const OSDP_CMD_MFG_MAX_DATALEN: u32 = 64;
pub const OSDP_CMD_FILE_TX_FLAG_CANCEL: u32 = 2147483648;
pub const OSDP_CMD_FLAG_BROADCAST: u32 = 1;
pub const OSDP_EVENT_CARDREAD_MAX_DATALEN: u32 = 64;
pub const OSDP_EVENT_KEYPRESS_MAX_DATALEN: u32 = 64;
pub const OSDP_EVENT_MFGREP_MAX_DATALEN: u32 = 128;
pub type __u_char = ::core::ffi::c_uchar;
pub type __u_short = ::core::ffi::c_ushort;
pub type __u_int = ::core::ffi::c_uint;
pub type __u_long = ::core::ffi::c_ulong;
pub type __int8_t = ::core::ffi::c_schar;
pub type __uint8_t = ::core::ffi::c_uchar;
pub type __int16_t = ::core::ffi::c_short;
pub type __uint16_t = ::core::ffi::c_ushort;
pub type __int32_t = ::core::ffi::c_int;
pub type __uint32_t = ::core::ffi::c_uint;
pub type __int64_t = ::core::ffi::c_long;
pub type __uint64_t = ::core::ffi::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::core::ffi::c_long;
pub type __u_quad_t = ::core::ffi::c_ulong;
pub type __intmax_t = ::core::ffi::c_long;
pub type __uintmax_t = ::core::ffi::c_ulong;
pub type __dev_t = ::core::ffi::c_ulong;
pub type __uid_t = ::core::ffi::c_uint;
pub type __gid_t = ::core::ffi::c_uint;
pub type __ino_t = ::core::ffi::c_ulong;
pub type __ino64_t = ::core::ffi::c_ulong;
pub type __mode_t = ::core::ffi::c_uint;
pub type __nlink_t = ::core::ffi::c_ulong;
pub type __off_t = ::core::ffi::c_long;
pub type __off64_t = ::core::ffi::c_long;
pub type __pid_t = ::core::ffi::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
pub __val: [::core::ffi::c_int; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of __fsid_t"][::core::mem::size_of::<__fsid_t>() - 8usize];
["Alignment of __fsid_t"][::core::mem::align_of::<__fsid_t>() - 4usize];
["Offset of field: __fsid_t::__val"][::core::mem::offset_of!(__fsid_t, __val) - 0usize];
};
pub type __clock_t = ::core::ffi::c_long;
pub type __rlim_t = ::core::ffi::c_ulong;
pub type __rlim64_t = ::core::ffi::c_ulong;
pub type __id_t = ::core::ffi::c_uint;
pub type __time_t = ::core::ffi::c_long;
pub type __useconds_t = ::core::ffi::c_uint;
pub type __suseconds_t = ::core::ffi::c_long;
pub type __suseconds64_t = ::core::ffi::c_long;
pub type __daddr_t = ::core::ffi::c_int;
pub type __key_t = ::core::ffi::c_int;
pub type __clockid_t = ::core::ffi::c_int;
pub type __timer_t = *mut ::core::ffi::c_void;
pub type __blksize_t = ::core::ffi::c_long;
pub type __blkcnt_t = ::core::ffi::c_long;
pub type __blkcnt64_t = ::core::ffi::c_long;
pub type __fsblkcnt_t = ::core::ffi::c_ulong;
pub type __fsblkcnt64_t = ::core::ffi::c_ulong;
pub type __fsfilcnt_t = ::core::ffi::c_ulong;
pub type __fsfilcnt64_t = ::core::ffi::c_ulong;
pub type __fsword_t = ::core::ffi::c_long;
pub type __ssize_t = ::core::ffi::c_long;
pub type __syscall_slong_t = ::core::ffi::c_long;
pub type __syscall_ulong_t = ::core::ffi::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::core::ffi::c_char;
pub type __intptr_t = ::core::ffi::c_long;
pub type __socklen_t = ::core::ffi::c_uint;
pub type __sig_atomic_t = ::core::ffi::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::core::ffi::c_schar;
pub type int_fast16_t = ::core::ffi::c_long;
pub type int_fast32_t = ::core::ffi::c_long;
pub type int_fast64_t = ::core::ffi::c_long;
pub type uint_fast8_t = ::core::ffi::c_uchar;
pub type uint_fast16_t = ::core::ffi::c_ulong;
pub type uint_fast32_t = ::core::ffi::c_ulong;
pub type uint_fast64_t = ::core::ffi::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
#[doc = " Dummy."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_UNUSED: osdp_pd_cap_function_code_e = 0;
#[doc = " This function indicates the ability to monitor the status of a switch\n using a two-wire electrical connection between the PD and the switch.\n The on/off position of the switch indicates the state of an external\n device.\n\n The PD may simply resolve all circuit states to an open/closed\n status, or it may implement supervision of the monitoring circuit. A\n supervised circuit is able to indicate circuit fault status in\n addition to open/closed status."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_CONTACT_STATUS_MONITORING:
osdp_pd_cap_function_code_e = 1;
#[doc = " This function provides a switched output, typically in the form of a\n relay. The Output has two states: active or inactive. The Control\n Panel (CP) can directly set the Output's state, or, if the PD\n supports timed operations, the CP can specify a time period for the\n activation of the Output."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_OUTPUT_CONTROL: osdp_pd_cap_function_code_e = 2;
#[doc = " This capability indicates the form of the card data is presented to\n the Control Panel."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_CARD_DATA_FORMAT: osdp_pd_cap_function_code_e = 3;
#[doc = " This capability indicates the presence of and type of LEDs."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_READER_LED_CONTROL: osdp_pd_cap_function_code_e =
4;
#[doc = " This capability indicates the presence of and type of an Audible\n Annunciator (buzzer or similar tone generator)"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_READER_AUDIBLE_OUTPUT:
osdp_pd_cap_function_code_e = 5;
#[doc = " This capability indicates that the PD supports a text display\n emulating character-based display terminals."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_READER_TEXT_OUTPUT: osdp_pd_cap_function_code_e =
6;
#[doc = " This capability indicates that the type of date and time awareness\n or time keeping ability of the PD."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_TIME_KEEPING: osdp_pd_cap_function_code_e = 7;
#[doc = " All PDs must be able to support the checksum mode. This capability\n indicates if the PD is capable of supporting CRC mode."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_CHECK_CHARACTER_SUPPORT:
osdp_pd_cap_function_code_e = 8;
#[doc = " This capability indicates the extent to which the PD supports\n communication security (Secure Channel Communication)"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_COMMUNICATION_SECURITY:
osdp_pd_cap_function_code_e = 9;
#[doc = " This capability indicates the maximum size single message the PD can\n receive."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_RECEIVE_BUFFERSIZE: osdp_pd_cap_function_code_e =
10;
#[doc = " This capability indicates the maximum size multi-part message which\n the PD can handle."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_LARGEST_COMBINED_MESSAGE_SIZE:
osdp_pd_cap_function_code_e = 11;
#[doc = " This capability indicates whether the PD supports the transparent\n mode used for communicating directly with a smart card."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_SMART_CARD_SUPPORT: osdp_pd_cap_function_code_e =
12;
#[doc = " This capability indicates the number of credential reader devices\n present. Compliance levels are bit fields to be assigned as needed."]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_READERS: osdp_pd_cap_function_code_e = 13;
#[doc = " This capability indicates the ability of the reader to handle\n biometric input"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_BIOMETRICS: osdp_pd_cap_function_code_e = 14;
#[doc = " This capability indicates if the reader is capable of supporting\n Secure Pin Entry (SPE) for smart cards"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_SECURE_PIN_ENTRY: osdp_pd_cap_function_code_e =
15;
#[doc = " This capability indicates the version of OSDP the PD supports\n\n Compliance Levels:\n 0 - Unspecified\n 1 - IEC 60839-11-5\n 2 - SIA OSDP 2.2"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_OSDP_VERSION: osdp_pd_cap_function_code_e = 16;
#[doc = " Capability Sentinel"]
pub const osdp_pd_cap_function_code_e_OSDP_PD_CAP_SENTINEL: osdp_pd_cap_function_code_e = 17;
#[doc = " @brief Various PD capability function codes."]
pub type osdp_pd_cap_function_code_e = ::core::ffi::c_uchar;
#[doc = "< No error"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_NONE: osdp_pd_nak_code_e = 0;
#[doc = "< Message check character(s) error (bad cksum/crc)"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_MSG_CHK: osdp_pd_nak_code_e = 1;
#[doc = "< Command length error"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_CMD_LEN: osdp_pd_nak_code_e = 2;
#[doc = "< Unknown Command Code – Command not implemented by PD"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_CMD_UNKNOWN: osdp_pd_nak_code_e = 3;
#[doc = "< Sequence number error"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_SEQ_NUM: osdp_pd_nak_code_e = 4;
#[doc = "< Secure Channel is not supported by PD"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_SC_UNSUP: osdp_pd_nak_code_e = 5;
#[doc = "< unsupported security block or security conditions not met"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_SC_COND: osdp_pd_nak_code_e = 6;
#[doc = "< BIO_TYPE not supported"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_BIO_TYPE: osdp_pd_nak_code_e = 7;
#[doc = "< BIO_FORMAT not supported"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_BIO_FMT: osdp_pd_nak_code_e = 8;
#[doc = "< Unable to process command record"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_RECORD: osdp_pd_nak_code_e = 9;
#[doc = "< NAK codes max value"]
pub const osdp_pd_nak_code_e_OSDP_PD_NAK_SENTINEL: osdp_pd_nak_code_e = 10;
#[doc = " @brief OSDP specified NAK codes"]
pub type osdp_pd_nak_code_e = ::core::ffi::c_uchar;
#[doc = " @brief PD capability structure. Each PD capability has a 3 byte\n representation."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_pd_cap {
#[doc = " Capability function code. See @ref osdp_pd_cap_function_code_e"]
pub function_code: u8,
#[doc = " A function_code dependent number that indicates what the PD can do\n with this capability."]
pub compliance_level: u8,
#[doc = " Number of such capability entities in PD"]
pub num_items: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_pd_cap"][::core::mem::size_of::<osdp_pd_cap>() - 3usize];
["Alignment of osdp_pd_cap"][::core::mem::align_of::<osdp_pd_cap>() - 1usize];
["Offset of field: osdp_pd_cap::function_code"]
[::core::mem::offset_of!(osdp_pd_cap, function_code) - 0usize];
["Offset of field: osdp_pd_cap::compliance_level"]
[::core::mem::offset_of!(osdp_pd_cap, compliance_level) - 1usize];
["Offset of field: osdp_pd_cap::num_items"]
[::core::mem::offset_of!(osdp_pd_cap, num_items) - 2usize];
};
#[doc = " @brief PD ID information advertised by the PD."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_pd_id {
#[doc = "< 1-Byte Manufacturer's version number"]
pub version: ::core::ffi::c_int,
#[doc = "< 1-byte Manufacturer's model number"]
pub model: ::core::ffi::c_int,
#[doc = "< 3-bytes IEEE assigned OUI"]
pub vendor_code: u32,
#[doc = "< 4-byte serial number for the PD"]
pub serial_number: u32,
#[doc = "< 3-byte version (major, minor, build)"]
pub firmware_version: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_pd_id"][::core::mem::size_of::<osdp_pd_id>() - 20usize];
["Alignment of osdp_pd_id"][::core::mem::align_of::<osdp_pd_id>() - 4usize];
["Offset of field: osdp_pd_id::version"][::core::mem::offset_of!(osdp_pd_id, version) - 0usize];
["Offset of field: osdp_pd_id::model"][::core::mem::offset_of!(osdp_pd_id, model) - 4usize];
["Offset of field: osdp_pd_id::vendor_code"]
[::core::mem::offset_of!(osdp_pd_id, vendor_code) - 8usize];
["Offset of field: osdp_pd_id::serial_number"]
[::core::mem::offset_of!(osdp_pd_id, serial_number) - 12usize];
["Offset of field: osdp_pd_id::firmware_version"]
[::core::mem::offset_of!(osdp_pd_id, firmware_version) - 16usize];
};
#[doc = " @brief pointer to function that copies received bytes into buffer. This\n function should be non-blocking.\n\n @param data for use by underlying layers. osdp_channel::data is passed\n @param buf byte array copy incoming data\n @param maxlen sizeof `buf`. Can copy utmost `maxlen` bytes into `buf`\n\n @retval +ve: number of bytes copied on to `buf`. Must be <= `len`\n @retval -ve on errors"]
pub type osdp_read_fn_t = ::core::option::Option<
unsafe extern "C" fn(
data: *mut ::core::ffi::c_void,
buf: *mut u8,
maxlen: ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief Pointer to function used to receive a full packet buffer.\n The callee returns a pointer and a max_len up to which LibOSDP may\n access the buffer. The caller must invoke release_pkt() when done.\n\n @param data for use by underlying layers. osdp_channel::data is passed\n @param buf output pointer to the packet buffer\n @param max_len output maximum length LibOSDP may touch in this buffer\n @return 0 when a complete packet is available; non-zero otherwise"]
pub type osdp_read_pkt_fn_t = ::core::option::Option<
unsafe extern "C" fn(
data: *mut ::core::ffi::c_void,
buf: *mut *const u8,
max_len: *mut ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief pointer to function that sends byte array into some channel. This\n function should be non-blocking.\n\n @param data for use by underlying layers. osdp_channel::data is passed\n @param buf byte array to be sent\n @param len number of bytes in `buf`\n\n @retval +ve: number of bytes sent. must be <= `len`\n @retval -ve on errors\n\n @note For now, LibOSDP expects method to write/queue all or no bytes over\n the channel per-invocation; ie., it does not support partial writes and is a\n known limitation. Since an OSDP packet isn't so large, and typical TX\n buffers are much larger than that, it's not as bad as it sounds and hence\n not on the priority list to be fixed."]
pub type osdp_write_fn_t = ::core::option::Option<
unsafe extern "C" fn(
data: *mut ::core::ffi::c_void,
buf: *mut u8,
len: ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief pointer to function that drops all bytes in TX/RX fifo. This\n function should be non-blocking.\n\n @param data for use by underlying layers. osdp_channel::data is passed"]
pub type osdp_flush_fn_t =
::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void)>;
#[doc = " @brief pointer to function that closes the underlying channel. This call is\n made when LibOSDP is terminating, once per PD.\n\n @param data for use by underlying layers. osdp_channel::data is passed"]
pub type osdp_close_fn_t =
::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void)>;
#[doc = " @brief Pointer to function used to release a buffer returned by recv_pkt().\n\n @param data for use by underlying layers. osdp_channel::data is passed\n @param buf pointer that was returned by recv_pkt()"]
pub type osdp_release_pkt_fn_t =
::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void, buf: *const u8)>;
#[doc = " @brief User defined communication channel abstraction for OSDP devices.\n The methods for read/write/flush are expected to be non-blocking."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_channel {
#[doc = " pointer to a block of memory that will be passed to the\n send/receive/flush method. This is optional (can be set to NULL)"]
pub data: *mut ::core::ffi::c_void,
#[doc = " channel_id; On multi-drop networks, more than one PD can share the\n same channel (read/write/flush pointers). On such networks, the\n channel_id is used to lock a PD to a channel. On multi-drop\n networks, this `id` must non-zero and be unique for each bus."]
pub id: ::core::ffi::c_int,
#[doc = " Pointer to function used to receive osdp packet data"]
pub recv: osdp_read_fn_t,
#[doc = " Pointer to function used to receive a full packet buffer (optional)"]
pub recv_pkt: osdp_read_pkt_fn_t,
#[doc = " Pointer to function used to send osdp packet data"]
pub send: osdp_write_fn_t,
#[doc = " Pointer to function used to flush the channel (optional)"]
pub flush: osdp_flush_fn_t,
#[doc = " Pointer to function used to release recv_pkt() data (optional)"]
pub release_pkt: osdp_release_pkt_fn_t,
#[doc = " Pointer to function used to close the channel (optional)"]
pub close: osdp_close_fn_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_channel"][::core::mem::size_of::<osdp_channel>() - 64usize];
["Alignment of osdp_channel"][::core::mem::align_of::<osdp_channel>() - 8usize];
["Offset of field: osdp_channel::data"][::core::mem::offset_of!(osdp_channel, data) - 0usize];
["Offset of field: osdp_channel::id"][::core::mem::offset_of!(osdp_channel, id) - 8usize];
["Offset of field: osdp_channel::recv"][::core::mem::offset_of!(osdp_channel, recv) - 16usize];
["Offset of field: osdp_channel::recv_pkt"]
[::core::mem::offset_of!(osdp_channel, recv_pkt) - 24usize];
["Offset of field: osdp_channel::send"][::core::mem::offset_of!(osdp_channel, send) - 32usize];
["Offset of field: osdp_channel::flush"]
[::core::mem::offset_of!(osdp_channel, flush) - 40usize];
["Offset of field: osdp_channel::release_pkt"]
[::core::mem::offset_of!(osdp_channel, release_pkt) - 48usize];
["Offset of field: osdp_channel::close"]
[::core::mem::offset_of!(osdp_channel, close) - 56usize];
};
#[doc = " @brief OSDP PD Information. This struct is used to describe a PD to LibOSDP."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_pd_info_t {
#[doc = " User provided name for this PD (log messages include this name)"]
pub name: *const ::core::ffi::c_char,
#[doc = " Can be one of 9600/19200/38400/57600/115200/230400"]
pub baud_rate: ::core::ffi::c_int,
#[doc = " 7 bit PD address. the rest of the bits are ignored. The special\n address 0x7F is used for broadcast. So there can be 2^7-1 devices on\n a multi-drop channel"]
pub address: ::core::ffi::c_int,
#[doc = " Used to modify the way the context is setup. See `OSDP_FLAG_*`\n macros."]
pub flags: ::core::ffi::c_int,
#[doc = " Static information that the PD reports to the CP when it received a\n `CMD_ID`. These information must be populated by a PD application."]
pub id: osdp_pd_id,
#[doc = " This is a pointer to an array of structures containing the PD'\n capabilities. Use { -1, 0, 0 } to terminate the array. This is used\n only PD mode of operation"]
pub cap: *const osdp_pd_cap,
#[doc = " Communication channel ops structure, containing send/recv function\n pointers"]
pub channel: osdp_channel,
#[doc = " Pointer to 16 bytes of Secure Channel Base Key for the PD. If\n non-null, this is used to set-up the secure channel."]
pub scbk: *const u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_pd_info_t"][::core::mem::size_of::<osdp_pd_info_t>() - 120usize];
["Alignment of osdp_pd_info_t"][::core::mem::align_of::<osdp_pd_info_t>() - 8usize];
["Offset of field: osdp_pd_info_t::name"]
[::core::mem::offset_of!(osdp_pd_info_t, name) - 0usize];
["Offset of field: osdp_pd_info_t::baud_rate"]
[::core::mem::offset_of!(osdp_pd_info_t, baud_rate) - 8usize];
["Offset of field: osdp_pd_info_t::address"]
[::core::mem::offset_of!(osdp_pd_info_t, address) - 12usize];
["Offset of field: osdp_pd_info_t::flags"]
[::core::mem::offset_of!(osdp_pd_info_t, flags) - 16usize];
["Offset of field: osdp_pd_info_t::id"][::core::mem::offset_of!(osdp_pd_info_t, id) - 20usize];
["Offset of field: osdp_pd_info_t::cap"]
[::core::mem::offset_of!(osdp_pd_info_t, cap) - 40usize];
["Offset of field: osdp_pd_info_t::channel"]
[::core::mem::offset_of!(osdp_pd_info_t, channel) - 48usize];
["Offset of field: osdp_pd_info_t::scbk"]
[::core::mem::offset_of!(osdp_pd_info_t, scbk) - 112usize];
};
#[doc = " @brief To keep the OSDP internal data structures from polluting the exposed\n headers, they are typedefed to void before sending them to the upper layers.\n This level of abstraction looked reasonable as _technically_ no one should\n attempt to modify it outside of the LibOSDP and their definition may change\n at any time."]
pub type osdp_t = ::core::ffi::c_void;
#[doc = " @brief Status report of the inputs attached the PD"]
pub const osdp_status_report_type_OSDP_STATUS_REPORT_INPUT: osdp_status_report_type = 0;
#[doc = " @brief Status report of the output attached the PD"]
pub const osdp_status_report_type_OSDP_STATUS_REPORT_OUTPUT: osdp_status_report_type = 1;
#[doc = " @brief Local tamper and power status report\n\n Bit-0: tamper\n Bit-1: power"]
pub const osdp_status_report_type_OSDP_STATUS_REPORT_LOCAL: osdp_status_report_type = 2;
#[doc = " @brief Remote tamper and power status report\n\n Bit-0: tamper\n Bit-1: power"]
pub const osdp_status_report_type_OSDP_STATUS_REPORT_REMOTE: osdp_status_report_type = 3;
#[doc = " @brief OSDP Status report types"]
pub type osdp_status_report_type = ::core::ffi::c_uchar;
#[doc = " @brief Status report structure. Used by OSDP_CMD_STATUS and\n OSDP_EVENT_STATUS. In case of command, it is used to send a query to the PD\n while in the case of events, the PD responds back with this structure.\n\n This can is used by the PD to indicate various status change reports. Upto a\n maximum of 32 statuses can be reported using this API."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_status_report {
#[doc = " The kind of event to report see `enum osdp_event_status_type_e`"]
pub type_: osdp_status_report_type,
#[doc = " Number of valid bits in `status`"]
pub nr_entries: ::core::ffi::c_int,
#[doc = " Status report"]
pub report: [u8; 64usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_status_report"][::core::mem::size_of::<osdp_status_report>() - 72usize];
["Alignment of osdp_status_report"][::core::mem::align_of::<osdp_status_report>() - 4usize];
["Offset of field: osdp_status_report::type_"]
[::core::mem::offset_of!(osdp_status_report, type_) - 0usize];
["Offset of field: osdp_status_report::nr_entries"]
[::core::mem::offset_of!(osdp_status_report, nr_entries) - 4usize];
["Offset of field: osdp_status_report::report"]
[::core::mem::offset_of!(osdp_status_report, report) - 8usize];
};
#[doc = " @brief Command sent from CP to Control digital output of PD."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_output {
#[doc = " 0 = First Output, 1 = Second Output, etc."]
pub output_no: u8,
#[doc = " One of the following:\n 0 - NOP – do not alter this output\n 1 - set the permanent state to OFF, abort timed operation (if any)\n 2 - set the permanent state to ON, abort timed operation (if any)\n 3 - set the permanent state to OFF, allow timed operation to complete\n 4 - set the permanent state to ON, allow timed operation to complete\n 5 - set the temporary state to ON, resume perm state on timeout\n 6 - set the temporary state to OFF, resume permanent state on timeout"]
pub control_code: u8,
#[doc = " Time in units of 100 ms"]
pub timer_count: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_output"][::core::mem::size_of::<osdp_cmd_output>() - 4usize];
["Alignment of osdp_cmd_output"][::core::mem::align_of::<osdp_cmd_output>() - 2usize];
["Offset of field: osdp_cmd_output::output_no"]
[::core::mem::offset_of!(osdp_cmd_output, output_no) - 0usize];
["Offset of field: osdp_cmd_output::control_code"]
[::core::mem::offset_of!(osdp_cmd_output, control_code) - 1usize];
["Offset of field: osdp_cmd_output::timer_count"]
[::core::mem::offset_of!(osdp_cmd_output, timer_count) - 2usize];
};
#[doc = "< No color"]
pub const osdp_led_color_e_OSDP_LED_COLOR_NONE: osdp_led_color_e = 0;
#[doc = "< Red"]
pub const osdp_led_color_e_OSDP_LED_COLOR_RED: osdp_led_color_e = 1;
#[doc = "< Green"]
pub const osdp_led_color_e_OSDP_LED_COLOR_GREEN: osdp_led_color_e = 2;
#[doc = "< Amber"]
pub const osdp_led_color_e_OSDP_LED_COLOR_AMBER: osdp_led_color_e = 3;
#[doc = "< Blue"]
pub const osdp_led_color_e_OSDP_LED_COLOR_BLUE: osdp_led_color_e = 4;
#[doc = "< Magenta"]
pub const osdp_led_color_e_OSDP_LED_COLOR_MAGENTA: osdp_led_color_e = 5;
#[doc = "< Cyan"]
pub const osdp_led_color_e_OSDP_LED_COLOR_CYAN: osdp_led_color_e = 6;
#[doc = "< White"]
pub const osdp_led_color_e_OSDP_LED_COLOR_WHITE: osdp_led_color_e = 7;
#[doc = "< Max value"]
pub const osdp_led_color_e_OSDP_LED_COLOR_SENTINEL: osdp_led_color_e = 8;
#[doc = " @brief LED Colors as specified in OSDP for the on_color/off_color\n parameters."]
pub type osdp_led_color_e = ::core::ffi::c_uchar;
#[doc = " @brief LED params sub-structure. Part of LED command. See @ref osdp_cmd_led."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_led_params {
#[doc = " Control code.\n\n Temporary Control Code:\n - 0 - NOP - do not alter this LED's temporary settings.\n - 1 - Cancel any temporary operation and display this LED's\n permanent state immediately.\n - 2 - Set the temporary state as given and start timer immediately.\n\n Permanent Control Code:\n - 0 - NOP - do not alter this LED's permanent settings.\n - 1 - Set the permanent state as given."]
pub control_code: u8,
#[doc = " The ON duration of the flash, in units of 100 ms."]
pub on_count: u8,
#[doc = " The OFF duration of the flash, in units of 100 ms."]
pub off_count: u8,
#[doc = " Color to set during the ON timer (see @ref osdp_led_color_e)."]
pub on_color: u8,
#[doc = " Color to set during the OFF timer (see @ref osdp_led_color_e)."]
pub off_color: u8,
#[doc = " Time in units of 100 ms (only for temporary mode)."]
pub timer_count: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_led_params"][::core::mem::size_of::<osdp_cmd_led_params>() - 8usize];
["Alignment of osdp_cmd_led_params"][::core::mem::align_of::<osdp_cmd_led_params>() - 2usize];
["Offset of field: osdp_cmd_led_params::control_code"]
[::core::mem::offset_of!(osdp_cmd_led_params, control_code) - 0usize];
["Offset of field: osdp_cmd_led_params::on_count"]
[::core::mem::offset_of!(osdp_cmd_led_params, on_count) - 1usize];
["Offset of field: osdp_cmd_led_params::off_count"]
[::core::mem::offset_of!(osdp_cmd_led_params, off_count) - 2usize];
["Offset of field: osdp_cmd_led_params::on_color"]
[::core::mem::offset_of!(osdp_cmd_led_params, on_color) - 3usize];
["Offset of field: osdp_cmd_led_params::off_color"]
[::core::mem::offset_of!(osdp_cmd_led_params, off_color) - 4usize];
["Offset of field: osdp_cmd_led_params::timer_count"]
[::core::mem::offset_of!(osdp_cmd_led_params, timer_count) - 6usize];
};
#[doc = " @brief Sent from CP to PD to control the behaviour of it's on-board LEDs"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_led {
#[doc = " Reader number. 0 = First Reader, 1 = Second Reader, etc."]
pub reader: u8,
#[doc = " LED number. 0 = first LED, 1 = second LED, etc."]
pub led_number: u8,
#[doc = " Ephemeral LED status descriptor."]
pub temporary: osdp_cmd_led_params,
#[doc = " Permanent LED status descriptor."]
pub permanent: osdp_cmd_led_params,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_led"][::core::mem::size_of::<osdp_cmd_led>() - 18usize];
["Alignment of osdp_cmd_led"][::core::mem::align_of::<osdp_cmd_led>() - 2usize];
["Offset of field: osdp_cmd_led::reader"]
[::core::mem::offset_of!(osdp_cmd_led, reader) - 0usize];
["Offset of field: osdp_cmd_led::led_number"]
[::core::mem::offset_of!(osdp_cmd_led, led_number) - 1usize];
["Offset of field: osdp_cmd_led::temporary"]
[::core::mem::offset_of!(osdp_cmd_led, temporary) - 2usize];
["Offset of field: osdp_cmd_led::permanent"]
[::core::mem::offset_of!(osdp_cmd_led, permanent) - 10usize];
};
#[doc = " @brief Sent from CP to control the behaviour of a buzzer in the PD."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_buzzer {
#[doc = " Reader number. 0 = First Reader, 1 = Second Reader, etc."]
pub reader: u8,
#[doc = " Control code.\n - 0 - no tone\n - 1 - off\n - 2 - default tone\n - 3+ - TBD"]
pub control_code: u8,
#[doc = " The ON duration of the sound, in units of 100 ms."]
pub on_count: u8,
#[doc = " The OFF duration of the sound, in units of 100 ms."]
pub off_count: u8,
#[doc = " The number of times to repeat the ON/OFF cycle; 0: forever."]
pub rep_count: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_buzzer"][::core::mem::size_of::<osdp_cmd_buzzer>() - 5usize];
["Alignment of osdp_cmd_buzzer"][::core::mem::align_of::<osdp_cmd_buzzer>() - 1usize];
["Offset of field: osdp_cmd_buzzer::reader"]
[::core::mem::offset_of!(osdp_cmd_buzzer, reader) - 0usize];
["Offset of field: osdp_cmd_buzzer::control_code"]
[::core::mem::offset_of!(osdp_cmd_buzzer, control_code) - 1usize];
["Offset of field: osdp_cmd_buzzer::on_count"]
[::core::mem::offset_of!(osdp_cmd_buzzer, on_count) - 2usize];
["Offset of field: osdp_cmd_buzzer::off_count"]
[::core::mem::offset_of!(osdp_cmd_buzzer, off_count) - 3usize];
["Offset of field: osdp_cmd_buzzer::rep_count"]
[::core::mem::offset_of!(osdp_cmd_buzzer, rep_count) - 4usize];
};
#[doc = " @brief Command to manipulate any display units that the PD supports."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_text {
#[doc = " Reader number. 0 = First Reader, 1 = Second Reader, etc."]
pub reader: u8,
#[doc = " Control code.\n - 1 - permanent text, no wrap\n - 2 - permanent text, with wrap\n - 3 - temp text, no wrap\n - 4 - temp text, with wrap"]
pub control_code: u8,
#[doc = " Duration to display temporary text, in seconds"]
pub temp_time: u8,
#[doc = " Row to display the first character (1-indexed)"]
pub offset_row: u8,
#[doc = " Column to display the first character (1-indexed)"]
pub offset_col: u8,
#[doc = " Number of characters in the string"]
pub length: u8,
#[doc = " The string to display"]
pub data: [u8; 32usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_text"][::core::mem::size_of::<osdp_cmd_text>() - 38usize];
["Alignment of osdp_cmd_text"][::core::mem::align_of::<osdp_cmd_text>() - 1usize];
["Offset of field: osdp_cmd_text::reader"]
[::core::mem::offset_of!(osdp_cmd_text, reader) - 0usize];
["Offset of field: osdp_cmd_text::control_code"]
[::core::mem::offset_of!(osdp_cmd_text, control_code) - 1usize];
["Offset of field: osdp_cmd_text::temp_time"]
[::core::mem::offset_of!(osdp_cmd_text, temp_time) - 2usize];
["Offset of field: osdp_cmd_text::offset_row"]
[::core::mem::offset_of!(osdp_cmd_text, offset_row) - 3usize];
["Offset of field: osdp_cmd_text::offset_col"]
[::core::mem::offset_of!(osdp_cmd_text, offset_col) - 4usize];
["Offset of field: osdp_cmd_text::length"]
[::core::mem::offset_of!(osdp_cmd_text, length) - 5usize];
["Offset of field: osdp_cmd_text::data"][::core::mem::offset_of!(osdp_cmd_text, data) - 6usize];
};
#[doc = " @brief Sent in response to a COMSET command. Set communication parameters to\n PD. Must be stored in PD non-volatile memory."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_comset {
#[doc = " Unit ID to which this PD will respond after the change takes effect."]
pub address: u8,
#[doc = " Baud rate.\n\n Valid values: 9600, 19200, 38400, 115200, 230400."]
pub baud_rate: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_comset"][::core::mem::size_of::<osdp_cmd_comset>() - 8usize];
["Alignment of osdp_cmd_comset"][::core::mem::align_of::<osdp_cmd_comset>() - 4usize];
["Offset of field: osdp_cmd_comset::address"]
[::core::mem::offset_of!(osdp_cmd_comset, address) - 0usize];
["Offset of field: osdp_cmd_comset::baud_rate"]
[::core::mem::offset_of!(osdp_cmd_comset, baud_rate) - 4usize];
};
#[doc = " @brief This command transfers an encryption key from the CP to a PD."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_keyset {
#[doc = " Type of keys:\n - 0x01 – Secure Channel Base Key"]
pub type_: u8,
#[doc = " Number of bytes of key data - (Key Length in bits + 7) / 8"]
pub length: u8,
#[doc = " Key data"]
pub data: [u8; 32usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_keyset"][::core::mem::size_of::<osdp_cmd_keyset>() - 34usize];
["Alignment of osdp_cmd_keyset"][::core::mem::align_of::<osdp_cmd_keyset>() - 1usize];
["Offset of field: osdp_cmd_keyset::type_"]
[::core::mem::offset_of!(osdp_cmd_keyset, type_) - 0usize];
["Offset of field: osdp_cmd_keyset::length"]
[::core::mem::offset_of!(osdp_cmd_keyset, length) - 1usize];
["Offset of field: osdp_cmd_keyset::data"]
[::core::mem::offset_of!(osdp_cmd_keyset, data) - 2usize];
};
#[doc = " @brief Manufacturer Specific Commands"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_mfg {
#[doc = " 3-byte IEEE assigned OUI. Most Significant 8-bits are unused"]
pub vendor_code: u32,
#[doc = " Command data"]
pub data: [u8; 64usize],
#[doc = " Length of the data (internal use)"]
pub length: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_mfg"][::core::mem::size_of::<osdp_cmd_mfg>() - 72usize];
["Alignment of osdp_cmd_mfg"][::core::mem::align_of::<osdp_cmd_mfg>() - 4usize];
["Offset of field: osdp_cmd_mfg::vendor_code"]
[::core::mem::offset_of!(osdp_cmd_mfg, vendor_code) - 0usize];
["Offset of field: osdp_cmd_mfg::data"][::core::mem::offset_of!(osdp_cmd_mfg, data) - 4usize];
["Offset of field: osdp_cmd_mfg::length"]
[::core::mem::offset_of!(osdp_cmd_mfg, length) - 68usize];
};
#[doc = " @brief File transfer start command"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_cmd_file_tx {
#[doc = " Pre-agreed file ID between CP and PD"]
pub id: ::core::ffi::c_int,
#[doc = " Reserved and set to zero by OSDP spec.\n\n @note: The upper bits are used by libosdp internally (IOW, not sent\n over the OSDP bus). Currently the following flags are defined:\n\n - @ref OSDP_CMD_FILE_TX_FLAG_CANCEL"]
pub flags: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd_file_tx"][::core::mem::size_of::<osdp_cmd_file_tx>() - 8usize];
["Alignment of osdp_cmd_file_tx"][::core::mem::align_of::<osdp_cmd_file_tx>() - 4usize];
["Offset of field: osdp_cmd_file_tx::id"]
[::core::mem::offset_of!(osdp_cmd_file_tx, id) - 0usize];
["Offset of field: osdp_cmd_file_tx::flags"]
[::core::mem::offset_of!(osdp_cmd_file_tx, flags) - 4usize];
};
#[doc = "< Output control command"]
pub const osdp_cmd_e_OSDP_CMD_OUTPUT: osdp_cmd_e = 1;
#[doc = "< Reader LED control command"]
pub const osdp_cmd_e_OSDP_CMD_LED: osdp_cmd_e = 2;
#[doc = "< Reader buzzer control command"]
pub const osdp_cmd_e_OSDP_CMD_BUZZER: osdp_cmd_e = 3;
#[doc = "< Reader text output command"]
pub const osdp_cmd_e_OSDP_CMD_TEXT: osdp_cmd_e = 4;
#[doc = "< Encryption Key Set Command"]
pub const osdp_cmd_e_OSDP_CMD_KEYSET: osdp_cmd_e = 5;
#[doc = "< PD communication configuration command"]
pub const osdp_cmd_e_OSDP_CMD_COMSET: osdp_cmd_e = 6;
#[doc = "< Manufacturer specific command"]
pub const osdp_cmd_e_OSDP_CMD_MFG: osdp_cmd_e = 7;
#[doc = "< File transfer command"]
pub const osdp_cmd_e_OSDP_CMD_FILE_TX: osdp_cmd_e = 8;
#[doc = "< Status report command"]
pub const osdp_cmd_e_OSDP_CMD_STATUS: osdp_cmd_e = 9;
#[doc = "< Comset completed; Alias for OSDP_CMD_COMSET"]
pub const osdp_cmd_e_OSDP_CMD_COMSET_DONE: osdp_cmd_e = 10;
#[doc = "< Max command value"]
pub const osdp_cmd_e_OSDP_CMD_SENTINEL: osdp_cmd_e = 11;
#[doc = " @brief OSDP application exposed commands"]
pub type osdp_cmd_e = ::core::ffi::c_uchar;
#[doc = " @brief Queue linkage node; layout-compatible with node_t from list.h.\n Embedded as @c _node in osdp_cmd and osdp_event. Do not read or write this\n field — it is reserved for internal use by the library."]
pub type osdp_queue_node_t = osdp_queue_node_s;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_queue_node_s {
pub next: *mut osdp_queue_node_t,
pub prev: *mut osdp_queue_node_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_queue_node_s"][::core::mem::size_of::<osdp_queue_node_s>() - 16usize];
["Alignment of osdp_queue_node_s"][::core::mem::align_of::<osdp_queue_node_s>() - 8usize];
["Offset of field: osdp_queue_node_s::next"]
[::core::mem::offset_of!(osdp_queue_node_s, next) - 0usize];
["Offset of field: osdp_queue_node_s::prev"]
[::core::mem::offset_of!(osdp_queue_node_s, prev) - 8usize];
};
#[doc = " @brief OSDP Command Structure. This is a wrapper for all individual OSDP\n commands."]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct osdp_cmd {
#[doc = "< Reserved: internal queue linkage"]
pub _node: osdp_queue_node_t,
#[doc = "< Command ID. Used to select specific commands in union"]
pub id: osdp_cmd_e,
#[doc = "< Flags; see OSDP_CMD_FLAG_* flags for possibilities"]
pub flags: u32,
pub __bindgen_anon_1: osdp_cmd__bindgen_ty_1,
}
#[doc = " Command"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union osdp_cmd__bindgen_ty_1 {
#[doc = "< LED command structure"]
pub led: osdp_cmd_led,
#[doc = "< Buzzer command structure"]
pub buzzer: osdp_cmd_buzzer,
#[doc = "< Text command structure"]
pub text: osdp_cmd_text,
#[doc = "< Output command structure"]
pub output: osdp_cmd_output,
#[doc = "< Comset command structure"]
pub comset: osdp_cmd_comset,
#[doc = "< Keyset command structure"]
pub keyset: osdp_cmd_keyset,
#[doc = "< Manufacturer specific command structure"]
pub mfg: osdp_cmd_mfg,
#[doc = "< File transfer command structure"]
pub file_tx: osdp_cmd_file_tx,
#[doc = "< Status report command structure"]
pub status: osdp_status_report,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd__bindgen_ty_1"][::core::mem::size_of::<osdp_cmd__bindgen_ty_1>() - 72usize];
["Alignment of osdp_cmd__bindgen_ty_1"]
[::core::mem::align_of::<osdp_cmd__bindgen_ty_1>() - 4usize];
["Offset of field: osdp_cmd__bindgen_ty_1::led"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, led) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::buzzer"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, buzzer) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::text"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, text) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::output"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, output) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::comset"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, comset) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::keyset"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, keyset) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::mfg"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, mfg) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::file_tx"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, file_tx) - 0usize];
["Offset of field: osdp_cmd__bindgen_ty_1::status"]
[::core::mem::offset_of!(osdp_cmd__bindgen_ty_1, status) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_cmd"][::core::mem::size_of::<osdp_cmd>() - 96usize];
["Alignment of osdp_cmd"][::core::mem::align_of::<osdp_cmd>() - 8usize];
["Offset of field: osdp_cmd::_node"][::core::mem::offset_of!(osdp_cmd, _node) - 0usize];
["Offset of field: osdp_cmd::id"][::core::mem::offset_of!(osdp_cmd, id) - 16usize];
["Offset of field: osdp_cmd::flags"][::core::mem::offset_of!(osdp_cmd, flags) - 20usize];
};
#[doc = "< Unspecified card format"]
pub const osdp_event_cardread_format_e_OSDP_CARD_FMT_RAW_UNSPECIFIED: osdp_event_cardread_format_e =
0;
#[doc = "< Wiegand card format"]
pub const osdp_event_cardread_format_e_OSDP_CARD_FMT_RAW_WIEGAND: osdp_event_cardread_format_e = 1;
#[doc = "< ASCII card format (deprecated; don't use)"]
pub const osdp_event_cardread_format_e_OSDP_CARD_FMT_ASCII: osdp_event_cardread_format_e = 2;
#[doc = "< Max card format value"]
pub const osdp_event_cardread_format_e_OSDP_CARD_FMT_SENTINEL: osdp_event_cardread_format_e = 3;
#[doc = " @brief Various card formats that a PD can support. This is sent to CP\n when a PD must report a card read."]
pub type osdp_event_cardread_format_e = ::core::ffi::c_uchar;
#[doc = " @brief OSDP event cardread"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_event_cardread {
#[doc = " Reader number. 0 = First Reader, 1 = Second Reader, etc."]
pub reader_no: ::core::ffi::c_int,
#[doc = " Format of the card being read."]
pub format: osdp_event_cardread_format_e,
#[doc = " Direction of data in @a data array.\n - 0 - Forward\n - 1 - Backward"]
pub direction: ::core::ffi::c_int,
#[doc = " Length of card data in bits"]
pub length: ::core::ffi::c_int,
#[doc = " Card data of @a length bytes or bits bits depending on @a format"]
pub data: [u8; 64usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event_cardread"][::core::mem::size_of::<osdp_event_cardread>() - 80usize];
["Alignment of osdp_event_cardread"][::core::mem::align_of::<osdp_event_cardread>() - 4usize];
["Offset of field: osdp_event_cardread::reader_no"]
[::core::mem::offset_of!(osdp_event_cardread, reader_no) - 0usize];
["Offset of field: osdp_event_cardread::format"]
[::core::mem::offset_of!(osdp_event_cardread, format) - 4usize];
["Offset of field: osdp_event_cardread::direction"]
[::core::mem::offset_of!(osdp_event_cardread, direction) - 8usize];
["Offset of field: osdp_event_cardread::length"]
[::core::mem::offset_of!(osdp_event_cardread, length) - 12usize];
["Offset of field: osdp_event_cardread::data"]
[::core::mem::offset_of!(osdp_event_cardread, data) - 16usize];
};
#[doc = " @brief OSDP Event Keypad"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_event_keypress {
#[doc = " Reader number in context of sub-readers attached to current PD; this\n number indicates the number of that reader. This is not supported by\n LibOSDP."]
pub reader_no: ::core::ffi::c_int,
#[doc = " Length of keypress data in bytes"]
pub length: ::core::ffi::c_int,
#[doc = " Keypress data of @a length bytes"]
pub data: [u8; 64usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event_keypress"][::core::mem::size_of::<osdp_event_keypress>() - 72usize];
["Alignment of osdp_event_keypress"][::core::mem::align_of::<osdp_event_keypress>() - 4usize];
["Offset of field: osdp_event_keypress::reader_no"]
[::core::mem::offset_of!(osdp_event_keypress, reader_no) - 0usize];
["Offset of field: osdp_event_keypress::length"]
[::core::mem::offset_of!(osdp_event_keypress, length) - 4usize];
["Offset of field: osdp_event_keypress::data"]
[::core::mem::offset_of!(osdp_event_keypress, data) - 8usize];
};
#[doc = " @brief OSDP Event Manufacturer Specific Command\n\n @note OSDP spec v2.2 makes this structure fixed at 4 bytes (3-byte vendor\n code and 1-byte data). LibOSDP allows for some additional data to be passed\n in this command using the @a data and @a length fields while using the\n 1-byte data (as specified in the specification) as @a command. To be fully\n compliant with the specification, you can set @a length to 0."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_event_mfgrep {
#[doc = " 3-bytes IEEE assigned OUI of manufacturer"]
pub vendor_code: u32,
#[doc = " Length of manufacturer data in bytes (optional)"]
pub length: u8,
#[doc = " Manufacturer data of `length` bytes (optional)"]
pub data: [u8; 128usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event_mfgrep"][::core::mem::size_of::<osdp_event_mfgrep>() - 136usize];
["Alignment of osdp_event_mfgrep"][::core::mem::align_of::<osdp_event_mfgrep>() - 4usize];
["Offset of field: osdp_event_mfgrep::vendor_code"]
[::core::mem::offset_of!(osdp_event_mfgrep, vendor_code) - 0usize];
["Offset of field: osdp_event_mfgrep::length"]
[::core::mem::offset_of!(osdp_event_mfgrep, length) - 4usize];
["Offset of field: osdp_event_mfgrep::data"]
[::core::mem::offset_of!(osdp_event_mfgrep, data) - 5usize];
};
#[doc = " Application command outcome report.\n\n arg0: The command ID\n arg1: outcome -- 0: success; -1: failure;"]
pub const osdp_event_notification_type_OSDP_EVENT_NOTIFICATION_COMMAND:
osdp_event_notification_type = 0;
#[doc = " Secure Channel state change\n\n arg0: status -- 0: inactive; 1: active\n arg1: scbk type -- 0: scbk; 1: scbk-d"]
pub const osdp_event_notification_type_OSDP_EVENT_NOTIFICATION_SC_STATUS:
osdp_event_notification_type = 1;
#[doc = " PD state change\n\n arg0: status -- 0: offline; 1: online"]
pub const osdp_event_notification_type_OSDP_EVENT_NOTIFICATION_PD_STATUS:
osdp_event_notification_type = 2;
#[doc = " @brief LibOSDP event notification type"]
pub type osdp_event_notification_type = ::core::ffi::c_uchar;
#[doc = " @brief LibOSDP event notification\n\n These are events generated by LibOSDP for the application to indicate various\n status such as external command outcomes, SC state change notifications, etc.\n The app can use these events to perform housekeeping activities as needed.\n\n Each notification event type can use the provided additional data members\n @a arg0, @a arg1, ... in custom ways. See @ref osdp_event_notification_type\n for documentation on how to use them."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_event_notification {
#[doc = "< Notification type"]
pub type_: osdp_event_notification_type,
#[doc = "< Additional data member"]
pub arg0: ::core::ffi::c_int,
#[doc = "< Additional data member"]
pub arg1: ::core::ffi::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event_notification"]
[::core::mem::size_of::<osdp_event_notification>() - 12usize];
["Alignment of osdp_event_notification"]
[::core::mem::align_of::<osdp_event_notification>() - 4usize];
["Offset of field: osdp_event_notification::type_"]
[::core::mem::offset_of!(osdp_event_notification, type_) - 0usize];
["Offset of field: osdp_event_notification::arg0"]
[::core::mem::offset_of!(osdp_event_notification, arg0) - 4usize];
["Offset of field: osdp_event_notification::arg1"]
[::core::mem::offset_of!(osdp_event_notification, arg1) - 8usize];
};
#[doc = "< Card read event"]
pub const osdp_event_type_OSDP_EVENT_CARDREAD: osdp_event_type = 1;
#[doc = "< Keypad press event"]
pub const osdp_event_type_OSDP_EVENT_KEYPRESS: osdp_event_type = 2;
#[doc = "< Manufacturer specific reply event"]
pub const osdp_event_type_OSDP_EVENT_MFGREP: osdp_event_type = 3;
#[doc = "< Status event"]
pub const osdp_event_type_OSDP_EVENT_STATUS: osdp_event_type = 4;
#[doc = "< LibOSDP notification event"]
pub const osdp_event_type_OSDP_EVENT_NOTIFICATION: osdp_event_type = 5;
#[doc = "< Max event value"]
pub const osdp_event_type_OSDP_EVENT_SENTINEL: osdp_event_type = 6;
#[doc = " @brief OSDP PD Events"]
pub type osdp_event_type = ::core::ffi::c_uchar;
#[doc = " @brief OSDP Event structure."]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct osdp_event {
#[doc = "< Reserved: internal queue linkage"]
pub _node: osdp_queue_node_t,
#[doc = "< Event type. Used to select specific event in union"]
pub type_: osdp_event_type,
#[doc = "< Flags; reserved, set to zero"]
pub flags: u32,
pub __bindgen_anon_1: osdp_event__bindgen_ty_1,
}
#[doc = " Event"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union osdp_event__bindgen_ty_1 {
#[doc = "< Keypress event structure"]
pub keypress: osdp_event_keypress,
#[doc = "< Card read event structure"]
pub cardread: osdp_event_cardread,
#[doc = "< Manufacturer specific response event struture"]
pub mfgrep: osdp_event_mfgrep,
#[doc = "< Status report event structure"]
pub status: osdp_status_report,
#[doc = "< Notification event structure"]
pub notif: osdp_event_notification,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event__bindgen_ty_1"]
[::core::mem::size_of::<osdp_event__bindgen_ty_1>() - 136usize];
["Alignment of osdp_event__bindgen_ty_1"]
[::core::mem::align_of::<osdp_event__bindgen_ty_1>() - 4usize];
["Offset of field: osdp_event__bindgen_ty_1::keypress"]
[::core::mem::offset_of!(osdp_event__bindgen_ty_1, keypress) - 0usize];
["Offset of field: osdp_event__bindgen_ty_1::cardread"]
[::core::mem::offset_of!(osdp_event__bindgen_ty_1, cardread) - 0usize];
["Offset of field: osdp_event__bindgen_ty_1::mfgrep"]
[::core::mem::offset_of!(osdp_event__bindgen_ty_1, mfgrep) - 0usize];
["Offset of field: osdp_event__bindgen_ty_1::status"]
[::core::mem::offset_of!(osdp_event__bindgen_ty_1, status) - 0usize];
["Offset of field: osdp_event__bindgen_ty_1::notif"]
[::core::mem::offset_of!(osdp_event__bindgen_ty_1, notif) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_event"][::core::mem::size_of::<osdp_event>() - 160usize];
["Alignment of osdp_event"][::core::mem::align_of::<osdp_event>() - 8usize];
["Offset of field: osdp_event::_node"][::core::mem::offset_of!(osdp_event, _node) - 0usize];
["Offset of field: osdp_event::type_"][::core::mem::offset_of!(osdp_event, type_) - 16usize];
["Offset of field: osdp_event::flags"][::core::mem::offset_of!(osdp_event, flags) - 20usize];
};
#[doc = " @brief Callback for PD command notifications. After it has been registered\n with `osdp_pd_set_command_callback`, this method is invoked when the PD\n receives a command from the CP.\n\n @param arg pointer that will was passed to the arg param of\n `osdp_pd_set_command_callback`.\n @param cmd pointer to the received command.\n\n @retval 0 if LibOSDP must send a `osdp_ACK` response\n @retval -ve if LibOSDP must send a `osdp_NAK` response\n @retval +ve and modify the passed `struct osdp_cmd *cmd` if LibOSDP must\n send a specific response. This is useful for sending manufacturer specific\n reply `osdp_MFGREP`."]
pub type pd_command_callback_t = ::core::option::Option<
unsafe extern "C" fn(arg: *mut ::core::ffi::c_void, cmd: *mut osdp_cmd) -> ::core::ffi::c_int,
>;
#[doc = " @brief Callback for CP event notifications. After it has been registered\n with `osdp_cp_set_event_callback`, this method is invoked when the CP\n receives an event from the PD.\n\n @param arg Opaque pointer provided by the application during callback\n registration.\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param ev pointer to osdp_event struct (filled by libosdp).\n\n @retval 0 on handling the event successfully.\n @retval -ve on errors."]
pub type cp_event_callback_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
pd: ::core::ffi::c_int,
ev: *mut osdp_event,
) -> ::core::ffi::c_int,
>;
#[doc = "< Successfully completed"]
pub const osdp_completion_status_OSDP_COMPLETION_OK: osdp_completion_status = 0;
#[doc = "< Transport/protocol failure"]
pub const osdp_completion_status_OSDP_COMPLETION_FAILED: osdp_completion_status = 1;
#[doc = "< Removed by flush API"]
pub const osdp_completion_status_OSDP_COMPLETION_FLUSHED: osdp_completion_status = 2;
#[doc = "< Removed during teardown"]
pub const osdp_completion_status_OSDP_COMPLETION_ABORTED: osdp_completion_status = 3;
#[doc = " @brief Terminal status of a submitted command/event object."]
pub type osdp_completion_status = ::core::ffi::c_uchar;
#[doc = " @brief Callback for CP command completion notifications."]
pub type cp_command_completion_callback_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
pd: ::core::ffi::c_int,
cmd: *const osdp_cmd,
status: osdp_completion_status,
),
>;
#[doc = " @brief Callback for PD event completion notifications."]
pub type pd_event_completion_callback_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
ev: *const osdp_event,
status: osdp_completion_status,
),
>;
unsafe extern "C" {
#[doc = " @brief This method is used to setup a device in PD mode. Application must\n store the returned context pointer and pass it back to all OSDP functions\n intact.\n\n @param info Pointer to info struct populated by application.\n\n @retval OSDP Context on success\n @retval NULL on errors"]
pub fn osdp_pd_setup(info: *const osdp_pd_info_t) -> *mut osdp_t;
}
unsafe extern "C" {
#[doc = " @brief Periodic refresh method. Must be called by the application at least\n once every 50ms to meet OSDP timing requirements.\n\n @param ctx OSDP context"]
pub fn osdp_pd_refresh(ctx: *mut osdp_t);
}
unsafe extern "C" {
#[doc = " @brief Cleanup all osdp resources. The context pointer is no longer valid\n after this call.\n\n @param ctx OSDP context"]
pub fn osdp_pd_teardown(ctx: *mut osdp_t);
}
unsafe extern "C" {
#[doc = " @brief Set PD's capabilities\n\n @param ctx OSDP context\n @param cap pointer to array of cap (`struct osdp_pd_cap`) terminated by a\n capability with cap->function_code set to 0."]
pub fn osdp_pd_set_capabilities(ctx: *mut osdp_t, cap: *const osdp_pd_cap);
}
unsafe extern "C" {
#[doc = " @brief Set callback method for PD command notification. This callback is\n invoked when the PD receives a command from the CP.\n\n @param ctx OSDP context\n @param cb The callback function's pointer\n @param arg A pointer that will be passed as the first argument of `cb`"]
pub fn osdp_pd_set_command_callback(
ctx: *mut osdp_t,
cb: pd_command_callback_t,
arg: *mut ::core::ffi::c_void,
);
}
unsafe extern "C" {
#[doc = " @brief API to notify PD events to CP. These events are sent to the CP as an\n alternate response to a POLL command.\n\n @param ctx OSDP context\n @param event pointer to event struct. Must be filled by application.\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_pd_notify_event(ctx: *mut osdp_t, event: *const osdp_event) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Submit PD events to CP. These events are delivered to the CP as a\n response to a future POLL command. A successful return does not mean CP\n received it, it only means LibOSDP accepted this submission.\n\n @param ctx OSDP context\n @param event pointer to event struct. Must be filled by application.\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_pd_submit_event(ctx: *mut osdp_t, event: *const osdp_event) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Deletes all events from the PD's event queue.\n\n @param ctx OSDP context\n @return int Count of events dequeued."]
pub fn osdp_pd_flush_events(ctx: *mut osdp_t) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief This method is used to setup a device in CP mode. Application must\n store the returned context pointer and pass it back to all OSDP functions\n intact.\n\n @param num_pd Number of PDs connected to this CP. The `osdp_pd_info_t *` is\n treated as an array of length num_pd.\n @param info Pointer to info struct populated by application.\n\n @retval OSDP Context on success\n @retval NULL on errors"]
pub fn osdp_cp_setup(num_pd: ::core::ffi::c_int, info: *const osdp_pd_info_t) -> *mut osdp_t;
}
unsafe extern "C" {
#[doc = " @brief Adds more PD devices in the CP control list.\n\n @param ctx OSDP context\n @param num_pd Number of PDs connected to this CP. The `osdp_pd_info_t *` is\n treated as an array of length num_pd.\n @param info Pointer to info struct populated by application.\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_cp_add_pd(
ctx: *mut osdp_t,
num_pd: ::core::ffi::c_int,
info: *const osdp_pd_info_t,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Periodic refresh method. Must be called by the application at least\n once every 50ms to meet OSDP timing requirements.\n\n @param ctx OSDP context"]
pub fn osdp_cp_refresh(ctx: *mut osdp_t);
}
unsafe extern "C" {
#[doc = " @brief Cleanup all osdp resources. The context pointer is no longer valid\n after this call.\n\n @param ctx OSDP context"]
pub fn osdp_cp_teardown(ctx: *mut osdp_t);
}
unsafe extern "C" {
#[doc = " @brief Generic command enqueue API.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param cmd command pointer. Must be filled by application.\n\n @retval 0 on success\n @retval -1 on failure\n\n @note This method only adds the command on to a particular PD's command\n queue. The command itself can fail due to various reasons."]
pub fn osdp_cp_send_command(
ctx: *mut osdp_t,
pd: ::core::ffi::c_int,
cmd: *const osdp_cmd,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Submit CP commands to PD. These commands are queued to be sent to the\n PD at the next available opportunity. A successful return does not mean PD\n received it, it only means LibOSDP accepted this submission.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param cmd command pointer. Must be filled by application.\n\n @retval 0 on success\n @retval -1 on failure\n\n @note This method only adds the command on to a particular PD's command\n queue. The command itself can fail due to various reasons."]
pub fn osdp_cp_submit_command(
ctx: *mut osdp_t,
pd: ::core::ffi::c_int,
cmd: *const osdp_cmd,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Deletes all commands queued for a give PD\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @return int Count of events dequeued"]
pub fn osdp_cp_flush_commands(ctx: *mut osdp_t, pd: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Get PD ID information as reported by the PD. Calling this method\n before the CP has had a the chance to get this information will return\n invalid/stale results.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param id A pointer to struct osdp_pd_id that will be filled with the\n PD ID information that the PD last returned.\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_cp_get_pd_id(
ctx: *const osdp_t,
pd: ::core::ffi::c_int,
id: *mut osdp_pd_id,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Get capability associated to a function_code that the PD reports in\n response to osdp_CAP(0x62) command. Calling this method before the CP has\n had a the chance to get this information will return invalid/stale results.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param cap in/out; struct osdp_pd_cap pointer with osdp_pd_cap::function_code\n set to the function code to get data for.\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_cp_get_capability(
ctx: *const osdp_t,
pd: ::core::ffi::c_int,
cap: *mut osdp_pd_cap,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Set callback method for CP event notification. This callback is\n invoked when the CP receives an event from the PD.\n\n @param ctx OSDP context\n @param cb The callback function's pointer\n @param arg A pointer that will be passed as the first argument of `cb`"]
pub fn osdp_cp_set_event_callback(
ctx: *mut osdp_t,
cb: cp_event_callback_t,
arg: *mut ::core::ffi::c_void,
);
}
unsafe extern "C" {
#[doc = " @brief Set or clear OSDP public flags\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n @param flags One or more of the public flags (OSDP_FLAG_XXX) exported from\n osdp.h. Any other bits will cause this method to fail.\n @param do_set when true: set `flags` in ctx; when false: clear `flags` in ctx\n\n @retval 0 on success\n @retval -1 on failure\n\n @note It doesn't make sense to call some initialization time flags during\n runtime. This method is for dynamic flags that can be turned on/off at runtime."]
pub fn osdp_cp_modify_flag(
ctx: *mut osdp_t,
pd: ::core::ffi::c_int,
flags: u32,
do_set: bool,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Disable a PD managed by the CP. Disabled PDs are brought to a safe\n state and will not process commands or generate events.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_cp_disable_pd(ctx: *mut osdp_t, pd: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Enable a previously disabled PD. The PD will start up as it would\n during initial setup.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n\n @retval 0 on success\n @retval -1 on failure"]
pub fn osdp_cp_enable_pd(ctx: *mut osdp_t, pd: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Check if a PD is currently enabled.\n\n @param ctx OSDP context\n @param pd PD offset (0-indexed) of this PD in `osdp_pd_info_t *` passed to\n osdp_cp_setup()\n\n @retval true if PD is enabled\n @retval false if PD is disabled or on error"]
pub fn osdp_cp_is_pd_enabled(ctx: *const osdp_t, pd: ::core::ffi::c_int) -> bool;
}
#[doc = "< Log level Emergency"]
pub const osdp_log_level_e_OSDP_LOG_EMERG: osdp_log_level_e = 0;
#[doc = "< Log level Alert"]
pub const osdp_log_level_e_OSDP_LOG_ALERT: osdp_log_level_e = 1;
#[doc = "< Log level Critical"]
pub const osdp_log_level_e_OSDP_LOG_CRIT: osdp_log_level_e = 2;
#[doc = "< Log level Error"]
pub const osdp_log_level_e_OSDP_LOG_ERROR: osdp_log_level_e = 3;
#[doc = "< Log level Warning"]
pub const osdp_log_level_e_OSDP_LOG_WARNING: osdp_log_level_e = 4;
#[doc = "< Log level Notice"]
pub const osdp_log_level_e_OSDP_LOG_NOTICE: osdp_log_level_e = 5;
#[doc = "< Log level Info"]
pub const osdp_log_level_e_OSDP_LOG_INFO: osdp_log_level_e = 6;
#[doc = "< Log level Debug"]
pub const osdp_log_level_e_OSDP_LOG_DEBUG: osdp_log_level_e = 7;
#[doc = "< Log level max value"]
pub const osdp_log_level_e_OSDP_LOG_MAX_LEVEL: osdp_log_level_e = 8;
#[doc = " @brief Different levels of log messages; based on importance of the message\n with LOG_EMERG being most critical to LOG_DEBUG being the least."]
pub type osdp_log_level_e = ::core::ffi::c_uchar;
#[doc = " @brief Puts a string to the logging medium\n\n @param msg a null-terminated char buffer.\n\n @retval 0 on success; -ve on errors"]
pub type osdp_log_puts_fn_t = ::core::option::Option<
unsafe extern "C" fn(msg: *const ::core::ffi::c_char) -> ::core::ffi::c_int,
>;
#[doc = " @brief A callback function to be used with external loggers\n\n @param log_level A syslog style log level. See `enum osdp_log_level_e`\n @param file Relative path to file which produced the log message\n @param line Line number in `file` which produced the log message\n @param msg The log message"]
pub type osdp_log_callback_fn_t = ::core::option::Option<
unsafe extern "C" fn(
log_level: ::core::ffi::c_int,
file: *const ::core::ffi::c_char,
line: ::core::ffi::c_ulong,
msg: *const ::core::ffi::c_char,
),
>;
unsafe extern "C" {
#[doc = " @brief Configure OSDP Logging.\n\n @param name A soft name for this module; will appear in all the log lines.\n @param log_level OSDP log levels of type `enum osdp_log_level_e`. Default is\n LOG_INFO.\n @param puts_fn A puts() like function that will be invoked to write the log\n buffer. Can be handy if you want to log to file on a UART device without\n putchar redirection. See `osdp_log_puts_fn_t` definition to see the\n behavioral expectations. When this is set to NULL, LibOSDP will log to\n stderr.\n\n Note: This function has to be called before osdp_{cp,pd}_setup(). Otherwise\n it will be ignored."]
pub fn osdp_logger_init(
name: *const ::core::ffi::c_char,
log_level: ::core::ffi::c_int,
puts_fn: osdp_log_puts_fn_t,
);
}
unsafe extern "C" {
#[doc = " @brief A callback function that gets called when LibOSDP wants to emit a log\n line. All messages (of all log levels) are passed on to this callback\n without any log formatting. This API is for users who may already have a\n logger configured in their application.\n\n @param cb The callback function. See `osdp_log_callback_fn_t` for more\n details.\n\n @note This function has to be called before osdp_{cp,pd}_setup(). Otherwise\n it will be ignored."]
pub fn osdp_set_log_callback(cb: osdp_log_callback_fn_t);
}
unsafe extern "C" {
#[doc = " @brief Get LibOSDP version as a `const char *`. Used in diagnostics.\n\n @retval version string"]
pub fn osdp_get_version() -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
#[doc = " @brief Get LibOSDP source identifier as a `const char *`. This string has\n info about the source tree from which this version of LibOSDP was built.\n Used in diagnostics.\n\n @retval source identifier string"]
pub fn osdp_get_source_info() -> *const ::core::ffi::c_char;
}
unsafe extern "C" {
#[doc = " @brief Get a bit mask of number of PD that are online currently.\n\n @param ctx OSDP context\n @param bitmask pointer to an array of bytes. must be as large as\n (num_pds + 7 / 8)."]
pub fn osdp_get_status_mask(ctx: *const osdp_t, bitmask: *mut u8);
}
unsafe extern "C" {
#[doc = " @brief Get a bit mask of number of PD that are online and have an active\n secure channel currently.\n\n @param ctx OSDP context\n @param bitmask pointer to an array of bytes. must be as large as\n (num_pds + 7 / 8)."]
pub fn osdp_get_sc_status_mask(ctx: *const osdp_t, bitmask: *mut u8);
}
#[doc = " @brief Open a pre-agreed file\n\n @param arg Opaque pointer that was provided in @ref osdp_file_ops when the\n ops struct was registered.\n @param file_id File ID of pre-agreed file between this CP and PD\n @param size Size of the file that was opened (to be populated by sender). In\n case of receiver, this value is just just input to indicate the incoming file\n size.\n\n @retval 0 on success\n @retval -1 on errors"]
pub type osdp_file_open_fn_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
file_id: ::core::ffi::c_int,
size: *mut ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief Read a chunk of file data into buffer\n\n @param arg Opaque pointer that was provided in @ref osdp_file_ops when the\n ops struct was registered.\n @param buf Buffer to store file data read\n @param size Number of bytes to read from file into buffer\n @param offset Number of bytes from the beginning of the file to\n start reading from.\n\n @retval Number of bytes read\n @retval 0 on EOF\n @retval -ve on errors.\n\n @note LibOSDP will guarantee that size and offset params are always\n positive and size is always greater than or equal to offset."]
pub type osdp_file_read_fn_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
buf: *mut ::core::ffi::c_void,
size: ::core::ffi::c_int,
offset: ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief Write a chunk of file data from buffer to disk.\n\n @param arg Opaque pointer that was provided in @ref osdp_file_ops when the\n ops struct was registered.\n @param buf Buffer with file data to be stored to disk\n @param size Number of bytes to write to disk\n @param offset Number of bytes from the beginning of the file to\n start writing too.\n\n @retval Number of bytes written\n @retval 0 on EOF\n @retval -ve on errors.\n\n @note LibOSDP will guarantee that size and offset params are always\n positive and size is always greater than or equal to offset."]
pub type osdp_file_write_fn_t = ::core::option::Option<
unsafe extern "C" fn(
arg: *mut ::core::ffi::c_void,
buf: *const ::core::ffi::c_void,
size: ::core::ffi::c_int,
offset: ::core::ffi::c_int,
) -> ::core::ffi::c_int,
>;
#[doc = " @brief Close file that corresponds to a given file descriptor\n\n @param arg Opaque pointer that was provided in @ref osdp_file_ops when the\n ops struct was registered.\n\n @retval 0 on success\n @retval -1 on errors."]
pub type osdp_file_close_fn_t = ::core::option::Option<
unsafe extern "C" fn(arg: *mut ::core::ffi::c_void) -> ::core::ffi::c_int,
>;
#[doc = " @brief OSDP File operations struct that needs to be filled by the CP/PD\n application and registered with LibOSDP using osdp_file_register_ops()\n before a file transfer command can be initiated."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct osdp_file_ops {
#[doc = " @brief A opaque pointer to private data that can be filled by the\n application which will be passed as the first argument for each of\n the below functions. Applications can keep their file context info\n such as the open file descriptors or any other private data here."]
pub arg: *mut ::core::ffi::c_void,
#[doc = "< open handler function"]
pub open: osdp_file_open_fn_t,
#[doc = "< read handler function"]
pub read: osdp_file_read_fn_t,
#[doc = "< write handler function"]
pub write: osdp_file_write_fn_t,
#[doc = "< close handler function"]
pub close: osdp_file_close_fn_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of osdp_file_ops"][::core::mem::size_of::<osdp_file_ops>() - 40usize];
["Alignment of osdp_file_ops"][::core::mem::align_of::<osdp_file_ops>() - 8usize];
["Offset of field: osdp_file_ops::arg"][::core::mem::offset_of!(osdp_file_ops, arg) - 0usize];
["Offset of field: osdp_file_ops::open"][::core::mem::offset_of!(osdp_file_ops, open) - 8usize];
["Offset of field: osdp_file_ops::read"]
[::core::mem::offset_of!(osdp_file_ops, read) - 16usize];
["Offset of field: osdp_file_ops::write"]
[::core::mem::offset_of!(osdp_file_ops, write) - 24usize];
["Offset of field: osdp_file_ops::close"]
[::core::mem::offset_of!(osdp_file_ops, close) - 32usize];
};
unsafe extern "C" {
#[doc = " @brief Register a global file operations struct with OSDP. Both CP and PD\n modes should have done so already before CP can sending a OSDP_CMD_FILE_TX.\n\n @param ctx OSDP context\n @param pd PD number in case of CP. This param is ignored in PD mode\n @param ops Populated file operations struct\n\n @retval 0 on success. -1 on errors."]
pub fn osdp_file_register_ops(
ctx: *mut osdp_t,
pd: ::core::ffi::c_int,
ops: *const osdp_file_ops,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " @brief Query file transfer status if one is in progress. Calling this method\n when there is no file transfer progressing will return error.\n\n @param ctx OSDP context\n @param pd PD number in case of CP. This param is ignored in PD mode\n @param size Total size of the file (as obtained from file_ops->open())\n @param offset Offset into the file that has been sent/received (CP/PD)\n @retval 0 on success. -1 on errors."]
pub fn osdp_get_file_tx_status(
ctx: *const osdp_t,
pd: ::core::ffi::c_int,
size: *mut ::core::ffi::c_int,
offset: *mut ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}