-
Notifications
You must be signed in to change notification settings - Fork 0
/
ltx.h
54 lines (43 loc) · 1.32 KB
/
ltx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022 Richard Palethorpe <[email protected]>
* Copyright (c) 2023 Andrea Cervesato <[email protected]>
*/
#ifndef LTX_H
#define LTX_H
/* The current LTX version */
#define VERSION "0.1"
/* ltx supported messages */
enum
{
LTX_NONE = 0xffff,
LTX_WARNING = 0xfff,
LTX_ERROR = 0xff,
LTX_VERSION = 0x00,
LTX_PING = 0x01,
LTX_PONG = 0x02,
LTX_GET_FILE = 0x03,
LTX_SET_FILE = 0x04,
LTX_ENV = 0x05,
LTX_CWD = 0x06,
LTX_EXEC = 0x07,
LTX_RESULT = 0x08,
LTX_LOG = 0x09,
LTX_DATA = 0xa0,
LTX_KILL = 0xa1,
};
/* ltx session abstract object to implement */
typedef struct ltx_session ltx_session;
/* Initialize ltx session with specific stdin/stdout */
struct ltx_session *ltx_session_init(const int stdin_fd, const int stdout_fd);
/* Stop current ltx session */
void ltx_session_stop(struct ltx_session *session);
/* Destroy current ltx session */
void ltx_session_destroy(struct ltx_session *session);
/* Start the main event loop */
void ltx_start_event_loop(struct ltx_session *session);
/* Set the debug file descriptor. STDERR_FILENO is used by default */
void ltx_set_debug_fd(struct ltx_session *session, const int fd);
/* Print a warning message on debug file descriptor */
void ltx_warning(struct ltx_session *session, const char *msg);
#endif /* LTX_H */