00001 /* 00002 * $Id: db_id.h 4518 2008-07-28 15:39:28Z henningw $ 00003 * 00004 * Copyright (C) 2001-2005 iptel.org 00005 * Copyright (C) 2007-2008 1&1 Internet AG 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 00010 * it 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, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU 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 USA 00022 */ 00023 00024 /*! 00025 * \file db/db_id.h 00026 * \ingroup db 00027 * \brief Functions for parsing a database URL and works with db identifier. 00028 */ 00029 00030 #ifndef _DB_ID_H 00031 #define _DB_ID_H 00032 00033 #include "../str.h" 00034 00035 /** Structure representing a database ID */ 00036 struct db_id { 00037 char* scheme; /**< URL scheme */ 00038 char* username; /**< Username, case sensitive */ 00039 char* password; /**< Password, case sensitive */ 00040 char* host; /**< Host or IP, case insensitive */ 00041 unsigned short port; /**< Port number */ 00042 char* database; /**< Database, case sensitive */ 00043 }; 00044 00045 00046 /** 00047 * Create a new connection identifier 00048 * \param url database URL 00049 * \return new allocated db_id structure, NULL on failure 00050 */ 00051 struct db_id* new_db_id(const str* url); 00052 00053 00054 /** 00055 * Compare two connection identifiers 00056 * \param id1 first identifier 00057 * \param id2 second identifier 00058 * \return 1 if both identifier are equal, 0 if there not equal 00059 */ 00060 unsigned char cmp_db_id(const struct db_id* id1, const struct db_id* id2); 00061 00062 00063 /** 00064 * Free a connection identifier 00065 * \param id the identifier that should released 00066 */ 00067 void free_db_id(struct db_id* id); 00068 00069 00070 #endif /* _DB_ID_H */
1.5.6