- case C_SESSION: add_type(p, C_SESSION, id,
- (char *) &session[id], sizeof(sessiont));
+ case C_SESSION:
+ add_type(p, C_SESSION, id, (uint8_t *) &session[id], sizeof(sessiont));
+ break;
+
+ case C_CBUNDLE: { // Compressed C_BUNDLE
+ uint8_t c[sizeof(bundlet) * 2]; // Bigger than worst case.
+ uint8_t *d = (uint8_t *) &bundle[id];
+ uint8_t *orig = d;
+ int size;
+
+ size = rle_compress( &d, sizeof(bundlet), c, sizeof(c) );
+
+ // Did we compress the full structure, and is the size actually
+ // reduced??
+ if ( (d - orig) == sizeof(bundlet) && size < sizeof(bundlet) ) {
+ add_type(p, C_CBUNDLE, id, c, size);
+ break;
+ }
+ // Failed to compress : Fall through.
+ }
+
+ case C_BUNDLE:
+ add_type(p, C_BUNDLE, id, (uint8_t *) &bundle[id], sizeof(bundlet));