Root/
1 | /* |
2 | * fw/dispatch.h - Wireless protocol dispatcher |
3 | * |
4 | * Written 2012 by Werner Almesberger |
5 | * Copyright 2012 Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | #ifndef DISPATCH_H |
14 | #define DISPATCH_H |
15 | |
16 | #include <stdbool.h> |
17 | #include <stdint.h> |
18 | |
19 | #include "proto.h" |
20 | |
21 | |
22 | struct handler { |
23 | enum pck_type type; |
24 | bool (*first)(uint8_t limit, const uint8_t *payload); |
25 | bool (*more)(uint8_t seq, uint8_t limit, const uint8_t *payload); |
26 | }; |
27 | |
28 | |
29 | extern struct handler image_handler; |
30 | extern struct handler reset_handler; |
31 | extern struct handler sample_handler; |
32 | extern struct handler param_handler; |
33 | extern struct handler diag_handler; |
34 | |
35 | |
36 | bool dispatch(const uint8_t *buf, uint8_t len, const struct handler **protos); |
37 | |
38 | #endif /* !PROTO_H */ |
39 |
Branches:
master
tornado-v1