4 * Phonet Pipe End Point sockets definitions
6 * Copyright (C) 2008 Nokia Corporation.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 #ifndef NET_PHONET_PEP_H
24 #define NET_PHONET_PEP_H
29 /* XXX: union-ify listening vs connected stuff ? */
30 /* Listening socket stuff: */
31 struct hlist_head ackq
;
32 struct hlist_head hlist
;
34 /* Connected socket stuff: */
35 struct sock
*listener
;
36 struct sk_buff_head ctrlreq_queue
;
37 #define PNPIPE_CTRLREQ_MAX 10
40 u16 peer_type
; /* peer type/subtype */
44 u8 rx_fc
; /* RX flow control */
45 u8 tx_fc
; /* TX flow control */
46 u8 init_enable
; /* auto-enable at creation */
48 #ifdef CONFIG_PHONET_PIPECTRLR
50 struct sockaddr_pn remote_pep
;
54 static inline struct pep_sock
*pep_sk(struct sock
*sk
)
56 return (struct pep_sock
*)sk
;
59 extern const struct proto_ops phonet_stream_ops
;
61 /* Pipe protocol definitions */
63 u8 utid
; /* transaction ID */
67 u8 state_after_connect
; /* connect request */
68 u8 state_after_reset
; /* reset request */
69 u8 error_code
; /* any response */
70 u8 pep_type
; /* status indication */
74 #define other_pep_type data[1]
76 static inline struct pnpipehdr
*pnp_hdr(struct sk_buff
*skb
)
78 return (struct pnpipehdr
*)skb_transport_header(skb
);
81 #define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4)
84 PNS_PIPE_CREATE_REQ
= 0x00,
90 PNS_PIPE_ALIGNED_DATA
,
92 PNS_PEP_CONNECT_REQ
= 0x40,
94 PNS_PEP_DISCONNECT_REQ
,
95 PNS_PEP_DISCONNECT_RESP
,
102 PNS_PEP_DISABLE_REQ
= 0x4C,
103 PNS_PEP_DISABLE_RESP
,
105 PNS_PEP_STATUS_IND
= 0x60,
106 PNS_PIPE_CREATED_IND
,
107 PNS_PIPE_RESET_IND
= 0x63,
108 PNS_PIPE_ENABLED_IND
,
109 PNS_PIPE_REDIRECTED_IND
,
110 PNS_PIPE_DISABLED_IND
= 0x66,
113 #define PN_PIPE_INVALID_HANDLE 0xff
114 #define PN_PEP_TYPE_COMMON 0x00
116 /* Phonet pipe status indication */
118 PN_PEP_IND_FLOW_CONTROL
,
119 PN_PEP_IND_ID_MCFC_GRANT_CREDITS
,
122 /* Phonet pipe error codes */
125 PN_PIPE_ERR_INVALID_PARAM
,
126 PN_PIPE_ERR_INVALID_HANDLE
,
127 PN_PIPE_ERR_INVALID_CTRL_ID
,
128 PN_PIPE_ERR_NOT_ALLOWED
,
129 PN_PIPE_ERR_PEP_IN_USE
,
130 PN_PIPE_ERR_OVERLOAD
,
131 PN_PIPE_ERR_DEV_DISCONNECTED
,
133 PN_PIPE_ERR_ALL_PIPES_IN_USE
,
135 PN_PIPE_ERR_NOT_SUPPORTED
,
138 /* Phonet pipe states */
144 /* Phonet pipe sub-block types */
146 PN_PIPE_SB_CREATE_REQ_PEP_SUB_TYPE
,
147 PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE
,
148 PN_PIPE_SB_REDIRECT_REQ_PEP_SUB_TYPE
,
149 PN_PIPE_SB_NEGOTIATED_FC
,
150 PN_PIPE_SB_REQUIRED_FC_TX
,
151 PN_PIPE_SB_PREFERRED_FC_RX
,
152 PN_PIPE_SB_ALIGNED_DATA
,
155 /* Phonet pipe flow control models */
158 PN_LEGACY_FLOW_CONTROL
,
159 PN_ONE_CREDIT_FLOW_CONTROL
,
160 PN_MULTI_CREDIT_FLOW_CONTROL
,
163 #define pn_flow_safe(fc) ((fc) >> 1)
165 /* Phonet pipe flow control states */
172 #ifdef CONFIG_PHONET_PIPECTRLR
173 #define PNS_PEP_CONNECT_UTID 0x02
174 #define PNS_PIPE_CREATED_IND_UTID 0x04
175 #define PNS_PIPE_ENABLE_UTID 0x0A
176 #define PNS_PIPE_ENABLED_IND_UTID 0x0C
177 #define PNS_PIPE_DISABLE_UTID 0x0F
178 #define PNS_PIPE_DISABLED_IND_UTID 0x11
179 #define PNS_PEP_DISCONNECT_UTID 0x06
181 /* Used for tracking state of a pipe */
187 #endif /* CONFIG_PHONET_PIPECTRLR */