1
0
mirror of https://github.com/CPunch/Laika.git synced 2026-01-03 03:20:43 +00:00

Added 'shell' command to LaikaShell

- another major refactoring
This commit is contained in:
2022-03-02 10:38:16 -06:00
parent 2d8e9ed106
commit 8ab3033bf3
13 changed files with 208 additions and 27 deletions

View File

@@ -11,6 +11,7 @@ typedef struct sShell_client {
uint8_t priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
struct sLaika_pollList pList;
struct sLaika_peer *peer;
tShell_peer *openShell; /* if not NULL, shell is open on peer */
struct hashmap *peers;
tShell_peer **peerTbl;
int peerTblCount;
@@ -28,6 +29,10 @@ tShell_peer *shellC_getPeerByPub(tShell_client *client, uint8_t *pub, int *id);
int shellC_addPeer(tShell_client *client, tShell_peer *peer); /* returns new peer id */
void shellC_rmvPeer(tShell_client *client, tShell_peer *peer, int id);
void shellC_openShell(tShell_client *client, tShell_peer *peer);
void shellC_closeShell(tShell_client *client);
void shellC_sendDataShell(tShell_client *client, uint8_t *data, size_t sz);
void shellC_printInfo(tShell_peer *peer);
#endif

View File

@@ -17,6 +17,8 @@ void shellT_printf(const char *format, ...);
/* waits for input for timeout (in ms). returns true if input is ready to be read, false if no events */
bool shellT_waitForInput(int timeout);
int shellT_readRawInput(uint8_t *buf, size_t max);
void shellT_writeRawOutput(uint8_t *buf, size_t sz);
char shellT_getch(void);
int shellT_kbget(void);
void shellT_printPrompt(void);