summaryrefslogtreecommitdiff
path: root/src/rexmpp.rs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2023-12-07 13:54:45 +0300
committerdefanor <defanor@uberspace.net>2023-12-07 14:40:51 +0300
commitb349a15d9221e1e9d6736eccb7357294399eb830 (patch)
treef6168ea6ddf5c6745758ea65ca5d6bf59dafcb34 /src/rexmpp.rs
parentecbef993632c9b3bdf442b381e02e1ad24bc1c87 (diff)
Provide a callback after socket creation, use _Bool
The callback is provided to set socket options, instead of individual options such as path_mtu_discovery (which is now removed). Noticed that the Rust rexmpp structure's C representation does not match that of C, since Rust's "bool" maps to C99's "_Bool", while I thought that it maps to "int" (c_int). Adjusted C structures to use "bool" from stdbool.h as well, since C99 (GNU99) is used already.
Diffstat (limited to 'src/rexmpp.rs')
-rw-r--r--src/rexmpp.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rexmpp.rs b/src/rexmpp.rs
index a6950a4..250da00 100644
--- a/src/rexmpp.rs
+++ b/src/rexmpp.rs
@@ -94,6 +94,9 @@ fn (s: *mut Rexmpp, cb_data: *mut c_void,
request: *mut rexmpp_xml::RexmppXML, response: *mut rexmpp_xml::RexmppXML,
success: c_int) -> ();
+type SocketCallback = unsafe extern "C"
+fn (s: *mut Rexmpp, socket: c_int) -> ();
+
#[repr(C)]
pub struct RexmppIQ {
pub requset: *mut rexmpp_xml::RexmppXML,
@@ -153,9 +156,6 @@ pub struct Rexmpp {
pub client_version: *const c_char, // XEP-0092
pub local_address: *const c_char, // For ICE, XEP-0176
pub jingle_prefer_rtcp_mux: bool,
- // An IP_MTU_DISCOVER parameter for TCP sockets, or -1 to not set
- // it
- pub path_mtu_discovery: c_int,
// A delay in seconds, to use for MUC self-ping by default
pub muc_ping_default_delay: c_uint,
// Resource limits
@@ -182,6 +182,7 @@ pub struct Rexmpp {
pub xml_out_cb: *const c_void,
pub roster_modify_cb: *const c_void,
pub console_print_cb: *const c_void,
+ pub socket_cb: Option<SocketCallback>,
// Stream-related state
pub assigned_jid: rexmpp_jid::RexmppJID,