blob: 37162260d17528137f2680a5aa8045cd60453e91 [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
Philippe Reynes6ec70bc2020-09-18 14:13:00 +02006#include <net.h>
7#include <net/udp.h>
8
9static struct udp_ops *udp_ops;
10
11int udp_prereq(void)
12{
13 int ret = 0;
14
15 if (udp_ops->prereq)
16 ret = udp_ops->prereq(udp_ops->data);
17
18 return ret;
19}
20
21int udp_start(void)
22{
23 return udp_ops->start(udp_ops->data);
24}
25
26int udp_loop(struct udp_ops *ops)
27{
28 int ret = -1;
29
30 if (!ops) {
31 printf("%s: ops should not be null\n", __func__);
32 goto out;
33 }
34
35 if (!ops->start) {
36 printf("%s: no start function defined\n", __func__);
37 goto out;
38 }
39
40 udp_ops = ops;
41 ret = net_loop(UDP);
42
43 out:
44 return ret;
45}