jabber_s/xjab_jcon.h

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