18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* linux/caif_socket.h 38c2ecf20Sopenharmony_ci * CAIF Definitions for CAIF socket and network layer 48c2ecf20Sopenharmony_ci * Copyright (C) ST-Ericsson AB 2010 58c2ecf20Sopenharmony_ci * Author: Sjur Brendeland 68c2ecf20Sopenharmony_ci * License terms: GNU General Public License (GPL) version 2 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _LINUX_CAIF_SOCKET_H 108c2ecf20Sopenharmony_ci#define _LINUX_CAIF_SOCKET_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/types.h> 138c2ecf20Sopenharmony_ci#include <linux/socket.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/** 168c2ecf20Sopenharmony_ci * enum caif_link_selector - Physical Link Selection. 178c2ecf20Sopenharmony_ci * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth 188c2ecf20Sopenharmony_ci * traffic. 198c2ecf20Sopenharmony_ci * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency 208c2ecf20Sopenharmony_ci * traffic. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * CAIF Link Layers can register their link properties. 238c2ecf20Sopenharmony_ci * This enum is used for choosing between CAIF Link Layers when 248c2ecf20Sopenharmony_ci * setting up CAIF Channels when multiple CAIF Link Layers exists. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_cienum caif_link_selector { 278c2ecf20Sopenharmony_ci CAIF_LINK_HIGH_BANDW, 288c2ecf20Sopenharmony_ci CAIF_LINK_LOW_LATENCY 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/** 328c2ecf20Sopenharmony_ci * enum caif_channel_priority - CAIF channel priorities. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * @CAIF_PRIO_MIN: Min priority for a channel. 358c2ecf20Sopenharmony_ci * @CAIF_PRIO_LOW: Low-priority channel. 368c2ecf20Sopenharmony_ci * @CAIF_PRIO_NORMAL: Normal/default priority level. 378c2ecf20Sopenharmony_ci * @CAIF_PRIO_HIGH: High priority level 388c2ecf20Sopenharmony_ci * @CAIF_PRIO_MAX: Max priority for channel 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * Priority can be set on CAIF Channels in order to 418c2ecf20Sopenharmony_ci * prioritize between traffic on different CAIF Channels. 428c2ecf20Sopenharmony_ci * These priority levels are recommended, but the priority value 438c2ecf20Sopenharmony_ci * is not restricted to the values defined in this enum, any value 448c2ecf20Sopenharmony_ci * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_cienum caif_channel_priority { 478c2ecf20Sopenharmony_ci CAIF_PRIO_MIN = 0x01, 488c2ecf20Sopenharmony_ci CAIF_PRIO_LOW = 0x04, 498c2ecf20Sopenharmony_ci CAIF_PRIO_NORMAL = 0x0f, 508c2ecf20Sopenharmony_ci CAIF_PRIO_HIGH = 0x14, 518c2ecf20Sopenharmony_ci CAIF_PRIO_MAX = 0x1F 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/** 558c2ecf20Sopenharmony_ci * enum caif_protocol_type - CAIF Channel type. 568c2ecf20Sopenharmony_ci * @CAIFPROTO_AT: Classic AT channel. 578c2ecf20Sopenharmony_ci * @CAIFPROTO_DATAGRAM: Datagram channel. 588c2ecf20Sopenharmony_ci * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. 598c2ecf20Sopenharmony_ci * @CAIFPROTO_UTIL: Utility (Psock) channel. 608c2ecf20Sopenharmony_ci * @CAIFPROTO_RFM: Remote File Manager 618c2ecf20Sopenharmony_ci * @CAIFPROTO_DEBUG: Debug link 628c2ecf20Sopenharmony_ci * 638c2ecf20Sopenharmony_ci * This enum defines the CAIF Channel type to be used. This defines 648c2ecf20Sopenharmony_ci * the service to connect to on the modem. 658c2ecf20Sopenharmony_ci */ 668c2ecf20Sopenharmony_cienum caif_protocol_type { 678c2ecf20Sopenharmony_ci CAIFPROTO_AT, 688c2ecf20Sopenharmony_ci CAIFPROTO_DATAGRAM, 698c2ecf20Sopenharmony_ci CAIFPROTO_DATAGRAM_LOOP, 708c2ecf20Sopenharmony_ci CAIFPROTO_UTIL, 718c2ecf20Sopenharmony_ci CAIFPROTO_RFM, 728c2ecf20Sopenharmony_ci CAIFPROTO_DEBUG, 738c2ecf20Sopenharmony_ci _CAIFPROTO_MAX 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci#define CAIFPROTO_MAX _CAIFPROTO_MAX 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/** 788c2ecf20Sopenharmony_ci * enum caif_at_type - AT Service Endpoint 798c2ecf20Sopenharmony_ci * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. 808c2ecf20Sopenharmony_ci */ 818c2ecf20Sopenharmony_cienum caif_at_type { 828c2ecf20Sopenharmony_ci CAIF_ATTYPE_PLAIN = 2 838c2ecf20Sopenharmony_ci}; 848c2ecf20Sopenharmony_ci /** 858c2ecf20Sopenharmony_ci * enum caif_debug_type - Content selection for debug connection 868c2ecf20Sopenharmony_ci * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain 878c2ecf20Sopenharmony_ci * both trace and interactive debug. 888c2ecf20Sopenharmony_ci * @CAIF_DEBUG_TRACE: Connection contains trace only. 898c2ecf20Sopenharmony_ci * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug. 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_cienum caif_debug_type { 928c2ecf20Sopenharmony_ci CAIF_DEBUG_TRACE_INTERACTIVE = 0, 938c2ecf20Sopenharmony_ci CAIF_DEBUG_TRACE, 948c2ecf20Sopenharmony_ci CAIF_DEBUG_INTERACTIVE, 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/** 988c2ecf20Sopenharmony_ci * enum caif_debug_service - Debug Service Endpoint 998c2ecf20Sopenharmony_ci * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system 1008c2ecf20Sopenharmony_ci * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system 1018c2ecf20Sopenharmony_ci */ 1028c2ecf20Sopenharmony_cienum caif_debug_service { 1038c2ecf20Sopenharmony_ci CAIF_RADIO_DEBUG_SERVICE = 1, 1048c2ecf20Sopenharmony_ci CAIF_APP_DEBUG_SERVICE 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/** 1088c2ecf20Sopenharmony_ci * struct sockaddr_caif - the sockaddr structure for CAIF sockets. 1098c2ecf20Sopenharmony_ci * @family: Address family number, must be AF_CAIF. 1108c2ecf20Sopenharmony_ci * @u: Union of address data 'switched' by family. 1118c2ecf20Sopenharmony_ci * : 1128c2ecf20Sopenharmony_ci * @u.at: Applies when family = CAIFPROTO_AT. 1138c2ecf20Sopenharmony_ci * 1148c2ecf20Sopenharmony_ci * @u.at.type: Type of AT link to set up (enum caif_at_type). 1158c2ecf20Sopenharmony_ci * 1168c2ecf20Sopenharmony_ci * @u.util: Applies when family = CAIFPROTO_UTIL 1178c2ecf20Sopenharmony_ci * 1188c2ecf20Sopenharmony_ci * @u.util.service: Utility service name. 1198c2ecf20Sopenharmony_ci * 1208c2ecf20Sopenharmony_ci * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM 1218c2ecf20Sopenharmony_ci * 1228c2ecf20Sopenharmony_ci * @u.dgm.connection_id: Datagram connection id. 1238c2ecf20Sopenharmony_ci * 1248c2ecf20Sopenharmony_ci * @u.dgm.nsapi: NSAPI of the PDP-Context. 1258c2ecf20Sopenharmony_ci * 1268c2ecf20Sopenharmony_ci * @u.rfm: Applies when family = CAIFPROTO_RFM 1278c2ecf20Sopenharmony_ci * 1288c2ecf20Sopenharmony_ci * @u.rfm.connection_id: Connection ID for RFM. 1298c2ecf20Sopenharmony_ci * 1308c2ecf20Sopenharmony_ci * @u.rfm.volume: Volume to mount. 1318c2ecf20Sopenharmony_ci * 1328c2ecf20Sopenharmony_ci * @u.dbg: Applies when family = CAIFPROTO_DEBUG. 1338c2ecf20Sopenharmony_ci * 1348c2ecf20Sopenharmony_ci * @u.dbg.type: Type of debug connection to set up 1358c2ecf20Sopenharmony_ci * (caif_debug_type). 1368c2ecf20Sopenharmony_ci * 1378c2ecf20Sopenharmony_ci * @u.dbg.service: Service sub-system to connect (caif_debug_service 1388c2ecf20Sopenharmony_ci * Description: 1398c2ecf20Sopenharmony_ci * This structure holds the connect parameters used for setting up a 1408c2ecf20Sopenharmony_ci * CAIF Channel. It defines the service to connect to on the modem. 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_cistruct sockaddr_caif { 1438c2ecf20Sopenharmony_ci __kernel_sa_family_t family; 1448c2ecf20Sopenharmony_ci union { 1458c2ecf20Sopenharmony_ci struct { 1468c2ecf20Sopenharmony_ci __u8 type; /* type: enum caif_at_type */ 1478c2ecf20Sopenharmony_ci } at; /* CAIFPROTO_AT */ 1488c2ecf20Sopenharmony_ci struct { 1498c2ecf20Sopenharmony_ci char service[16]; 1508c2ecf20Sopenharmony_ci } util; /* CAIFPROTO_UTIL */ 1518c2ecf20Sopenharmony_ci union { 1528c2ecf20Sopenharmony_ci __u32 connection_id; 1538c2ecf20Sopenharmony_ci __u8 nsapi; 1548c2ecf20Sopenharmony_ci } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/ 1558c2ecf20Sopenharmony_ci struct { 1568c2ecf20Sopenharmony_ci __u32 connection_id; 1578c2ecf20Sopenharmony_ci char volume[16]; 1588c2ecf20Sopenharmony_ci } rfm; /* CAIFPROTO_RFM */ 1598c2ecf20Sopenharmony_ci struct { 1608c2ecf20Sopenharmony_ci __u8 type; /* type:enum caif_debug_type */ 1618c2ecf20Sopenharmony_ci __u8 service; /* service:caif_debug_service */ 1628c2ecf20Sopenharmony_ci } dbg; /* CAIFPROTO_DEBUG */ 1638c2ecf20Sopenharmony_ci } u; 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci/** 1678c2ecf20Sopenharmony_ci * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. 1688c2ecf20Sopenharmony_ci * 1698c2ecf20Sopenharmony_ci * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are 1708c2ecf20Sopenharmony_ci * available. Either a high bandwidth 1718c2ecf20Sopenharmony_ci * link can be selected (CAIF_LINK_HIGH_BANDW) or 1728c2ecf20Sopenharmony_ci * a low latency link (CAIF_LINK_LOW_LATENCY). 1738c2ecf20Sopenharmony_ci * This option is of type __u32. 1748c2ecf20Sopenharmony_ci * Alternatively SO_BINDTODEVICE can be used. 1758c2ecf20Sopenharmony_ci * 1768c2ecf20Sopenharmony_ci * @CAIFSO_REQ_PARAM: Used to set the request parameters for a 1778c2ecf20Sopenharmony_ci * utility channel. (maximum 256 bytes). This 1788c2ecf20Sopenharmony_ci * option must be set before connecting. 1798c2ecf20Sopenharmony_ci * 1808c2ecf20Sopenharmony_ci * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility 1818c2ecf20Sopenharmony_ci * channel. (maximum 256 bytes). This option 1828c2ecf20Sopenharmony_ci * is valid after a successful connect. 1838c2ecf20Sopenharmony_ci * 1848c2ecf20Sopenharmony_ci * 1858c2ecf20Sopenharmony_ci * This enum defines the CAIF Socket options to be used on a socket 1868c2ecf20Sopenharmony_ci * of type PF_CAIF. 1878c2ecf20Sopenharmony_ci * 1888c2ecf20Sopenharmony_ci */ 1898c2ecf20Sopenharmony_cienum caif_socket_opts { 1908c2ecf20Sopenharmony_ci CAIFSO_LINK_SELECT = 127, 1918c2ecf20Sopenharmony_ci CAIFSO_REQ_PARAM = 128, 1928c2ecf20Sopenharmony_ci CAIFSO_RSP_PARAM = 129, 1938c2ecf20Sopenharmony_ci}; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci#endif /* _LINUX_CAIF_SOCKET_H */ 196