From 87c9d921d45a8e953ab9e1ddbac1089143212d40 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Sun, 27 Apr 2025 16:11:12 -0400 Subject: startiing to clean up c api --- include/zaprus.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'include/zaprus.h') diff --git a/include/zaprus.h b/include/zaprus.h index f170c38..db2d316 100644 --- a/include/zaprus.h +++ b/include/zaprus.h @@ -11,36 +11,5 @@ int zaprus_send_relay(const char* payload, size_t len, char dest[4]); int zaprus_send_initial_connection(const char* payload, size_t len, uint16_t initial_port); -struct SaprusMessage* zaprus_connect(const char* payload, size_t len); +void* zaprus_connect(const char* payload, size_t len); -// message -#define SAPRUS_RELAY_MESSAGE_TYPE 0x003C -#define SAPRUS_FILE_TRANSFER_MESSAGE_TYPE 0x8888 -#define SAPRUS_CONNECTION_MESSAGE_TYPE 0x00E9 - -struct SaprusMessage { - uint16_t packet_type; - uint16_t payload_len; - union { - struct { - char dest[4]; - } relay; - struct { - uint16_t src_port; - uint16_t dest_port; - uint32_t seq_num; - uint32_t msg_id; - char _reserved; - char options; - } connection; - } headers; - char *payload; -}; - -// ptr should be freed by the caller. -int zaprus_message_to_bytes(struct SaprusMessage msg, char** ptr, size_t* len); - -// Return value should be destroyed with zaprus_message_deinit. -struct SaprusMessage* zaprus_message_from_bytes(const char* bytes, size_t len); - -void zaprus_message_deinit(struct SaprusMessage* msg); -- cgit