/*
    Copyright (C) 2008-2024, Millistream Market Data <support@millistream.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef MDF_ENCODE_H
# define MDF_ENCODE_H 1

/* grow the data buffer in chunks of this size */
# define BUFFER_CHUNK_SIZE 65536
# define FIELDS_CHUNK_SIZE 1024
# define MESSAGES_CHUNK_SIZE 128

struct message {
	uint64_t insref;
	uint16_t mref;
	int fields;
	uint8_t delay;
};

struct field {
	size_t offset;
	uint32_t tag;
	int len;
};

struct mdf_message_s {
	int current_message;
	int messages_max;
	int fields_num;
	int fields_max;
	size_t data_used;
	size_t data_size;
	struct message *messages;
	struct field *fields;
	uint8_t * restrict data;
	size_t sendbuf_size;
	uint8_t * restrict sendbuf;
	struct field ** restrict sendfields;
	struct field ** restrict sendtags;
	int sendfields_num;
	int sendtags_num;
	uint8_t compression_level;
	uint8_t utf8_validate;
	uint8_t delay;
};

#endif

