|
| 1 | +/**************************************************************************** |
| 2 | + * include/netinet/if_ether.h |
| 3 | + * |
| 4 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 5 | + * contributor license agreements. See the NOTICE file distributed with |
| 6 | + * this work for additional information regarding copyright ownership. The |
| 7 | + * ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 8 | + * "License"); you may not use this file except in compliance with the |
| 9 | + * License. You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 | + * License for the specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + * |
| 19 | + ****************************************************************************/ |
| 20 | + |
| 21 | +#ifndef _INCLUDE_NETINET_IF_ETHER_H |
| 22 | +#define _INCLUDE_NETINET_IF_ETHER_H |
| 23 | + |
| 24 | +/**************************************************************************** |
| 25 | + * Included Files |
| 26 | + ****************************************************************************/ |
| 27 | + |
| 28 | +#include <stdint.h> |
| 29 | +#include <net/if_arp.h> |
| 30 | +#include <net/ethernet.h> |
| 31 | + |
| 32 | +/**************************************************************************** |
| 33 | + * Pre-processor Definitions |
| 34 | + ****************************************************************************/ |
| 35 | + |
| 36 | +#define ETH_ALEN 6 /* Octets in one ethernet addr */ |
| 37 | + |
| 38 | +#define ETH_P_IP ETHERTYPE_IP |
| 39 | +#define ETH_P_ARP ETHERTYPE_ARP |
| 40 | + |
| 41 | +/** |
| 42 | + * Ethernet Address Resolution Protocol. |
| 43 | + * |
| 44 | + * See RFC 826 for protocol description. Structure below is adapted |
| 45 | + * to resolving internet addresses. Field names used correspond to |
| 46 | + * RFC 826. |
| 47 | + */ |
| 48 | + |
| 49 | +struct ether_arp |
| 50 | +{ |
| 51 | + struct arphdr ea_hdr; /* fixed-size header */ |
| 52 | + uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ |
| 53 | + uint8_t arp_spa[4]; /* sender protocol address */ |
| 54 | + uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ |
| 55 | + uint8_t arp_tpa[4]; /* target protocol address */ |
| 56 | +}; |
| 57 | + |
| 58 | +#define arp_hrd ea_hdr.ar_hrd |
| 59 | +#define arp_pro ea_hdr.ar_pro |
| 60 | +#define arp_hln ea_hdr.ar_hln |
| 61 | +#define arp_pln ea_hdr.ar_pln |
| 62 | +#define arp_op ea_hdr.ar_op |
| 63 | + |
| 64 | +#endif /* _INCLUDE_NETINET_IF_ETHER_H */ |
0 commit comments