net: add compat headers without rte prefix
[dpdk.git] / lib / librte_net / rte_arp.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2013 6WIND S.A.
3  */
4
5 #ifndef _RTE_ARP_H_
6 #define _RTE_ARP_H_
7
8 /**
9  * @file
10  *
11  * ARP-related defines
12  */
13
14 #include <stdint.h>
15 #include <rte_ether.h>
16
17 #ifndef RTE_NET_NO_COMPAT
18 #include <rte_arp_compat.h>
19 #endif
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /**
26  * ARP header IPv4 payload.
27  */
28 struct rte_arp_ipv4 {
29         struct rte_ether_addr arp_sha;  /**< sender hardware address */
30         uint32_t          arp_sip;  /**< sender IP address */
31         struct rte_ether_addr arp_tha;  /**< target hardware address */
32         uint32_t          arp_tip;  /**< target IP address */
33 } __attribute__((__packed__));
34
35 /**
36  * ARP header.
37  */
38 struct rte_arp_hdr {
39         uint16_t arp_hardware;    /* format of hardware address */
40 #define RTE_ARP_HRD_ETHER     1  /* ARP Ethernet address format */
41
42         uint16_t arp_protocol;    /* format of protocol address */
43         uint8_t  arp_hlen;    /* length of hardware address */
44         uint8_t  arp_plen;    /* length of protocol address */
45         uint16_t arp_opcode;     /* ARP opcode (command) */
46 #define RTE_ARP_OP_REQUEST    1 /* request to resolve address */
47 #define RTE_ARP_OP_REPLY      2 /* response to previous request */
48 #define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */
49 #define RTE_ARP_OP_REVREPLY   4 /* response giving protocol address */
50 #define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */
51 #define RTE_ARP_OP_INVREPLY   9 /* response identifying peer */
52
53         struct rte_arp_ipv4 arp_data;
54 } __attribute__((__packed__));
55
56 /**
57  * @warning
58  * @b EXPERIMENTAL: this API may change without prior notice
59  *
60  * Make a RARP packet based on MAC addr.
61  *
62  * @param mpool
63  *   Pointer to the rte_mempool
64  * @param mac
65  *   Pointer to the MAC addr
66  *
67  * @return
68  *   - RARP packet pointer on success, or NULL on error
69  */
70 struct rte_mbuf * __rte_experimental
71 rte_net_make_rarp_packet(struct rte_mempool *mpool,
72                 const struct rte_ether_addr *mac);
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif /* _RTE_ARP_H_ */