Files
hmmmm/inc/proto/msg.h
2026-02-11 12:18:59 +03:00

26 lines
868 B
C

#ifndef __PROTO_MSG_H__
#define __PROTO_MSG_H__
#include "wsServer/include/ws.h"
#include <stdlib.h>
typedef struct {
ws_cli_conn_t clientIdx;
uint8_t* msg;
size_t msgLen;
} OutgoingMessage;
typedef struct {
uint64_t nonce;
uint8_t packetType;
uint8_t payloadHeader;
const void* payload;
size_t payloadLen;
} BaseMessage;
BaseMessage* parseMessage(const uint8_t* bytes, size_t size);
uint8_t* createControlNotifyMessage(uint64_t nonce, uint64_t clockCounter, uint8_t newEmulState, size_t* lenOut);
uint8_t* createDoneRegMessage(uint64_t nonce, uint8_t X, uint64_t devId, uint64_t segId, uint64_t startAddr, uint64_t segLength, uint32_t regId, size_t* lenOut);
uint8_t* createStreamSegmentPush(uint8_t mode, uint32_t regId, uint64_t clockCounter, uint8_t* payload, size_t payloadLen, size_t* lenOut);
#endif //ifndef __PROTO_MSG_H__