Annotation of embedaddon/strongswan/src/libstrongswan/database/database_factory.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2008 Martin Willi
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: /**
! 17: * @defgroup database_factory database_factory
! 18: * @{ @ingroup database
! 19: */
! 20:
! 21: #ifndef DATABASE_FACTORY_H_
! 22: #define DATABASE_FACTORY_H_
! 23:
! 24: typedef struct database_factory_t database_factory_t;
! 25:
! 26: #include <database/database.h>
! 27:
! 28: /**
! 29: * Generic database construction function.
! 30: *
! 31: * @param uri implementation specific connection URI
! 32: */
! 33: typedef database_t*(*database_constructor_t)(char *uri);
! 34:
! 35: /**
! 36: * Create instances of database connections using registered constructors.
! 37: */
! 38: struct database_factory_t {
! 39:
! 40: /**
! 41: * Create a database connection instance.
! 42: *
! 43: * @param uri implementation specific connection URI
! 44: * @return database_t instance, NULL if not supported/failed
! 45: */
! 46: database_t* (*create)(database_factory_t *this, char *uri);
! 47:
! 48: /**
! 49: * Register a database constructor.
! 50: *
! 51: * @param create database constructor to register
! 52: */
! 53: void (*add_database)(database_factory_t *this, database_constructor_t create);
! 54:
! 55: /**
! 56: * Unregister a previously registered database constructor.
! 57: *
! 58: * @param create database constructor to unregister
! 59: */
! 60: void (*remove_database)(database_factory_t *this, database_constructor_t create);
! 61:
! 62: /**
! 63: * Destroy a database_factory instance.
! 64: */
! 65: void (*destroy)(database_factory_t *this);
! 66: };
! 67:
! 68: /**
! 69: * Create a database_factory instance.
! 70: */
! 71: database_factory_t *database_factory_create();
! 72:
! 73: #endif /** DATABASE_FACTORY_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>