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