1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 /***
5   Copyright © 2014 Axis Communications AB. All rights reserved.
6 ***/
7 
8 #include <net/ethernet.h>
9 #include <netinet/in.h>
10 
11 #include "socket-util.h"
12 #include "sparse-endian.h"
13 
14 int arp_update_filter(int fd, const struct in_addr *a, const struct ether_addr *mac);
15 int arp_network_bind_raw_socket(int ifindex, const struct in_addr *a, const struct ether_addr *mac);
16 
17 int arp_send_packet(
18                 int fd,
19                 int ifindex,
20                 const struct in_addr *pa,
21                 const struct ether_addr *ha,
22                 bool announce);
arp_send_probe(int fd,int ifindex,const struct in_addr * pa,const struct ether_addr * ha)23 static inline int arp_send_probe(
24                 int fd,
25                 int ifindex,
26                 const struct in_addr *pa,
27                 const struct ether_addr *ha) {
28         return arp_send_packet(fd, ifindex, pa, ha, false);
29 }
arp_send_announcement(int fd,int ifindex,const struct in_addr * pa,const struct ether_addr * ha)30 static inline int arp_send_announcement(
31                 int fd,
32                 int ifindex,
33                 const struct in_addr *pa,
34                 const struct ether_addr *ha) {
35         return arp_send_packet(fd, ifindex, pa, ha, true);
36 }
37