~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/net/rarp.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2007 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
 
 
26
#include <stdint.h>
 
27
#include <byteswap.h>
 
28
#include <ipxe/netdevice.h>
 
29
#include <ipxe/iobuf.h>
 
30
#include <ipxe/if_ether.h>
 
31
#include <ipxe/rarp.h>
 
32
 
 
33
/** @file
 
34
 *
 
35
 * Reverse Address Resolution Protocol
 
36
 *
 
37
 */
 
38
 
 
39
/**
 
40
 * Process incoming ARP packets
 
41
 *
 
42
 * @v iobuf             I/O buffer
 
43
 * @v netdev            Network device
 
44
 * @v ll_dest           Link-layer destination address
 
45
 * @v ll_source         Link-layer source address
 
46
 * @v flags             Packet flags
 
47
 * @ret rc              Return status code
 
48
 *
 
49
 * This is a dummy method which simply discards RARP packets.
 
50
 */
 
51
static int rarp_rx ( struct io_buffer *iobuf,
 
52
                     struct net_device *netdev __unused,
 
53
                     const void *ll_dest __unused,
 
54
                     const void *ll_source __unused,
 
55
                     unsigned int flags __unused ) {
 
56
        free_iob ( iobuf );
 
57
        return 0;
 
58
}
 
59
 
 
60
 
 
61
/**
 
62
 * Transcribe RARP address
 
63
 *
 
64
 * @v net_addr  RARP address
 
65
 * @ret string  "<RARP>"
 
66
 *
 
67
 * This operation is meaningless for the RARP protocol.
 
68
 */
 
69
static const char * rarp_ntoa ( const void *net_addr __unused ) {
 
70
        return "<RARP>";
 
71
}
 
72
 
 
73
/** RARP protocol */
 
74
struct net_protocol rarp_protocol __net_protocol = {
 
75
        .name = "RARP",
 
76
        .net_proto = htons ( ETH_P_RARP ),
 
77
        .rx = rarp_rx,
 
78
        .ntoa = rarp_ntoa,
 
79
};