src/networkd/port.h \
src/networkd/port-bus.c \
src/networkd/port-bus.h \
+ src/networkd/port-dummy.c \
+ src/networkd/port-dummy.h \
src/networkd/stats-collector.c \
src/networkd/stats-collector.h \
src/networkd/string.h \
--- /dev/null
+/*#############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2023 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#include "port.h"
+#include "port-dummy.h"
+
+nw_port_ops_t nw_port_ops_dummy = {
+ // There is no special configuration
+ .config_read = NULL,
+ .config_write = NULL,
+};
--- /dev/null
+/*#############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2023 IPFire Network Development Team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#ifndef NETWORKD_PORT_DUMMY_H
+#define NETWORKD_PORT_DUMMY_H
+
+#include "port.h"
+
+extern nw_port_ops_t nw_port_ops_dummy;
+
+#endif /* NETWORKD_PORT_DUMMY_H */
#include "link.h"
#include "logging.h"
#include "port.h"
+#include "port-dummy.h"
#include "stats-collector.h"
#include "string.h"
// Common attributes
nw_address_t address;
+ // Type Operations
+ nw_port_ops_t ops;
+
// VLAN settings
struct nw_port_vlan {
nw_port* parent;
// Store the type
p->type = type;
+ // Set operations
+ switch (p->type) {
+ case NW_PORT_DUMMY:
+ p->ops = nw_port_ops_dummy;
+ break;
+ }
+
// Store the name
r = nw_string_set(p->name, name);
if (r)
typedef struct nw_port nw_port;
#include "address.h"
+#include "config.h"
#include "daemon.h"
+typedef struct nw_port_ops {
+ // Configuration
+ int (*config_read)(nw_port* port, nw_config* config);
+ int (*config_write)(nw_port* port, nw_config* config);
+} nw_port_ops_t;
+
int nw_port_create(nw_port** port, nw_daemon* daemon,
nw_port_type_t type, const char* name);
int nw_port_create_from_config(nw_port** port, nw_daemon* daemon,