Sat Aug 6 00:39:29 2011

Asterisk developer's documentation


jabber.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Matt O'Gorman <mogorman@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 #ifndef _ASTERISK_JABBER_H
00020 #define _ASTERISK_JABBER_H
00021 
00022 #include <iksemel.h>
00023 #include "asterisk/astobj.h"
00024 #include "asterisk/linkedlists.h"
00025 
00026 /* 
00027  * As per RFC 3920 - section 3.1, the maximum length for a full Jabber ID 
00028  * is 3071 bytes.
00029  * The ABNF syntax for jid :
00030  * jid = [node "@" ] domain [ "/" resource ]
00031  * Each allowable portion of a JID (node identifier, domain identifier,
00032  * and resource identifier) MUST NOT be more than 1023 bytes in length,
00033  * resulting in a maximum total size (including the '@' and '/' separators) 
00034  * of 3071 bytes.
00035  */
00036 #define AJI_MAX_JIDLEN 3071
00037 #define AJI_MAX_RESJIDLEN 1023
00038 
00039 enum aji_state {
00040    AJI_DISCONNECTING,
00041    AJI_DISCONNECTED,
00042    AJI_CONNECTING,
00043    AJI_CONNECTED
00044 };
00045 
00046 enum {
00047    AJI_AUTOPRUNE = (1 << 0),
00048    AJI_AUTOREGISTER = (1 << 1)
00049 };
00050 
00051 enum aji_btype {
00052    AJI_USER=0,
00053    AJI_TRANS=1,
00054    AJI_UTRANS=2
00055 };
00056 
00057 struct aji_version {
00058    char version[50];
00059    int jingle;
00060    struct aji_capabilities *parent;
00061    struct aji_version *next;
00062 };
00063 
00064 struct aji_capabilities {
00065    char node[200];
00066    struct aji_version *versions;
00067    struct aji_capabilities *next;
00068 };
00069 
00070 struct aji_resource {
00071    int status;
00072    char resource[AJI_MAX_RESJIDLEN];
00073    char *description;
00074    struct aji_version *cap;
00075    int priority;
00076    struct aji_resource *next;
00077 };
00078 
00079 struct aji_message {
00080    char *from;
00081    char *message;
00082    char id[25];
00083    time_t arrived;
00084    AST_LIST_ENTRY(aji_message) list;
00085 };
00086 
00087 struct aji_buddy {
00088    ASTOBJ_COMPONENTS_FULL(struct aji_buddy, AJI_MAX_JIDLEN, 1);
00089    struct aji_resource *resources;
00090    unsigned int flags;
00091 };
00092 
00093 struct aji_buddy_container {
00094    ASTOBJ_CONTAINER_COMPONENTS(struct aji_buddy);
00095 };
00096 
00097 struct aji_transport_container {
00098    ASTOBJ_CONTAINER_COMPONENTS(struct aji_transport);
00099 };
00100 
00101 struct aji_client {
00102    ASTOBJ_COMPONENTS(struct aji_client);
00103    char password[160];
00104    char user[AJI_MAX_JIDLEN];
00105    char serverhost[AJI_MAX_RESJIDLEN];
00106    char statusmessage[256];
00107    char sid[10]; /* Session ID */
00108    char mid[6]; /* Message ID */
00109    iksid *jid;
00110    iksparser *p;
00111    iksfilter *f;
00112    ikstack *stack;
00113    enum aji_state state;
00114    int port;
00115    int debug;
00116    int usetls;
00117    int forcessl;
00118    int usesasl;
00119    int keepalive;
00120    int allowguest;
00121    int timeout;
00122    int message_timeout;
00123    int authorized;
00124    unsigned int flags;
00125    int component; /* 0 client,  1 component */
00126    struct aji_buddy_container buddies;
00127    AST_LIST_HEAD(messages,aji_message) messages;
00128    void *jingle;
00129    pthread_t thread;
00130 };
00131 
00132 struct aji_client_container{
00133    ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
00134 };
00135 
00136 int ast_aji_send(struct aji_client *client, const char *address, const char *message);
00137 int ast_aji_disconnect(struct aji_client *client);
00138 int ast_aji_check_roster(void);
00139 void ast_aji_increment_mid(char *mid);
00140 int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
00141 int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
00142 int ast_aji_join_chat(struct aji_client *client,char *room);
00143 struct aji_client *ast_aji_get_client(const char *name);
00144 struct aji_client_container *ast_aji_get_clients(void);
00145 
00146 #endif

Generated on Sat Aug 6 00:39:29 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7