mirror of
https://github.com/CPunch/Laika.git
synced 2026-02-04 07:30:03 +00:00
refactored laikaS_*Packet functions, added debugging output
This commit is contained in:
@@ -20,6 +20,7 @@ typedef void (*PeerPktHandler)(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void
|
||||
struct sLaika_peer {
|
||||
struct sLaika_socket sock; /* DO NOT MOVE THIS. this member HAS TO BE FIRST so that typecasting sLaika_peer* to sLaika_sock* works as intended */
|
||||
uint8_t peerPub[crypto_kx_PUBLICKEYBYTES]; /* connected peer's public key */
|
||||
uint8_t inKey[crypto_kx_SESSIONKEYBYTES], outKey[crypto_kx_SESSIONKEYBYTES];
|
||||
struct sLaika_pollList *pList; /* pollList we're active in */
|
||||
PeerPktHandler *handlers;
|
||||
LAIKAPKT_SIZE *pktSizeTable; /* const table to pull pkt size data from */
|
||||
@@ -27,12 +28,20 @@ struct sLaika_peer {
|
||||
LAIKAPKT_SIZE pktSize; /* current pkt size */
|
||||
LAIKAPKT_ID pktID; /* current pkt ID */
|
||||
PEERTYPE type;
|
||||
int outStart; /* index of pktID for out packet */
|
||||
int inStart; /* index of pktID for in packet */
|
||||
bool setPollOut; /* is EPOLLOUT/POLLOUT is set on sock's pollfd ? */
|
||||
bool useSecure; /* if true, peer will transmit/receive encrypted data using inKey & outKey */
|
||||
};
|
||||
|
||||
struct sLaika_peer *laikaS_newPeer(PeerPktHandler *handlers, LAIKAPKT_SIZE *pktSizeTable, struct sLaika_pollList *pList, void *uData);
|
||||
void laikaS_freePeer(struct sLaika_peer *peer);
|
||||
|
||||
void laikaS_setSecure(struct sLaika_peer *peer, bool flag);
|
||||
void laikaS_startOutPacket(struct sLaika_peer *peer, uint8_t id);
|
||||
int laikaS_endOutPacket(struct sLaika_peer *peer);
|
||||
void laikaS_startInPacket(struct sLaika_peer *peer);
|
||||
int laikaS_endInPacket(struct sLaika_peer *peer);
|
||||
bool laikaS_handlePeerIn(struct sLaika_peer *peer);
|
||||
bool laikaS_handlePeerOut(struct sLaika_peer *peer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user