qos_ctx_helpers.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2007 SOMA Networks, INC.
00005  * Written By Ovidiu Sas
00006  *
00007  * This file is part of Kamailio, a free SIP server.
00008  *
00009  * Kamailio is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * Kamailio is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022  * USA
00023  *
00024  * History:
00025  * --------
00026  * 2007-07-16 initial version (osas)
00027  */
00028 
00029 #ifndef _QOS_CTX_HELPERS_H_
00030 #define _QOS_CTX_HELPERS_H_
00031 
00032 #include "qos_cb.h"
00033 
00034 #define QOS_CALLER  0
00035 #define QOS_CALLEE  1
00036 
00037 typedef struct qos_sdp_st {
00038    struct qos_sdp_st *prev;
00039    struct qos_sdp_st *next;
00040    unsigned int method_dir;     /* the transaction initiator: CALLER/CALLEE */
00041    int          method_id;      /* the method id that is carrying the sdp */
00042    str          method;         /* the method that is carrying the sdp */
00043    str          cseq;           /* the cseq of the method */
00044    unsigned int negotiation;    /* the negotiation type */
00045    sdp_session_cell_t *sdp_session[2]; /* CALLER's and CALLEE's sdp */
00046 } qos_sdp_t;
00047 
00048 /**
00049  * The QoS context.
00050  */
00051 typedef struct qos_ctx_st {
00052    qos_sdp_t           *negotiated_sdp;
00053    qos_sdp_t           *pending_sdp;
00054    gen_lock_t lock;
00055    struct qos_head_cbl  cbs;
00056 } qos_ctx_t;
00057 
00058 /*
00059  
00060 ** AFTER INVITE/183 **
00061 
00062 qos_ctx:
00063  +----------------+
00064  | *negotiated_sdp|
00065  +----------------+    qos_sdp (pending)
00066  | *pending_sdp------->+----------------+
00067  +----------------+    | *prev          |
00068                        +----------------+
00069                        | *next          |
00070                        +----------------+  
00071              | method_dir     |      sdp_session (caller)
00072              | method_id      |  +-->+----------+
00073              | method         |  |   |          |
00074              | cseq           |  |   |          |
00075              | negotiation    |  |   +----------+
00076              +----------------+  |
00077              | sdp_session[0]----+
00078              +----------------+      sdp_session (callee)
00079              | sdp_session[1]------->+----------+
00080              +----------------+      |          |
00081                                      |          |
00082                       +----------+
00083 
00084 ** AFTER INVITE/200ok **
00085 
00086 qos_ctx:
00087  +----------------+    qos_sdp (negotiated)
00088  | *negotiated_sdp---->+----------------+
00089  +----------------+    | *prev          |
00090  | *pending_sdp   |    +----------------+
00091  +----------------+    | *next          |
00092                        +----------------+  
00093              | method_dir     |      sdp_session (caller)
00094              | method_id      |  +-->+----------+
00095              | method         |  |   |          |
00096              | cseq           |  |   |          |
00097              | negotiation    |  |   +----------+
00098              +----------------+  |
00099              | sdp_session[0]----+
00100              +----------------+      sdp_session (callee)
00101              | sdp_session[1]------->+----------+
00102              +----------------+      |          |
00103                                      |          |
00104                       +----------+
00105 
00106 
00107  */
00108 
00109 qos_ctx_t* build_new_qos_ctx();
00110 void destroy_qos_ctx(qos_ctx_t *ctx);
00111 
00112 void add_sdp(qos_ctx_t *qos_ctx, unsigned int dir, struct sip_msg *_m, unsigned int role, unsigned int other_role);
00113 void remove_sdp(qos_ctx_t *qos_ctx, unsigned int dir, struct sip_msg *_m, unsigned int role, unsigned int other_role);
00114 
00115 #endif /* _QOS_CTX_HELPERS_H_ */

Generated on Thu May 24 08:00:53 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6