blob: ed4b2e2649942413adbb8420e0040b6607f8dd37 [file] [log] [blame]
Joe Hershberger586cbd12015-03-22 17:09:21 -05001/*
2 * Copyright (c) 2015 National Instruments
3 *
4 * (C) Copyright 2015
5 * Joe Hershberger <joe.hershberger@ni.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0
8 */
9
10#ifndef __ETH_RAW_OS_H
11#define __ETH_RAW_OS_H
12
13/**
14 * struct eth_sandbox_raw_priv - raw socket session
15 *
16 * sd: socket descriptor - the open socket during a session
17 * device: struct sockaddr_ll - the host interface packets move to/from
Joe Hershbergera8921922015-03-22 17:09:23 -050018 * local: 1 or 0 to select the local interface ('lo') or not
19 * local_bindsd: socket descriptor to prevent the kernel from sending
20 * a message to the server claiming the port is
21 * unreachable
22 * local_bind_udp_port: The UDP port number that we bound to
Joe Hershberger586cbd12015-03-22 17:09:21 -050023 */
24struct eth_sandbox_raw_priv {
25 int sd;
26 void *device;
Joe Hershbergera8921922015-03-22 17:09:23 -050027 int local;
28 int local_bind_sd;
29 unsigned short local_bind_udp_port;
Joe Hershberger586cbd12015-03-22 17:09:21 -050030};
31
32int sandbox_eth_raw_os_start(const char *ifname, unsigned char *ethmac,
33 struct eth_sandbox_raw_priv *priv);
34int sandbox_eth_raw_os_send(void *packet, int length,
Joe Hershbergera8921922015-03-22 17:09:23 -050035 struct eth_sandbox_raw_priv *priv);
Joe Hershberger586cbd12015-03-22 17:09:21 -050036int sandbox_eth_raw_os_recv(void *packet, int *length,
37 const struct eth_sandbox_raw_priv *priv);
38void sandbox_eth_raw_os_stop(struct eth_sandbox_raw_priv *priv);
39
40#endif /* __ETH_RAW_OS_H */