usr_avp.h
717bc5da
 /*
  * $Id$
  *
53c7e0f1
  * Copyright (C) 2001-2003 FhG Fokus
717bc5da
  *
  * This file is part of ser, a free SIP server.
  *
  * ser is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
  * For a license to use the ser software under conditions
  * other than those described here, or to purchase support for this
  * software, please contact iptel.org by e-mail at the following addresses:
  *    info@iptel.org
  *
  * ser is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * History:
  * ---------
2be21e31
  *  2004-07-21  created (bogdan)
7dfb54d7
  *  2004-11-14  global aliases support added
d0fdbd45
  *  2005-02-14  list with FLAGS USAGE added (bogdan)
717bc5da
  */
 
 #ifndef _SER_URS_AVP_H_
 #define _SER_URS_AVP_H_
 
d0fdbd45
 /*
  *   LIST with the allocated flags, their meaning and owner
  *   flag no.    owner            description
  *   -------------------------------------------------------
  *     0        avp_core          avp has a string name
  *     1        avp_core          avp has a string value
  *     3        avpops module     avp was loaded from DB
75a0b581
  *     4        lcr module        contact avp qvalue change
d0fdbd45
  *
  */
717bc5da
 
2be21e31
 #include "str.h"
 
 typedef union {
 	int  n;
 	str *s;
 } int_str;
 
717bc5da
 
 struct usr_avp {
2be21e31
 	unsigned short id;
 	unsigned short flags;
717bc5da
 	struct usr_avp *next;
2be21e31
 	void *data;
717bc5da
 };
 
7dfb54d7
 
2be21e31
 #define AVP_NAME_STR     (1<<0)
 #define AVP_VAL_STR      (1<<1)
717bc5da
 
d34839a3
 #define GALIAS_CHAR_MARKER  '$'
 
2be21e31
 /* add functions */
 int add_avp( unsigned short flags, int_str name, int_str val);
717bc5da
 
53c7e0f1
 /* search functions */
2be21e31
 struct usr_avp *search_first_avp( unsigned short name_type, int_str name,
 															int_str *val );
 struct usr_avp *search_next_avp( struct usr_avp *avp, int_str *val  );
590612d3
 
2be21e31
 /* free functions */
 void reset_avps( );
 void destroy_avp( struct usr_avp *avp);
 void destroy_avp_list( struct usr_avp **list );
 void destroy_avp_list_unsafe( struct usr_avp **list );
717bc5da
 
a564ae7a
 /* get func */
2be21e31
 void get_avp_val(struct usr_avp *avp, int_str *val );
a564ae7a
 str* get_avp_name(struct usr_avp *avp);
2be21e31
 struct usr_avp** set_avp_list( struct usr_avp **list );
a564ae7a
 struct usr_avp** get_avp_list( );
717bc5da
 
7dfb54d7
 /* global alias functions (manipulation and parsing)*/
 int add_avp_galias_str(char *alias_definition);
d34839a3
 int lookup_avp_galias(str *alias, int *type, int_str *avp_name);
7dfb54d7
 int add_avp_galias(str *alias, int type, int_str avp_name);
 int parse_avp_name( str *name, int *type, int_str *avp_name);
d34839a3
 int parse_avp_spec( str *name, int *type, int_str *avp_name);
717bc5da
 
 #endif