1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1992-2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _NETLB_H 28 #define _NETLB_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * The following ioctls may be implemented by any network driver 38 * that provides loopback functionality. 39 */ 40 #define LB_IOC ('U' << 8) 41 #define LB_GET_INFO_SIZE (LB_IOC|0) /* Get size of loopback info */ 42 #define LB_GET_INFO (LB_IOC|1) /* Get loopback info table */ 43 #define LB_GET_MODE (LB_IOC|2) /* Get current loopback mode */ 44 #define LB_SET_MODE (LB_IOC|3) /* Set current loopback mode */ 45 46 /* 47 * The 'loopback info' is a table (array) of available loopback modes. 48 * Each has a generic type (normal/external/internal), a name (e.g. the 49 * speed or style of loopback implemented), and a key value, used in the 50 * GET_MODE and SET_MODE commands. 51 * 52 * So, a loopback-test program could: 53 * open the network device 54 * use the LB_GET_INFO_SIZE ioctl (parameter: &size) 55 * to find the size of the info array 56 * allocate some space for the info array 57 * use the LB_GET_INFO ioctl (parameter: infoptr) 58 * to get the whole info array 59 * search the array for a particular type of loopback (e.g. internal), 60 * or display all the available modes for the user to select one 61 * use the LB_GET_MODE ioctl (parameter: &oldmode) 62 * to get the current mode 63 * use the LB_SET_MODE ioctl (parameter: &newmode) 64 * to set the new mode 65 * perform the test(s) 66 * use the LB_SET_MODE ioctl (parameter: &oldmode) 67 * to restore the new mode 68 */ 69 70 typedef uint32_t lb_info_sz_t; 71 72 typedef enum { 73 normal, 74 external, 75 internal 76 } lb_type_t; 77 78 typedef struct _lb_property_t { 79 lb_type_t lb_type; 80 char key[16]; 81 uint32_t value; 82 } lb_property_t, *p_lb_property_t; 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* _NETLB_H */ 89