#include <assert.h>
#include <errno.h>
-#include <limits.h>
#include <netinet/in.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <algorithm>
#include <string>
#include <vector>
#include "log.h"
-#include "metacube.h"
+#include "metacube2.h"
#include "state.pb.h"
#include "stream.h"
#include "util.h"
if (encoding == Stream::STREAM_ENCODING_METACUBE) {
// Add a Metacube block header before the data.
- metacube_block_header hdr;
- memcpy(hdr.sync, METACUBE_SYNC, sizeof(hdr.sync));
+ metacube2_block_header hdr;
+ memcpy(hdr.sync, METACUBE2_SYNC, sizeof(hdr.sync));
hdr.size = htonl(bytes);
- hdr.flags = htonl(0);
+ hdr.flags = htons(0);
if (suitable_for_stream_start == NOT_SUITABLE_FOR_STREAM_START) {
- hdr.flags |= htonl(METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START);
+ hdr.flags |= htons(METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START);
}
+ hdr.csum = htons(metacube2_compute_crc(&hdr));
iovec iov;
iov.iov_base = new char[bytes + sizeof(hdr)];