Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef _ASTERISK_JABBER_H
00044 #define _ASTERISK_JABBER_H
00045
00046 #ifdef HAVE_OPENSSL
00047
00048 #include <openssl/ssl.h>
00049 #include <openssl/err.h>
00050 #define TRY_SECURE 2
00051 #define SECURE 4
00052
00053 #endif
00054
00055 #define NET_IO_BUF_SIZE 4096
00056
00057 #define IKS_NET_EXPIRED 12
00058
00059 #include <iksemel.h>
00060 #include "asterisk/astobj.h"
00061 #include "asterisk/linkedlists.h"
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #define AJI_MAX_JIDLEN 3071
00074 #define AJI_MAX_RESJIDLEN 1023
00075
00076 enum aji_state {
00077 AJI_DISCONNECTING,
00078 AJI_DISCONNECTED,
00079 AJI_CONNECTING,
00080 AJI_CONNECTED
00081 };
00082
00083 enum {
00084 AJI_AUTOPRUNE = (1 << 0),
00085 AJI_AUTOREGISTER = (1 << 1)
00086 };
00087
00088 enum aji_btype {
00089 AJI_USER=0,
00090 AJI_TRANS=1,
00091 AJI_UTRANS=2
00092 };
00093
00094 struct aji_version {
00095 char version[50];
00096 int jingle;
00097 struct aji_capabilities *parent;
00098 struct aji_version *next;
00099 };
00100
00101 struct aji_capabilities {
00102 char node[200];
00103 struct aji_version *versions;
00104 struct aji_capabilities *next;
00105 };
00106
00107 struct aji_resource {
00108 int status;
00109 char resource[AJI_MAX_RESJIDLEN];
00110 char *description;
00111 struct aji_version *cap;
00112 int priority;
00113 struct aji_resource *next;
00114 };
00115
00116 struct aji_message {
00117 char *from;
00118 char *message;
00119 char id[25];
00120 time_t arrived;
00121 AST_LIST_ENTRY(aji_message) list;
00122 };
00123
00124 struct aji_buddy {
00125 ASTOBJ_COMPONENTS_FULL(struct aji_buddy, AJI_MAX_JIDLEN, 1);
00126 char channel[160];
00127 struct aji_resource *resources;
00128 enum aji_btype btype;
00129 struct ast_flags flags;
00130 };
00131
00132 struct aji_buddy_container {
00133 ASTOBJ_CONTAINER_COMPONENTS(struct aji_buddy);
00134 };
00135
00136 struct aji_transport_container {
00137 ASTOBJ_CONTAINER_COMPONENTS(struct aji_transport);
00138 };
00139
00140 struct aji_client {
00141 ASTOBJ_COMPONENTS(struct aji_client);
00142 char password[160];
00143 char user[AJI_MAX_JIDLEN];
00144 char serverhost[AJI_MAX_RESJIDLEN];
00145 char statusmessage[256];
00146 char name_space[256];
00147 char sid[10];
00148 char mid[6];
00149 iksid *jid;
00150 iksparser *p;
00151 iksfilter *f;
00152 ikstack *stack;
00153 #ifdef HAVE_OPENSSL
00154 SSL_CTX *ssl_context;
00155 SSL *ssl_session;
00156 const SSL_METHOD *ssl_method;
00157 unsigned int stream_flags;
00158 #endif
00159 enum aji_state state;
00160 int port;
00161 int debug;
00162 int usetls;
00163 int forcessl;
00164 int usesasl;
00165 int keepalive;
00166 int allowguest;
00167 int timeout;
00168 int message_timeout;
00169 int authorized;
00170 struct ast_flags flags;
00171 int component;
00172 struct aji_buddy_container buddies;
00173 AST_LIST_HEAD(messages,aji_message) messages;
00174 void *jingle;
00175 pthread_t thread;
00176 int priority;
00177 enum ikshowtype status;
00178 };
00179
00180 struct aji_client_container{
00181 ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
00182 };
00183
00184
00185 int ast_aji_send(struct aji_client *client, iks *x);
00186
00187 int ast_aji_send_chat(struct aji_client *client, const char *address, const char *message);
00188
00189 int ast_aji_disconnect(struct aji_client *client);
00190 int ast_aji_check_roster(void);
00191 void ast_aji_increment_mid(char *mid);
00192
00193 int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
00194
00195 int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
00196
00197 int ast_aji_join_chat(struct aji_client *client,char *room);
00198 struct aji_client *ast_aji_get_client(const char *name);
00199 struct aji_client_container *ast_aji_get_clients(void);
00200
00201 #endif