jabber_k/xjab_jcon.h

00001 /*
00002  * $Id$
00003  *
00004  * eXtended JABber module - headers for functions used for JABBER srv connection
00005  *
00006  * Copyright (C) 2001-2003 FhG Fokus
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * Kamailio is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  */
00024 
00025 
00026 #ifndef _XJAB_JCON_H_
00027 #define _XJAB_JCON_H_
00028 
00029 #include "../../str.h"
00030 #include "xjab_jconf.h"
00031 #include "xjab_base.h"
00032 #include "tree234.h"
00033 #include "xjab_presence.h"
00034 
00035 #define XJ_NET_NUL      0
00036 #define XJ_NET_ALL      0xFFFFFFFF
00037 #define XJ_NET_JAB      1
00038 #define XJ_NET_AIM      2
00039 #define XJ_NET_ICQ      4
00040 #define XJ_NET_MSN      8
00041 #define XJ_NET_YAH      16
00042 
00043 #define XJ_AIM_NAME "aim."
00044 #define XJ_AIM_LEN  4
00045 #define XJ_ICQ_NAME "icq"
00046 #define XJ_ICQ_LEN  3
00047 #define XJ_MSN_NAME "msn."
00048 #define XJ_MSN_LEN  4
00049 #define XJ_YAH_NAME "yahoo."
00050 #define XJ_YAH_LEN  6
00051 
00052 #define XJ_JMSG_NORMAL          1
00053 #define XJ_JMSG_CHAT            2
00054 #define XJ_JMSG_GROUPCHAT       4
00055 
00056 #define XJ_JCMD_SUBSCRIBE       1
00057 #define XJ_JCMD_UNSUBSCRIBE     2
00058 
00059 typedef struct _xj_jcon
00060 {
00061         int sock;                       // communication socket
00062         int port;                       // port of the server
00063         int juid;                       // internal id of the Jabber user
00064         int seq_nr;                     // sequence number
00065         char *hostname;         // hostname of the Jabber server
00066         char *stream_id;        // stream id of the session
00067 
00068         char *resource;         // resource ID
00069 
00070         xj_jkey jkey;           // id of connection
00071         int expire;                     // time when the open connection is expired
00072         int allowed;            // allowed IM networks
00073         int ready;                      // time when the connection is ready for sending messages
00074 
00075         int nrjconf;            // number of open conferences
00076         tree234 *jconf;         // open conferences
00077         xj_pres_list plist;     // presence list
00078 } t_xj_jcon, *xj_jcon;
00079 
00081 xj_jcon xj_jcon_init(char*, int);
00082 int xj_jcon_free(xj_jcon);
00083 
00084 int xj_jcon_connect(xj_jcon);
00085 int xj_jcon_disconnect(xj_jcon);
00086 
00087 void xj_jcon_set_juid(xj_jcon, int);
00088 int  xj_jcon_get_juid(xj_jcon);
00089 
00090 int xj_jcon_get_roster(xj_jcon);
00091 int xj_jcon_set_roster(xj_jcon, char*, char*);
00092 
00093 int xj_jcon_user_auth(xj_jcon, char*, char*, char*);
00094 int xj_jcon_send_presence(xj_jcon, char*, char*, char*, char*);
00095 int xj_jcon_send_subscribe(xj_jcon, char*, char*, char*);
00096 
00097 int xj_jcon_send_msg(xj_jcon, char*, int, char*, int, int);
00098 int xj_jcon_send_sig_msg(xj_jcon, char*, int, char*, int, char*, int);
00099 
00100 int xj_jcon_is_ready(xj_jcon, char *, int, char);
00101 
00102 xj_jconf xj_jcon_get_jconf(xj_jcon, str*, char);
00103 xj_jconf xj_jcon_check_jconf(xj_jcon, char*);
00104 int xj_jcon_del_jconf(xj_jcon, str*, char, int);
00105 int xj_jcon_jconf_presence(xj_jcon, xj_jconf, char*, char*);
00106 
00107 /**********             ***/
00108 
00109 int xj_jcon_set_attrs(xj_jcon, xj_jkey, int, int);
00110 int xj_jcon_update(xj_jcon, int);
00111 
00112 /**********             ***/
00113 
00114 #endif
00115