13926a3a0SYegor Yefremov /* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */ 2922cd657SDavid Howells /* 3922cd657SDavid Howells * linux/can/raw.h 4922cd657SDavid Howells * 5922cd657SDavid Howells * Definitions for raw CAN sockets 6922cd657SDavid Howells * 7922cd657SDavid Howells * Authors: Oliver Hartkopp <[email protected]> 8922cd657SDavid Howells * Urs Thuermann <[email protected]> 9922cd657SDavid Howells * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 10922cd657SDavid Howells * All rights reserved. 11922cd657SDavid Howells * 122485602fSUwe Kleine-König * Redistribution and use in source and binary forms, with or without 132485602fSUwe Kleine-König * modification, are permitted provided that the following conditions 142485602fSUwe Kleine-König * are met: 152485602fSUwe Kleine-König * 1. Redistributions of source code must retain the above copyright 162485602fSUwe Kleine-König * notice, this list of conditions and the following disclaimer. 172485602fSUwe Kleine-König * 2. Redistributions in binary form must reproduce the above copyright 182485602fSUwe Kleine-König * notice, this list of conditions and the following disclaimer in the 192485602fSUwe Kleine-König * documentation and/or other materials provided with the distribution. 202485602fSUwe Kleine-König * 3. Neither the name of Volkswagen nor the names of its contributors 212485602fSUwe Kleine-König * may be used to endorse or promote products derived from this software 222485602fSUwe Kleine-König * without specific prior written permission. 232485602fSUwe Kleine-König * 242485602fSUwe Kleine-König * Alternatively, provided that this notice is retained in full, this 252485602fSUwe Kleine-König * software may be distributed under the terms of the GNU General 262485602fSUwe Kleine-König * Public License ("GPL") version 2, in which case the provisions of the 272485602fSUwe Kleine-König * GPL apply INSTEAD OF those given above. 282485602fSUwe Kleine-König * 292485602fSUwe Kleine-König * The provided data structures and external interfaces from this code 302485602fSUwe Kleine-König * are not restricted to be used by modules with a GPL compatible license. 312485602fSUwe Kleine-König * 322485602fSUwe Kleine-König * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 332485602fSUwe Kleine-König * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 342485602fSUwe Kleine-König * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 352485602fSUwe Kleine-König * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 362485602fSUwe Kleine-König * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 372485602fSUwe Kleine-König * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 382485602fSUwe Kleine-König * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 392485602fSUwe Kleine-König * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 402485602fSUwe Kleine-König * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 412485602fSUwe Kleine-König * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 422485602fSUwe Kleine-König * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 432485602fSUwe Kleine-König * DAMAGE. 44922cd657SDavid Howells */ 45922cd657SDavid Howells 4642193e3eSOliver Hartkopp #ifndef _UAPI_CAN_RAW_H 4742193e3eSOliver Hartkopp #define _UAPI_CAN_RAW_H 48922cd657SDavid Howells 49922cd657SDavid Howells #include <linux/can.h> 50922cd657SDavid Howells 51922cd657SDavid Howells #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) 52735d86a8SOliver Hartkopp #define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */ 53735d86a8SOliver Hartkopp 54eb88531bSVincent Mailhol enum { 55eb88531bSVincent Mailhol SCM_CAN_RAW_ERRQUEUE = 1, 56eb88531bSVincent Mailhol }; 57922cd657SDavid Howells 58922cd657SDavid Howells /* for socket options affecting the socket (not the global system) */ 59922cd657SDavid Howells 60922cd657SDavid Howells enum { 61922cd657SDavid Howells CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ 62922cd657SDavid Howells CAN_RAW_ERR_FILTER, /* set filter for error frames */ 63922cd657SDavid Howells CAN_RAW_LOOPBACK, /* local loopback (default:on) */ 64922cd657SDavid Howells CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ 65922cd657SDavid Howells CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ 66a5581ef4SOliver Hartkopp CAN_RAW_JOIN_FILTERS, /* all filters must match to trigger */ 6762633269SOliver Hartkopp CAN_RAW_XL_FRAMES, /* allow CAN XL frames (default:off) */ 68*c83c22ecSOliver Hartkopp CAN_RAW_XL_VCID_OPTS, /* CAN XL VCID configuration options */ 69922cd657SDavid Howells }; 70922cd657SDavid Howells 71*c83c22ecSOliver Hartkopp /* configuration for CAN XL virtual CAN identifier (VCID) handling */ 72*c83c22ecSOliver Hartkopp struct can_raw_vcid_options { 73*c83c22ecSOliver Hartkopp 74*c83c22ecSOliver Hartkopp __u8 flags; /* flags for vcid (filter) behaviour */ 75*c83c22ecSOliver Hartkopp __u8 tx_vcid; /* VCID value set into canxl_frame.prio */ 76*c83c22ecSOliver Hartkopp __u8 rx_vcid; /* VCID value for VCID filter */ 77*c83c22ecSOliver Hartkopp __u8 rx_vcid_mask; /* VCID mask for VCID filter */ 78*c83c22ecSOliver Hartkopp 79*c83c22ecSOliver Hartkopp }; 80*c83c22ecSOliver Hartkopp 81*c83c22ecSOliver Hartkopp /* can_raw_vcid_options.flags for CAN XL virtual CAN identifier handling */ 82*c83c22ecSOliver Hartkopp #define CAN_RAW_XL_VCID_TX_SET 0x01 83*c83c22ecSOliver Hartkopp #define CAN_RAW_XL_VCID_TX_PASS 0x02 84*c83c22ecSOliver Hartkopp #define CAN_RAW_XL_VCID_RX_FILTER 0x04 85*c83c22ecSOliver Hartkopp 8642193e3eSOliver Hartkopp #endif /* !_UAPI_CAN_RAW_H */ 87