From b349a15d9221e1e9d6736eccb7357294399eb830 Mon Sep 17 00:00:00 2001 From: defanor Date: Thu, 7 Dec 2023 13:54:45 +0300 Subject: 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. --- examples/basic.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'examples') diff --git a/examples/basic.c b/examples/basic.c index 60a240a..5df4f65 100644 --- a/examples/basic.c +++ b/examples/basic.c @@ -88,6 +88,11 @@ int my_console_print_cb (rexmpp_t *s, const char *fmt, va_list args) { return 0; } +/* void my_socket_options(rexmpp_t *s, int sock) { */ +/* int pmtudisc = IP_PMTUDISC_WANT; */ +/* setsockopt(sock, IPPROTO_IP, IP_MTU_DISCOVER, &pmtudisc, sizeof(pmtudisc)); */ +/* } */ + void print_help (char *prog_name) { printf("Usage: %s [options] \n" \ "Options:\n" \ @@ -152,6 +157,7 @@ int main (int argc, char **argv) { /* rexmpp_openpgp_set_home_dir(&s, "pgp"); */ s.roster_cache_file = "roster.xml"; /* s.tls_policy = REXMPP_TLS_AVOID; */ + /* s.socket_cb = my_socket_options; */ /* Once the main structure is initialised and everything is sufficiently configured, we are ready to run the main loop and -- cgit v1.2.3