mirror of
https://github.com/CPunch/Laika.git
synced 2025-11-27 13:31:04 +00:00
Added .clang-format, formatted codebase
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "lpeer.h"
|
||||
#include "ltask.h"
|
||||
#include "lsodium.h"
|
||||
|
||||
#include "ltask.h"
|
||||
#include "speer.h"
|
||||
|
||||
typedef struct sShell_client {
|
||||
typedef struct sShell_client
|
||||
{
|
||||
uint8_t priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
|
||||
struct sLaika_pollList pList;
|
||||
struct sLaika_taskService tService;
|
||||
@@ -31,7 +31,8 @@ bool shellC_poll(tShell_client *client, int timeout);
|
||||
void shellC_loadKeys(tShell_client *client, const char *pub, const char *priv);
|
||||
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 */
|
||||
/* returns new peer id */
|
||||
int shellC_addPeer(tShell_client *client, tShell_peer *peer);
|
||||
void shellC_rmvPeer(tShell_client *client, tShell_peer *peer, int id);
|
||||
|
||||
void shellC_openShell(tShell_client *client, tShell_peer *peer, uint16_t col, uint16_t row);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#ifndef SHELLCMD_H
|
||||
#define SHELLCMD_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "sclient.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef void (*shellCmdCallback)(tShell_client *client, int args, char *argc[]);
|
||||
|
||||
typedef struct sShell_cmdDef {
|
||||
typedef struct sShell_cmdDef
|
||||
{
|
||||
const char *cmd;
|
||||
const char *help;
|
||||
const char *syntax;
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
#ifndef SHELLPEER_H
|
||||
#define SHELLPEER_H
|
||||
|
||||
#include "lsodium.h"
|
||||
#include "lpeer.h"
|
||||
#include "lsodium.h"
|
||||
|
||||
typedef struct sShell_peer {
|
||||
typedef struct sShell_peer
|
||||
{
|
||||
uint8_t pub[crypto_kx_PUBLICKEYBYTES];
|
||||
char hostname[LAIKA_HOSTNAME_LEN], inet[LAIKA_INET_LEN], ipStr[LAIKA_IPSTR_LEN];
|
||||
PEERTYPE type;
|
||||
OSTYPE osType;
|
||||
} tShell_peer;
|
||||
|
||||
tShell_peer *shellP_newPeer(PEERTYPE type, OSTYPE osType, uint8_t *pub, char *hostname, char *inet, char *ipStr);
|
||||
tShell_peer *shellP_newPeer(PEERTYPE type, OSTYPE osType, uint8_t *pub, char *hostname, char *inet,
|
||||
char *ipStr);
|
||||
void shellP_freePeer(tShell_peer *peer);
|
||||
|
||||
void shellP_printInfo(tShell_peer *peer);
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#ifndef SHELLTERM_H
|
||||
#define SHELLTERM_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "sclient.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/select.h>
|
||||
#include <termios.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sclient.h"
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
TERM_BLACK,
|
||||
TERM_RED,
|
||||
TERM_GREEN,
|
||||
@@ -31,29 +32,34 @@ typedef enum {
|
||||
TERM_BRIGHT_WHITE
|
||||
} TERM_COLOR;
|
||||
|
||||
#define PRINTTAG(color) shellT_printf("\r%s[~]%s ", shellT_getForeColor(color), shellT_getForeColor(TERM_BRIGHT_WHITE))
|
||||
#define PRINTTAG(color) \
|
||||
shellT_printf("\r%s[~]%s ", shellT_getForeColor(color), shellT_getForeColor(TERM_BRIGHT_WHITE))
|
||||
|
||||
#define PRINTINFO(...) do { \
|
||||
PRINTTAG(TERM_BRIGHT_YELLOW); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while(0);
|
||||
#define PRINTINFO(...) \
|
||||
do { \
|
||||
PRINTTAG(TERM_BRIGHT_YELLOW); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
#define PRINTSUCC(...) do { \
|
||||
PRINTTAG(TERM_BRIGHT_GREEN); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while(0);
|
||||
#define PRINTSUCC(...) \
|
||||
do { \
|
||||
PRINTTAG(TERM_BRIGHT_GREEN); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
#define PRINTERROR(...) do { \
|
||||
PRINTTAG(TERM_BRIGHT_RED); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while(0);
|
||||
#define PRINTERROR(...) \
|
||||
do { \
|
||||
PRINTTAG(TERM_BRIGHT_RED); \
|
||||
shellT_printf(__VA_ARGS__); \
|
||||
} while (0);
|
||||
|
||||
void shellT_conioTerm(void);
|
||||
void shellT_resetTerm(void);
|
||||
const char *shellT_getForeColor(TERM_COLOR);
|
||||
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 */
|
||||
/* 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);
|
||||
@@ -62,6 +68,7 @@ char shellT_getch(void);
|
||||
int shellT_kbget(void);
|
||||
void shellT_printPrompt(void);
|
||||
void shellT_setPrompt(char *prompt);
|
||||
void shellT_addChar(tShell_client *client, int c); /* processes input, moving cursor, adding char to cmd, etc. */
|
||||
/* processes input, moving cursor, adding char to cmd, etc. */
|
||||
void shellT_addChar(tShell_client *client, int c);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user