jabber_s/xjab_util.h

00001 /*
00002  * $Id$
00003  *
00004  * eXtended JABber module
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_UTIL_H_
00033 #define _XJAB_UTIL_H_
00034 
00035 #include "xjab_base.h"
00036 #include "xjab_jcon.h"
00037 #include "../../str.h"
00038 
00039 /**********             ***/
00040 
00041 typedef struct _xj_jmsg_queue
00042 {
00043         int len;                // maximum size of the queue
00044         int size;               // number of elements in the queue
00045         int cache;              // cache time (seconds)
00046         int *expire;    // expire time of the queued message
00047         xj_sipmsg *jsm; // pointer to the message
00048         xj_jcon *ojc;   // pointer to the connection which will be used on sending
00049 } t_xj_jmsg_queue, *xj_jmsg_queue;
00050 
00051 /**********             ***/
00052 
00053 typedef struct _xj_jcon_pool
00054 {
00055         int len;                                        // maximum len of the pool
00056         xj_jcon *ojc;                           // the connections to the Jabber
00057         t_xj_jmsg_queue jmqueue;        // messages queue
00058 } t_xj_jcon_pool, *xj_jcon_pool;
00059 
00060 /**********   LOOK AT IMPLEMENTATION OF FUNCTIONS FOR DESCRIPTION    ***/
00061 
00062 xj_jcon_pool xj_jcon_pool_init(int, int, int);
00063 int xj_jcon_pool_add(xj_jcon_pool, xj_jcon);
00064 xj_jcon xj_jcon_pool_get(xj_jcon_pool, xj_jkey);
00065 int xj_jcon_pool_del(xj_jcon_pool, xj_jkey);
00066 void xj_jccon_pool_free(xj_jcon_pool);
00067 void xj_jcon_pool_print(xj_jcon_pool);
00068 int xj_jcon_pool_add_jmsg(xj_jcon_pool, xj_sipmsg, xj_jcon);
00069 int xj_jcon_pool_del_jmsg(xj_jcon_pool, int);
00070 
00071 /**********             ***/
00072 
00073 #endif
00074