Example #1
0
static
bool valid_fix_message(fix_group* const group, const fix_message_data* const data)
{
	const char
		type = data->hdr.MsgType,
		real_type = get_fix_group_error_details(group)->msg_type.begin[0];

	ENSURE(real_type == type, "Message type mismatch: expected '%c', got '%c'", type, real_type);

	if(!valid_header(group, &data->hdr))
		return false;

	switch(type)
	{
		case 'D':
			return valid_new_order_single(group, &data->order);
		default:
			REPORT_FAILURE("Unexpected message type '%c'", type);
			return false;
	}
}
Example #2
0
static struct sector_header_s *
header_get(struct sbd_context *st)
{
	struct sector_header_s *s_header;
	s_header = sector_alloc();

	if (header_read(st, s_header) < 0) {
		cl_log(LOG_ERR, "Unable to read header from device %d", st->devfd);
		return NULL;
	}

	if (valid_header(s_header) < 0) {
		cl_log(LOG_ERR, "header on device %d is not valid.", st->devfd);
		return NULL;
	}

	/* cl_log(LOG_INFO, "Found version %d header with %d slots",
			s_header->version, s_header->slots); */

	return s_header;
}