29 lines
1.0 KiB
C
29 lines
1.0 KiB
C
#ifndef __PROTO_MSG_H__
|
|
#define __PROTO_MSG_H__
|
|
|
|
#include "wsServer/include/ws.h"
|
|
#include <stdlib.h>
|
|
#include "client.h"
|
|
|
|
typedef struct {
|
|
ClientContext* client;
|
|
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);
|
|
void fillHead(uint64_t nonce, uint8_t packetType, uint8_t payloadHeader, uint8_t* outmsg);
|
|
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);
|
|
uint8_t* createClientSetup(uint64_t nonce, ClientContext* ctx, size_t* lenOut);
|
|
|
|
#endif //ifndef __PROTO_MSG_H__
|