6 * Copyright (c) Maksim Yevmenkin <m_evmenkin@yahoo.com>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * $Id: ng_l2cap.h,v 1.2 2003/04/27 00:52:26 max Exp $
31 * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_l2cap.h,v 1.4 2005/08/31 18:13:23 emax Exp $
32 * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_l2cap.h,v 1.2 2008/06/26 23:05:40 dillon Exp $
36 * This file contains everything that application needs to know about
37 * Link Layer Control and Adaptation Protocol (L2CAP). All information
38 * was obtained from Bluetooth Specification Book v1.1.
40 * This file can be included by both kernel and userland applications.
43 #ifndef _NETGRAPH_L2CAP_H_
44 #define _NETGRAPH_L2CAP_H_
46 /**************************************************************************
47 **************************************************************************
48 ** Netgraph node hook name, type name and type cookie and commands
49 **************************************************************************
50 **************************************************************************/
52 /* Netgraph node hook names */
53 #define NG_L2CAP_HOOK_HCI "hci" /* HCI <-> L2CAP */
54 #define NG_L2CAP_HOOK_L2C "l2c" /* L2CAP <-> Upper */
55 #define NG_L2CAP_HOOK_CTL "ctl" /* L2CAP <-> User */
57 /* Node type name and type cookie */
58 #define NG_L2CAP_NODE_TYPE "l2cap"
59 #define NGM_L2CAP_COOKIE 1000774185
61 /**************************************************************************
62 **************************************************************************
63 ** Common defines and types (L2CAP)
64 **************************************************************************
65 **************************************************************************/
68 * Channel IDs are assigned relative to the instance of L2CAP node, i.e.
69 * relative to the unit. So the total number of channels that unit can have
70 * open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number
71 * does not depend on number of connections.
74 #define NG_L2CAP_NULL_CID 0x0000 /* DO NOT USE THIS CID */
75 #define NG_L2CAP_SIGNAL_CID 0x0001 /* signaling channel ID */
76 #define NG_L2CAP_CLT_CID 0x0002 /* connectionless channel ID */
77 /* 0x0003 - 0x003f Reserved */
78 #define NG_L2CAP_FIRST_CID 0x0040 /* dynamically alloc. (start) */
79 #define NG_L2CAP_LAST_CID 0xffff /* dynamically alloc. (end) */
82 #define NG_L2CAP_MTU_MINIMUM 48
83 #define NG_L2CAP_MTU_DEFAULT 672
84 #define NG_L2CAP_MTU_MAXIMUM 0xffff
86 /* L2CAP flush and link timeouts */
87 #define NG_L2CAP_FLUSH_TIMO_DEFAULT 0xffff /* always retransmit */
88 #define NG_L2CAP_LINK_TIMO_DEFAULT 0xffff
90 /* L2CAP Command Reject reasons */
91 #define NG_L2CAP_REJ_NOT_UNDERSTOOD 0x0000
92 #define NG_L2CAP_REJ_MTU_EXCEEDED 0x0001
93 #define NG_L2CAP_REJ_INVALID_CID 0x0002
94 /* 0x0003 - 0xffff - reserved for future use */
96 /* Protocol/Service Multioplexor (PSM) values */
97 #define NG_L2CAP_PSM_ANY 0x0000 /* Any/Invalid PSM */
98 #define NG_L2CAP_PSM_SDP 0x0001 /* Service Discovery Protocol */
99 #define NG_L2CAP_PSM_RFCOMM 0x0003 /* RFCOMM protocol */
100 #define NG_L2CAP_PSM_TCP 0x0005 /* Telephony Control Protocol */
101 /* 0x0006 - 0x1000 - reserved for future use */
103 /* L2CAP Connection response command result codes */
104 #define NG_L2CAP_SUCCESS 0x0000
105 #define NG_L2CAP_PENDING 0x0001
106 #define NG_L2CAP_PSM_NOT_SUPPORTED 0x0002
107 #define NG_L2CAP_SEQUIRY_BLOCK 0x0003
108 #define NG_L2CAP_NO_RESOURCES 0x0004
109 #define NG_L2CAP_TIMEOUT 0xeeee
110 #define NG_L2CAP_UNKNOWN 0xffff
111 /* 0x0005 - 0xffff - reserved for future use */
113 /* L2CAP Connection response status codes */
114 #define NG_L2CAP_NO_INFO 0x0000
115 #define NG_L2CAP_AUTH_PENDING 0x0001
116 #define NG_L2CAP_AUTZ_PENDING 0x0002
117 /* 0x0003 - 0xffff - reserved for future use */
119 /* L2CAP Configuration response result codes */
120 #define NG_L2CAP_UNACCEPTABLE_PARAMS 0x0001
121 #define NG_L2CAP_REJECT 0x0002
122 #define NG_L2CAP_UNKNOWN_OPTION 0x0003
123 /* 0x0003 - 0xffff - reserved for future use */
125 /* L2CAP Configuration options */
126 #define NG_L2CAP_OPT_CFLAG_BIT 0x0001
127 #define NG_L2CAP_OPT_CFLAG(flags) ((flags) & NG_L2CAP_OPT_CFLAG_BIT)
128 #define NG_L2CAP_OPT_HINT_BIT 0x80
129 #define NG_L2CAP_OPT_HINT(type) ((type) & NG_L2CAP_OPT_HINT_BIT)
130 #define NG_L2CAP_OPT_HINT_MASK 0x7f
131 #define NG_L2CAP_OPT_MTU 0x01
132 #define NG_L2CAP_OPT_MTU_SIZE sizeof(u_int16_t)
133 #define NG_L2CAP_OPT_FLUSH_TIMO 0x02
134 #define NG_L2CAP_OPT_FLUSH_TIMO_SIZE sizeof(u_int16_t)
135 #define NG_L2CAP_OPT_QOS 0x03
136 #define NG_L2CAP_OPT_QOS_SIZE sizeof(ng_l2cap_flow_t)
137 /* 0x4 - 0xff - reserved for future use */
139 /* L2CAP Information request type codes */
140 #define NG_L2CAP_CONNLESS_MTU 0x0001
141 /* 0x0002 - 0xffff - reserved for future use */
143 /* L2CAP Information response codes */
144 #define NG_L2CAP_NOT_SUPPORTED 0x0001
145 /* 0x0002 - 0xffff - reserved for future use */
147 /* L2CAP flow control */
149 u_int8_t flags; /* reserved for future use */
150 u_int8_t service_type; /* service type */
151 u_int32_t token_rate; /* bytes per second */
152 u_int32_t token_bucket_size; /* bytes */
153 u_int32_t peak_bandwidth; /* bytes per second */
154 u_int32_t latency; /* microseconds */
155 u_int32_t delay_variation; /* microseconds */
156 } __attribute__ ((packed)) ng_l2cap_flow_t;
157 typedef ng_l2cap_flow_t * ng_l2cap_flow_p;
159 /**************************************************************************
160 **************************************************************************
161 ** Link level defines, headers and types
162 **************************************************************************
163 **************************************************************************/
167 u_int16_t length; /* payload size */
168 u_int16_t dcid; /* destination channel ID */
169 } __attribute__ ((packed)) ng_l2cap_hdr_t;
171 /* L2CAP ConnectionLess Traffic (CLT) (if destination cid == 0x2) */
173 u_int16_t psm; /* Protocol/Service Multiplexor */
174 } __attribute__ ((packed)) ng_l2cap_clt_hdr_t;
176 #define NG_L2CAP_CLT_MTU_MAXIMUM \
177 (NG_L2CAP_MTU_MAXIMUM - sizeof(ng_l2cap_clt_hdr_t))
179 /* L2CAP command header */
181 u_int8_t code; /* command OpCode */
182 u_int8_t ident; /* identifier to match request and response */
183 u_int16_t length; /* command parameters length */
184 } __attribute__ ((packed)) ng_l2cap_cmd_hdr_t;
186 /* L2CAP Command Reject */
187 #define NG_L2CAP_CMD_REJ 0x01
189 u_int16_t reason; /* reason to reject command */
190 /* u_int8_t data[]; -- optional data (depends on reason) */
191 } __attribute__ ((packed)) ng_l2cap_cmd_rej_cp;
193 /* CommandReject data */
195 /* NG_L2CAP_REJ_MTU_EXCEEDED */
197 u_int16_t mtu; /* actual signaling MTU */
198 } __attribute__ ((packed)) mtu;
199 /* NG_L2CAP_REJ_INVALID_CID */
201 u_int16_t scid; /* local CID */
202 u_int16_t dcid; /* remote CID */
203 } __attribute__ ((packed)) cid;
204 } ng_l2cap_cmd_rej_data_t;
205 typedef ng_l2cap_cmd_rej_data_t * ng_l2cap_cmd_rej_data_p;
207 /* L2CAP Connection Request */
208 #define NG_L2CAP_CON_REQ 0x02
210 u_int16_t psm; /* Protocol/Service Multiplexor (PSM) */
211 u_int16_t scid; /* source channel ID */
212 } __attribute__ ((packed)) ng_l2cap_con_req_cp;
214 /* L2CAP Connection Response */
215 #define NG_L2CAP_CON_RSP 0x03
217 u_int16_t dcid; /* destination channel ID */
218 u_int16_t scid; /* source channel ID */
219 u_int16_t result; /* 0x00 - success */
220 u_int16_t status; /* more info if result != 0x00 */
221 } __attribute__ ((packed)) ng_l2cap_con_rsp_cp;
223 /* L2CAP Configuration Request */
224 #define NG_L2CAP_CFG_REQ 0x04
226 u_int16_t dcid; /* destination channel ID */
227 u_int16_t flags; /* flags */
228 /* u_int8_t options[] -- options */
229 } __attribute__ ((packed)) ng_l2cap_cfg_req_cp;
231 /* L2CAP Configuration Response */
232 #define NG_L2CAP_CFG_RSP 0x05
234 u_int16_t scid; /* source channel ID */
235 u_int16_t flags; /* flags */
236 u_int16_t result; /* 0x00 - success */
237 /* u_int8_t options[] -- options */
238 } __attribute__ ((packed)) ng_l2cap_cfg_rsp_cp;
240 /* L2CAP configuration option */
244 /* u_int8_t value[] -- option value (depends on type) */
245 } __attribute__ ((packed)) ng_l2cap_cfg_opt_t;
246 typedef ng_l2cap_cfg_opt_t * ng_l2cap_cfg_opt_p;
248 /* L2CAP configuration option value */
250 u_int16_t mtu; /* NG_L2CAP_OPT_MTU */
251 u_int16_t flush_timo; /* NG_L2CAP_OPT_FLUSH_TIMO */
252 ng_l2cap_flow_t flow; /* NG_L2CAP_OPT_QOS */
253 } ng_l2cap_cfg_opt_val_t;
254 typedef ng_l2cap_cfg_opt_val_t * ng_l2cap_cfg_opt_val_p;
256 /* L2CAP Disconnect Request */
257 #define NG_L2CAP_DISCON_REQ 0x06
259 u_int16_t dcid; /* destination channel ID */
260 u_int16_t scid; /* source channel ID */
261 } __attribute__ ((packed)) ng_l2cap_discon_req_cp;
263 /* L2CAP Disconnect Response */
264 #define NG_L2CAP_DISCON_RSP 0x07
265 typedef ng_l2cap_discon_req_cp ng_l2cap_discon_rsp_cp;
267 /* L2CAP Echo Request */
268 #define NG_L2CAP_ECHO_REQ 0x08
269 /* No command parameters, only optional data */
271 /* L2CAP Echo Response */
272 #define NG_L2CAP_ECHO_RSP 0x09
273 #define NG_L2CAP_MAX_ECHO_SIZE \
274 (NG_L2CAP_MTU_MAXIMUM - sizeof(ng_l2cap_cmd_hdr_t))
275 /* No command parameters, only optional data */
277 /* L2CAP Information Request */
278 #define NG_L2CAP_INFO_REQ 0x0a
280 u_int16_t type; /* requested information type */
281 } __attribute__ ((packed)) ng_l2cap_info_req_cp;
283 /* L2CAP Information Response */
284 #define NG_L2CAP_INFO_RSP 0x0b
286 u_int16_t type; /* requested information type */
287 u_int16_t result; /* 0x00 - success */
288 /* u_int8_t info[] -- info data (depends on type)
290 * NG_L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU
292 } __attribute__ ((packed)) ng_l2cap_info_rsp_cp;
295 /* NG_L2CAP_CONNLESS_MTU */
298 } __attribute__ ((packed)) mtu;
299 } ng_l2cap_info_rsp_data_t;
300 typedef ng_l2cap_info_rsp_data_t * ng_l2cap_info_rsp_data_p;
302 /**************************************************************************
303 **************************************************************************
304 ** Upper layer protocol interface. L2CA_xxx messages
305 **************************************************************************
306 **************************************************************************/
311 * Bluetooth specification says that L2CA_xxx request must block until
312 * response is ready. We are not allowed to block in Netgraph, so we
313 * need to queue request and save some information that can be used
314 * later and help match request and response.
316 * The idea is to use "token" field from Netgraph message header. The
317 * upper layer protocol _MUST_ populate "token". L2CAP will queue request
318 * (using L2CAP command descriptor) and start processing. Later, when
319 * response is ready or timeout has occur L2CAP layer will create new
320 * Netgraph message, set "token" and RESP flag and send the message to
321 * the upper layer protocol.
323 * L2CA_xxx_Ind messages _WILL_NOT_ populate "token" and _WILL_NOT_
324 * set RESP flag. There is no reason for this, because they are just
325 * notifications and do not require acknowlegment.
327 * NOTE: This is _NOT_ what NG_MKRESPONSE and NG_RESPOND_MSG do, however
328 * it is somewhat similar.
331 /* L2CA data packet header */
333 u_int32_t token; /* token to use in L2CAP_L2CA_WRITE */
334 u_int16_t length; /* length of the data */
335 u_int16_t lcid; /* local channel ID */
336 } __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t;
339 #define NGM_L2CAP_L2CA_CON 0x80
342 u_int16_t psm; /* Protocol/Service Multiplexor */
343 bdaddr_t bdaddr; /* remote unit address */
344 } ng_l2cap_l2ca_con_ip;
348 u_int16_t lcid; /* local channel ID */
349 u_int16_t result; /* 0x00 - success */
350 u_int16_t status; /* if result != 0x00 */
351 } ng_l2cap_l2ca_con_op;
353 /* L2CA_ConnectInd */
354 #define NGM_L2CAP_L2CA_CON_IND 0x81
357 bdaddr_t bdaddr; /* remote unit address */
358 u_int16_t lcid; /* local channel ID */
359 u_int16_t psm; /* Procotol/Service Multiplexor */
360 u_int8_t ident; /* indentifier */
361 u_int8_t unused; /* place holder */
362 } ng_l2cap_l2ca_con_ind_ip;
363 /* No output parameters */
365 /* L2CA_ConnectRsp */
366 #define NGM_L2CAP_L2CA_CON_RSP 0x82
369 bdaddr_t bdaddr; /* remote unit address */
370 u_int8_t ident; /* "ident" from L2CAP_ConnectInd event */
371 u_int8_t unused; /* place holder */
372 u_int16_t lcid; /* local channel ID */
373 u_int16_t result; /* 0x00 - success */
374 u_int16_t status; /* if response != 0x00 */
375 } ng_l2cap_l2ca_con_rsp_ip;
379 u_int16_t result; /* 0x00 - success */
380 } ng_l2cap_l2ca_con_rsp_op;
383 #define NGM_L2CAP_L2CA_CFG 0x83
386 u_int16_t lcid; /* local channel ID */
387 u_int16_t imtu; /* receiving MTU for the local channel */
388 ng_l2cap_flow_t oflow; /* out flow */
389 u_int16_t flush_timo; /* flush timeout (msec) */
390 u_int16_t link_timo; /* link timeout (msec) */
391 } ng_l2cap_l2ca_cfg_ip;
395 u_int16_t result; /* 0x00 - success */
396 u_int16_t imtu; /* sending MTU for the remote channel */
397 ng_l2cap_flow_t oflow; /* out flow */
398 u_int16_t flush_timo; /* flush timeout (msec) */
399 } ng_l2cap_l2ca_cfg_op;
402 #define NGM_L2CAP_L2CA_CFG_RSP 0x84
405 u_int16_t lcid; /* local channel ID */
406 u_int16_t omtu; /* sending MTU for the local channel */
407 ng_l2cap_flow_t iflow; /* in FLOW */
408 } ng_l2cap_l2ca_cfg_rsp_ip;
412 u_int16_t result; /* 0x00 - sucsess */
413 } ng_l2cap_l2ca_cfg_rsp_op;
416 #define NGM_L2CAP_L2CA_CFG_IND 0x85
419 u_int16_t lcid; /* local channel ID */
420 u_int16_t omtu; /* outgoing MTU for the local channel */
421 ng_l2cap_flow_t iflow; /* in flow */
422 u_int16_t flush_timo; /* flush timeout (msec) */
423 } ng_l2cap_l2ca_cfg_ind_ip;
424 /* No output parameters */
426 /* L2CA_QoSViolationInd */
427 #define NGM_L2CAP_L2CA_QOS_IND 0x86
430 bdaddr_t bdaddr; /* remote unit address */
431 } ng_l2cap_l2ca_qos_ind_ip;
432 /* No output parameters */
434 /* L2CA_Disconnect */
435 #define NGM_L2CAP_L2CA_DISCON 0x87
438 u_int16_t lcid; /* local channel ID */
439 } ng_l2cap_l2ca_discon_ip;
443 u_int16_t result; /* 0x00 - sucsess */
444 } ng_l2cap_l2ca_discon_op;
446 /* L2CA_DisconnectInd */
447 #define NGM_L2CAP_L2CA_DISCON_IND 0x88
449 typedef ng_l2cap_l2ca_discon_ip ng_l2cap_l2ca_discon_ind_ip;
450 /* No output parameters */
452 /* L2CA_Write response */
453 #define NGM_L2CAP_L2CA_WRITE 0x89
454 /* No input parameters */
458 int result; /* result (0x00 - success) */
459 u_int16_t length; /* amount of data written */
460 u_int16_t lcid; /* local channel ID */
461 } ng_l2cap_l2ca_write_op;
463 /* L2CA_GroupCreate */
464 #define NGM_L2CAP_L2CA_GRP_CREATE 0x8a
467 u_int16_t psm; /* Protocol/Service Multiplexor */
468 } ng_l2cap_l2ca_grp_create_ip;
472 u_int16_t lcid; /* local group channel ID */
473 } ng_l2cap_l2ca_grp_create_op;
475 /* L2CA_GroupClose */
476 #define NGM_L2CAP_L2CA_GRP_CLOSE 0x8b
479 u_int16_t lcid; /* local group channel ID */
480 } ng_l2cap_l2ca_grp_close_ip;
485 * u_int16_t result; /* 0x00 - success */
486 * } ng_l2cap_l2ca_grp_close_op;
489 /* L2CA_GroupAddMember */
490 #define NGM_L2CAP_L2CA_GRP_ADD_MEMBER 0x8c
493 u_int16_t lcid; /* local group channel ID */
494 bdaddr_t bdaddr; /* remote unit address */
495 } ng_l2cap_l2ca_grp_add_member_ip;
499 u_int16_t result; /* 0x00 - success */
500 } ng_l2cap_l2ca_grp_add_member_op;
502 /* L2CA_GroupRemoveMember */
503 #define NGM_L2CAP_L2CA_GRP_REM_MEMBER 0x8d
505 typedef ng_l2cap_l2ca_grp_add_member_ip ng_l2cap_l2ca_grp_rem_member_ip;
509 * typedef ng_l2cap_l2ca_grp_add_member_op ng_l2cap_l2ca_grp_rem_member_op;
512 /* L2CA_GroupMembeship */
513 #define NGM_L2CAP_L2CA_GRP_MEMBERSHIP 0x8e
516 u_int16_t lcid; /* local group channel ID */
517 } ng_l2cap_l2ca_grp_get_members_ip;
521 u_int16_t result; /* 0x00 - success */
522 u_int16_t nmembers; /* number of group members */
523 /* bdaddr_t members[] -- group memebers */
524 } ng_l2cap_l2ca_grp_get_members_op;
527 #define NGM_L2CAP_L2CA_PING 0x8f
530 bdaddr_t bdaddr; /* remote unit address */
531 u_int16_t echo_size; /* size of echo data in bytes */
532 /* u_int8_t echo_data[] -- echo data */
533 } ng_l2cap_l2ca_ping_ip;
537 u_int16_t result; /* 0x00 - success */
538 bdaddr_t bdaddr; /* remote unit address */
539 u_int16_t echo_size; /* size of echo data in bytes */
540 /* u_int8_t echo_data[] -- echo data */
541 } ng_l2cap_l2ca_ping_op;
544 #define NGM_L2CAP_L2CA_GET_INFO 0x90
547 bdaddr_t bdaddr; /* remote unit address */
548 u_int16_t info_type; /* info type */
549 } ng_l2cap_l2ca_get_info_ip;
553 u_int16_t result; /* 0x00 - success */
554 u_int16_t info_size; /* size of info data in bytes */
555 /* u_int8_t info_data[] -- info data */
556 } ng_l2cap_l2ca_get_info_op;
558 /* L2CA_EnableCLT/L2CA_DisableCLT */
559 #define NGM_L2CAP_L2CA_ENABLE_CLT 0x91
562 u_int16_t psm; /* Protocol/Service Multiplexor */
563 u_int16_t enable; /* 0x00 - disable */
564 } ng_l2cap_l2ca_enable_clt_ip;
569 * u_int16_t result; /* 0x00 - success */
570 * } ng_l2cap_l2ca_enable_clt_op;
573 /**************************************************************************
574 **************************************************************************
575 ** L2CAP node messages
576 **************************************************************************
577 **************************************************************************/
579 /* L2CAP connection states */
580 #define NG_L2CAP_CON_CLOSED 0 /* connection closed */
581 #define NG_L2CAP_W4_LP_CON_CFM 1 /* waiting... */
582 #define NG_L2CAP_CON_OPEN 2 /* connection open */
584 /* L2CAP channel states */
585 #define NG_L2CAP_CLOSED 0 /* channel closed */
586 #define NG_L2CAP_W4_L2CAP_CON_RSP 1 /* wait for L2CAP resp. */
587 #define NG_L2CAP_W4_L2CA_CON_RSP 2 /* wait for upper resp. */
588 #define NG_L2CAP_CONFIG 3 /* L2CAP configuration */
589 #define NG_L2CAP_OPEN 4 /* channel open */
590 #define NG_L2CAP_W4_L2CAP_DISCON_RSP 5 /* wait for L2CAP discon. */
591 #define NG_L2CAP_W4_L2CA_DISCON_RSP 6 /* wait for upper discon. */
594 #define NG_L2CAP_CLT_SDP_DISABLED (1 << 0) /* disable SDP CLT */
595 #define NG_L2CAP_CLT_RFCOMM_DISABLED (1 << 1) /* disable RFCOMM CLT */
596 #define NG_L2CAP_CLT_TCP_DISABLED (1 << 2) /* disable TCP CLT */
599 #define NG_L2CAP_ALERT_LEVEL 1
600 #define NG_L2CAP_ERR_LEVEL 2
601 #define NG_L2CAP_WARN_LEVEL 3
602 #define NG_L2CAP_INFO_LEVEL 4
604 /* Get node flags (see flags above) */
605 #define NGM_L2CAP_NODE_GET_FLAGS 0x400 /* L2CAP -> User */
606 typedef u_int16_t ng_l2cap_node_flags_ep;
608 /* Get/Set debug level (see levels above) */
609 #define NGM_L2CAP_NODE_GET_DEBUG 0x401 /* L2CAP -> User */
610 #define NGM_L2CAP_NODE_SET_DEBUG 0x402 /* User -> L2CAP */
611 typedef u_int16_t ng_l2cap_node_debug_ep;
613 #define NGM_L2CAP_NODE_HOOK_INFO 0x409 /* L2CAP -> Upper */
614 /* bdaddr_t bdaddr; -- local (source BDADDR) */
616 #define NGM_L2CAP_NODE_GET_CON_LIST 0x40a /* L2CAP -> User */
618 u_int32_t num_connections; /* number of connections */
619 } ng_l2cap_node_con_list_ep;
621 /* Connection flags */
622 #define NG_L2CAP_CON_TX (1 << 0) /* sending data */
623 #define NG_L2CAP_CON_RX (1 << 1) /* receiving data */
624 #define NG_L2CAP_CON_OUTGOING (1 << 2) /* outgoing connection */
625 #define NG_L2CAP_CON_LP_TIMO (1 << 3) /* LP timeout */
626 #define NG_L2CAP_CON_AUTO_DISCON_TIMO (1 << 4) /* auto discon. timeout */
627 #define NG_L2CAP_CON_DYING (1 << 5) /* connection is dying */
630 u_int8_t state; /* connection state */
631 u_int8_t flags; /* flags */
632 int16_t pending; /* num. pending packets */
633 u_int16_t con_handle; /* connection handle */
634 bdaddr_t remote; /* remote bdaddr */
635 } ng_l2cap_node_con_ep;
637 #define NG_L2CAP_MAX_CON_NUM \
638 ((0xffff - sizeof(ng_l2cap_node_con_list_ep))/sizeof(ng_l2cap_node_con_ep))
640 #define NGM_L2CAP_NODE_GET_CHAN_LIST 0x40b /* L2CAP -> User */
642 u_int32_t num_channels; /* number of channels */
643 } ng_l2cap_node_chan_list_ep;
646 u_int32_t state; /* channel state */
648 u_int16_t scid; /* source (local) channel ID */
649 u_int16_t dcid; /* destination (remote) channel ID */
651 u_int16_t imtu; /* incomming MTU */
652 u_int16_t omtu; /* outgoing MTU */
654 u_int16_t psm; /* PSM */
655 bdaddr_t remote; /* remote bdaddr */
656 } ng_l2cap_node_chan_ep;
658 #define NG_L2CAP_MAX_CHAN_NUM \
659 ((0xffff - sizeof(ng_l2cap_node_chan_list_ep))/sizeof(ng_l2cap_node_chan_ep))
661 #define NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO 0x40c /* L2CAP -> User */
662 #define NGM_L2CAP_NODE_SET_AUTO_DISCON_TIMO 0x40d /* User -> L2CAP */
663 typedef u_int16_t ng_l2cap_node_auto_discon_ep;
665 #endif /* ndef _NETGRAPH_L2CAP_H_ */