Skip to content

Commit c64c0a9

Browse files
committed
libosdp-sys: Release v3.2.0
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
1 parent 8c969b2 commit c64c0a9

3 files changed

Lines changed: 86 additions & 17 deletions

File tree

libosdp-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libosdp-sys"
3-
version = "3.1.0"
3+
version = "3.2.0"
44
edition = "2021"
55
authors = ["Siddharth Chandrasekaran <sidcha.dev@gmail.com>"]
66
description = "Sys crate for https://github.com/goToMain/libosdp"

libosdp-sys/src/bindings.rs

Lines changed: 84 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ pub type osdp_read_fn_t = ::core::option::Option<
338338
maxlen: ::core::ffi::c_int,
339339
) -> ::core::ffi::c_int,
340340
>;
341+
#[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"]
342+
pub type osdp_read_pkt_fn_t = ::core::option::Option<
343+
unsafe extern "C" fn(
344+
data: *mut ::core::ffi::c_void,
345+
buf: *mut *const u8,
346+
max_len: *mut ::core::ffi::c_int,
347+
) -> ::core::ffi::c_int,
348+
>;
341349
#[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."]
342350
pub type osdp_write_fn_t = ::core::option::Option<
343351
unsafe extern "C" fn(
@@ -352,6 +360,9 @@ pub type osdp_flush_fn_t =
352360
#[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"]
353361
pub type osdp_close_fn_t =
354362
::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void)>;
363+
#[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()"]
364+
pub type osdp_release_pkt_fn_t =
365+
::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void, buf: *const u8)>;
355366
#[doc = " @brief User defined communication channel abstraction for OSDP devices.\n The methods for read/write/flush are expected to be non-blocking."]
356367
#[repr(C)]
357368
#[derive(Debug, Copy, Clone)]
@@ -362,25 +373,33 @@ pub struct osdp_channel {
362373
pub id: ::core::ffi::c_int,
363374
#[doc = " Pointer to function used to receive osdp packet data"]
364375
pub recv: osdp_read_fn_t,
376+
#[doc = " Pointer to function used to receive a full packet buffer (optional)"]
377+
pub recv_pkt: osdp_read_pkt_fn_t,
365378
#[doc = " Pointer to function used to send osdp packet data"]
366379
pub send: osdp_write_fn_t,
367380
#[doc = " Pointer to function used to flush the channel (optional)"]
368381
pub flush: osdp_flush_fn_t,
382+
#[doc = " Pointer to function used to release recv_pkt() data (optional)"]
383+
pub release_pkt: osdp_release_pkt_fn_t,
369384
#[doc = " Pointer to function used to close the channel (optional)"]
370385
pub close: osdp_close_fn_t,
371386
}
372387
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
373388
const _: () = {
374-
["Size of osdp_channel"][::core::mem::size_of::<osdp_channel>() - 48usize];
389+
["Size of osdp_channel"][::core::mem::size_of::<osdp_channel>() - 64usize];
375390
["Alignment of osdp_channel"][::core::mem::align_of::<osdp_channel>() - 8usize];
376391
["Offset of field: osdp_channel::data"][::core::mem::offset_of!(osdp_channel, data) - 0usize];
377392
["Offset of field: osdp_channel::id"][::core::mem::offset_of!(osdp_channel, id) - 8usize];
378393
["Offset of field: osdp_channel::recv"][::core::mem::offset_of!(osdp_channel, recv) - 16usize];
379-
["Offset of field: osdp_channel::send"][::core::mem::offset_of!(osdp_channel, send) - 24usize];
394+
["Offset of field: osdp_channel::recv_pkt"]
395+
[::core::mem::offset_of!(osdp_channel, recv_pkt) - 24usize];
396+
["Offset of field: osdp_channel::send"][::core::mem::offset_of!(osdp_channel, send) - 32usize];
380397
["Offset of field: osdp_channel::flush"]
381-
[::core::mem::offset_of!(osdp_channel, flush) - 32usize];
398+
[::core::mem::offset_of!(osdp_channel, flush) - 40usize];
399+
["Offset of field: osdp_channel::release_pkt"]
400+
[::core::mem::offset_of!(osdp_channel, release_pkt) - 48usize];
382401
["Offset of field: osdp_channel::close"]
383-
[::core::mem::offset_of!(osdp_channel, close) - 40usize];
402+
[::core::mem::offset_of!(osdp_channel, close) - 56usize];
384403
};
385404
#[doc = " @brief OSDP PD Information. This struct is used to describe a PD to LibOSDP."]
386405
#[repr(C)]
@@ -405,7 +424,7 @@ pub struct osdp_pd_info_t {
405424
}
406425
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
407426
const _: () = {
408-
["Size of osdp_pd_info_t"][::core::mem::size_of::<osdp_pd_info_t>() - 104usize];
427+
["Size of osdp_pd_info_t"][::core::mem::size_of::<osdp_pd_info_t>() - 120usize];
409428
["Alignment of osdp_pd_info_t"][::core::mem::align_of::<osdp_pd_info_t>() - 8usize];
410429
["Offset of field: osdp_pd_info_t::name"]
411430
[::core::mem::offset_of!(osdp_pd_info_t, name) - 0usize];
@@ -421,7 +440,7 @@ const _: () = {
421440
["Offset of field: osdp_pd_info_t::channel"]
422441
[::core::mem::offset_of!(osdp_pd_info_t, channel) - 48usize];
423442
["Offset of field: osdp_pd_info_t::scbk"]
424-
[::core::mem::offset_of!(osdp_pd_info_t, scbk) - 96usize];
443+
[::core::mem::offset_of!(osdp_pd_info_t, scbk) - 112usize];
425444
};
426445
#[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."]
427446
pub type osdp_t = ::core::ffi::c_void;
@@ -729,10 +748,29 @@ pub const osdp_cmd_e_OSDP_CMD_COMSET_DONE: osdp_cmd_e = 10;
729748
pub const osdp_cmd_e_OSDP_CMD_SENTINEL: osdp_cmd_e = 11;
730749
#[doc = " @brief OSDP application exposed commands"]
731750
pub type osdp_cmd_e = ::core::ffi::c_uchar;
751+
#[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."]
752+
pub type osdp_queue_node_t = osdp_queue_node_s;
753+
#[repr(C)]
754+
#[derive(Debug, Copy, Clone)]
755+
pub struct osdp_queue_node_s {
756+
pub next: *mut osdp_queue_node_t,
757+
pub prev: *mut osdp_queue_node_t,
758+
}
759+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
760+
const _: () = {
761+
["Size of osdp_queue_node_s"][::core::mem::size_of::<osdp_queue_node_s>() - 16usize];
762+
["Alignment of osdp_queue_node_s"][::core::mem::align_of::<osdp_queue_node_s>() - 8usize];
763+
["Offset of field: osdp_queue_node_s::next"]
764+
[::core::mem::offset_of!(osdp_queue_node_s, next) - 0usize];
765+
["Offset of field: osdp_queue_node_s::prev"]
766+
[::core::mem::offset_of!(osdp_queue_node_s, prev) - 8usize];
767+
};
732768
#[doc = " @brief OSDP Command Structure. This is a wrapper for all individual OSDP\n commands."]
733769
#[repr(C)]
734770
#[derive(Copy, Clone)]
735771
pub struct osdp_cmd {
772+
#[doc = "< Reserved: internal queue linkage"]
773+
pub _node: osdp_queue_node_t,
736774
#[doc = "< Command ID. Used to select specific commands in union"]
737775
pub id: osdp_cmd_e,
738776
#[doc = "< Flags; see OSDP_CMD_FLAG_* flags for possibilities"]
@@ -788,10 +826,11 @@ const _: () = {
788826
};
789827
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
790828
const _: () = {
791-
["Size of osdp_cmd"][::core::mem::size_of::<osdp_cmd>() - 80usize];
792-
["Alignment of osdp_cmd"][::core::mem::align_of::<osdp_cmd>() - 4usize];
793-
["Offset of field: osdp_cmd::id"][::core::mem::offset_of!(osdp_cmd, id) - 0usize];
794-
["Offset of field: osdp_cmd::flags"][::core::mem::offset_of!(osdp_cmd, flags) - 4usize];
829+
["Size of osdp_cmd"][::core::mem::size_of::<osdp_cmd>() - 96usize];
830+
["Alignment of osdp_cmd"][::core::mem::align_of::<osdp_cmd>() - 8usize];
831+
["Offset of field: osdp_cmd::_node"][::core::mem::offset_of!(osdp_cmd, _node) - 0usize];
832+
["Offset of field: osdp_cmd::id"][::core::mem::offset_of!(osdp_cmd, id) - 16usize];
833+
["Offset of field: osdp_cmd::flags"][::core::mem::offset_of!(osdp_cmd, flags) - 20usize];
795834
};
796835
#[doc = "< Unspecified card format"]
797836
pub const osdp_event_cardread_format_e_OSDP_CARD_FMT_RAW_UNSPECIFIED: osdp_event_cardread_format_e =
@@ -931,6 +970,8 @@ pub type osdp_event_type = ::core::ffi::c_uchar;
931970
#[repr(C)]
932971
#[derive(Copy, Clone)]
933972
pub struct osdp_event {
973+
#[doc = "< Reserved: internal queue linkage"]
974+
pub _node: osdp_queue_node_t,
934975
#[doc = "< Event type. Used to select specific event in union"]
935976
pub type_: osdp_event_type,
936977
#[doc = "< Flags; reserved, set to zero"]
@@ -971,10 +1012,11 @@ const _: () = {
9711012
};
9721013
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
9731014
const _: () = {
974-
["Size of osdp_event"][::core::mem::size_of::<osdp_event>() - 144usize];
975-
["Alignment of osdp_event"][::core::mem::align_of::<osdp_event>() - 4usize];
976-
["Offset of field: osdp_event::type_"][::core::mem::offset_of!(osdp_event, type_) - 0usize];
977-
["Offset of field: osdp_event::flags"][::core::mem::offset_of!(osdp_event, flags) - 4usize];
1015+
["Size of osdp_event"][::core::mem::size_of::<osdp_event>() - 160usize];
1016+
["Alignment of osdp_event"][::core::mem::align_of::<osdp_event>() - 8usize];
1017+
["Offset of field: osdp_event::_node"][::core::mem::offset_of!(osdp_event, _node) - 0usize];
1018+
["Offset of field: osdp_event::type_"][::core::mem::offset_of!(osdp_event, type_) - 16usize];
1019+
["Offset of field: osdp_event::flags"][::core::mem::offset_of!(osdp_event, flags) - 20usize];
9781020
};
9791021
#[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`."]
9801022
pub type pd_command_callback_t = ::core::option::Option<
@@ -988,6 +1030,33 @@ pub type cp_event_callback_t = ::core::option::Option<
9881030
ev: *mut osdp_event,
9891031
) -> ::core::ffi::c_int,
9901032
>;
1033+
#[doc = "< Successfully completed"]
1034+
pub const osdp_completion_status_OSDP_COMPLETION_OK: osdp_completion_status = 0;
1035+
#[doc = "< Transport/protocol failure"]
1036+
pub const osdp_completion_status_OSDP_COMPLETION_FAILED: osdp_completion_status = 1;
1037+
#[doc = "< Removed by flush API"]
1038+
pub const osdp_completion_status_OSDP_COMPLETION_FLUSHED: osdp_completion_status = 2;
1039+
#[doc = "< Removed during teardown"]
1040+
pub const osdp_completion_status_OSDP_COMPLETION_ABORTED: osdp_completion_status = 3;
1041+
#[doc = " @brief Terminal status of a submitted command/event object."]
1042+
pub type osdp_completion_status = ::core::ffi::c_uchar;
1043+
#[doc = " @brief Callback for CP command completion notifications."]
1044+
pub type cp_command_completion_callback_t = ::core::option::Option<
1045+
unsafe extern "C" fn(
1046+
arg: *mut ::core::ffi::c_void,
1047+
pd: ::core::ffi::c_int,
1048+
cmd: *const osdp_cmd,
1049+
status: osdp_completion_status,
1050+
),
1051+
>;
1052+
#[doc = " @brief Callback for PD event completion notifications."]
1053+
pub type pd_event_completion_callback_t = ::core::option::Option<
1054+
unsafe extern "C" fn(
1055+
arg: *mut ::core::ffi::c_void,
1056+
ev: *const osdp_event,
1057+
status: osdp_completion_status,
1058+
),
1059+
>;
9911060
unsafe extern "C" {
9921061
#[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"]
9931062
pub fn osdp_pd_setup(info: *const osdp_pd_info_t) -> *mut osdp_t;
@@ -1029,7 +1098,7 @@ unsafe extern "C" {
10291098
pub fn osdp_cp_setup(num_pd: ::core::ffi::c_int, info: *const osdp_pd_info_t) -> *mut osdp_t;
10301099
}
10311100
unsafe extern "C" {
1032-
#[doc = " @brief Adds more PD devices in the CP control list.\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 0 on success\n @retval -1 on failure"]
1101+
#[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"]
10331102
pub fn osdp_cp_add_pd(
10341103
ctx: *mut osdp_t,
10351104
num_pd: ::core::ffi::c_int,

libosdp-sys/vendor

Submodule vendor updated 101 files

0 commit comments

Comments
 (0)