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
00027
00028
00029
00030
00031
00032
00033
00034
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];
00108 char mid[6];
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;
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