36 lines
1.0 KiB
C
36 lines
1.0 KiB
C
/*
|
|
Copyright (c) 2010-2014 Roger Light <roger@atchoo.org>
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
are made available under the terms of the Eclipse Public License v1.0
|
|
and Eclipse Distribution License v1.0 which accompany this distribution.
|
|
|
|
The Eclipse Public License is available at
|
|
http://www.eclipse.org/legal/epl-v10.html
|
|
and the Eclipse Distribution License is available at
|
|
http://www.eclipse.org/org/documents/edl-v10.php.
|
|
|
|
Contributors:
|
|
Roger Light - initial implementation and documentation.
|
|
*/
|
|
|
|
#ifndef PERSIST_H
|
|
#define PERSIST_H
|
|
|
|
#define MOSQ_DB_VERSION 3
|
|
|
|
/* DB read/write */
|
|
const unsigned char magic[15] = {0x00, 0xB5, 0x00, 'm','o','s','q','u','i','t','t','o',' ','d','b'};
|
|
#define DB_CHUNK_CFG 1
|
|
#define DB_CHUNK_MSG_STORE 2
|
|
#define DB_CHUNK_CLIENT_MSG 3
|
|
#define DB_CHUNK_RETAIN 4
|
|
#define DB_CHUNK_SUB 5
|
|
#define DB_CHUNK_CLIENT 6
|
|
/* End DB read/write */
|
|
|
|
#define read_e(f, b, c) if(fread(b, 1, c, f) != c){ goto error; }
|
|
#define write_e(f, b, c) if(fwrite(b, 1, c, f) != c){ goto error; }
|
|
|
|
#endif
|