blob: 2ae56e8447720ef4a9f24561f967639bfb85cbe2 [file] [log] [blame]
Philippe Reynes6ec70bc2020-09-18 14:13:00 +02001/* 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 */
19struct udp_ops {
20 int (*prereq)(void *data);
21 int (*start)(void *data);
22 void *data;
23};
24
25int udp_prereq(void);
26
27int 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 */
39int udp_loop(struct udp_ops *ops);
40
41#endif