-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandlers.h
47 lines (38 loc) · 1.37 KB
/
handlers.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
/* Handlers - A collection of cli handlers
* Copyright (C) 2021 Stan Vlad <vstan02@protonmail.com>
*
* This file is part of Conix.
*
* Conix is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CONIX_HANDLERS_H
#define CONIX_HANDLERS_H
#include "common.h"
#define HANDLER_STORES 10
typedef struct handler handler_t;
typedef struct handlers handlers_t;
typedef struct handler_store handler_store_t;
struct handler {
const char* id;
void* payload;
handle_t handle;
};
struct handlers {
handler_store_t* stores[HANDLER_STORES];
};
extern void handlers_init(handlers_t* handlers);
extern void handlers_free(handlers_t* handlers);
extern void handlers_put(handlers_t* handlers, handler_t handler);
extern handler_t* handlers_get(handlers_t* handlers, const char* id);
#endif // CONIX_HANDLERS_H