00001 /* 00002 * Copyright (c) 2006 00003 * Telecooperation Office (TecO), Universitaet Karlsruhe (TH), Germany. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above 00012 * copyright notice, this list of conditions and the following 00013 * disclaimer in the documentation and/or other materials provided 00014 * with the distribution. 00015 * 3. Neither the name of the Universitaet Karlsruhe (TH) nor the names 00016 * of its contributors may be used to endorse or promote products 00017 * derived from this software without specific prior written 00018 * permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00023 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 * 00032 * Author(s): Daniel Wildschut <wildschu@teco.edu> 00033 */ 00034 #ifndef _LIBPARTICLE_DB_ 00035 #define _LIBPARTICLE_DB_ 00036 00037 #include <libparticle/packet.h> 00038 #include <time.h> 00039 00040 00041 typedef struct _p_db p_db; 00042 typedef struct _p_query p_query; 00043 00066 LIBPARTICLE_API p_db *p_db_open(char *db_id); 00067 00088 LIBPARTICLE_API p_db *p_db_open_paths(char *db_id, char *searchpaths); 00089 00097 LIBPARTICLE_API void p_db_close(p_db *db); 00098 00114 LIBPARTICLE_API p_query *p_db_query(p_db *db,time_t start,time_t stop); 00115 00128 LIBPARTICLE_API p_query *p_db_query_filtered(p_db *db,int filter, time_t start, time_t stop); 00129 00139 LIBPARTICLE_API struct p_packet *p_db_fetch(p_query *q , time_t *time); 00140 00151 LIBPARTICLE_API int p_db_add(p_db *db, struct p_packet *p, time_t timestamp); 00152 00160 LIBPARTICLE_API void p_db_finalize(p_query *q); 00161 00164 #endif