This is done to support architectures where `rdtsc()` is not implemented.
In case it is available use `clock_gettime()`. Otherwise still fall back
to use `clock()`.
The first approach was to always use `clock_gettime()` if it is available
but the overhead it brings compared to `rdtsc()` is high, so I chose to
only try to use it if `rdtsc()` is not implemented.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
The cache is stored per connection object and is cleared on
* entry of wrong password
* release of connection object
* successful connection
It can be configured that libstrophe retries the password entry in case
the user entered a wrong password.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
In order to be able to load password-protected key files a password
callback was added.
This also adds support for PKCS#12 containers instead of certificate+key.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
The registered callback function will be called before connect() is
called on the socket, allowing tweaking of much more than just keepalive
settings.
This deprecates xmpp_conn_set_keepalive().
Includes helper/example callback function to set default keepalive
parameters that some library users may find useful.
In case this ifdef-elseif-chain falls back to the else path, the macro
to `clock()` wasn't defined.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
examples/perf.c: In function ‘perf_rand’:
examples/perf.c:42:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) {
Based on the differences to libmesode this functionality has been added.
It allows a library-user to set a callback for cases where the TLS stack
can't verify a received certificate and let the end-user decide what to
do.
examples/basic implements an example handler of said functionality.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This adds a new API function xmpp_ctx_set_verbosity() to set increased
verbosity levels.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Const variables in prototypes don't add much value, but make the code
larger and redundant. Remove these const keywords.
Note, this doesn't apply to pointers to const memory.
Introduced UNUSED macro with cast to void in commoh.h for internal
use. Used cast to void directly in those files which do not
include common.h. Although this change doesn't fix semantic issues
with unused function parameters, it does explicitly mark all those
places, which might require attention in future.
@sjaeckel integrated clang-format with formal coding style. Run his
script and commit changes.
There are pros and cons of this commit.
Mixed coding style is a "broken window". A good single style simplifies
reading and writing code.
On the other hand, this is a big change which will lead to conflicts.
XEP-0077 will not be implemented as part of libstrophe's API, but an
example is provided. The example shows how to use the "raw" connection
to register a user.
Closes#54.
If interface function returns char* the result must be freed with
xmpp_free().
In case of const char* the result must not be changed by user. Also, the
result is valid only during stanza lifetime.
Store keepalive parameters in conn object. This allows call the function
with a disconnected conn. Also, the parameters are not cleared on
reconnect and applied once a socket is created.
xmpp_conn_set_flags() and xmpp_conn_get_flags() unify interface of
connection configuration.
This interface allows compile-time check of supported features or even
run-time check. Therefore, applications can be built with older
libstrophe which doesn't support some optional flags.