1 #ifndef _MADARA_FRAGMENTATION_HEADER_H_ 2 #define _MADARA_FRAGMENTATION_HEADER_H_ 16 #include "madara/MADARA_export.h" 23 #define FRAGMENTATION_MADARA_ID "KFRG1.3" 66 virtual uint32_t encoded_size (
void)
const;
73 static uint32_t static_encoded_size (
void);
79 static uint32_t get_updates (
const char * buffer);
89 virtual const char * read (
const char * buffer,
90 int64_t & buffer_remaining);
105 virtual char * write (
char * buffer, int64_t & buffer_remaining);
156 MADARA_Export
char *
add_fragment (
const char * originator, uint64_t clock,
157 uint32_t update_number,
const char * fragment,
158 uint32_t queue_length,
159 OriginatorFragmentMap & map,
bool clear =
true);
167 MADARA_Export
char *
defrag (FragmentMap & map);
181 MADARA_Export
void frag (
182 char * source, uint32_t fragment_size, FragmentMap & map);
191 MADARA_Export
bool is_complete (
const char * originator, uint64_t clock,
192 OriginatorFragmentMap & map);
202 MADARA_Export
bool exists (
const char * originator, uint64_t clock,
203 uint32_t update_number, OriginatorFragmentMap & map);
207 #endif // _MADARA_FRAGMENTATION_HEADER_H_ MADARA_Export char * add_fragment(const char *originator, uint64_t clock, uint32_t update_number, const char *fragment, uint32_t queue_length, OriginatorFragmentMap &map, bool clear=true)
Adds a fragment to an originator fragment map and returns the aggregate message if the message is com...
MADARA_Export char * defrag(FragmentMap &map)
Pieces together a fragment map into a single buffer.
MADARA_Export bool is_complete(const char *originator, uint64_t clock, OriginatorFragmentMap &map)
Breaks a large packet into smaller packets.
MADARA_Export void frag(char *source, uint32_t fragment_size, FragmentMap &map)
Breaks a large packet into smaller packets.
#define FRAGMENTATION_MADARA_ID
std::map< std::string, ClockFragmentMap > OriginatorFragmentMap
Map of originator to a map of clocks to fragments.
std::map< uint64_t, FragmentMap > ClockFragmentMap
Map of clocks to fragments.
MADARA_Export void delete_fragments(FragmentMap &map)
Deletes fragments within a fragment map and clears the map.
MADARA_Export bool exists(const char *originator, uint64_t clock, uint32_t update_number, OriginatorFragmentMap &map)
Checks if a fragment already exists within a fragment map.
std::map< uint32_t, const char * > FragmentMap
Map of fragment identifiers to fragments.
Copyright (c) 2015 Carnegie Mellon University.