2022-02-25 04:13:05 +00:00
|
|
|
#ifndef SHELLCLIENT_H
|
|
|
|
#define SHELLCLIENT_H
|
|
|
|
|
2022-09-02 01:00:37 +00:00
|
|
|
#include "core/hashmap.h"
|
|
|
|
#include "core/lmem.h"
|
|
|
|
#include "core/lsodium.h"
|
|
|
|
#include "core/ltask.h"
|
|
|
|
#include "net/lpeer.h"
|
2022-02-25 04:13:05 +00:00
|
|
|
#include "speer.h"
|
|
|
|
|
2022-06-27 23:57:00 +00:00
|
|
|
typedef struct sShell_client
|
|
|
|
{
|
2022-02-25 04:13:05 +00:00
|
|
|
uint8_t priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
|
|
|
|
struct sLaika_pollList pList;
|
2022-04-13 17:19:06 +00:00
|
|
|
struct sLaika_taskService tService;
|
2022-02-25 04:13:05 +00:00
|
|
|
struct sLaika_peer *peer;
|
2022-03-02 16:38:16 +00:00
|
|
|
tShell_peer *openShell; /* if not NULL, shell is open on peer */
|
2022-02-25 04:13:05 +00:00
|
|
|
struct hashmap *peers;
|
2022-09-02 00:35:52 +00:00
|
|
|
laikaM_newVector(tShell_peer *, peerTbl);
|
2022-02-25 04:13:05 +00:00
|
|
|
} tShell_client;
|
|
|
|
|
2022-03-03 16:28:43 +00:00
|
|
|
#define shellC_isShellOpen(x) (x->openShell != NULL)
|
|
|
|
|
2022-02-25 04:13:05 +00:00
|
|
|
void shellC_init(tShell_client *client);
|
|
|
|
void shellC_cleanup(tShell_client *client);
|
|
|
|
|
|
|
|
void shellC_connectToCNC(tShell_client *client, char *ip, char *port);
|
|
|
|
bool shellC_poll(tShell_client *client, int timeout);
|
|
|
|
|
2022-04-06 04:57:37 +00:00
|
|
|
void shellC_loadKeys(tShell_client *client, const char *pub, const char *priv);
|
2022-02-25 04:13:05 +00:00
|
|
|
tShell_peer *shellC_getPeerByPub(tShell_client *client, uint8_t *pub, int *id);
|
|
|
|
|
2022-06-27 23:57:00 +00:00
|
|
|
/* returns new peer id */
|
|
|
|
int shellC_addPeer(tShell_client *client, tShell_peer *peer);
|
2022-02-25 04:13:05 +00:00
|
|
|
void shellC_rmvPeer(tShell_client *client, tShell_peer *peer, int id);
|
|
|
|
|
2022-03-07 21:16:46 +00:00
|
|
|
void shellC_openShell(tShell_client *client, tShell_peer *peer, uint16_t col, uint16_t row);
|
2022-03-02 16:38:16 +00:00
|
|
|
void shellC_closeShell(tShell_client *client);
|
|
|
|
void shellC_sendDataShell(tShell_client *client, uint8_t *data, size_t sz);
|
|
|
|
|
2022-02-25 04:13:05 +00:00
|
|
|
#endif
|