sipops.c

Go to the documentation of this file.
00001 /*
00002  * $Id: utils.h 5318 2008-12-08 16:38:47Z henningw $
00003  *
00004  * SIPUTILS mangler 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 #include "../../mod_fix.h"
00027 #include "../../cmpapi.h"
00028 
00029 #include "sipops.h"
00030 
00031 int w_cmp_uri(struct sip_msg *msg, char *uri1, char *uri2)
00032 {
00033    str s1;
00034    str s2;
00035    int ret;
00036 
00037    if(fixup_get_svalue(msg, (gparam_p)uri1, &s1)!=0)
00038    {
00039       LM_ERR("cannot get first parameter\n");
00040       return -8;
00041    }
00042    if(fixup_get_svalue(msg, (gparam_p)uri2, &s2)!=0)
00043    {
00044       LM_ERR("cannot get second parameter\n");
00045       return -8;
00046    }
00047    ret = cmp_uri_str(&s1, &s2);
00048    if(ret==0)
00049       return 1;
00050    if(ret>0)
00051       return -1;
00052    return -2;
00053 }
00054 
00055 int w_cmp_aor(struct sip_msg *msg, char *uri1, char *uri2)
00056 {
00057    str s1;
00058    str s2;
00059    int ret;
00060 
00061    if(fixup_get_svalue(msg, (gparam_p)uri1, &s1)!=0)
00062    {
00063       LM_ERR("cannot get first parameter\n");
00064       return -8;
00065    }
00066    if(fixup_get_svalue(msg, (gparam_p)uri2, &s2)!=0)
00067    {
00068       LM_ERR("cannot get second parameter\n");
00069       return -8;
00070    }
00071    ret = cmp_aor_str(&s1, &s2);
00072    if(ret==0)
00073       return 1;
00074    if(ret>0)
00075       return -1;
00076    return -2;
00077 }
00078 

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