iPXE
rarp.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  *
00019  * You can also choose to distribute this program under the terms of
00020  * the Unmodified Binary Distribution Licence (as given in the file
00021  * COPYING.UBDL), provided that you have satisfied its requirements.
00022  */
00023 
00024 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00025 
00026 #include <stdint.h>
00027 #include <byteswap.h>
00028 #include <ipxe/netdevice.h>
00029 #include <ipxe/iobuf.h>
00030 #include <ipxe/if_ether.h>
00031 #include <ipxe/rarp.h>
00032 
00033 /** @file
00034  *
00035  * Reverse Address Resolution Protocol
00036  *
00037  */
00038 
00039 /**
00040  * Process incoming ARP packets
00041  *
00042  * @v iobuf             I/O buffer
00043  * @v netdev            Network device
00044  * @v ll_dest           Link-layer destination address
00045  * @v ll_source         Link-layer source address
00046  * @v flags             Packet flags
00047  * @ret rc              Return status code
00048  *
00049  * This is a dummy method which simply discards RARP packets.
00050  */
00051 static int rarp_rx ( struct io_buffer *iobuf,
00052                      struct net_device *netdev __unused,
00053                      const void *ll_dest __unused,
00054                      const void *ll_source __unused,
00055                      unsigned int flags __unused ) {
00056         free_iob ( iobuf );
00057         return 0;
00058 }
00059 
00060 
00061 /**
00062  * Transcribe RARP address
00063  *
00064  * @v net_addr  RARP address
00065  * @ret string  "<RARP>"
00066  *
00067  * This operation is meaningless for the RARP protocol.
00068  */
00069 static const char * rarp_ntoa ( const void *net_addr __unused ) {
00070         return "<RARP>";
00071 }
00072 
00073 /** RARP protocol */
00074 struct net_protocol rarp_protocol __net_protocol = {
00075         .name = "RARP",
00076         .net_proto = htons ( ETH_P_RARP ),
00077         .rx = rarp_rx,
00078         .ntoa = rarp_ntoa,
00079 };