Fix examples to use new API and lots of compiler warnings.
This commit is contained in:
9
Doxyfile
9
Doxyfile
@@ -24,8 +24,8 @@ ABBREVIATE_BRIEF = "The $name class" \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = src
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
@@ -46,7 +46,7 @@ SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
TYPEDEF_HIDES_STRUCT = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -95,7 +95,8 @@ WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = /Users/jack/Sources/libstrophe/
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c
|
||||
FILE_PATTERNS = *.c \
|
||||
*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE = examples \
|
||||
tests
|
||||
|
||||
@@ -48,7 +48,7 @@ Sources = Split("""
|
||||
util.c
|
||||
thread.c
|
||||
snprintf.c
|
||||
tls_schannel.c
|
||||
tls_dummy.c
|
||||
oocontext.cpp
|
||||
oostanza.cpp
|
||||
""")
|
||||
|
||||
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
|
||||
xmpp_conn_set_pass(conn, argv[2]);
|
||||
|
||||
/* initiate connection */
|
||||
xmpp_connect_client(conn, argv[3], conn_handler, ctx);
|
||||
xmpp_connect_client(conn, argv[3], NULL, 0, conn_handler, ctx);
|
||||
|
||||
/* start the event loop */
|
||||
xmpp_run(ctx);
|
||||
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
|
||||
xmpp_conn_set_pass(conn, pass);
|
||||
|
||||
/* initiate connection */
|
||||
xmpp_connect_client(conn, server, conn_handler, ctx);
|
||||
xmpp_connect_client(conn, server, NULL, 0, conn_handler, ctx);
|
||||
|
||||
/* enter the event loop -
|
||||
our connect handler will trigger an exit */
|
||||
|
||||
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
|
||||
xmpp_conn_t *conn;
|
||||
|
||||
if (argc != 4) {
|
||||
fprintf(stderr, "Usage: active <jid> <pass> <server>\n\n");
|
||||
fprintf(stderr, "Usage: roster <jid> <pass> <server>\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
|
||||
xmpp_conn_set_pass(conn, argv[2]);
|
||||
|
||||
/* initiate connection */
|
||||
xmpp_connect_client(conn, argv[3], conn_handler, ctx);
|
||||
xmpp_connect_client(conn, argv[3], NULL, 0, conn_handler, ctx);
|
||||
|
||||
/* start the event loop */
|
||||
xmpp_run(ctx);
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Internally used functions and structures.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_COMMON_H__
|
||||
#define __LIBSTROPHE_COMMON_H__
|
||||
|
||||
|
||||
@@ -32,6 +32,13 @@
|
||||
#include "strophe.h"
|
||||
#include "common.h"
|
||||
|
||||
/* do any of the immediate children have namespaces that match? */
|
||||
static int _match_children(xmpp_stanza_t * const stanza,
|
||||
const char * const ns)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Fire off all stanza handlers that match.
|
||||
* This function is called internally by the event loop whenever stanzas
|
||||
* are received from the XMPP server.
|
||||
@@ -99,7 +106,8 @@ void handler_fire_stanza(xmpp_conn_t * const conn,
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((!item->ns || (ns && strcmp(ns, item->ns) == 0)) &&
|
||||
if ((!item->ns || (ns && strcmp(ns, item->ns) == 0) ||
|
||||
_match_children(stanza, item->ns)) &&
|
||||
(!item->name || (name && strcmp(name, item->name) == 0)) &&
|
||||
(!item->type || (type && strcmp(type, item->type) == 0)))
|
||||
if (!((xmpp_handler)(item->handler))(conn, stanza, item->userdata)) {
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Hash table API.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_HASH_H__
|
||||
#define __LIBSTROPHE_HASH_H__
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
** This code is in the Public Domain.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* MD5 hash API.
|
||||
*/
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Type definitions for platforms without stdint.h.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_OSTYPES_H__
|
||||
#define __LIBSTROPHE_OSTYPES_H__
|
||||
|
||||
|
||||
78
src/sasl.c
78
src/sasl.c
@@ -56,7 +56,7 @@ char *sasl_plain(xmpp_ctx_t *ctx, const char *authid, const char *password) {
|
||||
memcpy(msg+1, authid, idlen);
|
||||
msg[1+idlen] = '\0';
|
||||
memcpy(msg+1+idlen+1, password, passlen);
|
||||
result = base64_encode(ctx, msg, 2 + idlen + passlen);
|
||||
result = base64_encode(ctx, (unsigned char *)msg, 2 + idlen + passlen);
|
||||
xmpp_free(ctx, msg);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ char *sasl_plain(xmpp_ctx_t *ctx, const char *authid, const char *password) {
|
||||
/** helpers for digest auth */
|
||||
|
||||
/* create a new, null-terminated string from a substring */
|
||||
static char *_make_string(xmpp_ctx_t *ctx, const char *s, const int len)
|
||||
static char *_make_string(xmpp_ctx_t *ctx, const char *s, const unsigned len)
|
||||
{
|
||||
char *result;
|
||||
|
||||
@@ -98,9 +98,9 @@ static char *_make_quoted(xmpp_ctx_t *ctx, const char *s)
|
||||
static hash_t *_parse_digest_challenge(xmpp_ctx_t *ctx, const char *msg)
|
||||
{
|
||||
hash_t *result;
|
||||
char *text;
|
||||
unsigned char *text;
|
||||
char *key, *value;
|
||||
char *s, *t;
|
||||
unsigned char *s, *t;
|
||||
|
||||
text = base64_decode(ctx, msg, strlen(msg));
|
||||
if (text == NULL) {
|
||||
@@ -118,7 +118,7 @@ static hash_t *_parse_digest_challenge(xmpp_ctx_t *ctx, const char *msg)
|
||||
t = s;
|
||||
while ((*t != '=') && (*t != '\0')) t++;
|
||||
if (*t == '\0') break; /* bad string */
|
||||
key = _make_string(ctx, s, (t-s));
|
||||
key = _make_string(ctx, (char *)s, (t-s));
|
||||
if (key == NULL) break;
|
||||
/* advance our start pointer past the key */
|
||||
s = t + 1;
|
||||
@@ -129,16 +129,16 @@ static hash_t *_parse_digest_challenge(xmpp_ctx_t *ctx, const char *msg)
|
||||
while ((*t != *s) && (*t != '\0'))
|
||||
t++;
|
||||
if (*t == *s) {
|
||||
value = _make_string(ctx, s+1, (t-s-2));
|
||||
value = _make_string(ctx, (char *)s+1, (t-s-2));
|
||||
s = t + 1;
|
||||
} else {
|
||||
value = _make_string(ctx, s+1, (t-s-1));
|
||||
value = _make_string(ctx, (char *)s+1, (t-s-1));
|
||||
s = t;
|
||||
}
|
||||
/* otherwise, accumulate a value ending in ',' or '\0' */
|
||||
} else {
|
||||
while ((*t != ',') && (*t != '\0')) t++;
|
||||
value = _make_string(ctx, s, (t-s));
|
||||
value = _make_string(ctx, (char *)s, (t-s));
|
||||
s = t;
|
||||
}
|
||||
if (value == NULL) {
|
||||
@@ -268,21 +268,21 @@ char *sasl_digest_md5(xmpp_ctx_t *ctx, const char *challenge,
|
||||
|
||||
/* construct MD5(A1) */
|
||||
MD5Init(&MD5);
|
||||
MD5Update(&MD5, node, strlen(node));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, domain, strlen(domain));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, password, strlen(password));
|
||||
MD5Update(&MD5, (unsigned char *)node, strlen(node));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)domain, strlen(domain));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)password, strlen(password));
|
||||
MD5Final(digest, &MD5);
|
||||
|
||||
MD5Init(&MD5);
|
||||
MD5Update(&MD5, digest, 16);
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)digest, 16);
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
value = hash_get(table, "nonce");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
value = hash_get(table, "cnonce");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Final(digest, &MD5);
|
||||
|
||||
A1 = xmpp_alloc(ctx, 16);
|
||||
@@ -290,9 +290,9 @@ char *sasl_digest_md5(xmpp_ctx_t *ctx, const char *challenge,
|
||||
|
||||
/* construct MD5(A2) */
|
||||
MD5Init(&MD5);
|
||||
MD5Update(&MD5, "AUTHENTICATE:", 13);
|
||||
MD5Update(&MD5, (unsigned char *)"AUTHENTICATE:", 13);
|
||||
value = hash_get(table, "digest-uri");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Final(digest, &MD5);
|
||||
|
||||
A2 = xmpp_alloc(ctx, 16);
|
||||
@@ -300,26 +300,26 @@ char *sasl_digest_md5(xmpp_ctx_t *ctx, const char *challenge,
|
||||
|
||||
/* construct response */
|
||||
MD5Init(&MD5);
|
||||
_digest_to_hex(A1, hex);
|
||||
MD5Update(&MD5, hex, 32);
|
||||
MD5Update(&MD5, ":", 1);
|
||||
_digest_to_hex((char *)A1, hex);
|
||||
MD5Update(&MD5, (unsigned char *)hex, 32);
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
value = hash_get(table, "nonce");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, "00000001", 8);
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)"00000001", 8);
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
value = hash_get(table, "cnonce");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
value = hash_get(table, "qop");
|
||||
MD5Update(&MD5, value, strlen(value));
|
||||
MD5Update(&MD5, ":", 1);
|
||||
_digest_to_hex(A2, hex);
|
||||
MD5Update(&MD5, hex, 32);
|
||||
MD5Update(&MD5, (unsigned char *)value, strlen(value));
|
||||
MD5Update(&MD5, (unsigned char *)":", 1);
|
||||
_digest_to_hex((char *)A2, hex);
|
||||
MD5Update(&MD5, (unsigned char *)hex, 32);
|
||||
MD5Final(digest, &MD5);
|
||||
|
||||
response = xmpp_alloc(ctx, 32+1);
|
||||
_digest_to_hex(digest, hex);
|
||||
_digest_to_hex((char *)digest, hex);
|
||||
memcpy(response, hex, 32);
|
||||
response[32] = '\0';
|
||||
hash_add(table, "response", response);
|
||||
@@ -345,7 +345,7 @@ char *sasl_digest_md5(xmpp_ctx_t *ctx, const char *challenge,
|
||||
hash_release(table); /* also frees value strings */
|
||||
|
||||
/* reuse response for the base64 encode of our result */
|
||||
response = base64_encode(ctx, result, strlen(result));
|
||||
response = base64_encode(ctx, (unsigned char *)result, strlen(result));
|
||||
xmpp_free(ctx, result);
|
||||
|
||||
return response;
|
||||
@@ -389,14 +389,14 @@ static const char _base64_charmap[65] = {
|
||||
'='
|
||||
};
|
||||
|
||||
int base64_encoded_len(xmpp_ctx_t *ctx, const int len)
|
||||
int base64_encoded_len(xmpp_ctx_t *ctx, const unsigned len)
|
||||
{
|
||||
/* encoded steam is 4 bytes for every three, rounded up */
|
||||
return ((len + 2)/3) << 2;
|
||||
}
|
||||
|
||||
char *base64_encode(xmpp_ctx_t *ctx,
|
||||
const unsigned char * const buffer, const int len)
|
||||
const unsigned char * const buffer, const unsigned len)
|
||||
{
|
||||
int clen;
|
||||
char *cbuf, *c;
|
||||
@@ -450,7 +450,7 @@ char *base64_encode(xmpp_ctx_t *ctx,
|
||||
}
|
||||
|
||||
int base64_decoded_len(xmpp_ctx_t *ctx,
|
||||
const char * const buffer, const int len)
|
||||
const char * const buffer, const unsigned len)
|
||||
{
|
||||
int nudge;
|
||||
int c;
|
||||
@@ -474,7 +474,7 @@ int base64_decoded_len(xmpp_ctx_t *ctx,
|
||||
}
|
||||
|
||||
unsigned char *base64_decode(xmpp_ctx_t *ctx,
|
||||
const char * const buffer, const int len)
|
||||
const char * const buffer, const unsigned len)
|
||||
{
|
||||
int dlen;
|
||||
unsigned char *dbuf, *d;
|
||||
|
||||
12
src/sasl.h
12
src/sasl.h
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* SASL authentication helpers.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_SASL_H__
|
||||
#define __LIBSTROPHE_SASL_H__
|
||||
|
||||
@@ -26,15 +30,15 @@ char *sasl_digest_md5(xmpp_ctx_t *ctx, const char *challenge,
|
||||
|
||||
/** Base64 encoding routines. Implemented according to RFC 3548 */
|
||||
|
||||
int base64_encoded_len(xmpp_ctx_t *ctx, const int len);
|
||||
int base64_encoded_len(xmpp_ctx_t *ctx, const unsigned len);
|
||||
|
||||
char *base64_encode(xmpp_ctx_t *ctx,
|
||||
const unsigned char * const buffer, const int len);
|
||||
const unsigned char * const buffer, const unsigned len);
|
||||
|
||||
int base64_decoded_len(xmpp_ctx_t *ctx,
|
||||
const char * const buffer, const int len);
|
||||
const char * const buffer, const unsigned len);
|
||||
|
||||
unsigned char *base64_decode(xmpp_ctx_t *ctx,
|
||||
const char * const buffer, const int len);
|
||||
const char * const buffer, const unsigned len);
|
||||
|
||||
#endif /* _LIBXMPP_SASL_H__ */
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* public api for steve reid's public domain SHA-1 implementation */
|
||||
/* this file is in the public domain */
|
||||
|
||||
/** @file
|
||||
* SHA-1 hash API.
|
||||
*/
|
||||
|
||||
#ifndef __SHA1_H
|
||||
#define __SHA1_H
|
||||
|
||||
|
||||
14
src/sock.c
14
src/sock.c
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -161,7 +162,7 @@ int sock_is_recoverable(const int error)
|
||||
int sock_connect_error(const sock_t sock)
|
||||
{
|
||||
struct sockaddr sa;
|
||||
int len;
|
||||
unsigned len;
|
||||
char temp;
|
||||
|
||||
sa.sa_family = AF_INET;
|
||||
@@ -285,13 +286,14 @@ void netbuf_get_16bitnum(unsigned char *buf, int buflen, int *offset, unsigned s
|
||||
*offset += 2;
|
||||
}
|
||||
|
||||
void netbuf_add_domain_name(unsigned char *buf, int buflen, int *offset, char *name)
|
||||
void netbuf_add_domain_name(unsigned char *buf, int buflen, int *offset,
|
||||
char *name)
|
||||
{
|
||||
unsigned char *start = buf + *offset;
|
||||
unsigned char *p = start;
|
||||
unsigned char *wordstart, *wordend;
|
||||
|
||||
wordstart = name;
|
||||
wordstart = (unsigned char *)name;
|
||||
|
||||
while (*wordstart)
|
||||
{
|
||||
@@ -388,7 +390,6 @@ void netbuf_get_domain_name(unsigned char *buf, int buflen, int *offset, char **
|
||||
{
|
||||
unsigned char *start = buf + *offset;
|
||||
unsigned char *p = start;
|
||||
char *p2;
|
||||
int *curroffset = offset;
|
||||
|
||||
*name = malloc(sizeof(**name) * (calc_domain_name_size(buf, buflen, *offset) + 1));
|
||||
@@ -417,7 +418,7 @@ void netbuf_get_domain_name(unsigned char *buf, int buflen, int *offset, char **
|
||||
strcat(*name, ".");
|
||||
}
|
||||
|
||||
strncat(*name, p + 1, *p);
|
||||
strncat(*name, (char *)p + 1, *p);
|
||||
p += *p + 1;
|
||||
}
|
||||
}
|
||||
@@ -597,7 +598,6 @@ void netbuf_get_dnsquery_resourcerecord(unsigned char *buf, int buflen, int *off
|
||||
|
||||
char **SeparateStringByDots(char *string)
|
||||
{
|
||||
FILE *fp;
|
||||
char **result;
|
||||
char *p = string;
|
||||
char **ps;
|
||||
@@ -947,8 +947,6 @@ int sock_srv_lookup(const char *service, const char *proto, const char *domain,
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
int len = offset;
|
||||
int i;
|
||||
struct dnsquery_header header;
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Socket abstraction API.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_SOCK_H__
|
||||
#define __LIBSTROPHE_SOCK_H__
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* XMPP stanza creation and manipulation.
|
||||
* Stanza creation and manipulation.
|
||||
*/
|
||||
|
||||
/** @defgroup Stanza Stanza creation and manipulation
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Threading abstraction API.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_THREAD_H__
|
||||
#define __LIBSTROPHE_THREAD_H__
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* TLS abstraction API.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_TLS_H__
|
||||
#define __LIBSTROPHE_TLS_H__
|
||||
|
||||
@@ -36,4 +40,7 @@ int tls_error(tls_t *tls);
|
||||
int tls_read(tls_t *tls, void * const buff, const size_t len);
|
||||
int tls_write(tls_t *tls, const void * const buff, const size_t len);
|
||||
|
||||
int tls_clear_pending_write(tls_t *tls);
|
||||
int tls_is_recoverable(int error);
|
||||
|
||||
#endif /* __LIBSTROPHE_TLS_H__ */
|
||||
|
||||
@@ -44,7 +44,7 @@ tls_t *tls_new(xmpp_ctx_t *ctx, sock_t sock)
|
||||
|
||||
void tls_free(tls_t *tls)
|
||||
{
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
int tls_set_credentials(tls_t *tls, const char *cafilename)
|
||||
@@ -77,3 +77,13 @@ int tls_write(tls_t *tls, const void * const buff, const size_t len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int tls_clear_pending_write(tls_t *tls)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int tls_is_recoverable(int error)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Internally used utility functions.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_UTIL_H__
|
||||
#define __LIBSTROPHE_UTIL_H__
|
||||
|
||||
|
||||
78
strophe.h
78
strophe.h
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Strophe public C API definitions.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_STROPHE_H__
|
||||
#define __LIBSTROPHE_STROPHE_H__
|
||||
|
||||
@@ -22,35 +26,87 @@ extern "C" {
|
||||
#include <stdio.h>
|
||||
|
||||
/* namespace defines */
|
||||
/** @def XMPP_NS_CLIENT
|
||||
* Namespace definition for 'jabber:client'.
|
||||
*/
|
||||
#define XMPP_NS_CLIENT "jabber:client"
|
||||
/** @def XMPP_NS_COMPONENT
|
||||
* Namespace definition for 'jabber:component:accept'.
|
||||
*/
|
||||
#define XMPP_NS_COMPONENT "jabber:component:accept"
|
||||
/** @def XMPP_NS_STREAMS
|
||||
* Namespace definition for 'http://etherx.jabber.org/streams'.
|
||||
*/
|
||||
#define XMPP_NS_STREAMS "http://etherx.jabber.org/streams"
|
||||
/** @def XMPP_NS_STREAMS_IETF
|
||||
* Namespace definition for 'urn:ietf:params:xml:ns:xmpp-streams'.
|
||||
*/
|
||||
#define XMPP_NS_STREAMS_IETF "urn:ietf:params:xml:ns:xmpp-streams"
|
||||
/** @def XMPP_NS_TLS
|
||||
* Namespace definition for 'url:ietf:params:xml:ns:xmpp-tls'.
|
||||
*/
|
||||
#define XMPP_NS_TLS "urn:ietf:params:xml:ns:xmpp-tls"
|
||||
/** @def XMPP_NS_SASL
|
||||
* Namespace definition for 'urn:ietf:params:xml:ns:xmpp-sasl'.
|
||||
*/
|
||||
#define XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
|
||||
/** @def XMPP_NS_BIND
|
||||
* Namespace definition for 'urn:ietf:params:xml:ns:xmpp-bind'.
|
||||
*/
|
||||
#define XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"
|
||||
/** @def XMPP_NS_SESSION
|
||||
* Namespace definition for 'urn:ietf:params:xml:ns:xmpp-session'.
|
||||
*/
|
||||
#define XMPP_NS_SESSION "urn:ietf:params:xml:ns:xmpp-session"
|
||||
/** @def XMPP_NS_AUTH
|
||||
* Namespace definition for 'jabber:iq:auth'.
|
||||
*/
|
||||
#define XMPP_NS_AUTH "jabber:iq:auth"
|
||||
/** @def XMPP_NS_DISCO_INFO
|
||||
* Namespace definition for 'http://jabber.org/protocol/disco#info'.
|
||||
*/
|
||||
#define XMPP_NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
|
||||
/** @def XMPP_NS_DISCO_ITEMS
|
||||
* Namespace definition for 'http://jabber.org/protocol/disco#items'.
|
||||
*/
|
||||
#define XMPP_NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items"
|
||||
/** @def XMPP_NS_ROSTER
|
||||
* Namespace definition for 'jabber:iq:roster'.
|
||||
*/
|
||||
#define XMPP_NS_ROSTER "jabber:iq:roster"
|
||||
|
||||
/* error defines */
|
||||
/** @def XMPP_EOK
|
||||
* Success error code.
|
||||
*/
|
||||
#define XMPP_EOK 0
|
||||
/** @def XMPP_EMEM
|
||||
* Memory related failure error code.
|
||||
*
|
||||
* This is returned on allocation errors and signals that the host may
|
||||
* be out of memory.
|
||||
*/
|
||||
#define XMPP_EMEM -1
|
||||
/** @def XMPP_EINVOP
|
||||
* Invalid operation error code.
|
||||
*
|
||||
* This error code is returned when the operation was invalid and signals
|
||||
* that the Strophe API is being used incorrectly.
|
||||
*/
|
||||
#define XMPP_EINVOP -2
|
||||
/** @def XMPP_EINT
|
||||
* Internal failure error code.
|
||||
*/
|
||||
#define XMPP_EINT -3
|
||||
|
||||
/** initialization and shutdown **/
|
||||
|
||||
/* initialization and shutdown */
|
||||
void xmpp_initialize(void);
|
||||
void xmpp_shutdown(void);
|
||||
|
||||
/** version **/
|
||||
|
||||
/* version */
|
||||
int xmpp_version_check(int major, int minor);
|
||||
|
||||
/** run-time contexts **/
|
||||
/* run-time contexts */
|
||||
|
||||
/* user-replaceable memory allocator */
|
||||
typedef struct _xmpp_mem_t xmpp_mem_t;
|
||||
@@ -99,7 +155,7 @@ struct _xmpp_log_t {
|
||||
/* return a default logger filtering at a given level */
|
||||
xmpp_log_t *xmpp_get_default_logger(xmpp_log_level_t level);
|
||||
|
||||
/** connection **/
|
||||
/* connection */
|
||||
|
||||
/* opaque connection object */
|
||||
typedef struct _xmpp_conn_t xmpp_conn_t;
|
||||
@@ -269,20 +325,26 @@ int xmpp_stanza_set_id(xmpp_stanza_t * const stanza,
|
||||
const char * const id);
|
||||
int xmpp_stanza_set_type(xmpp_stanza_t * const stanza,
|
||||
const char * const type);
|
||||
|
||||
/* unimplemented
|
||||
int xmpp_stanza_set_to();
|
||||
int xmpp_stanza_set_from();
|
||||
*/
|
||||
|
||||
/** allocate and initialize a stanza in reply to another */
|
||||
/* allocate and initialize a stanza in reply to another */
|
||||
/* unimplemented
|
||||
xmpp_stanza_t *xmpp_stanza_reply(const xmpp_stanza_t *stanza);
|
||||
*/
|
||||
|
||||
/* stanza subclasses */
|
||||
/* unimplemented
|
||||
void xmpp_message_new();
|
||||
void xmpp_message_get_body();
|
||||
void xmpp_message_set_body();
|
||||
|
||||
void xmpp_iq_new();
|
||||
void xmpp_presence_new();
|
||||
|
||||
*/
|
||||
|
||||
/** event loop **/
|
||||
void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout);
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
** distribution.
|
||||
*/
|
||||
|
||||
/** @file
|
||||
* Strophe public C++ API definitions.
|
||||
*/
|
||||
|
||||
#ifndef __LIBSTROPHE_STROPHEPP_H__
|
||||
#define __LIBSTROPHE_STROPHEPP_H__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user