summaryrefslogtreecommitdiff
path: root/eth-multiplexer/vdev.h
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2016-11-02 18:06:53 +0100
committerJustus Winter <justus@gnupg.org>2016-11-04 15:40:53 +0100
commit25d614aa11e52370c200e677099746a619ea76db (patch)
tree46bbcbf80c1264131264b6d3ab334d856a17ffdc /eth-multiplexer/vdev.h
parent50e14fce11f2bebb4faad220f8f610a55f4110c5 (diff)
eth-multiplexer: Merge the eth-multiplexer.
* Makefile (prog-subdirs): Add the new program. * NEWS: Update. * eth-multiplexer/ChangeLog: New file. * eth-multiplexer/Makefile: Likewise. * eth-multiplexer/README: Likewise. * eth-multiplexer/demuxer.c: Likewise. * eth-multiplexer/dev_stat.c: Likewise. * eth-multiplexer/device_impl.c: Likewise. * eth-multiplexer/ethernet.c: Likewise. * eth-multiplexer/ethernet.h: Likewise. * eth-multiplexer/mig-decls.h: Likewise. * eth-multiplexer/mig-mutate.h: Likewise. * eth-multiplexer/multiplexer.c: Likewise. * eth-multiplexer/netfs_impl.c: Likewise. * eth-multiplexer/netfs_impl.h: Likewise. * eth-multiplexer/notify_impl.c: Likewise. * eth-multiplexer/test.c: Likewise. * eth-multiplexer/util.h: Likewise. * eth-multiplexer/vdev.c: Likewise. * eth-multiplexer/vdev.h: Likewise. The eth-multiplexer has been written by Zheng Da. This merges his work into the main repository.
Diffstat (limited to 'eth-multiplexer/vdev.h')
-rw-r--r--eth-multiplexer/vdev.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/eth-multiplexer/vdev.h b/eth-multiplexer/vdev.h
new file mode 100644
index 00000000..c8696785
--- /dev/null
+++ b/eth-multiplexer/vdev.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Written by Zheng Da.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd 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 2, or (at
+ your option) any later version.
+
+ The GNU Hurd 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
+
+#ifndef VDEV_H
+#define VDEV_H
+
+#include <net/if.h>
+
+#include <hurd.h>
+#include <mach.h>
+#include <hurd/ports.h>
+#include <device/net_status.h>
+
+#include <bpf_impl.h>
+
+#include "queue.h"
+#include "util.h"
+
+#define MAX_SERVERS 10
+#define ETH_MTU 1500
+
+struct vether_device
+{
+ /* The ports used by the socket server to send packets to the interface. */
+ struct port_info dev_pi;
+ mach_port_t dev_port;
+
+ char name[IFNAMSIZ];
+
+ short if_header_size;
+ short if_mtu;
+ short if_header_format;
+ short if_address_size;
+ short if_flags;
+ char if_address[ETH_ALEN];
+
+ struct vether_device *next;
+ struct vether_device **pprev;
+
+ if_filter_list_t port_list;
+};
+
+typedef int (*dev_act_func) (struct vether_device *);
+
+int serv_connect (mach_port_t port);
+int serv_disconnect ();
+struct vether_device *lookup_dev_by_name (char *name);
+int remove_dead_port_from_dev (mach_port_t dead_port);
+struct vether_device *add_vdev (char *name, int size,
+ struct port_class *class,
+ struct port_bucket *bucket);
+void destroy_vdev (void *port);
+int has_vdev ();
+int deliver_msg (struct net_rcv_msg *msg, struct vether_device *vdev);
+int deliver_pack (char *data, int datalen, struct vether_device *vdev);
+boolean_t all_dev_close ();
+int broadcast_pack (char *data, int datalen, struct vether_device *from_vdev);
+int broadcast_msg (struct net_rcv_msg *msg);
+int get_dev_num ();
+int foreach_dev_do (dev_act_func func);
+
+#endif