msgpack_unpacked *filter_receive_message(Filter * const filter) { msgpack_unpacker * const msgpack_unpacker = &filter->msgpack_unpacker; msgpack_unpacker_destroy(msgpack_unpacker); msgpack_unpacker_init(msgpack_unpacker, FILTER_UNPACK_BUFFER_SIZE); msgpack_unpacker_reserve_buffer(msgpack_unpacker, FILTER_READ_BUFFER_SIZE); msgpack_unpacked * const message = &filter->message; ssize_t readnb; while (msgpack_unpacker_next(msgpack_unpacker, message) == false) { assert(msgpack_unpacker_buffer_capacity(msgpack_unpacker) > 0U); readnb = safe_read_partial (filter->upipe_stdout.fd_read, msgpack_unpacker_buffer(msgpack_unpacker), msgpack_unpacker_buffer_capacity(msgpack_unpacker)); if (readnb <= (ssize_t) 0) { assert(0); return NULL; } msgpack_unpacker_buffer_consumed(msgpack_unpacker, readnb); } assert(message->data.type == MSGPACK_OBJECT_MAP); return message; }
void add_input_bytes(msgpack_unpacker *unpacker, char *buf, int sz) { msgpack_unpacked result; int got = 0; printf("reading %d bytes\n", sz); //getchar(); printf("ENT u(%u) f(%u) o(%u) p(%u)\n", (unsigned)unpacker->used, (unsigned)unpacker->free, (unsigned)unpacker->off, (unsigned)unpacker->parsed); msgpack_unpacker_reserve_buffer(unpacker, sz); printf("EXP u(%u) f(%u) o(%u) p(%u)\n", (unsigned)unpacker->used, (unsigned)unpacker->free, (unsigned)unpacker->off, (unsigned)unpacker->parsed); memcpy(msgpack_unpacker_buffer(unpacker), buf, sz); msgpack_unpacker_buffer_consumed(unpacker, sz); printf("CON u(%u) f(%u) o(%u) p(%u)\n", (unsigned)unpacker->used, (unsigned)unpacker->free, (unsigned)unpacker->off, (unsigned)unpacker->parsed); msgpack_unpacked_init(&result); while (msgpack_unpacker_next(unpacker, &result)) { got = 1; msgpack_object_print(stdout, result.data); printf("\n"); } if (got) { msgpack_unpacker_expand_buffer(unpacker, 0); printf("XXX u(%u) f(%u) o(%u) p(%u)\n", (unsigned)unpacker->used, (unsigned)unpacker->free, (unsigned)unpacker->off, (unsigned)unpacker->parsed); } msgpack_unpacked_destroy(&result); }
/** * msgpack_conn_read - Buffer data from a socket read and deserialize. */ int msgpack_conn_read(GIOChannel *channel, GIOCondition condition, void *data) { struct msgpack_conn *conn; msgpack_unpacked result; size_t bytes_read; int r = TRUE; GIOStatus status; GError *error = NULL; conn = (struct msgpack_conn *)data; msgpack_unpacked_init(&result); // Keep reading until we've flushed the channel's read buffer completely. do { // Reserve enough space in the msgpack_unpacker buffer for a read. msgpack_unpacker_reserve_buffer(&conn->mc_unpacker, BUFSIZE); // Read up to BUFSIZE bytes into the stream. status = g_io_channel_read_chars(channel, msgpack_unpacker_buffer(&conn->mc_unpacker), BUFSIZE, &bytes_read, &error); if (status == G_IO_STATUS_ERROR) { g_warning("msgpack_conn_read: Read from socket failed."); } // Inform the msgpack_unpacker how much of the buffer we actually consumed. msgpack_unpacker_buffer_consumed(&conn->mc_unpacker, bytes_read); // Pop as many msgpack objects as we can get our hands on. while (msgpack_unpacker_next(&conn->mc_unpacker, &result)) { if (conn->mc_recv(conn, &result.data)) { g_warning("paxos_read_conn: Dispatch failed."); r = FALSE; break; } } // Drop the connection if we're at the end. if (status == G_IO_STATUS_EOF) { conn->mc_drop(conn); r = FALSE; break; } } while (g_io_channel_get_buffer_condition(channel) & G_IO_IN); msgpack_unpacked_destroy(&result); return r; }
void tmate_decoder_commit(struct tmate_decoder *decoder, size_t len) { struct tmate_unpacker _uk, *uk = &_uk; msgpack_unpacked result; msgpack_unpacker_buffer_consumed(&decoder->unpacker, len); msgpack_unpacked_init(&result); while (msgpack_unpacker_next(&decoder->unpacker, &result)) { init_unpacker(uk, result.data); decoder->reader(decoder->userdata, uk); } msgpack_unpacked_destroy(&result); }
void unpack(receiver* r) { /* buf is allocated by unpacker. */ msgpack_unpacker* unp = msgpack_unpacker_new(100); msgpack_unpacked result; msgpack_unpack_return ret; size_t recv_len; int recv_count = 0; int i = 0; msgpack_unpacked_init(&result); while (true) { recv_len = receiver_to_unpacker(r, EACH_RECV_SIZE, unp); if (recv_len == 0) break; // (reached end of input) printf("receive count: %d %zd bytes received.\n", recv_count++, recv_len); ret = msgpack_unpacker_next(unp, &result); while (ret == MSGPACK_UNPACK_SUCCESS) { msgpack_object obj = result.data; /* Use obj. */ printf("Object no %d:\n", ++i); msgpack_object_print(stdout, obj); printf("\n"); /* If you want to allocate something on the zone, you can use zone. */ /* msgpack_zone* zone = result.zone; */ /* The lifetime of the obj and the zone, */ ret = msgpack_unpacker_next(unp, &result); } if (ret == MSGPACK_UNPACK_PARSE_ERROR) { printf("The data in the buf is invalid format.\n"); msgpack_unpacked_destroy(&result); return; } } msgpack_unpacked_destroy(&result); msgpack_unpacker_free(unp); }
/** * Process incoming data from the given fd. * * \see fromStdinOut() and QSocketNotifier() */ void MsgpackIODevice::dataAvailableFd(int fd) { qint64 bytes = read(fd, msgpack_unpacker_buffer(&m_uk), msgpack_unpacker_buffer_capacity(&m_uk)); if (bytes > 0) { msgpack_unpacker_buffer_consumed(&m_uk, bytes); msgpack_unpacked result; msgpack_unpacked_init(&result); while(msgpack_unpacker_next(&m_uk, &result)) { dispatch(result.data); } } else if (bytes == -1) { setError(InvalidDevice, tr("Error when reading from device")); } }
/** * Process incoming data. * * \see fromStdinOut() and StdinReader() */ void MsgpackIODevice::dataAvailableStdin(const QByteArray& data) { if ( (quint64)data.length() > msgpack_unpacker_buffer_capacity(&m_uk)) { setError(InvalidDevice, tr("Error when reading from stdin, BUG(buffered data exceeds capaciy)")); return; } else if ( data.length() > 0 ) { memcpy(msgpack_unpacker_buffer(&m_uk), data.constData(), data.length()); msgpack_unpacker_buffer_consumed(&m_uk, data.length()); msgpack_unpacked result; msgpack_unpacked_init(&result); while(msgpack_unpacker_next(&m_uk, &result)) { dispatch(result.data); } } }
int main(int argc, char **argv) { void *pattern = objpath_compile(argv[1]); msgpack_unpacker pac; msgpack_unpacker_init(&pac, MSGPACK_UNPACKER_INIT_BUFFER_SIZE); msgpack_unpacked result; msgpack_unpacked_init(&result); while(1) { int rc = read_more(&pac); if(!rc) break; while(msgpack_unpacker_next(&pac, &result)) { match(&result.data, pattern); } } return 0; }
static ktype_t msgpack_unpackTo(CTX ctx, const char *buf, size_t size, ksfp_t *sfp) { ktype_t type; msgpack_unpacker upk; msgpack_unpacked result; msgpack_unpacker_init(&upk, MSGPACK_UNPACKER_INIT_BUFFER_SIZE); msgpack_unpacker_reserve_buffer(&upk, size); memcpy(msgpack_unpacker_buffer(&upk), buf, size); msgpack_unpacker_buffer_consumed(&upk, size); msgpack_unpacked_init(&result); msgpack_unpacker_next(&upk, &result); type = msgpack_read(ctx, result.data, sfp); msgpack_unpacker_destroy(&upk); msgpack_unpacked_destroy(&result); return type; }
void tmate_decoder_commit(struct tmate_decoder *decoder, size_t len) { msgpack_unpacked result; msgpack_unpacker_buffer_consumed(&decoder->unpacker, len); msgpack_unpacked_init(&result); while (msgpack_unpacker_next(&decoder->unpacker, &result)) { handle_message(decoder, result.data); } msgpack_unpacked_destroy(&result); if (msgpack_unpacker_message_size(&decoder->unpacker) > TMATE_MAX_MESSAGE_SIZE) { tmate_fatal("Message too big"); } }
int main(int argc, char **argv) { g_cmd = argv[0]; if (argc > 2) usage(); if (argc == 2) g_path = argv[1]; char buf[CHK_SIZE]; int fd; ssize_t rsize; msgpack_unpacker u; msgpack_unpacked obj; if (!strcmp(g_path, "-")) fd = 0; else if (strlen(g_path) > 0) fd = open(g_path, O_RDONLY); else fd = 0; if (fd < 0) goto readerr; msgpack_unpacker_init(&u, BUF_SIZE); msgpack_unpacked_init(&obj); while ((rsize = read(fd, buf, CHK_SIZE)) > 0) { msgpack_unpacker_reserve_buffer(&u, rsize); memcpy(msgpack_unpacker_buffer(&u), buf, rsize); msgpack_unpacker_buffer_consumed(&u, rsize); while (msgpack_unpacker_next(&u, &obj)) { msgpack_object_print(stdout, obj.data); putchar('\n'); } } msgpack_unpacker_destroy(&u); msgpack_unpacked_destroy(&obj); if (fd > 0) close(fd); return 0; readerr: fprintf(stderr, "file read error\n"); exit(1); }
/** * Process incoming data from the underlying device * * \see QIODevice() */ void MsgpackIODevice::dataAvailable() { qint64 read = 1; while (read > 0) { if ( msgpack_unpacker_buffer_capacity(&m_uk) == 0 ) { if ( !msgpack_unpacker_reserve_buffer(&m_uk, 8192 ) ) { // FIXME: error out qWarning() << "Could not allocate memory in unpack buffer"; return; } } read = m_dev->read(msgpack_unpacker_buffer(&m_uk), msgpack_unpacker_buffer_capacity(&m_uk)); if ( read > 0 ) { msgpack_unpacker_buffer_consumed(&m_uk, read); msgpack_unpacked result; msgpack_unpacked_init(&result); while(msgpack_unpacker_next(&m_uk, &result)) { dispatch(result.data); } } } }
static void client_input(struct socket_info *si) { struct client_connection *c = si->udata; char buf[1500]; int n; int got = 0; int ok; if (!c) croak(1, "client_input: no client_connection information"); if ( (n = read(si->fd, buf, 1500)) == -1) { switch (errno) { case EPIPE: client_gone(si); return; case ECONNRESET: client_gone(si); return; } croak(1, "client_input: read error"); } if (n == 0) { client_gone(si); return; } msgpack_unpacker_reserve_buffer(&c->unpacker, n); memcpy(msgpack_unpacker_buffer(&c->unpacker), buf, n); msgpack_unpacker_buffer_consumed(&c->unpacker, n); while (msgpack_unpacker_next(&c->unpacker, &c->input)) { msgpack_object *o; uint32_t cid; uint32_t type; got = 1; ok = -1; PS.client_requests++; si->PS.client_requests++; //if (!opt_quiet) { // printf("got client input: "); // msgpack_object_print(stdout, c->input.data); // printf("\n"); //} o = &c->input.data; if (o->type != MSGPACK_OBJECT_ARRAY) { error_reply(si, RT_ERROR, 0, "Request is not an array"); goto end; } if (o->via.array.size < 1) { error_reply(si, RT_ERROR, 0, "Request is an empty array"); goto end; } if (o->via.array.size < 2) { error_reply(si, RT_ERROR, 0, "Request without an id"); goto end; } if (o->via.array.ptr[RI_CID].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { error_reply(si, RT_ERROR, 0, "Request id is not a positive integer"); goto end; } cid = o->via.array.ptr[RI_CID].via.u64; if (o->via.array.ptr[RI_TYPE].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { error_reply(si, RT_ERROR, cid, "Request type is not a positive integer"); goto end; } type = o->via.array.ptr[RI_TYPE].via.u64; switch (type) { case RT_SETOPT: ok = handle_setopt_request(si, cid, o); break; case RT_GETOPT: ok = handle_getopt_request(si, cid, o); break; case RT_INFO: ok = handle_info_request(si, cid, o); break; case RT_DEST_INFO: ok = handle_dest_info_request(si, cid, o); break; case RT_GET: ok = handle_get_request(si, cid, o); break; case RT_GETTABLE: ok = handle_gettable_request(si, cid, o); break; default: error_reply(si, type|RT_ERROR, cid, "Unknown request type"); } end: if (ok < 0) { PS.invalid_requests++; si->PS.invalid_requests++; } } if (got) { msgpack_unpacker_expand_buffer(&c->unpacker, 0); } }
/** * plume_recv_dispatch - Dispatch routine for Plume server messages. */ int plume_recv_dispatch(struct plume_client *client, int status, void *data) { ssize_t len; msgpack_unpacked result; msgpack_object *o, *p; int opcode; (void)status; (void)data; msgpack_unpacked_init(&result); // Reserve enough space in the msgpack buffer for a read. msgpack_unpacker_reserve_buffer(&client->pc_unpac, BUFSIZE); // Read up to BUFSIZE bytes into the stream. len = plume_recv(client, msgpack_unpacker_buffer(&client->pc_unpac), BUFSIZE); msgpack_unpacker_buffer_consumed(&client->pc_unpac, len); // Dispatch on as many msgpack objects as possible. while (msgpack_unpacker_next(&client->pc_unpac, &result)) { o = &result.data; // Discard malformed responses. if (o->type != MSGPACK_OBJECT_ARRAY || o->via.array.size < 2 || o->via.array.size > 3) { log_error("Discarding malformed Plume server payload"); continue; } p = o->via.array.ptr; // Pull out the opcode. if (p->type != MSGPACK_OBJECT_POSITIVE_INTEGER) { log_error("Discarding malformed Plume server payload"); continue; } opcode = (p++)->via.u64; // Dispatch. switch (opcode) { case PLUME_OP_IDENTIFY: plume_recv_identify(client, p->via.raw.ptr, p->via.raw.size, p + 1); break; case PLUME_OP_CERT: plume_recv_cert(client, p->via.raw.ptr, p->via.raw.size, p + 1); break; case PLUME_OP_CONNECT: plume_recv_connect(client, p->via.raw.ptr, p->via.raw.size, p + 1); break; case PLUME_OP_UDP_ACK: plume_recv_udp_ack(client, p); case PLUME_OP_UDP_ECHO: plume_recv_udp_echo(client, p); break; default: log_error("Discarding malformed Plume server payload"); break; } } msgpack_unpacked_destroy(&result); return 0; }
void monitor_method_recv(void) { fd_set rfds; int retval; static const struct timespec tv = {0, 0}; ssize_t size; char strname[100]; msgpack_unpacked result; msgpack_object *name, *data; FD_ZERO(&rfds); FD_SET(sock, &rfds); retval = pselect(sock + 1, &rfds, NULL, NULL, &tv, NULL); if(retval == 0) { /* no data */ return; } else if(retval == -1) { if(errno != EINTR) { err(EXIT_FAILURE, "method_receive pselect"); } return; } /* receive */ size = read(sock, msgpack_unpacker_buffer(up), msgpack_unpacker_buffer_capacity(up)); msgpack_unpacker_buffer_consumed(up, size); msgpack_unpacked_init(&result); /* stream unpacker */ while(msgpack_unpacker_next(up, &result)) { if(DEBUG_MON) { printf("[Monitor] "); msgpack_object_print(stdout, result.data); puts(""); } /* method: ["METHODNAME", [some, method, args]] */ if(result.data.type != MSGPACK_OBJECT_ARRAY || result.data.via.array.size <= 0) { errx(EXIT_FAILURE, "invalid method"); } /* method name */ name = result.data.via.array.ptr; /* method data */ if(result.data.via.array.size == 2) { data = result.data.via.array.ptr + 1; } else { data = NULL; } if(name->type != MSGPACK_OBJECT_RAW) { errx(EXIT_FAILURE, "invalid method"); } /* convert method name */ memcpy(strname, name->via.raw.ptr, name->via.raw.size); strname[name->via.raw.size] = '\0'; /* call method */ if(!strcmp(strname, "CONNECT")) { } else if(!strcmp(strname, "DISCONNECT")) { exec_finish = true; } else if(data == NULL) { errx(EXIT_FAILURE, "invalid method (no data?)"); } else if(!strcmp(strname, "KEYBOARD_SCANCODE")) { msgpack_object *obj; unsigned int i, n; unsigned char scancode; if(data->type == MSGPACK_OBJECT_ARRAY) { obj = data->via.array.ptr; n = data->via.array.size; } else if(data->type == MSGPACK_OBJECT_POSITIVE_INTEGER) { obj = data; n = 1; } else { n = 0; } for(i = 0; i < n; i++, obj++) { /* push FIFO */ scancode = obj->via.i64 & 0xff; fifo_scancode[fifo_scancode_end++] = scancode; if(fifo_scancode_end >= KMC_FIFO_SCANCODE_SIZE) { fifo_scancode_end = 0; } if(fifo_scancode_start == fifo_scancode_end) { fifo_scancode_start++; if(fifo_scancode_start >= KMC_FIFO_SCANCODE_SIZE) { fifo_scancode_start = 0; } } gci_nodes[GCI_KMC_NUM].int_dispatch = true; DEBUGMON("[Monitor] KEYBOARD_SCANCODE %x\n", scancode); } } else { errx(EXIT_FAILURE, "unknown method '%s'", strname); } } }
TEST(streaming, basic) { msgpack_sbuffer* buffer = msgpack_sbuffer_new(); msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write); // 1, 2, 3, "str", ["str_data"], "bin", ["bin_data"], {0.3: 0.4} EXPECT_EQ(0, msgpack_pack_int(pk, 1)); EXPECT_EQ(0, msgpack_pack_int(pk, 2)); EXPECT_EQ(0, msgpack_pack_int(pk, 3)); EXPECT_EQ(0, msgpack_pack_str(pk, 3)); EXPECT_EQ(0, msgpack_pack_str_body(pk, "str", 3)); EXPECT_EQ(0, msgpack_pack_array(pk, 1)); EXPECT_EQ(0, msgpack_pack_str(pk, 8)); EXPECT_EQ(0, msgpack_pack_str_body(pk, "str_data", 8)); EXPECT_EQ(0, msgpack_pack_bin(pk, 3)); EXPECT_EQ(0, msgpack_pack_bin_body(pk, "bin", 3)); EXPECT_EQ(0, msgpack_pack_array(pk, 1)); EXPECT_EQ(0, msgpack_pack_bin(pk, 8)); EXPECT_EQ(0, msgpack_pack_bin_body(pk, "bin_data", 8)); EXPECT_EQ(0, msgpack_pack_map(pk, 1)); EXPECT_EQ(0, msgpack_pack_float(pk, 0.4f)); EXPECT_EQ(0, msgpack_pack_double(pk, 0.8)); int max_count = 6; msgpack_packer_free(pk); const char* input = buffer->data; const char* const eof = input + buffer->size; msgpack_unpacker pac; msgpack_unpacker_init(&pac, MSGPACK_UNPACKER_INIT_BUFFER_SIZE); msgpack_unpacked result; msgpack_unpacked_init(&result); int count = 0; while(count < max_count) { bool unpacked = false; msgpack_unpacker_reserve_buffer(&pac, 32*1024); while(!unpacked) { /* read buffer into msgpack_unapcker_buffer(&pac) upto * msgpack_unpacker_buffer_capacity(&pac) bytes. */ memcpy(msgpack_unpacker_buffer(&pac), input, 1); input += 1; EXPECT_TRUE(input <= eof); msgpack_unpacker_buffer_consumed(&pac, 1); while(msgpack_unpacker_next(&pac, &result) == MSGPACK_UNPACK_SUCCESS) { unpacked = 1; msgpack_object obj = result.data; msgpack_object e; switch(count++) { case 0: EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, obj.type); EXPECT_EQ(1, obj.via.u64); break; case 1: EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, obj.type); EXPECT_EQ(2, obj.via.u64); break; case 2: EXPECT_EQ(MSGPACK_OBJECT_POSITIVE_INTEGER, obj.type); EXPECT_EQ(3, obj.via.u64); break; case 3: EXPECT_EQ(MSGPACK_OBJECT_STR, obj.type); EXPECT_EQ(std::string("str",3), std::string(obj.via.str.ptr, obj.via.str.size)); break; case 4: EXPECT_EQ(MSGPACK_OBJECT_ARRAY, obj.type); EXPECT_EQ(1, obj.via.array.size); e = obj.via.array.ptr[0]; EXPECT_EQ(MSGPACK_OBJECT_STR, e.type); EXPECT_EQ(std::string("str_data",8), std::string(e.via.str.ptr, e.via.str.size)); break; case 5: EXPECT_EQ(MSGPACK_OBJECT_BIN, obj.type); EXPECT_EQ(std::string("bin",3), std::string(obj.via.bin.ptr, obj.via.bin.size)); break; case 6: EXPECT_EQ(MSGPACK_OBJECT_ARRAY, obj.type); EXPECT_EQ(1, obj.via.array.size); e = obj.via.array.ptr[0]; EXPECT_EQ(MSGPACK_OBJECT_BIN, e.type); EXPECT_EQ(std::string("bin_data",8), std::string(e.via.bin.ptr, e.via.bin.size)); break; case 7: EXPECT_EQ(MSGPACK_OBJECT_MAP, obj.type); EXPECT_EQ(1, obj.via.map.size); e = obj.via.map.ptr[0].key; EXPECT_EQ(MSGPACK_OBJECT_FLOAT, e.type); ASSERT_FLOAT_EQ(0.4f, static_cast<float>(e.via.f64)); #if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT) EXPECT_EQ(MSGPACK_OBJECT_DOUBLE, e.type); ASSERT_FLOAT_EQ(0.4f, static_cast<float>(e.via.dec)); #endif // MSGPACK_USE_LEGACY_NAME_AS_FLOAT e = obj.via.map.ptr[0].val; EXPECT_EQ(MSGPACK_OBJECT_FLOAT, e.type); ASSERT_DOUBLE_EQ(0.8, e.via.f64); #if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT) EXPECT_EQ(MSGPACK_OBJECT_DOUBLE, e.type); ASSERT_DOUBLE_EQ(0.8, e.via.dec); #endif // MSGPACK_USE_LEGACY_NAME_AS_FLOAT break; } } } } msgpack_unpacker_destroy(&pac); msgpack_unpacked_destroy(&result); msgpack_sbuffer_free(buffer); }
void ANetworkController::TryReceiveData() { if (!TcpSocket) { return; } uint32 Size; if (TcpSocket->HasPendingData(Size)) { uint8 buffer[4096]; int32 read; TcpSocket->Recv(buffer, 4096, read); msgpack_unpacker_reserve_buffer(&unpacker, read); memcpy(msgpack_unpacker_buffer(&unpacker), buffer, read); msgpack_unpacker_buffer_consumed(&unpacker, read); msgpack_unpacked result; msgpack_unpacked_init(&result); while (msgpack_unpacker_next(&unpacker, &result)) { msgpack_object* packet = &result.data; TMap<FName, msgpack_object*> Received = Unpack<TMap<FName, msgpack_object*>>(packet); uint8 PacketTypeId = Received[TYPE]->via.i64; EPacketType PacketType = (EPacketType)PacketTypeId; msgpack_object* Data = Received[DATA]; switch (PacketType) { case EPacketType::PT_SetPaused: { bool Paused = Received[DATA]->via.boolean; ReceivedSetPaused(Paused); break; } case EPacketType::PT_GetBehaviors: { ReceivedGetBehaviors(); break; } case EPacketType::PT_ConfigureSpawner: { TMap<FName, msgpack_object*> DataMap = Unpack<TMap<FName, msgpack_object*>>(Data); ReceivedConfigureSpawner(DataMap); break; } case EPacketType::PT_DisableAllSpawners: { ReceivedDisableAllSpawners(); break; } case EPacketType::PT_ExecuteCommand: { ReceivedExecuteCommand(Data); break; } case EPacketType::PT_RemoveAllVehicles: { ReceivedRemoveAllVehicles(); break; } case EPacketType::PT_ResetStats: { ReceivedResetStats(); break; } case EPacketType::PT_RecreateLogEntry: { ReceivedRecreateLogEntry(Data); break; } case EPacketType::PT_AddArrow: { ReceivedAddArrow(Data); break; } case EPacketType::PT_StartRecording: { ReceivedStartRecording(Data); break; } case EPacketType::PT_StopRecording: { ReceivedStopRecording(Data); break; } case EPacketType::PT_StartPlayback: { ReceivedStartPlayback(Data); break; } case EPacketType::PT_StopPlayback: { ReceivedStopPlayback(Data); break; } case EPacketType::PT_GetGitHash: { ReceivedGetGitHash(); break; } case EPacketType::PT_StartMatinee: { ReceivedStartMatinee(Data); break; } case EPacketType::PT_SetArrowsVisible: ReceivedSetArrowsVisible(Data); break; case EPacketType::PT_SeekAndPauseReplay: ReceivedSeekAndPauseReplay(Data); break; case EPacketType::PT_SetReplaySpeed: ReceivedSetReplaySpeed(Data); break; case EPacketType::PT_SetReplayPaused: ReceivedSetReplayPaused(Data); break; case EPacketType::PT_SelectCamera: ReceivedSelectCamera(Data); break; case EPacketType::PT_CameraLookAtVehicle: ReceivedCameraLookAtVehicle(Data); break; case EPacketType::PT_SelectVehicleCamera: ReceivedSelectVehicleCamera(Data); break; case EPacketType::PT_FollowCam: ReceivedFollowCam(Data); break; } } msgpack_unpacked_destroy(&result); } }