mirror of
https://github.com/CPunch/Laika.git
synced 2026-01-27 12:20:08 +00:00
refactored laikaS_*Packet functions, added debugging output
This commit is contained in:
@@ -63,16 +63,12 @@ typedef enum {
|
||||
struct sLaika_socket {
|
||||
uint8_t *outBuf; /* raw data to be sent() */
|
||||
uint8_t *inBuf; /* raw data we recv()'d */
|
||||
uint8_t inKey[crypto_kx_SESSIONKEYBYTES], outKey[crypto_kx_SESSIONKEYBYTES];
|
||||
SOCKET sock; /* raw socket fd */
|
||||
int outCount;
|
||||
int inCount;
|
||||
int outCap;
|
||||
int inCap;
|
||||
int outStart; /* index of pktID for out packet */
|
||||
int inStart; /* index of pktID for in packet */
|
||||
bool flipEndian;
|
||||
bool useSecure; /* if true, sock will transmit/receive encrypted data using inKey & outKey */
|
||||
};
|
||||
|
||||
#define laikaS_isAlive(arg) (arg->sock != INVALID_SOCKET)
|
||||
@@ -90,11 +86,6 @@ void laikaS_bind(struct sLaika_socket *sock, uint16_t port); /* bind sock to por
|
||||
void laikaS_acceptFrom(struct sLaika_socket *sock, struct sLaika_socket *from);
|
||||
bool laikaS_setNonBlock(struct sLaika_socket *sock);
|
||||
|
||||
void laikaS_startOutPacket(struct sLaika_socket *sock, uint8_t id);
|
||||
int laikaS_endOutPacket(struct sLaika_socket *sock);
|
||||
void laikaS_startInPacket(struct sLaika_socket *sock);
|
||||
int laikaS_endInPacket(struct sLaika_socket *sock);
|
||||
void laikaS_setSecure(struct sLaika_socket *sock, bool flag);
|
||||
void laikaS_read(struct sLaika_socket *sock, void *buf, size_t sz); /* reads from inBuf */
|
||||
void laikaS_write(struct sLaika_socket *sock, void *buf, size_t sz); /* writes to outBuf */
|
||||
void laikaS_writeKeyEncrypt(struct sLaika_socket *sock, void *buf, size_t sz, uint8_t *pub); /* encrypts & writes from buf using pub key */
|
||||
|
||||
Reference in New Issue
Block a user