Properly play a holdtime message if the announce-holdtime option is
[asterisk-bristuff.git] / include / asterisk / jabber.h
blob39618cd4ba5c589bbcaa3be7927d7dd9c90229c4
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Matt O'Gorman <mogorman@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 #ifndef _ASTERISK_JABBER_H
20 #define _ASTERISK_JABBER_H
22 #include <iksemel.h>
23 #include "asterisk/astobj.h"
24 #include "asterisk/linkedlists.h"
26 /*
27 * As per RFC 3920 - section 3.1, the maximum length for a full Jabber ID
28 * is 3071 bytes.
29 * The ABNF syntax for jid :
30 * jid = [node "@" ] domain [ "/" resource ]
31 * Each allowable portion of a JID (node identifier, domain identifier,
32 * and resource identifier) MUST NOT be more than 1023 bytes in length,
33 * resulting in a maximum total size (including the '@' and '/' separators)
34 * of 3071 bytes.
36 #define AJI_MAX_JIDLEN 3071
37 #define AJI_MAX_RESJIDLEN 1023
39 enum aji_state {
40 AJI_DISCONNECTING,
41 AJI_DISCONNECTED,
42 AJI_CONNECTING,
43 AJI_CONNECTED
46 enum {
47 AJI_AUTOPRUNE = (1 << 0),
48 AJI_AUTOREGISTER = (1 << 1)
51 enum aji_btype {
52 AJI_USER=0,
53 AJI_TRANS=1,
54 AJI_UTRANS=2
57 struct aji_version {
58 char version[50];
59 int jingle;
60 struct aji_capabilities *parent;
61 struct aji_version *next;
64 struct aji_capabilities {
65 char node[200];
66 struct aji_version *versions;
67 struct aji_capabilities *next;
70 struct aji_resource {
71 int status;
72 char resource[AJI_MAX_RESJIDLEN];
73 char *description;
74 struct aji_version *cap;
75 int priority;
76 struct aji_resource *next;
79 struct aji_message {
80 char *from;
81 char *message;
82 char id[25];
83 time_t arrived;
84 AST_LIST_ENTRY(aji_message) list;
87 struct aji_buddy {
88 ASTOBJ_COMPONENTS_FULL(struct aji_buddy, AJI_MAX_JIDLEN, 1);
89 struct aji_resource *resources;
90 unsigned int flags;
93 struct aji_buddy_container {
94 ASTOBJ_CONTAINER_COMPONENTS(struct aji_buddy);
97 struct aji_transport_container {
98 ASTOBJ_CONTAINER_COMPONENTS(struct aji_transport);
101 struct aji_client {
102 ASTOBJ_COMPONENTS(struct aji_client);
103 char password[160];
104 char user[AJI_MAX_JIDLEN];
105 char serverhost[AJI_MAX_RESJIDLEN];
106 char statusmessage[256];
107 char sid[10]; /* Session ID */
108 char mid[6]; /* Message ID */
109 iksid *jid;
110 iksparser *p;
111 iksfilter *f;
112 ikstack *stack;
113 enum aji_state state;
114 int port;
115 int debug;
116 int usetls;
117 int forcessl;
118 int usesasl;
119 int keepalive;
120 int allowguest;
121 int timeout;
122 int message_timeout;
123 int authorized;
124 unsigned int flags;
125 int component; /* 0 client, 1 component */
126 struct aji_buddy_container buddies;
127 AST_LIST_HEAD(messages,aji_message) messages;
128 void *jingle;
129 pthread_t thread;
132 struct aji_client_container{
133 ASTOBJ_CONTAINER_COMPONENTS(struct aji_client);
136 int ast_aji_send(struct aji_client *client, const char *address, const char *message);
137 int ast_aji_disconnect(struct aji_client *client);
138 int ast_aji_check_roster(void);
139 void ast_aji_increment_mid(char *mid);
140 int ast_aji_create_chat(struct aji_client *client,char *room, char *server, char *topic);
141 int ast_aji_invite_chat(struct aji_client *client, char *user, char *room, char *message);
142 int ast_aji_join_chat(struct aji_client *client,char *room);
143 struct aji_client *ast_aji_get_client(const char *name);
144 struct aji_client_container *ast_aji_get_clients(void);
146 #endif