Philippe Reynes | 6ec70bc | 2020-09-18 14:13:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (C) 2020 Philippe Reynes <philippe.reynes@softathome.com> |
| 4 | */ |
| 5 | |
| 6 | #ifndef __UDP |
| 7 | #define __UDP |
| 8 | |
| 9 | /** |
| 10 | * struct udp_ops - function to handle udp packet |
| 11 | * |
| 12 | * This structure provides the function to handle udp packet in |
| 13 | * the network loop. |
| 14 | * |
| 15 | * @prereq: callback called to check the requirement |
| 16 | * @start: callback called to start the protocol/feature |
| 17 | * @data: pointer to store private data (used by prereq and start) |
| 18 | */ |
| 19 | struct udp_ops { |
| 20 | int (*prereq)(void *data); |
| 21 | int (*start)(void *data); |
| 22 | void *data; |
| 23 | }; |
| 24 | |
| 25 | int udp_prereq(void); |
| 26 | |
| 27 | int udp_start(void); |
| 28 | |
| 29 | /** |
| 30 | * udp_loop() - network loop for udp protocol |
| 31 | * |
| 32 | * Launch a network loop for udp protocol and use callbacks |
| 33 | * provided in parameter @ops to initialize the loop, and then |
| 34 | * to handle udp packet. |
| 35 | * |
| 36 | * @ops: udp callback |
| 37 | * @return: 0 if success, otherwise < 0 on error |
| 38 | */ |
| 39 | int udp_loop(struct udp_ops *ops); |
| 40 | |
| 41 | #endif |