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