00001 00002 /* 00003 ** Copyright (C) 2004 Russell Leighton 00004 ** 00005 ** This program is free software; you can redistribute it and/or modify 00006 ** it under the terms of the GNU General Public License as published by 00007 ** the Free Software Foundation; either version 2 of the License, or 00008 ** (at your option) any later version. 00009 ** 00010 ** This program is distributed in the hope that it will be useful, 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 ** GNU General Public License for more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program; if not, write to the Free Software 00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 00021 00022 00023 #ifndef __AW_SQLITE__ 00024 #define __AW_SQLITE__ 00025 00026 #include "awdb.h" 00027 00028 #include "sqlite3.h" 00029 00030 #include "monitor.h" 00031 00032 #include "wire.h" 00033 00034 #include "regexmatch.h" 00035 00036 00045 typedef struct { 00046 00047 const byte_t 00048 *db; 00049 00050 } aw_sqlite_cinfo_t ; 00051 00052 00056 typedef struct { 00057 00058 int32_t 00059 prev_connected, /* value for previous attempt */ 00060 connected; /* 1 for connected, -1 for not connected */ 00061 00062 u_int32_t 00063 connection_attempts; 00064 00065 sqlite3 00066 *conn; 00067 00068 /* array 1-1 with the watchers, each val marks 00069 if a match occured during the probe, could be a bitmap, but I am being lazy */ 00070 u_int32_t 00071 *match_markers; 00072 00073 } aw_sqlite_state_t ; 00074 00075 00079 void aw_sqlite_init(void); 00080 00084 int32_t aw_sqlite_initialized(void); 00085 00093 void aw_sqlite_disconnect(aw_sqlite_cinfo_t *cinfo, aw_sqlite_state_t *state, aw_logger_t *logger, int32_t close); 00094 00101 void aw_sqlite_disconnect_all(aw_sqlite_cinfo_t *cinfo, aw_sqlite_state_t *state, aw_logger_t *logger); 00102 00109 void aw_sqlite_connect(aw_sqlite_cinfo_t *cinfo, aw_sqlite_state_t *state, aw_logger_t *logger); 00110 00118 int32_t aw_sqlite_execute_stmt(sqlite3_stmt *stmt, aw_logger_t *logger); 00119 00120 #endif 00121