summaryrefslogtreecommitdiff
path: root/common/inc/nx_rarp.h
blob: 3dee5c99dab4bc2ca81e68ec7fde3ffeb2598fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2025-present Eclipse ThreadX Contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** NetX Component                                                        */
/**                                                                       */
/**   Reverse Address Resolution Protocol (RARP)                          */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/*                                                                        */
/*  COMPONENT DEFINITION                                   RELEASE        */
/*                                                                        */
/*    nx_rarp.h                                           PORTABLE C      */
/*                                                           6.4.3        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This file defines the NetX Reverse Address Resolution Protocol      */
/*    component, including all data types and external references.  It    */
/*    is assumed that nx_api.h and nx_port.h have already been included.  */
/*                                                                        */
/**************************************************************************/

#ifndef NX_RARP_H
#define NX_RARP_H

#include "nx_api.h"


#ifndef NX_DISABLE_IPV4
/* Define RARP Message format.  This will get encapsulated by an Ethernet frame
   as well.  The Ethernet frame will typically have a 6-byte Ethernet destination
   address, a 6-byte Ethernet source address, and a 2-byte Ethernet Frame type,
   which is 0x8035.  Regular IP frames have a frame type of 0x0800.

    Byte offset     Size            Meaning

        0           2           Hardware type (1 for Ethernet)
        2           2           Protocol type (0x0800 for IP)
        4           1           Number of bytes for hardware address (6 for Ethernet)
        5           1           Number of bytes for IP address (4 for IP)
        6           2           Operation, ARP request is 1, ARP reply is 2
        8           6           Sender's Ethernet Address
        14          4           Sender's IP Address
        18          6           Target Ethernet Address
        24          4           Target IP Address
 */

#define NX_RARP_HARDWARE_TYPE   ((ULONG)0x0001)
#define NX_RARP_PROTOCOL_TYPE   ((ULONG)0x0800)
#define NX_RARP_HARDWARE_SIZE   ((ULONG)0x06)
#define NX_RARP_PROTOCOL_SIZE   ((ULONG)0x04)
#define NX_RARP_OPTION_REQUEST  ((ULONG)0x0003)
#define NX_RARP_OPTION_RESPONSE ((ULONG)0x0004)
#define NX_RARP_MESSAGE_SIZE    28

/* Define RARP internal function prototypes.  */
VOID _nx_rarp_packet_send(NX_IP *ip_ptr);
VOID _nx_rarp_packet_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
VOID _nx_rarp_packet_deferred_receive(NX_IP *ip_ptr, NX_PACKET *packet_ptr);
VOID _nx_rarp_periodic_update(NX_IP *ip_ptr);
VOID _nx_rarp_queue_process(NX_IP *ip_ptr);
#endif /* NX_DISABLE_IPV4 */

/* Define RARP function prototypes.  */
UINT _nx_rarp_enable(NX_IP *ip_ptr);
UINT _nx_rarp_disable(NX_IP *ip_ptr);
UINT _nx_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received,
                       ULONG *rarp_invalid_messages);

/* Define error checking shells for RARP services.  These are only referenced by the
   application.  */

UINT _nxe_rarp_enable(NX_IP *ip_ptr);
UINT _nxe_rarp_disable(NX_IP *ip_ptr);
UINT _nxe_rarp_info_get(NX_IP *ip_ptr, ULONG *rarp_requests_sent, ULONG *rarp_responses_received,
                        ULONG *rarp_invalid_messages);
#endif