| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /********************************************************************* |
| 2 | * |
||
| 3 | * ARP Module Defs for Microchip TCP/IP Stack |
||
| 4 | * |
||
| 5 | ********************************************************************* |
||
| 6 | * FileName: ARP.h |
||
| 7 | * Dependencies: Stacktsk.h |
||
| 8 | * MAC.h |
||
| 9 | * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32 |
||
| 10 | * Compiler: Microchip C32 v1.05 or higher |
||
| 11 | * Microchip C30 v3.12 or higher |
||
| 12 | * Microchip C18 v3.30 or higher |
||
| 13 | * HI-TECH PICC-18 PRO 9.63PL2 or higher |
||
| 14 | * Company: Microchip Technology, Inc. |
||
| 15 | * |
||
| 16 | * Software License Agreement |
||
| 17 | * |
||
| 18 | * Copyright (C) 2002-2009 Microchip Technology Inc. All rights |
||
| 19 | * reserved. |
||
| 20 | * |
||
| 21 | * Microchip licenses to you the right to use, modify, copy, and |
||
| 22 | * distribute: |
||
| 23 | * (i) the Software when embedded on a Microchip microcontroller or |
||
| 24 | * digital signal controller product ("Device") which is |
||
| 25 | * integrated into Licensee's product; or |
||
| 26 | * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h, |
||
| 27 | * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device |
||
| 28 | * used in conjunction with a Microchip ethernet controller for |
||
| 29 | * the sole purpose of interfacing with the ethernet controller. |
||
| 30 | * |
||
| 31 | * You should refer to the license agreement accompanying this |
||
| 32 | * Software for additional information regarding your rights and |
||
| 33 | * obligations. |
||
| 34 | * |
||
| 35 | * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT |
||
| 36 | * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT |
||
| 37 | * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||
| 38 | * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
||
| 39 | * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR |
||
| 40 | * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF |
||
| 41 | * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS |
||
| 42 | * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE |
||
| 43 | * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER |
||
| 44 | * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT |
||
| 45 | * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE. |
||
| 46 | * |
||
| 47 | * |
||
| 48 | * Author Date Comment |
||
| 49 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
| 50 | * Nilesh Rajbharti 5/1/01 Original (Rev 1.0) |
||
| 51 | * Nilesh Rajbharti 2/9/02 Cleanup |
||
| 52 | * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail) |
||
| 53 | * Howard Schlunder 8/17/06 Combined ARP.h and ARPTsk.h into ARP.h |
||
| 54 | ********************************************************************/ |
||
| 55 | #ifndef __ARP_H |
||
| 56 | #define __ARP_H |
||
| 57 | |||
| 58 | #ifdef STACK_CLIENT_MODE |
||
| 59 | void ARPInit(void); |
||
| 60 | #else |
||
| 61 | #define ARPInit() |
||
| 62 | #endif |
||
| 63 | |||
| 64 | #define ARP_OPERATION_REQ 0x0001u // Operation code indicating an ARP Request |
||
| 65 | #define ARP_OPERATION_RESP 0x0002u // Operation code indicating an ARP Response |
||
| 66 | |||
| 67 | #define HW_ETHERNET (0x0001u) // ARP Hardware type as defined by IEEE 802.3 |
||
| 68 | #define ARP_IP (0x0800u) // ARP IP packet type as defined by IEEE 802.3 |
||
| 69 | |||
| 70 | |||
| 71 | // ARP packet structure |
||
| 72 | typedef struct __attribute__((aligned(2), packed)) |
||
| 73 | { |
||
| 74 | WORD HardwareType; |
||
| 75 | WORD Protocol; |
||
| 76 | BYTE MACAddrLen; |
||
| 77 | BYTE ProtocolLen; |
||
| 78 | WORD Operation; |
||
| 79 | MAC_ADDR SenderMACAddr; |
||
| 80 | IP_ADDR SenderIPAddr; |
||
| 81 | MAC_ADDR TargetMACAddr; |
||
| 82 | IP_ADDR TargetIPAddr; |
||
| 83 | } ARP_PACKET; |
||
| 84 | |||
| 85 | BOOL ARPProcess(void); |
||
| 86 | void ARPResolve(IP_ADDR* IPAddr); |
||
| 87 | BOOL ARPIsResolved(IP_ADDR* IPAddr, MAC_ADDR* MACAddr); |
||
| 88 | void SwapARPPacket(ARP_PACKET* p); |
||
| 89 | |||
| 90 | #ifdef STACK_USE_ZEROCONF_LINK_LOCAL |
||
| 91 | /* API specific Definitions */ |
||
| 92 | #define ARP_REQ 0x0001u // Operation code indicating an ARP Request |
||
| 93 | #define ARP_RESP 0x0002u // Operation code indicating an ARP Response |
||
| 94 | |||
| 95 | struct arp_app_callbacks { |
||
| 96 | BOOL used; |
||
| 97 | void (*ARPPkt_notify)(DWORD SenderIPAddr, DWORD TargetIPAddr, |
||
| 98 | MAC_ADDR* SenderMACAddr, MAC_ADDR* TargetMACAddr, BYTE op_req); |
||
| 99 | }; |
||
| 100 | CHAR ARPRegisterCallbacks(struct arp_app_callbacks *app); |
||
| 101 | BOOL ARPDeRegisterCallbacks(CHAR id); |
||
| 102 | BOOL ARPSendPkt(DWORD SrcIPAddr, DWORD DestIPAddr, BYTE op_req ); |
||
| 103 | #endif |
||
| 104 | |||
| 105 | #endif |
||
| 106 | |||
| 107 |
Powered by WebSVN v2.8.3