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