Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Related Pages  

C:/proj/src/ethernut/nut/eboot/arp.h

00001 #ifndef _ARP_H
00002 #define _ARP_H
00003 
00004 /*
00005  * Copyright (C) 2001-2002 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. All advertising materials mentioning features or use of this
00017  *    software must display the following acknowledgement:
00018  *
00019  *    This product includes software developed by egnite Software GmbH
00020  *    and its contributors.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00026  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  *
00037  * -
00038  * Portions Copyright (c) 1983, 1993 by
00039  *  The Regents of the University of California.  All rights reserved.
00040  *
00041  * Redistribution and use in source and binary forms, with or without
00042  * modification, are permitted provided that the following conditions
00043  * are met:
00044  * 1. Redistributions of source code must retain the above copyright
00045  *    notice, this list of conditions and the following disclaimer.
00046  * 2. Redistributions in binary form must reproduce the above copyright
00047  *    notice, this list of conditions and the following disclaimer in the
00048  *    documentation and/or other materials provided with the distribution.
00049  * 3. All advertising materials mentioning features or use of this software
00050  *    must display the following acknowledgement:
00051  *  This product includes software developed by the University of
00052  *  California, Berkeley and its contributors.
00053  * 4. Neither the name of the University nor the names of its contributors
00054  *    may be used to endorse or promote products derived from this software
00055  *    without specific prior written permission.
00056  *
00057  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00058  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00059  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00060  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00061  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00062  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00063  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00064  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00065  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00066  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00067  * SUCH DAMAGE.
00068  * -
00069  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
00070  *
00071  * Permission to use, copy, modify, and distribute this software for any
00072  * purpose with or without fee is hereby granted, provided that the above
00073  * copyright notice and this permission notice appear in all copies, and that
00074  * the name of Digital Equipment Corporation not be used in advertising or
00075  * publicity pertaining to distribution of the document or software without
00076  * specific, written prior permission.
00077  * 
00078  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
00079  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
00080  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
00081  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
00082  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00083  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00084  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00085  * SOFTWARE.
00086  */
00087 
00088 /*
00089  * $Log: arp.h,v $
00090  * Revision 1.1  2002/08/01 17:34:29  harald
00091  * First check in
00092  *
00093  */
00094 
00095 #include "types.h"
00096 
00097 #include "ether.h"
00098 
00099 /*!
00100  * \addtogroup xgStack
00101  */
00102 /*@{*/
00103 
00104 #define ARPHRD_ETHER    1   /*!< \brief ethernet hardware format */
00105 
00106 #define ARPOP_REQUEST   1   /*!< \brief request to resolve address */
00107 #define ARPOP_REPLY     2   /*!< \brief response to previous request */
00108 
00109 /*!
00110  * \typedef ETHERARP
00111  * \brief Ethernet ARP protocol type.
00112  */
00113 typedef struct ether_arp {
00114     u_short arp_hrd;    /*!< \brief Format of hardware address. 
00115                         *   Nut/Net supports ARPHRD_ETHER only. 
00116                         */
00117     u_short arp_pro;    /*!< \brief Format of protocol address.
00118                         *   Only ETHERTYPE_IP is supported by Nut/Net.
00119                         */
00120     u_char  arp_hln;    /*!< \brief Length of hardware address. */
00121     u_char  arp_pln;    /*!< \brief Length of protocol address. */
00122     u_short arp_op;     /*!< \brief ARP operation.
00123                         *   May be either ARPOP_REQUEST or ARPOP_REPLY.
00124                         */
00125     u_char arp_sha[6]; /*!< \brief Source hardware address. */
00126     u_long arp_spa;    /*!< \brief Source protocol address. */
00127     u_char arp_tha[6]; /*!< \brief Target hardware address. */
00128     u_long arp_tpa;    /*!< \brief Target protocol address. */
00129 } ETHERARP;
00130 
00131 typedef struct {
00132     ETHERHDR eth_hdr;
00133     ETHERARP eth_arp;
00134 } ARPFRAME;
00135 
00136 extern ARPFRAME arpframe;
00137 
00138 typedef struct {
00139     u_long ae_ip;       /*!< \brief IP address. */
00140     u_char ae_ha[6];    /*!< \brief Hardware address. */
00141 } ARPENTRY;
00142 
00143 /*@}*/
00144 
00145 extern int ArpRequest(u_long ip, u_char *mac);
00146 extern void ArpRespond(void);
00147 
00148 #endif
00149 

© 2002 by egnite Software GmbH - visit http://www.ethernut.de/