00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 enum aji_state {
00027 AJI_DISCONNECTED = 0,
00028 AJI_CONNECTING,
00029 AJI_CONNECTED
00030 };
00031
00032 enum {
00033 AJI_AUTOPRUNE = (1 << 0),
00034 AJI_AUTOREGISTER = (1 << 1)
00035 };
00036
00037 enum aji_btype {
00038 AJI_USER=0,
00039 AJI_TRANS=1,
00040 AJI_UTRANS=2
00041 };
00042
00043 struct aji_version {
00044 char version[50];
00045 int jingle;
00046 struct aji_capabilities *parent;
00047 struct aji_version *next;
00048 };
00049
00050 struct aji_capabilities {
00051 char node[200];
00052 struct aji_version *versions;
00053 struct aji_capabilities *next;
00054 };
00055
00056 struct aji_resource {
00057 int status;
00058 char resource[80];
00059 char *description;
00060 struct aji_version *cap;
00061 int priority;
00062 struct aji_resource *next;
00063 };
00064
00065 struct aji_message {
00066 char *from;
00067 char *message;
00068 char id[25];
00069 time_t arrived;
00070 AST_LIST_ENTRY(aji_message) list;
00071 };
00072
00073 struct aji_buddy {
00074 ASTOBJ_COMPONENTS(struct aji_buddy);
00075 struct aji_resource *resources;
00076 unsigned int flags;
00077 };
00078
00079 struct aji_buddy_container {
00080 ASTOBJ_CONTAINER_COMPONENTS(struct aji_buddy);
00081 };
00082
00083 struct aji_transport_container {
00084 ASTOBJ_CONTAINER_COMPONENTS(struct aji_transport);
00085 };
00086
00087 struct aji_client {
00088 ASTOBJ_COMPONENTS(struct aji_client);
00089 char password[160];
00090 char user[160];
00091 char serverhost[160];
00092 char context[100];
00093 char statusmessage[256];
00094 char sid[10];
00095 char mid[6];
00096 iksid *jid;
00097 iksparser *p;
00098 iksfilter *f;
00099 ikstack *stack;
00100 enum aji_state state;
00101 int port;
00102 int debug;
00103 int usetls;
00104 int forcessl;
00105 int usesasl;
00106 int keepalive;
00107 int allowguest;
00108 int timeout;
00109 int message_timeout;
00110 int authorized;
00111 unsigned int flags;
00112 int component;
00113 struct aji_buddy_container buddies;
00114 AST_LIST_HEAD(messages,aji_message) messages;
00115 void *jingle;
00116 pthread_t thread;
00117 };
00118
00119 struct aji_client_container{
00120 ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
00121 };
00122
00123 int ast_aji_send(struct aji_client *client, const char *address, const char *message);
00124 int ast_aji_disconnect(struct aji_client *client);
00125 int ast_aji_check_roster(void);
00126 void ast_aji_increment_mid(char *mid);
00127 int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
00128 int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
00129 int ast_aji_join_chat(struct aji_client *client,char *room);
00130 struct aji_client *ast_aji_get_client(const char *name);
00131 struct aji_client_container *ast_aji_get_clients(void);
00132
00133 #endif