ng_btsocket_l2cap.c (121054) | ng_btsocket_l2cap.c (123812) |
---|---|
1/* 2 * ng_btsocket_l2cap.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.c,v 1.16 2003/09/14 23:29:06 max Exp $ | 1/* 2 * ng_btsocket_l2cap.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.c,v 1.16 2003/09/14 23:29:06 max Exp $ |
29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c 121054 2003-10-12 22:04:24Z emax $ | 29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.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/endian.h> 37#include <sys/errno.h> --- 207 unchanged lines hidden (view full) --- 245 246 ng_btsocket_l2cap_node = NULL; 247 248 return (error); 249 } 250 251 error = ng_name_node(ng_btsocket_l2cap_node, 252 NG_BTSOCKET_L2CAP_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/endian.h> 37#include <sys/errno.h> --- 207 unchanged lines hidden (view full) --- 245 246 ng_btsocket_l2cap_node = NULL; 247 248 return (error); 249 } 250 251 error = ng_name_node(ng_btsocket_l2cap_node, 252 NG_BTSOCKET_L2CAP_NODE_TYPE); |
253 if (error != NULL) { | 253 if (error != 0) { |
254 NG_BTSOCKET_L2CAP_ALERT( 255"%s: Could not name Netgraph node, error=%d\n", __func__, error); 256 257 NG_NODE_UNREF(ng_btsocket_l2cap_node); 258 ng_btsocket_l2cap_node = NULL; 259 260 return (error); 261 } --- 927 unchanged lines hidden (view full) --- 1189 return (ENOMEM); 1190 1191 msg->header.token = pcb->token; 1192 1193 ip = (ng_l2cap_l2ca_con_ip *)(msg->data); 1194 bcopy(&pcb->dst, &ip->bdaddr, sizeof(ip->bdaddr)); 1195 ip->psm = pcb->psm; 1196 | 254 NG_BTSOCKET_L2CAP_ALERT( 255"%s: Could not name Netgraph node, error=%d\n", __func__, error); 256 257 NG_NODE_UNREF(ng_btsocket_l2cap_node); 258 ng_btsocket_l2cap_node = NULL; 259 260 return (error); 261 } --- 927 unchanged lines hidden (view full) --- 1189 return (ENOMEM); 1190 1191 msg->header.token = pcb->token; 1192 1193 ip = (ng_l2cap_l2ca_con_ip *)(msg->data); 1194 bcopy(&pcb->dst, &ip->bdaddr, sizeof(ip->bdaddr)); 1195 ip->psm = pcb->psm; 1196 |
1197 NG_SEND_MSG_HOOK(error,ng_btsocket_l2cap_node,msg,pcb->rt->hook,NULL); | 1197 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg,pcb->rt->hook, 0); |
1198 1199 return (error); 1200} /* ng_btsocket_l2cap_send_l2ca_con_req */ 1201 1202/* 1203 * Send L2CA_Connect response 1204 */ 1205 --- 18 unchanged lines hidden (view full) --- 1224 1225 ip = (ng_l2cap_l2ca_con_rsp_ip *)(msg->data); 1226 bcopy(dst, &ip->bdaddr, sizeof(ip->bdaddr)); 1227 ip->ident = ident; 1228 ip->lcid = lcid; 1229 ip->result = result; 1230 ip->status = 0; 1231 | 1198 1199 return (error); 1200} /* ng_btsocket_l2cap_send_l2ca_con_req */ 1201 1202/* 1203 * Send L2CA_Connect response 1204 */ 1205 --- 18 unchanged lines hidden (view full) --- 1224 1225 ip = (ng_l2cap_l2ca_con_rsp_ip *)(msg->data); 1226 bcopy(dst, &ip->bdaddr, sizeof(ip->bdaddr)); 1227 ip->ident = ident; 1228 ip->lcid = lcid; 1229 ip->result = result; 1230 ip->status = 0; 1231 |
1232 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg, rt->hook, NULL); | 1232 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg, rt->hook, 0); |
1233 1234 return (error); 1235} /* ng_btsocket_l2cap_send_l2ca_con_rsp_req */ 1236 1237/* 1238 * Send L2CA_Config request 1239 */ 1240 --- 19 unchanged lines hidden (view full) --- 1260 1261 ip = (ng_l2cap_l2ca_cfg_ip *)(msg->data); 1262 ip->lcid = pcb->cid; 1263 ip->imtu = pcb->imtu; 1264 bcopy(&pcb->oflow, &ip->oflow, sizeof(ip->oflow)); 1265 ip->flush_timo = pcb->flush_timo; 1266 ip->link_timo = pcb->link_timo; 1267 | 1233 1234 return (error); 1235} /* ng_btsocket_l2cap_send_l2ca_con_rsp_req */ 1236 1237/* 1238 * Send L2CA_Config request 1239 */ 1240 --- 19 unchanged lines hidden (view full) --- 1260 1261 ip = (ng_l2cap_l2ca_cfg_ip *)(msg->data); 1262 ip->lcid = pcb->cid; 1263 ip->imtu = pcb->imtu; 1264 bcopy(&pcb->oflow, &ip->oflow, sizeof(ip->oflow)); 1265 ip->flush_timo = pcb->flush_timo; 1266 ip->link_timo = pcb->link_timo; 1267 |
1268 NG_SEND_MSG_HOOK(error,ng_btsocket_l2cap_node,msg,pcb->rt->hook,NULL); | 1268 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg,pcb->rt->hook, 0); |
1269 1270 return (error); 1271} /* ng_btsocket_l2cap_send_l2ca_cfg_req */ 1272 1273/* 1274 * Send L2CA_Config response 1275 */ 1276 --- 17 unchanged lines hidden (view full) --- 1294 1295 msg->header.token = pcb->token; 1296 1297 ip = (ng_l2cap_l2ca_cfg_rsp_ip *)(msg->data); 1298 ip->lcid = pcb->cid; 1299 ip->omtu = pcb->omtu; 1300 bcopy(&pcb->iflow, &ip->iflow, sizeof(ip->iflow)); 1301 | 1269 1270 return (error); 1271} /* ng_btsocket_l2cap_send_l2ca_cfg_req */ 1272 1273/* 1274 * Send L2CA_Config response 1275 */ 1276 --- 17 unchanged lines hidden (view full) --- 1294 1295 msg->header.token = pcb->token; 1296 1297 ip = (ng_l2cap_l2ca_cfg_rsp_ip *)(msg->data); 1298 ip->lcid = pcb->cid; 1299 ip->omtu = pcb->omtu; 1300 bcopy(&pcb->iflow, &ip->iflow, sizeof(ip->iflow)); 1301 |
1302 NG_SEND_MSG_HOOK(error,ng_btsocket_l2cap_node,msg,pcb->rt->hook,NULL); | 1302 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg, pcb->rt->hook, 0); |
1303 1304 return (error); 1305} /* ng_btsocket_l2cap_send_l2ca_cfg_rsp */ 1306 1307/* 1308 * Send L2CA_Disconnect request 1309 */ 1310 --- 16 unchanged lines hidden (view full) --- 1327 if (msg == NULL) 1328 return (ENOMEM); 1329 1330 msg->header.token = token; 1331 1332 ip = (ng_l2cap_l2ca_discon_ip *)(msg->data); 1333 ip->lcid = pcb->cid; 1334 | 1303 1304 return (error); 1305} /* ng_btsocket_l2cap_send_l2ca_cfg_rsp */ 1306 1307/* 1308 * Send L2CA_Disconnect request 1309 */ 1310 --- 16 unchanged lines hidden (view full) --- 1327 if (msg == NULL) 1328 return (ENOMEM); 1329 1330 msg->header.token = token; 1331 1332 ip = (ng_l2cap_l2ca_discon_ip *)(msg->data); 1333 ip->lcid = pcb->cid; 1334 |
1335 NG_SEND_MSG_HOOK(error,ng_btsocket_l2cap_node,msg,pcb->rt->hook,NULL); | 1335 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_node, msg,pcb->rt->hook, 0); |
1336 1337 return (error); 1338} /* ng_btsocket_l2cap_send_l2ca_discon_req */ 1339 1340/***************************************************************************** 1341 ***************************************************************************** 1342 ** Socket interface 1343 ***************************************************************************** --- 1511 unchanged lines hidden --- | 1336 1337 return (error); 1338} /* ng_btsocket_l2cap_send_l2ca_discon_req */ 1339 1340/***************************************************************************** 1341 ***************************************************************************** 1342 ** Socket interface 1343 ***************************************************************************** --- 1511 unchanged lines hidden --- |