Deleted Added
full compact
ng_btsocket_l2cap_raw.c (121054) ng_btsocket_l2cap_raw.c (123812)
1/*
2 * ng_btsocket_l2cap_raw.c
3 *
4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: ng_btsocket_l2cap_raw.c,v 1.12 2003/09/14 23:29:06 max Exp $
1/*
2 * ng_btsocket_l2cap_raw.c
3 *
4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: ng_btsocket_l2cap_raw.c,v 1.12 2003/09/14 23:29:06 max Exp $
29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 121054 2003-10-12 22:04:24Z emax $
29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 123812 2003-12-24 18:51:01Z alfred $
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bitstring.h>
35#include <sys/domain.h>
36#include <sys/errno.h>
37#include <sys/filedesc.h>

--- 158 unchanged lines hidden (view full) ---

196
197 ng_btsocket_l2cap_raw_node = NULL;
198
199 return (error);
200 }
201
202 error = ng_name_node(ng_btsocket_l2cap_raw_node,
203 NG_BTSOCKET_L2CAP_RAW_NODE_TYPE);
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bitstring.h>
35#include <sys/domain.h>
36#include <sys/errno.h>
37#include <sys/filedesc.h>

--- 158 unchanged lines hidden (view full) ---

196
197 ng_btsocket_l2cap_raw_node = NULL;
198
199 return (error);
200 }
201
202 error = ng_name_node(ng_btsocket_l2cap_raw_node,
203 NG_BTSOCKET_L2CAP_RAW_NODE_TYPE);
204 if (error != NULL) {
204 if (error != 0) {
205 NG_BTSOCKET_L2CAP_RAW_ALERT(
206"%s: Could not name Netgraph node, error=%d\n", __func__, error);
207
208 NG_NODE_UNREF(ng_btsocket_l2cap_raw_node);
209 ng_btsocket_l2cap_raw_node = NULL;
210
211 return (error);
212 }

--- 638 unchanged lines hidden (view full) ---

851 error = ENOMEM;
852 break;
853 }
854 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
855 pcb->token = msg->header.token;
856 pcb->msg = NULL;
857
858 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
205 NG_BTSOCKET_L2CAP_RAW_ALERT(
206"%s: Could not name Netgraph node, error=%d\n", __func__, error);
207
208 NG_NODE_UNREF(ng_btsocket_l2cap_raw_node);
209 ng_btsocket_l2cap_raw_node = NULL;
210
211 return (error);
212 }

--- 638 unchanged lines hidden (view full) ---

851 error = ENOMEM;
852 break;
853 }
854 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
855 pcb->token = msg->header.token;
856 pcb->msg = NULL;
857
858 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
859 pcb->rt->hook, NULL);
859 pcb->rt->hook, 0);
860 if (error != 0) {
861 pcb->token = 0;
862 break;
863 }
864
865 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
866 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
867 pcb->token = 0;

--- 38 unchanged lines hidden (view full) ---

906 error = ENOMEM;
907 break;
908 }
909 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
910 pcb->token = msg->header.token;
911 pcb->msg = NULL;
912
913 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
860 if (error != 0) {
861 pcb->token = 0;
862 break;
863 }
864
865 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
866 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
867 pcb->token = 0;

--- 38 unchanged lines hidden (view full) ---

906 error = ENOMEM;
907 break;
908 }
909 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
910 pcb->token = msg->header.token;
911 pcb->msg = NULL;
912
913 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
914 pcb->rt->hook, NULL);
914 pcb->rt->hook, 0);
915 if (error != 0) {
916 pcb->token = 0;
917 break;
918 }
919
920 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
921 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
922 pcb->token = 0;

--- 56 unchanged lines hidden (view full) ---

979 if (error != 0) {
980 NG_FREE_MSG(msg);
981 pcb->token = 0;
982 break;
983 }
984 }
985
986 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
915 if (error != 0) {
916 pcb->token = 0;
917 break;
918 }
919
920 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
921 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
922 pcb->token = 0;

--- 56 unchanged lines hidden (view full) ---

979 if (error != 0) {
980 NG_FREE_MSG(msg);
981 pcb->token = 0;
982 break;
983 }
984 }
985
986 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
987 pcb->rt->hook, NULL);
987 pcb->rt->hook, 0);
988 if (error != 0) {
989 pcb->token = 0;
990 break;
991 }
992
993 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
994 bluetooth_l2cap_rtx_timeout());
995 pcb->token = 0;

--- 44 unchanged lines hidden (view full) ---

1040 pcb->token = msg->header.token;
1041 pcb->msg = NULL;
1042
1043 ip = (ng_l2cap_l2ca_get_info_ip *)(msg->data);
1044 bcopy(&pcb->dst, &ip->bdaddr, sizeof(ip->bdaddr));
1045 ip->info_type = p->info_type;
1046
1047 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
988 if (error != 0) {
989 pcb->token = 0;
990 break;
991 }
992
993 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
994 bluetooth_l2cap_rtx_timeout());
995 pcb->token = 0;

--- 44 unchanged lines hidden (view full) ---

1040 pcb->token = msg->header.token;
1041 pcb->msg = NULL;
1042
1043 ip = (ng_l2cap_l2ca_get_info_ip *)(msg->data);
1044 bcopy(&pcb->dst, &ip->bdaddr, sizeof(ip->bdaddr));
1045 ip->info_type = p->info_type;
1046
1047 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
1048 pcb->rt->hook, NULL);
1048 pcb->rt->hook, 0);
1049 if (error != 0) {
1050 pcb->token = 0;
1051 break;
1052 }
1053
1054 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
1055 bluetooth_l2cap_rtx_timeout());
1056 pcb->token = 0;

--- 196 unchanged lines hidden (view full) ---

1253
1254 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, arglen, M_NOWAIT);
1255 if (msg == NULL)
1256 return (ENOMEM);
1257
1258 if (arg != NULL && arglen > 0)
1259 bcopy(arg, msg->data, arglen);
1260
1049 if (error != 0) {
1050 pcb->token = 0;
1051 break;
1052 }
1053
1054 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
1055 bluetooth_l2cap_rtx_timeout());
1056 pcb->token = 0;

--- 196 unchanged lines hidden (view full) ---

1253
1254 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, arglen, M_NOWAIT);
1255 if (msg == NULL)
1256 return (ENOMEM);
1257
1258 if (arg != NULL && arglen > 0)
1259 bcopy(arg, msg->data, arglen);
1260
1261 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, hook, NULL);
1261 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, hook, 0);
1262
1263 return (error);
1264} /* ng_btsocket_l2cap_raw_send_ngmsg */
1265
1266/*
1267 * Send Netgraph message to the node (no data) and wait for reply
1268 */
1269

--- 9 unchanged lines hidden (view full) ---

1279 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, 0, M_NOWAIT);
1280 if (msg == NULL)
1281 return (ENOMEM);
1282
1283 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
1284 pcb->token = msg->header.token;
1285 pcb->msg = NULL;
1286
1262
1263 return (error);
1264} /* ng_btsocket_l2cap_raw_send_ngmsg */
1265
1266/*
1267 * Send Netgraph message to the node (no data) and wait for reply
1268 */
1269

--- 9 unchanged lines hidden (view full) ---

1279 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, 0, M_NOWAIT);
1280 if (msg == NULL)
1281 return (ENOMEM);
1282
1283 ng_btsocket_l2cap_raw_get_token(&msg->header.token);
1284 pcb->token = msg->header.token;
1285 pcb->msg = NULL;
1286
1287 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
1288 pcb->rt->hook, NULL);
1287 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg,
1288 pcb->rt->hook, 0);
1289 if (error != 0) {
1290 pcb->token = 0;
1291 return (error);
1292 }
1293
1294 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
1295 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
1296 pcb->token = 0;

--- 14 unchanged lines hidden ---
1289 if (error != 0) {
1290 pcb->token = 0;
1291 return (error);
1292 }
1293
1294 error = msleep(&pcb->msg, &pcb->pcb_mtx, PZERO|PCATCH, "l2ctl",
1295 ng_btsocket_l2cap_raw_ioctl_timeout * hz);
1296 pcb->token = 0;

--- 14 unchanged lines hidden ---