Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pep.h
Go to the documentation of this file.
1 /*
2  * File: pep.h
3  *
4  * Phonet Pipe End Point sockets definitions
5  *
6  * Copyright (C) 2008 Nokia Corporation.
7  *
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.
11  *
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.
16  *
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
20  * 02110-1301 USA
21  */
22 
23 #ifndef NET_PHONET_PEP_H
24 #define NET_PHONET_PEP_H
25 
26 struct pep_sock {
27  struct pn_sock pn_sk;
28 
29  /* XXX: union-ify listening vs connected stuff ? */
30  /* Listening socket stuff: */
31  struct hlist_head hlist;
32 
33  /* Connected socket stuff: */
34  struct sock *listener;
36 #define PNPIPE_CTRLREQ_MAX 10
38  int ifindex;
39  u16 peer_type; /* peer type/subtype */
41 
43  u8 rx_fc; /* RX flow control */
44  u8 tx_fc; /* TX flow control */
45  u8 init_enable; /* auto-enable at creation */
47 };
48 
49 static inline struct pep_sock *pep_sk(struct sock *sk)
50 {
51  return (struct pep_sock *)sk;
52 }
53 
54 extern const struct proto_ops phonet_stream_ops;
55 
56 /* Pipe protocol definitions */
57 struct pnpipehdr {
58  u8 utid; /* transaction ID */
61  union {
62  u8 state_after_connect; /* connect request */
63  u8 state_after_reset; /* reset request */
64  u8 error_code; /* any response */
65  u8 pep_type; /* status indication */
66  u8 data[1];
67  };
68 };
69 #define other_pep_type data[1]
70 
71 static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
72 {
73  return (struct pnpipehdr *)skb_transport_header(skb);
74 }
75 
76 #define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4)
77 
78 enum {
83 
84  PNS_PIPE_DATA = 0x20,
86 
99 
106 };
107 
108 #define PN_PIPE_INVALID_HANDLE 0xff
109 #define PN_PEP_TYPE_COMMON 0x00
110 
111 /* Phonet pipe status indication */
112 enum {
115 };
116 
117 /* Phonet pipe error codes */
118 enum {
131 };
132 
133 /* Phonet pipe states */
134 enum {
137 };
138 
139 /* Phonet pipe sub-block types */
140 enum {
148 };
149 
150 /* Phonet pipe flow control models */
151 enum {
157 };
158 
159 #define pn_flow_safe(fc) ((fc) >> 1)
160 
161 /* Phonet pipe flow control states */
162 enum {
166 };
167 
168 #endif