00001 /* 00002 * DB-ALLe - Archive for punctual meteorological data 00003 * 00004 * Copyright (C) 2005,2006 ARPA-SIM <urpsim@smr.arpa.emr.it> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License. 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * Author: Enrico Zini <enrico@enricozini.com> 00020 */ 00021 00022 #ifndef DBALLE_RAWMSG_H 00023 #define DBALLE_RAWMSG_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00034 #include <dballe/core/error.h> 00035 00039 typedef enum { 00040 BUFR = 0, 00041 CREX = 1, 00042 AOF = 2 00043 } dba_encoding; 00044 00054 const char* dba_encoding_name(dba_encoding enc); 00055 00056 struct _dba_file; 00057 00061 struct _dba_rawmsg { 00067 struct _dba_file* file; 00069 int offset; 00071 int index; 00072 00074 unsigned char* buf; 00076 int len; 00078 int alloclen; 00079 00081 dba_encoding encoding; 00082 }; 00084 typedef struct _dba_rawmsg* dba_rawmsg; 00085 00095 dba_err dba_rawmsg_create(dba_rawmsg* msg); 00096 00105 void dba_rawmsg_delete(dba_rawmsg msg); 00106 00113 void dba_rawmsg_reset(dba_rawmsg msg); 00114 00118 dba_err dba_rawmsg_acquire_buf(dba_rawmsg msg, unsigned char* buf, int size); 00119 00133 dba_err dba_rawmsg_get_raw(dba_rawmsg msg, const unsigned char** buf, int* size); 00134 00147 dba_err dba_rawmsg_expand_buffer(dba_rawmsg msg); 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif 00152 00153 /* vim:set ts=4 sw=4: */ 00154 #endif