iPXE
nullnet.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 FILE_SECBOOT ( PERMITTED );
26 
27 #include <stdint.h>
28 #include <errno.h>
29 #include <ipxe/iobuf.h>
30 #include <ipxe/netdevice.h>
31 
32 /** @file
33  *
34  * Null network device
35  *
36  */
37 
38 static int null_open ( struct net_device *netdev __unused ) {
39  return -ENODEV;
40 };
41 
42 static void null_close ( struct net_device *netdev __unused ) {
43  /* Do nothing */
44 };
45 
46 static int null_transmit ( struct net_device *netdev __unused,
47  struct io_buffer *iobuf __unused ) {
48  return -ENODEV;
49 };
50 
51 static void null_poll ( struct net_device *netdev __unused ) {
52  /* Do nothing */
53 }
54 
55 static void null_irq ( struct net_device *netdev __unused,
56  int enable __unused ) {
57  /* Do nothing */
58 }
59 
61  .open = null_open,
62  .close = null_close,
63  .transmit = null_transmit,
64  .poll = null_poll,
65  .irq = null_irq,
66 };
int(* open)(struct net_device *netdev)
Open network device.
Definition: netdevice.h:223
Error codes.
I/O buffers.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
static void null_poll(struct net_device *netdev __unused)
Definition: nullnet.c:51
static struct net_device * netdev
Definition: gdbudp.c:52
static int null_transmit(struct net_device *netdev __unused, struct io_buffer *iobuf __unused)
Definition: nullnet.c:46
static int null_open(struct net_device *netdev __unused)
Definition: nullnet.c:38
A network device.
Definition: netdevice.h:353
#define ENODEV
No such device.
Definition: errno.h:510
FILE_SECBOOT(PERMITTED)
static void null_irq(struct net_device *netdev __unused, int enable __unused)
Definition: nullnet.c:55
static void null_close(struct net_device *netdev __unused)
Definition: nullnet.c:42
Network device operations.
Definition: netdevice.h:214
Network device management.
struct net_device_operations null_netdev_operations
Definition: nullnet.c:60
A persistent I/O buffer.
Definition: iobuf.h:38