Haka: include/haka/engine.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

engine.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef HAKA_ENGINE_H
6 #define HAKA_ENGINE_H
7
8 #include <haka/types.h>
9 #include <stdlib.h>
10
11 enum thread_status {
12 THREAD_RUNNING,
13 THREAD_WAITING,
14 THREAD_DEBUG,
15 THREAD_DEFUNC,
16 THREAD_STOPPED
17 };
18
19 struct packet_stats {
20 size_t recv_packets;
21 size_t recv_bytes;
22 size_t trans_bytes;
23 size_t trans_packets;
24 size_t drop_packets;
25 };
26
27 struct engine_thread;
28 struct lua_State;
29
30 bool engine_prepare(int thread_count);
31
32 struct engine_thread *engine_thread_init(struct lua_State *L, int id);
33 void engine_thread_cleanup(struct engine_thread *thread);
34 struct engine_thread *engine_thread_current();
35 struct engine_thread *engine_thread_byid(int id);
36
37 int engine_thread_id(struct engine_thread *thread);
38 enum thread_status engine_thread_update_status(struct engine_thread *thread, enum thread_status status);
39 enum thread_status engine_thread_status(struct engine_thread *thread);
40 volatile struct packet_stats *engine_thread_statistics(struct engine_thread *thread);
41
42 bool engine_thread_remote_launch(struct engine_thread *thread, void (*callback)(void *), void *data);
43 int engine_thread_lua_remote_launch(struct engine_thread *thread, struct lua_State *L, int index);
44 char* engine_thread_raw_lua_remote_launch(struct engine_thread *thread, const char *code, size_t *size);
45 void engine_thread_check_remote_launch(struct engine_thread *thread);
46 void engine_thread_interrupt_begin(struct engine_thread *thread);
47 void engine_thread_interrupt_end(struct engine_thread *thread);
48 int engine_thread_interrupt_fd();
49
50 #endif /* HAKA_ENGINE_H */
types.h