Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /* linux/caif_socket.h
0003  * CAIF Definitions for CAIF socket and network layer
0004  * Copyright (C) ST-Ericsson AB 2010
0005  * Author:   Sjur Brendeland
0006  * License terms: GNU General Public License (GPL) version 2
0007  */
0008 
0009 #ifndef _LINUX_CAIF_SOCKET_H
0010 #define _LINUX_CAIF_SOCKET_H
0011 
0012 #include <linux/types.h>
0013 #include <linux/socket.h>
0014 
0015 /**
0016  * enum caif_link_selector -    Physical Link Selection.
0017  * @CAIF_LINK_HIGH_BANDW:   Physical interface for high-bandwidth
0018  *              traffic.
0019  * @CAIF_LINK_LOW_LATENCY:  Physical interface for low-latency
0020  *              traffic.
0021  *
0022  * CAIF Link Layers can register their link properties.
0023  * This enum is used for choosing between CAIF Link Layers when
0024  * setting up CAIF Channels when multiple CAIF Link Layers exists.
0025  */
0026 enum caif_link_selector {
0027     CAIF_LINK_HIGH_BANDW,
0028     CAIF_LINK_LOW_LATENCY
0029 };
0030 
0031 /**
0032  * enum caif_channel_priority - CAIF channel priorities.
0033  *
0034  * @CAIF_PRIO_MIN:  Min priority for a channel.
0035  * @CAIF_PRIO_LOW:  Low-priority channel.
0036  * @CAIF_PRIO_NORMAL:   Normal/default priority level.
0037  * @CAIF_PRIO_HIGH: High priority level
0038  * @CAIF_PRIO_MAX:  Max priority for channel
0039  *
0040  * Priority can be set on CAIF Channels in order to
0041  * prioritize between traffic on different CAIF Channels.
0042  * These priority levels are recommended, but the priority value
0043  * is not restricted to the values defined in this enum, any value
0044  * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
0045  */
0046 enum caif_channel_priority {
0047     CAIF_PRIO_MIN    = 0x01,
0048     CAIF_PRIO_LOW    = 0x04,
0049     CAIF_PRIO_NORMAL = 0x0f,
0050     CAIF_PRIO_HIGH   = 0x14,
0051     CAIF_PRIO_MAX    = 0x1F
0052 };
0053 
0054 /**
0055  * enum caif_protocol_type  -   CAIF Channel type.
0056  * @CAIFPROTO_AT:       Classic AT channel.
0057  * @CAIFPROTO_DATAGRAM: Datagram channel.
0058  * @CAIFPROTO_DATAGRAM_LOOP:    Datagram loopback channel, used for testing.
0059  * @CAIFPROTO_UTIL:     Utility (Psock) channel.
0060  * @CAIFPROTO_RFM:      Remote File Manager
0061  * @CAIFPROTO_DEBUG:        Debug link
0062  *
0063  * This enum defines the CAIF Channel type to be used. This defines
0064  * the service to connect to on the modem.
0065  */
0066 enum caif_protocol_type {
0067     CAIFPROTO_AT,
0068     CAIFPROTO_DATAGRAM,
0069     CAIFPROTO_DATAGRAM_LOOP,
0070     CAIFPROTO_UTIL,
0071     CAIFPROTO_RFM,
0072     CAIFPROTO_DEBUG,
0073     _CAIFPROTO_MAX
0074 };
0075 #define CAIFPROTO_MAX _CAIFPROTO_MAX
0076 
0077 /**
0078  * enum caif_at_type - AT Service Endpoint
0079  * @CAIF_ATTYPE_PLAIN:       Connects to a plain vanilla AT channel.
0080  */
0081 enum caif_at_type {
0082     CAIF_ATTYPE_PLAIN = 2
0083 };
0084  /**
0085  * enum caif_debug_type - Content selection for debug connection
0086  * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
0087  *              both trace and interactive debug.
0088  * @CAIF_DEBUG_TRACE:       Connection contains trace only.
0089  * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug.
0090  */
0091 enum caif_debug_type {
0092     CAIF_DEBUG_TRACE_INTERACTIVE = 0,
0093     CAIF_DEBUG_TRACE,
0094     CAIF_DEBUG_INTERACTIVE,
0095 };
0096 
0097 /**
0098  * enum caif_debug_service - Debug Service Endpoint
0099  * @CAIF_RADIO_DEBUG_SERVICE:   Debug service on the Radio sub-system
0100  * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system
0101  */
0102 enum caif_debug_service {
0103     CAIF_RADIO_DEBUG_SERVICE = 1,
0104     CAIF_APP_DEBUG_SERVICE
0105 };
0106 
0107 /**
0108  * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
0109  * @family:          Address family number, must be AF_CAIF.
0110  * @u:               Union of address data 'switched' by family.
0111  * :
0112  * @u.at:                    Applies when family = CAIFPROTO_AT.
0113  *
0114  * @u.at.type:               Type of AT link to set up (enum caif_at_type).
0115  *
0116  * @u.util:                  Applies when family = CAIFPROTO_UTIL
0117  *
0118  * @u.util.service:          Utility service name.
0119  *
0120  * @u.dgm:                   Applies when family = CAIFPROTO_DATAGRAM
0121  *
0122  * @u.dgm.connection_id:     Datagram connection id.
0123  *
0124  * @u.dgm.nsapi:             NSAPI of the PDP-Context.
0125  *
0126  * @u.rfm:                   Applies when family = CAIFPROTO_RFM
0127  *
0128  * @u.rfm.connection_id:     Connection ID for RFM.
0129  *
0130  * @u.rfm.volume:            Volume to mount.
0131  *
0132  * @u.dbg:            Applies when family = CAIFPROTO_DEBUG.
0133  *
0134  * @u.dbg.type:              Type of debug connection to set up
0135  *                (caif_debug_type).
0136  *
0137  * @u.dbg.service:        Service sub-system to connect (caif_debug_service
0138  * Description:
0139  * This structure holds the connect parameters used for setting up a
0140  * CAIF Channel. It defines the service to connect to on the modem.
0141  */
0142 struct sockaddr_caif {
0143     __kernel_sa_family_t  family;
0144     union {
0145         struct {
0146             __u8  type;     /* type: enum caif_at_type */
0147         } at;               /* CAIFPROTO_AT */
0148         struct {
0149             char      service[16];
0150         } util;             /* CAIFPROTO_UTIL */
0151         union {
0152             __u32 connection_id;
0153             __u8  nsapi;
0154         } dgm;              /* CAIFPROTO_DATAGRAM(_LOOP)*/
0155         struct {
0156             __u32 connection_id;
0157             char      volume[16];
0158         } rfm;              /* CAIFPROTO_RFM */
0159         struct {
0160             __u8  type;     /* type:enum caif_debug_type */
0161             __u8  service;      /* service:caif_debug_service */
0162         } dbg;              /* CAIFPROTO_DEBUG */
0163     } u;
0164 };
0165 
0166 /**
0167  * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
0168  *
0169  * @CAIFSO_LINK_SELECT:     Selector used if multiple CAIF Link layers are
0170  *              available. Either a high bandwidth
0171  *              link can be selected (CAIF_LINK_HIGH_BANDW) or
0172  *              a low latency link (CAIF_LINK_LOW_LATENCY).
0173  *                              This option is of type __u32.
0174  *              Alternatively SO_BINDTODEVICE can be used.
0175  *
0176  * @CAIFSO_REQ_PARAM:       Used to set the request parameters for a
0177  *              utility channel. (maximum 256 bytes). This
0178  *              option must be set before connecting.
0179  *
0180  * @CAIFSO_RSP_PARAM:       Gets the response parameters for a utility
0181  *              channel. (maximum 256 bytes). This option
0182  *              is valid after a successful connect.
0183  *
0184  *
0185  * This enum defines the CAIF Socket options to be used on a socket
0186  * of type PF_CAIF.
0187  *
0188  */
0189 enum caif_socket_opts {
0190     CAIFSO_LINK_SELECT  = 127,
0191     CAIFSO_REQ_PARAM    = 128,
0192     CAIFSO_RSP_PARAM    = 129,
0193 };
0194 
0195 #endif /* _LINUX_CAIF_SOCKET_H */