~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/phonet.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/uapi/linux/phonet.h (Version linux-6.12-rc7) and /include/uapi/linux/phonet.h (Version linux-4.20.17)


  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux      1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 /**                                                 2 /**
  3  * file phonet.h                                    3  * file phonet.h
  4  *                                                  4  *
  5  * Phonet sockets kernel interface                  5  * Phonet sockets kernel interface
  6  *                                                  6  *
  7  * Copyright (C) 2008 Nokia Corporation. All r      7  * Copyright (C) 2008 Nokia Corporation. All rights reserved.
  8  *                                                  8  *
  9  * This program is free software; you can redi      9  * This program is free software; you can redistribute it and/or
 10  * modify it under the terms of the GNU Genera     10  * modify it under the terms of the GNU General Public License
 11  * version 2 as published by the Free Software     11  * version 2 as published by the Free Software Foundation.
 12  *                                                 12  *
 13  * This program is distributed in the hope tha     13  * This program is distributed in the hope that it will be useful, but
 14  * WITHOUT ANY WARRANTY; without even the impl     14  * WITHOUT ANY WARRANTY; without even the implied warranty of
 15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16  * General Public License for more details.        16  * General Public License for more details.
 17  *                                                 17  *
 18  * You should have received a copy of the GNU      18  * You should have received a copy of the GNU General Public License
 19  * along with this program; if not, write to t     19  * along with this program; if not, write to the Free Software
 20  * Foundation, Inc., 51 Franklin St, Fifth Flo     20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 21  * 02110-1301 USA                                  21  * 02110-1301 USA
 22  */                                                22  */
 23                                                    23 
 24 #ifndef _UAPILINUX_PHONET_H                        24 #ifndef _UAPILINUX_PHONET_H
 25 #define _UAPILINUX_PHONET_H                        25 #define _UAPILINUX_PHONET_H
 26                                                    26 
 27 #include <linux/types.h>                           27 #include <linux/types.h>
 28 #include <linux/socket.h>                          28 #include <linux/socket.h>
 29                                                    29 
 30 /* Automatic protocol selection */                 30 /* Automatic protocol selection */
 31 #define PN_PROTO_TRANSPORT      0                  31 #define PN_PROTO_TRANSPORT      0
 32 /* Phonet datagram socket */                       32 /* Phonet datagram socket */
 33 #define PN_PROTO_PHONET         1                  33 #define PN_PROTO_PHONET         1
 34 /* Phonet pipe */                                  34 /* Phonet pipe */
 35 #define PN_PROTO_PIPE           2                  35 #define PN_PROTO_PIPE           2
 36 #define PHONET_NPROTO           3                  36 #define PHONET_NPROTO           3
 37                                                    37 
 38 /* Socket options for SOL_PNPIPE level */          38 /* Socket options for SOL_PNPIPE level */
 39 #define PNPIPE_ENCAP            1                  39 #define PNPIPE_ENCAP            1
 40 #define PNPIPE_IFINDEX          2                  40 #define PNPIPE_IFINDEX          2
 41 #define PNPIPE_HANDLE           3                  41 #define PNPIPE_HANDLE           3
 42 #define PNPIPE_INITSTATE        4                  42 #define PNPIPE_INITSTATE        4
 43                                                    43 
 44 #define PNADDR_ANY              0                  44 #define PNADDR_ANY              0
 45 #define PNADDR_BROADCAST        0xFC               45 #define PNADDR_BROADCAST        0xFC
 46 #define PNPORT_RESOURCE_ROUTING 0                  46 #define PNPORT_RESOURCE_ROUTING 0
 47                                                    47 
 48 /* Values for PNPIPE_ENCAP option */               48 /* Values for PNPIPE_ENCAP option */
 49 #define PNPIPE_ENCAP_NONE       0                  49 #define PNPIPE_ENCAP_NONE       0
 50 #define PNPIPE_ENCAP_IP         1                  50 #define PNPIPE_ENCAP_IP         1
 51                                                    51 
 52 /* ioctls */                                       52 /* ioctls */
 53 #define SIOCPNGETOBJECT         (SIOCPROTOPRIV     53 #define SIOCPNGETOBJECT         (SIOCPROTOPRIVATE + 0)
 54 #define SIOCPNENABLEPIPE        (SIOCPROTOPRIV     54 #define SIOCPNENABLEPIPE        (SIOCPROTOPRIVATE + 13)
 55 #define SIOCPNADDRESOURCE       (SIOCPROTOPRIV     55 #define SIOCPNADDRESOURCE       (SIOCPROTOPRIVATE + 14)
 56 #define SIOCPNDELRESOURCE       (SIOCPROTOPRIV     56 #define SIOCPNDELRESOURCE       (SIOCPROTOPRIVATE + 15)
 57                                                    57 
 58 /* Phonet protocol header */                       58 /* Phonet protocol header */
 59 struct phonethdr {                                 59 struct phonethdr {
 60         __u8    pn_rdev;                           60         __u8    pn_rdev;
 61         __u8    pn_sdev;                           61         __u8    pn_sdev;
 62         __u8    pn_res;                            62         __u8    pn_res;
 63         __be16  pn_length;                         63         __be16  pn_length;
 64         __u8    pn_robj;                           64         __u8    pn_robj;
 65         __u8    pn_sobj;                           65         __u8    pn_sobj;
 66 } __attribute__((packed));                         66 } __attribute__((packed));
 67                                                    67 
 68 /* Common Phonet payload header */                 68 /* Common Phonet payload header */
 69 struct phonetmsg {                                 69 struct phonetmsg {
 70         __u8    pn_trans_id;    /* transaction     70         __u8    pn_trans_id;    /* transaction ID */
 71         __u8    pn_msg_id;      /* message typ     71         __u8    pn_msg_id;      /* message type */
 72         union {                                    72         union {
 73                 struct {                           73                 struct {
 74                         __u8    pn_submsg_id;      74                         __u8    pn_submsg_id;   /* message subtype */
 75                         __u8    pn_data[5];        75                         __u8    pn_data[5];
 76                 } base;                            76                 } base;
 77                 struct {                           77                 struct {
 78                         __u16   pn_e_res_id;       78                         __u16   pn_e_res_id;    /* extended resource ID */
 79                         __u8    pn_e_submsg_id     79                         __u8    pn_e_submsg_id; /* message subtype */
 80                         __u8    pn_e_data[3];      80                         __u8    pn_e_data[3];
 81                 } ext;                             81                 } ext;
 82         } pn_msg_u;                                82         } pn_msg_u;
 83 };                                                 83 };
 84 #define PN_COMMON_MESSAGE       0xF0               84 #define PN_COMMON_MESSAGE       0xF0
 85 #define PN_COMMGR               0x10               85 #define PN_COMMGR               0x10
 86 #define PN_PREFIX               0xE0 /* resour     86 #define PN_PREFIX               0xE0 /* resource for extended messages */
 87 #define pn_submsg_id            pn_msg_u.base.     87 #define pn_submsg_id            pn_msg_u.base.pn_submsg_id
 88 #define pn_e_submsg_id          pn_msg_u.ext.p     88 #define pn_e_submsg_id          pn_msg_u.ext.pn_e_submsg_id
 89 #define pn_e_res_id             pn_msg_u.ext.p     89 #define pn_e_res_id             pn_msg_u.ext.pn_e_res_id
 90 #define pn_data                 pn_msg_u.base.     90 #define pn_data                 pn_msg_u.base.pn_data
 91 #define pn_e_data               pn_msg_u.ext.p     91 #define pn_e_data               pn_msg_u.ext.pn_e_data
 92                                                    92 
 93 /* data for unreachable errors */                  93 /* data for unreachable errors */
 94 #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP        94 #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP     0x01
 95 #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP      95 #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP   0x14
 96 #define pn_orig_msg_id          pn_data[0]         96 #define pn_orig_msg_id          pn_data[0]
 97 #define pn_status               pn_data[1]         97 #define pn_status               pn_data[1]
 98 #define pn_e_orig_msg_id        pn_e_data[0]       98 #define pn_e_orig_msg_id        pn_e_data[0]
 99 #define pn_e_status             pn_e_data[1]       99 #define pn_e_status             pn_e_data[1]
100                                                   100 
101 /* Phonet socket address structure */             101 /* Phonet socket address structure */
102 struct sockaddr_pn {                              102 struct sockaddr_pn {
103         __kernel_sa_family_t spn_family;          103         __kernel_sa_family_t spn_family;
104         __u8 spn_obj;                             104         __u8 spn_obj;
105         __u8 spn_dev;                             105         __u8 spn_dev;
106         __u8 spn_resource;                        106         __u8 spn_resource;
107         __u8 spn_zero[sizeof(struct sockaddr)     107         __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
108 } __attribute__((packed));                        108 } __attribute__((packed));
109                                                   109 
110 /* Well known address */                          110 /* Well known address */
111 #define PN_DEV_PC       0x10                      111 #define PN_DEV_PC       0x10
112                                                   112 
113 static inline __u16 pn_object(__u8 addr, __u16    113 static inline __u16 pn_object(__u8 addr, __u16 port)
114 {                                                 114 {
115         return (addr << 8) | (port & 0x3ff);      115         return (addr << 8) | (port & 0x3ff);
116 }                                                 116 }
117                                                   117 
118 static inline __u8 pn_obj(__u16 handle)           118 static inline __u8 pn_obj(__u16 handle)
119 {                                                 119 {
120         return handle & 0xff;                     120         return handle & 0xff;
121 }                                                 121 }
122                                                   122 
123 static inline __u8 pn_dev(__u16 handle)           123 static inline __u8 pn_dev(__u16 handle)
124 {                                                 124 {
125         return handle >> 8;                       125         return handle >> 8;
126 }                                                 126 }
127                                                   127 
128 static inline __u16 pn_port(__u16 handle)         128 static inline __u16 pn_port(__u16 handle)
129 {                                                 129 {
130         return handle & 0x3ff;                    130         return handle & 0x3ff;
131 }                                                 131 }
132                                                   132 
133 static inline __u8 pn_addr(__u16 handle)          133 static inline __u8 pn_addr(__u16 handle)
134 {                                                 134 {
135         return (handle >> 8) & 0xfc;              135         return (handle >> 8) & 0xfc;
136 }                                                 136 }
137                                                   137 
138 static inline void pn_sockaddr_set_addr(struct    138 static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
139 {                                                 139 {
140         spn->spn_dev &= 0x03;                     140         spn->spn_dev &= 0x03;
141         spn->spn_dev |= addr & 0xfc;              141         spn->spn_dev |= addr & 0xfc;
142 }                                                 142 }
143                                                   143 
144 static inline void pn_sockaddr_set_port(struct    144 static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
145 {                                                 145 {
146         spn->spn_dev &= 0xfc;                     146         spn->spn_dev &= 0xfc;
147         spn->spn_dev |= (port >> 8) & 0x03;       147         spn->spn_dev |= (port >> 8) & 0x03;
148         spn->spn_obj = port & 0xff;               148         spn->spn_obj = port & 0xff;
149 }                                                 149 }
150                                                   150 
151 static inline void pn_sockaddr_set_object(stru    151 static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,
152                                                   152                                                 __u16 handle)
153 {                                                 153 {
154         spn->spn_dev = pn_dev(handle);            154         spn->spn_dev = pn_dev(handle);
155         spn->spn_obj = pn_obj(handle);            155         spn->spn_obj = pn_obj(handle);
156 }                                                 156 }
157                                                   157 
158 static inline void pn_sockaddr_set_resource(st    158 static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,
159                                                   159                                                 __u8 resource)
160 {                                                 160 {
161         spn->spn_resource = resource;             161         spn->spn_resource = resource;
162 }                                                 162 }
163                                                   163 
164 static inline __u8 pn_sockaddr_get_addr(const     164 static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)
165 {                                                 165 {
166         return spn->spn_dev & 0xfc;               166         return spn->spn_dev & 0xfc;
167 }                                                 167 }
168                                                   168 
169 static inline __u16 pn_sockaddr_get_port(const    169 static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)
170 {                                                 170 {
171         return ((spn->spn_dev & 0x03) << 8) |     171         return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;
172 }                                                 172 }
173                                                   173 
174 static inline __u16 pn_sockaddr_get_object(con    174 static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)
175 {                                                 175 {
176         return pn_object(spn->spn_dev, spn->sp    176         return pn_object(spn->spn_dev, spn->spn_obj);
177 }                                                 177 }
178                                                   178 
179 static inline __u8 pn_sockaddr_get_resource(co    179 static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
180 {                                                 180 {
181         return spn->spn_resource;                 181         return spn->spn_resource;
182 }                                                 182 }
183                                                   183 
184 /* Phonet device ioctl requests */                184 /* Phonet device ioctl requests */
185                                                   185 
186 #endif /* _UAPILINUX_PHONET_H */                  186 #endif /* _UAPILINUX_PHONET_H */
187                                                   187 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php