jabber_k/xjab_util.h

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