1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Component */ 17 /** */ 18 /** Reverse Address Resolution Protocol (RARP) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /**************************************************************************/ 25 /* */ 26 /* COMPONENT DEFINITION RELEASE */ 27 /* */ 28 /* nx_rarp.h PORTABLE C */ 29 /* 6.1.9 */ 30 /* AUTHOR */ 31 /* */ 32 /* Yuxin Zhou, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file defines the NetX Reverse Address Resolution Protocol */ 37 /* component, including all data types and external references. It */ 38 /* is assumed that nx_api.h and nx_port.h have already been included. */ 39 /* */ 40 /* RELEASE HISTORY */ 41 /* */ 42 /* DATE NAME DESCRIPTION */ 43 /* */ 44 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 45 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 46 /* resulting in version 6.1 */ 47 /* 10-15-2021 Yuxin Zhou Modified comment(s), included */ 48 /* necessary header file, */ 49 /* resulting in version 6.1.9 */ 50 /* */ 51 /**************************************************************************/ 52 53 #ifndef NX_RARP_H 54 #define NX_RARP_H 55 56 #include "nx_api.h" 57 58 59 #ifndef NX_DISABLE_IPV4 60 /* Define RARP Message format. This will get encapsulated by an Ethernet frame 61 as well. The Ethernet frame will typically have a 6-byte Ethernet destination 62 address, a 6-byte Ethernet source address, and a 2-byte Ethernet Frame type, 63 which is 0x8035. Regular IP frames have a frame type of 0x0800. 64 65 Byte offset Size Meaning 66 67 0 2 Hardware type (1 for Ethernet) 68 2 2 Protocol type (0x0800 for IP) 69 4 1 Number of bytes for hardware address (6 for Ethernet) 70 5 1 Number of bytes for IP address (4 for IP) 71 6 2 Operation, ARP request is 1, ARP reply is 2 72 8 6 Sender's Ethernet Address 73 14 4 Sender's IP Address 74 18 6 Target Ethernet Address 75 24 4 Target IP Address 76 */ 77 78 #define NX_RARP_HARDWARE_TYPE ((ULONG)0x0001) 79 #define NX_RARP_PROTOCOL_TYPE ((ULONG)0x0800) 80 #define NX_RARP_HARDWARE_SIZE ((ULONG)0x06) 81 #define NX_RARP_PROTOCOL_SIZE ((ULONG)0x04) 82 #define NX_RARP_OPTION_REQUEST ((ULONG)0x0003) 83 #define NX_RARP_OPTION_RESPONSE ((ULONG)0x0004) 84 #define NX_RARP_MESSAGE_SIZE 28 85 86 /* Define RARP internal function prototypes. */ 87 VOID _nx_rarp_packet_send(NX_IP *ip_ptr); 88 VOID _nx_rarp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); 89 VOID _nx_rarp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr); 90 VOID _nx_rarp_periodic_update(NX_IP *ip_ptr); 91 VOID _nx_rarp_queue_process(NX_IP *ip_ptr); 92 #endif /* NX_DISABLE_IPV4 */ 93 94 /* Define RARP function prototypes. */ 95 UINT _nx_rarp_enable(NX_IP *ip_ptr); 96 UINT _nx_rarp_disable(NX_IP *ip_ptr); 97 UINT _nx_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received, 98 ULONG *rarp_invalid_messages); 99 100 /* Define error checking shells for RARP services. These are only referenced by the 101 application. */ 102 103 UINT _nxe_rarp_enable(NX_IP *ip_ptr); 104 UINT _nxe_rarp_disable(NX_IP *ip_ptr); 105 UINT _nxe_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received, 106 ULONG *rarp_invalid_messages); 107 #endif 108 109