#endif
/**
- * Flags used by the FSS-000E (Simple Packet) write functions.
+ * Flags used by the FSS-000E (Payload) header map functions.
*
- * Values of f_fss_payload_write_*_e:
- * - none: No write flag set.
+ * Values of f_fss_payload_header_map_*_e:
+ * - none: No map flag set.
* - base_2: Convert number to string using base 2.
* - base_8: Convert number to string using base 8.
* - base_10: Convert number to string using base 10.
* - base_12: Convert number to string using base 12.
* - base_16: Convert number to string using base 16.
*/
-#ifndef _di_f_fss_payload_write_e_
+#ifndef _di_f_fss_payload_header_map_e_
enum {
- f_fss_payload_write_none_e = 0x0,
- f_fss_payload_write_base_2_e = 0x1,
- f_fss_payload_write_base_8_e = 0x2,
- f_fss_payload_write_base_10_e = 0x4,
- f_fss_payload_write_base_12_e = 0x8,
- f_fss_payload_write_base_16_e = 0x10,
+ f_fss_payload_header_map_none_e = 0x0,
+ f_fss_payload_header_map_base_2_e = 0x1,
+ f_fss_payload_header_map_base_8_e = 0x2,
+ f_fss_payload_header_map_base_10_e = 0x4,
+ f_fss_payload_header_map_base_12_e = 0x8,
+ f_fss_payload_header_map_base_16_e = 0x10,
}; // enum
-#endif // _di_f_fss_payload_write_e_
+#endif // _di_f_fss_payload_header_map_e_
/**
- * FSS Payload strings.
+ * FSS-000E (Payload) strings.
*
- * f_fss_payload_*_s:
- * - header_comment: The header comment string for Payload (FSS-000E).
- * - header_object: The header object.
- * - payload_object: The payload object.
- * - signature_object: The signature object.
+ * f_fss_payload_comment_*_s:
+ * - header: The complete header comment line for Payload (FSS-000E).
+ * - header_end: The complete header comment line for Payload (FSS-000E).
+ * - header_begin: The complete header comment line for Payload (FSS-000E).
+ *
+ * f_fss_payload_object_*_s:
+ * - end: The Object end characters.
+ * - header: The header Object or signature Content header Object.
+ * - length: The header Content length Object.
+ * - part: The header Content part Object.
+ * - payload: The payload Object or signature Content payload Object.
+ * - signature: The signature Object.
+ * - status: The header Content status Object.
+ * - total: The header Content total Object.
*/
#ifndef _di_f_fss_payload_s_
- #define F_fss_payload_comment_header_s "# fss-000e\n"
- #define F_fss_payload_object_header_s "header:\n"
- #define F_fss_payload_object_payload_s "payload:\n"
- #define F_fss_payload_object_signature_s "signature:\n"
+ #define F_fss_payload_comment_header_s "fss-000e"
+ #define F_fss_payload_comment_header_end_s "\n"
+ #define F_fss_payload_comment_header_begin_s "# "
+
+ #define F_fss_payload_object_end_s ":\n"
+ #define F_fss_payload_object_header_s "header"
+ #define F_fss_payload_object_length_s "length"
+ #define F_fss_payload_object_part_s "part"
+ #define F_fss_payload_object_payload_s "payload"
+ #define F_fss_payload_object_signature_s "signature"
+ #define F_fss_payload_object_status_s "status"
+ #define F_fss_payload_object_total_s "total"
- #define F_fss_payload_comment_header_s_length 10
- #define F_fss_payload_object_header_s_length 8
- #define F_fss_payload_object_payload_s_length 9
- #define F_fss_payload_object_signature_s_length 11
+ #define F_fss_payload_comment_header_s_length 8
+ #define F_fss_payload_comment_header_end_s_length 1
+ #define F_fss_payload_comment_header_begin_s_length 2
+
+ #define F_fss_payload_object_end_s_length 2
+ #define F_fss_payload_object_length_s_length 6
+ #define F_fss_payload_object_header_s_length 6
+ #define F_fss_payload_object_part_s_length 4
+ #define F_fss_payload_object_payload_s_length 7
+ #define F_fss_payload_object_signature_s_length 9
+ #define F_fss_payload_object_status_s_length 6
+ #define F_fss_payload_object_total_s_length 5
#ifndef _di_f_fss_payload_comment_header_s_
extern const f_string_static_t f_fss_payload_comment_header_s;
#endif // _di_f_fss_payload_comment_header_s_
+ #ifndef _di_f_fss_payload_comment_header_end_s_
+ extern const f_string_static_t f_fss_payload_comment_header_end_s;
+ #endif // _di_f_fss_payload_comment_header_end_s_
+
+ #ifndef _di_f_fss_payload_comment_header_begin_s_
+ extern const f_string_static_t f_fss_payload_comment_header_begin_s;
+ #endif // _di_f_fss_payload_comment_header_begin_s_
+
+ #ifndef _di_f_fss_payload_object_end_s_
+ extern const f_string_static_t f_fss_payload_object_end_s;
+ #endif // _di_f_fss_payload_object_end_s_
+
#ifndef _di_f_fss_payload_object_header_s_
extern const f_string_static_t f_fss_payload_object_header_s;
#endif // _di_f_fss_payload_object_header_s_
+ #ifndef _di_f_fss_payload_object_length_s_
+ extern const f_string_static_t f_fss_payload_object_length_s;
+ #endif // _di_f_fss_payload_object_length_s_
+
#ifndef _di_f_fss_payload_object_payload_s_
extern const f_string_static_t f_fss_payload_object_payload_s;
#endif // _di_f_fss_payload_object_payload_s_
#ifndef _di_f_fss_payload_object_signature_s_
extern const f_string_static_t f_fss_payload_object_signature_s;
#endif // _di_f_fss_payload_object_signature_s_
+
+ #ifndef _di_f_fss_payload_object_status_s_
+ extern const f_string_static_t f_fss_payload_object_status_s;
+ #endif // _di_f_fss_payload_object_status_s_
#endif // _di_f_fss_payload_s_
#ifdef __cplusplus
/**
* Inline helper function to reduce amount of code typed.
*
- * Process the signed number, converting it to a string and appending that string onto data->cache_1.
- * The resulting data->cache_1 is then appended onto the destination value on success.
- * If the number is not appended to data->cache_1, then nothing is appended to the destination value.
+ * Process the signed number, converting it to a string and appending that string onto data->cache.
+ * The resulting data->cache is then appended onto the destination value on success.
+ * If the number is not appended to data->cache, then nothing is appended to the destination value.
*
* @param data
* The f_fss_payload_header_write_state_t pointer.
- * This resets data->cache_1.used as needed.
+ * This resets data->cache.used as needed.
* @param state
* The state passed directly from the f_fss_payload_header_write() parameters.
* @param internal
*/
static inline uint8_t private_inline_f_payload_header_write_number_signed(f_fss_payload_header_write_state_t * const data, f_state_t * const state, f_fss_payload_header_write_internal_t * const internal, const f_number_signed_t number) {
- data->cache_1->used = 0;
+ data->cache->used = 0;
- state->status = f_conversion_number_signed_to_string(number, data->conversion, data->cache_1);
+ state->status = f_conversion_number_signed_to_string(number, data->conversion, data->cache);
if (F_status_is_error(state->status)) return F_true;
- if (data->cache_1->used) {
+ if (data->cache->used) {
internal->range.start = 0;
- internal->range.stop = data->cache_1->used - 1;
+ internal->range.stop = data->cache->used - 1;
- private_fl_fss_basic_write(F_false, *data->cache_1, 0, &internal->range, &internal->destinations->array[internal->destinations->used].value, state, (void * const) internal);
+ private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &internal->destinations->array[internal->destinations->used].value, state, (void * const) internal);
if (F_status_is_error(state->status)) return F_true;
}
/**
* Inline helper function to reduce amount of code typed.
*
- * Process the unsigned number, converting it to a string and appending that string onto data->cache_1.
- * The resulting data->cache_1 is then appended onto the destination value on success.
- * If the number is not appended to data->cache_1, then nothing is appended to the destination value.
+ * Process the unsigned number, converting it to a string and appending that string onto data->cache.
+ * The resulting data->cache is then appended onto the destination value on success.
+ * If the number is not appended to data->cache, then nothing is appended to the destination value.
*
* @param data
* The f_fss_payload_header_write_state_t pointer.
- * This resets data->cache_1.used as needed.
+ * This resets data->cache.used as needed.
* @param state
* The state passed directly from the f_fss_payload_header_write() parameters.
* @param internal
*/
static inline uint8_t private_inline_f_payload_header_write_number_unsigned(f_fss_payload_header_write_state_t * const data, f_state_t * const state, f_fss_payload_header_write_internal_t * const internal, const f_number_unsigned_t number) {
- data->cache_1->used = 0;
+ data->cache->used = 0;
- state->status = f_conversion_number_unsigned_to_string(number, data->conversion, data->cache_1);
+ state->status = f_conversion_number_unsigned_to_string(number, data->conversion, data->cache);
if (F_status_is_error(state->status)) return F_true;
- if (data->cache_1->used) {
+ if (data->cache->used) {
internal->range.start = 0;
- internal->range.stop = data->cache_1->used - 1;
+ internal->range.stop = data->cache->used - 1;
- private_fl_fss_basic_write(F_false, *data->cache_1, 0, &internal->range, &internal->destinations->array[internal->destinations->used].value, state, (void * const) internal);
+ private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &internal->destinations->array[internal->destinations->used].value, state, (void * const) internal);
if (F_status_is_error(state->status)) return F_true;
}
f_fss_payload_header_write_state_t * const data = (f_fss_payload_header_write_state_t *) state->data;
f_fss_payload_header_write_internal_t internal = macro_f_fss_payload_header_write_internal_t_initialize_2(destinations, destinations->used);
- if (!data->cache_1) {
+ if (!data->cache) {
state->status = F_status_set_error(F_parameter);
if (state->handle) {
case f_abstruse_strings_e:
// @todo flag to break strings into multiple rows.
- data->cache_1->used = 0;
+ data->cache->used = 0;
if (headers.array[internal.i].value.is.a_strings) {
internal.k = 0;
internal.k += f_fss_extended_next_s.used;
} // for
- state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
+ state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
if (F_status_is_error(state->status)) break;
for (internal.j = 0; headers.array[internal.i].value.is.a_strings[internal.j]; ++internal.j) {
internal.range.start = 0;
internal.range.stop = string_static.used - 1;
- private_fl_fss_basic_write(F_false, string_static, 0, &internal.range, data->cache_1, state, (void * const) &internal);
+ private_fl_fss_basic_write(F_false, string_static, 0, &internal.range, data->cache, state, (void * const) &internal);
if (F_status_is_error(state->status)) break;
- data->cache_1->string[data->cache_1->used++] = f_fss_extended_open_s.string[0];
+ data->cache->string[data->cache->used++] = f_fss_extended_open_s.string[0];
}
} // for
if (F_status_is_error_not(state->status)) {
// The f_fss_extended_next_s is always added at the end of the loop to avoid an additional condition check in the loop.
- data->cache_1->used -= f_fss_extended_next_s.used;
+ data->cache->used -= f_fss_extended_next_s.used;
- state->status = f_string_dynamic_append(*data->cache_1, &destinations->array[destinations->used].value);
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
}
}
break;
case f_abstruse_dynamic_e:
- data->cache_1->used = 0;
+ data->cache->used = 0;
if (headers.array[internal.i].value.is.a_dynamic.used) {
internal.j = headers.array[internal.i].value.is.a_dynamic.used;
internal.j = f_string_ascii_quote_double_s.used * 2;
}
- state->status = f_memory_array_increase_by(internal.j, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
+ state->status = f_memory_array_increase_by(internal.j, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_dynamic);
if (F_status_is_error_not(state->status)) {
// The f_fss_extended_next_s is always added at the end of the macro.
- data->cache_1->used -= f_fss_extended_next_s.used;
+ data->cache->used -= f_fss_extended_next_s.used;
- state->status = f_string_dynamic_append(*data->cache_1, &destinations->array[destinations->used].value);
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
}
if (F_status_is_error_not(state->status)) {
case f_abstruse_dynamics_e:
// @todo flag to break dynamics into multiple rows.
- data->cache_1->used = 0;
+ data->cache->used = 0;
if (headers.array[internal.i].value.is.a_dynamics.used) {
internal.k = 0;
internal.k += f_fss_extended_next_s.used;
} // for
- state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
+ state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
if (F_status_is_error(state->status)) break;
for (internal.j = 0; internal.j < headers.array[internal.i].value.is.a_dynamics.used; ++internal.j) {
if (F_status_is_error_not(state->status)) {
// The f_fss_extended_next_s is always added at the end of the loop to avoid an additional condition check in the loop.
- data->cache_1->used -= f_fss_extended_next_s.used;
+ data->cache->used -= f_fss_extended_next_s.used;
- state->status = f_string_dynamic_append(*data->cache_1, &destinations->array[destinations->used].value);
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
}
}
break;
case f_abstruse_map_e:
- data->cache_1->used = 0;
+ data->cache->used = 0;
internal.k = f_fss_extended_next_s.used;
if (headers.array[internal.i].value.is.a_map.name.used) {
internal.k += f_string_ascii_quote_double_s.used * 4;
}
- state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
+ state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_map.name);
if (F_status_is_error_not(state->status)) {
// The f_fss_extended_next_s is always added at the end of the macro.
- data->cache_1->used -= f_fss_extended_next_s.used;
+ data->cache->used -= f_fss_extended_next_s.used;
- state->status = f_string_dynamic_append(*data->cache_1, &destinations->array[destinations->used].value);
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
}
if (F_status_is_error_not(state->status)) {
break;
case f_abstruse_map_multi_e:
- data->cache_1->used = 0;
+ data->cache->used = 0;
internal.k = headers.array[internal.i].value.is.a_map_multi.name.used ? headers.array[internal.i].value.is.a_map_multi.name.used : f_string_ascii_quote_double_s.used * 2;
internal.k += f_fss_extended_next_s.used;
internal.k += f_fss_extended_next_s.used;
} // for
- state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
+ state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_map_multi.name);
- data->cache_1->string[data->cache_1->used++] = f_fss_extended_next_s.string[0];
+ data->cache->string[data->cache->used++] = f_fss_extended_next_s.string[0];
for (internal.l = 0; internal.l < headers.array[internal.i].value.is.a_map_multi.value.used; ++internal.l) {
}
if (headers.array[internal.i].value.is.a_map_multi.value.array[internal.l].used) {
- state->status = f_string_dynamic_append(headers.array[internal.i].value.is.a_map_multi.value.array[internal.l], data->cache_1);
+ state->status = f_string_dynamic_append(headers.array[internal.i].value.is.a_map_multi.value.array[internal.l], data->cache);
if (F_status_is_error(state->status)) break;
}
else {
- data->cache_1->string[data->cache_1->used++] = f_string_ascii_quote_double_s.string[0];
- data->cache_1->string[data->cache_1->used++] = f_string_ascii_quote_double_s.string[0];
+ data->cache->string[data->cache->used++] = f_string_ascii_quote_double_s.string[0];
+ data->cache->string[data->cache->used++] = f_string_ascii_quote_double_s.string[0];
}
- data->cache_1->string[data->cache_1->used++] = f_fss_extended_next_s.string[0];
+ data->cache->string[data->cache->used++] = f_fss_extended_next_s.string[0];
} // for
if (F_status_is_error_not(state->status)) {
// The f_fss_extended_next_s is always added at the end of the loop to avoid an additional condition check in the loop.
- data->cache_1->used -= f_fss_extended_next_s.used;
+ data->cache->used -= f_fss_extended_next_s.used;
- state->status = f_string_dynamic_append(*data->cache_1, &destinations->array[destinations->used].value);
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
}
}
else if (headers.array[internal.i].value.is.a_map_multi.name.used) {
case f_abstruse_ranges_e:
// @todo
break;
-/*
+
case f_abstruse_triple_e:
- data->cache_1->used = 0;
+ data->cache->used = 0;
if (headers.array[internal.i].value.is.a_triple.a.used) {
internal.k = headers.array[internal.i].value.is.a_triple.a.used;
internal.k = f_string_ascii_quote_double_s.used * 6;
}
- internal.k += f_fss_extended_open_s.used * 2;
+ internal.k += f_fss_extended_next_s.used * 2;
- if (data->cache_1->used + internal.k > data->cache_1->size) {
- state->status = f_memory_array_increase_by(state->step_small + internal.k, sizeof(f_char_t), (void **) &data->cache_1->string, &data->cache_1->used, &data->cache_1->size);
- if (F_status_is_error(state->status)) break;
- }
+ state->status = f_memory_array_increase_by(internal.k, sizeof(f_char_t), (void **) &data->cache->string, &data->cache->used, &data->cache->size);
+ if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_triple.a);
-
- data->cache_1->string[data->cache_1->used++] = f_fss_extended_open_s.string[0];
+ if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_triple.b);
-
- data->cache_1->string[data->cache_1->used++] = f_fss_extended_open_s.string[0];
+ if (F_status_is_error(state->status)) break;
macro_f_fss_payload_header_write_process_dynamic_d(data, state, internal, headers.array[internal.i].value.is.a_triple.c);
- if (F_status_is_error_not(state->status) && data->cache_1->used) {
- // @todo build signature, use a callback for this so that the caller can provide an appropriate algorithm.
+ if (F_status_is_error_not(state->status)) {
+
+ // The f_fss_extended_next_s is always added at the end of the macro.
+ data->cache->used -= f_fss_extended_next_s.used;
+
+ state->status = f_string_dynamic_append(*data->cache, &destinations->array[destinations->used].value);
+ }
- state->status = f_string_dynamic_append(*data->cache_1, data->cache_1);
+ if (F_status_is_error_not(state->status)) {
+ ++destinations->used;
}
break;
-*/
+
case f_abstruse_triples_e:
// @todo
break;