diff options
author | defanor <defanor@uberspace.net> | 2023-12-07 13:54:45 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-12-07 14:40:51 +0300 |
commit | b349a15d9221e1e9d6736eccb7357294399eb830 (patch) | |
tree | f6168ea6ddf5c6745758ea65ca5d6bf59dafcb34 /examples | |
parent | ecbef993632c9b3bdf442b381e02e1ad24bc1c87 (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 'examples')
-rw-r--r-- | examples/basic.c | 6 |
1 files changed, 6 insertions, 0 deletions
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] <jid>\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 |