File: call_plugin.c

package info (click to toggle)
mptcpd 0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,612 kB
  • sloc: ansic: 9,472; sh: 5,154; makefile: 467; cpp: 61
file content (114 lines) | stat: -rw-r--r-- 4,576 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @file call_plugin.c
 *
 * @brief mptcpd test plugin call functions.
 *
 * Copyright (c) 2019-2022, Intel Corporation
 */

#include <stdlib.h>

#include <mptcpd/private/plugin.h>

#include "test-plugin.h"

#undef NDEBUG
#include <assert.h>


void call_plugin_ops(struct plugin_call_count const *count,
                     struct plugin_call_args const *args)
{
        assert(count != NULL);
        assert(args != NULL);

        for (int i = 0; i < count->new_connection; ++i)
                mptcpd_plugin_new_connection(args->name,
                                             args->token,
                                             args->laddr,
                                             args->raddr,
                                             args->server_side,
                                             args->deny_join_id0,
                                             args->pm);

        for (int i = 0; i < count->connection_established; ++i)
                mptcpd_plugin_connection_established(args->token,
                                                     args->laddr,
                                                     args->raddr,
                                                     args->server_side,
                                                     args->deny_join_id0,
                                                     args->pm);

        for (int i = 0; i < count->new_address; ++i)
                mptcpd_plugin_new_address(args->token,
                                          args->raddr_id,
                                          args->raddr,
                                          args->pm);

        for (int i = 0; i < count->address_removed; ++i)
                mptcpd_plugin_address_removed(args->token,
                                              args->raddr_id,
                                              args->pm);

        for (int i = 0; i < count->new_subflow; ++i)
                mptcpd_plugin_new_subflow(args->token,
                                          args->laddr,
                                          args->raddr,
                                          args->backup,
                                          args->pm);

        for (int i = 0; i < count->subflow_closed; ++i)
                mptcpd_plugin_subflow_closed(args->token,
                                             args->laddr,
                                             args->raddr,
                                             args->backup,
                                             args->error,
                                             args->pm);

        for (int i = 0; i < count->subflow_priority; ++i)
                mptcpd_plugin_subflow_priority(args->token,
                                               args->laddr,
                                               args->raddr,
                                               args->backup,
                                               args->pm);

        for (int i = 0; i < count->listener_created; ++i)
                mptcpd_plugin_listener_created(args->name,
                                               args->laddr,
                                               args->pm);

        for (int i = 0; i < count->listener_closed; ++i)
                mptcpd_plugin_listener_closed(args->name,
                                              args->laddr,
                                              args->pm);

        for (int i = 0; i < count->connection_closed; ++i)
                mptcpd_plugin_connection_closed(args->token, args->pm);

        for (int i = 0; i < count->new_interface; ++i)
                mptcpd_plugin_new_interface(args->interface, args->pm);

        for (int i = 0; i < count->update_interface; ++i)
                mptcpd_plugin_update_interface(args->interface, args->pm);

        for (int i = 0; i < count->delete_interface; ++i)
                mptcpd_plugin_delete_interface(args->interface, args->pm);

        for (int i = 0; i < count->new_local_address; ++i)
                mptcpd_plugin_new_local_address(args->interface,
                                                args->laddr,
                                                args->pm);

        for (int i = 0; i < count->delete_local_address; ++i)
                mptcpd_plugin_delete_local_address(args->interface,
                                                   args->laddr,
                                                   args->pm);
}


/*
  Local Variables:
  c-file-style: "linux"
  End:
*/