1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2015 National Instruments
6 * Joe Hershberger <joe.hershberger@ni.com>
10 #define __ETH_RAW_OS_H
15 * struct eth_sandbox_raw_priv - raw socket session
17 * sd: socket descriptor - the open socket during a session
18 * host_ifname: interface name on the host to use for sending our packets
19 * host_ifindex: interface index number on the host
20 * device: struct sockaddr_ll - the host interface packets move to/from
21 * local: 1 or 0 to select the local interface ('lo') or not
22 * local_bindsd: socket descriptor to prevent the kernel from sending
23 * a message to the server claiming the port is
25 * local_bind_udp_port: The UDP port number that we bound to
27 struct eth_sandbox_raw_priv {
29 char host_ifname[IFNAMSIZ];
30 unsigned int host_ifindex;
34 unsigned short local_bind_udp_port;
38 * Check if the interface named "ifname" is a localhost interface or not.
39 * ifname - the interface name on the host to check
41 * returns - 0 if real interface, 1 if local, negative if error
43 int sandbox_eth_raw_os_is_local(const char *ifname);
45 int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
46 unsigned char *ethmac);
47 int sandbox_eth_raw_os_send(void *packet, int length,
48 struct eth_sandbox_raw_priv *priv);
49 int sandbox_eth_raw_os_recv(void *packet, int *length,
50 const struct eth_sandbox_raw_priv *priv);
51 void sandbox_eth_raw_os_stop(struct eth_sandbox_raw_priv *priv);
53 #endif /* __ETH_RAW_OS_H */