ng_btsocket_l2cap_raw.c (107120) | ng_btsocket_l2cap_raw.c (109623) |
---|---|
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.1 2002/09/04 21:44:00 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.1 2002/09/04 21:44:00 max Exp $ |
29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 107120 2002-11-20 23:01:59Z julian $ | 29 * $FreeBSD: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 109623 2003-01-21 08:56:16Z alfred $ |
30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/domain.h> 35#include <sys/errno.h> 36#include <sys/filedesc.h> 37#include <sys/ioccom.h> --- 528 unchanged lines hidden (view full) --- 566 /* Reserve send and receive space if it is not reserved yet */ 567 error = soreserve(so, NG_BTSOCKET_L2CAP_RAW_SENDSPACE, 568 NG_BTSOCKET_L2CAP_RAW_RECVSPACE); 569 if (error != 0) 570 return (error); 571 572 /* Allocate the PCB */ 573 MALLOC(pcb, ng_btsocket_l2cap_raw_pcb_p, sizeof(*pcb), | 30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/domain.h> 35#include <sys/errno.h> 36#include <sys/filedesc.h> 37#include <sys/ioccom.h> --- 528 unchanged lines hidden (view full) --- 566 /* Reserve send and receive space if it is not reserved yet */ 567 error = soreserve(so, NG_BTSOCKET_L2CAP_RAW_SENDSPACE, 568 NG_BTSOCKET_L2CAP_RAW_RECVSPACE); 569 if (error != 0) 570 return (error); 571 572 /* Allocate the PCB */ 573 MALLOC(pcb, ng_btsocket_l2cap_raw_pcb_p, sizeof(*pcb), |
574 M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_WAITOK | M_ZERO); | 574 M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_ZERO); |
575 if (pcb == NULL) 576 return (ENOMEM); 577 578 /* Link the PCB and the socket */ 579 so->so_pcb = (caddr_t) pcb; 580 pcb->so = so; 581 582 /* Add the PCB to the list */ --- 170 unchanged lines hidden (view full) --- 753 case SIOC_L2CAP_NODE_GET_FLAGS: { 754 struct ng_btsocket_l2cap_raw_node_flags *p = 755 (struct ng_btsocket_l2cap_raw_node_flags *) data; 756 757 ng_btsocket_l2cap_raw_get_token(&pcb->token); 758 pcb->msg = NULL; 759 760 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_FLAGS, | 575 if (pcb == NULL) 576 return (ENOMEM); 577 578 /* Link the PCB and the socket */ 579 so->so_pcb = (caddr_t) pcb; 580 pcb->so = so; 581 582 /* Add the PCB to the list */ --- 170 unchanged lines hidden (view full) --- 753 case SIOC_L2CAP_NODE_GET_FLAGS: { 754 struct ng_btsocket_l2cap_raw_node_flags *p = 755 (struct ng_btsocket_l2cap_raw_node_flags *) data; 756 757 ng_btsocket_l2cap_raw_get_token(&pcb->token); 758 pcb->msg = NULL; 759 760 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_FLAGS, |
761 0, M_WAITOK); | 761 0, 0); |
762 if (msg == NULL) { 763 pcb->token = 0; 764 error = ENOMEM; 765 break; 766 } 767 msg->header.token = pcb->token; 768 769 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 24 unchanged lines hidden (view full) --- 794 case SIOC_L2CAP_NODE_GET_DEBUG: { 795 struct ng_btsocket_l2cap_raw_node_debug *p = 796 (struct ng_btsocket_l2cap_raw_node_debug *) data; 797 798 ng_btsocket_l2cap_raw_get_token(&pcb->token); 799 pcb->msg = NULL; 800 801 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_DEBUG, | 762 if (msg == NULL) { 763 pcb->token = 0; 764 error = ENOMEM; 765 break; 766 } 767 msg->header.token = pcb->token; 768 769 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 24 unchanged lines hidden (view full) --- 794 case SIOC_L2CAP_NODE_GET_DEBUG: { 795 struct ng_btsocket_l2cap_raw_node_debug *p = 796 (struct ng_btsocket_l2cap_raw_node_debug *) data; 797 798 ng_btsocket_l2cap_raw_get_token(&pcb->token); 799 pcb->msg = NULL; 800 801 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_DEBUG, |
802 0, M_WAITOK); | 802 0, 0); |
803 if (msg == NULL) { 804 pcb->token = 0; 805 error = ENOMEM; 806 break; 807 } 808 msg->header.token = pcb->token; 809 810 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 21 unchanged lines hidden (view full) --- 832 pcb->token = 0; 833 } break; 834 835 case SIOC_L2CAP_NODE_SET_DEBUG: { 836 struct ng_btsocket_l2cap_raw_node_debug *p = 837 (struct ng_btsocket_l2cap_raw_node_debug *) data; 838 839 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_SET_DEBUG, | 803 if (msg == NULL) { 804 pcb->token = 0; 805 error = ENOMEM; 806 break; 807 } 808 msg->header.token = pcb->token; 809 810 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 21 unchanged lines hidden (view full) --- 832 pcb->token = 0; 833 } break; 834 835 case SIOC_L2CAP_NODE_SET_DEBUG: { 836 struct ng_btsocket_l2cap_raw_node_debug *p = 837 (struct ng_btsocket_l2cap_raw_node_debug *) data; 838 839 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_SET_DEBUG, |
840 sizeof(ng_l2cap_node_debug_ep), M_WAITOK); | 840 sizeof(ng_l2cap_node_debug_ep), 0); |
841 if (msg == NULL) { 842 error = ENOMEM; 843 break; 844 } 845 846 *((ng_l2cap_node_debug_ep *)(msg->data)) = p->debug; 847 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, 848 msg, rt->hook, NULL); --- 11 unchanged lines hidden (view full) --- 860 error = EINVAL; 861 break; 862 } 863 864 ng_btsocket_l2cap_raw_get_token(&pcb->token); 865 pcb->msg = NULL; 866 867 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CON_LIST, | 841 if (msg == NULL) { 842 error = ENOMEM; 843 break; 844 } 845 846 *((ng_l2cap_node_debug_ep *)(msg->data)) = p->debug; 847 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, 848 msg, rt->hook, NULL); --- 11 unchanged lines hidden (view full) --- 860 error = EINVAL; 861 break; 862 } 863 864 ng_btsocket_l2cap_raw_get_token(&pcb->token); 865 pcb->msg = NULL; 866 867 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CON_LIST, |
868 0, M_WAITOK); | 868 0, 0); |
869 if (msg == NULL) { 870 pcb->token = 0; 871 error = ENOMEM; 872 break; 873 } 874 msg->header.token = pcb->token; 875 876 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 41 unchanged lines hidden (view full) --- 918 error = EINVAL; 919 break; 920 } 921 922 ng_btsocket_l2cap_raw_get_token(&pcb->token); 923 pcb->msg = NULL; 924 925 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, | 869 if (msg == NULL) { 870 pcb->token = 0; 871 error = ENOMEM; 872 break; 873 } 874 msg->header.token = pcb->token; 875 876 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 41 unchanged lines hidden (view full) --- 918 error = EINVAL; 919 break; 920 } 921 922 ng_btsocket_l2cap_raw_get_token(&pcb->token); 923 pcb->msg = NULL; 924 925 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, |
926 NGM_L2CAP_NODE_GET_CHAN_LIST, 0, M_WAITOK); | 926 NGM_L2CAP_NODE_GET_CHAN_LIST, 0, 0); |
927 if (msg == NULL) { 928 pcb->token = 0; 929 error = ENOMEM; 930 break; 931 } 932 msg->header.token = pcb->token; 933 934 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 47 unchanged lines hidden (view full) --- 982 break; 983 } 984 985 ng_btsocket_l2cap_raw_get_token(&pcb->token); 986 pcb->msg = NULL; 987 988 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, 989 NGM_L2CAP_L2CA_PING, sizeof(*ip) + p->echo_size, | 927 if (msg == NULL) { 928 pcb->token = 0; 929 error = ENOMEM; 930 break; 931 } 932 msg->header.token = pcb->token; 933 934 NG_SEND_MSG_HOOK(error, ng_btsocket_l2cap_raw_node, msg, --- 47 unchanged lines hidden (view full) --- 982 break; 983 } 984 985 ng_btsocket_l2cap_raw_get_token(&pcb->token); 986 pcb->msg = NULL; 987 988 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, 989 NGM_L2CAP_L2CA_PING, sizeof(*ip) + p->echo_size, |
990 M_WAITOK); | 990 0); |
991 if (msg == NULL) { 992 pcb->token = 0; 993 error = ENOMEM; 994 break; 995 } 996 msg->header.token = pcb->token; 997 998 ip = (ng_l2cap_l2ca_ping_ip *)(msg->data); --- 52 unchanged lines hidden (view full) --- 1051 break; 1052 } 1053 1054 ng_btsocket_l2cap_raw_get_token(&pcb->token); 1055 pcb->msg = NULL; 1056 1057 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, 1058 NGM_L2CAP_L2CA_GET_INFO, sizeof(*ip) + p->info_size, | 991 if (msg == NULL) { 992 pcb->token = 0; 993 error = ENOMEM; 994 break; 995 } 996 msg->header.token = pcb->token; 997 998 ip = (ng_l2cap_l2ca_ping_ip *)(msg->data); --- 52 unchanged lines hidden (view full) --- 1051 break; 1052 } 1053 1054 ng_btsocket_l2cap_raw_get_token(&pcb->token); 1055 pcb->msg = NULL; 1056 1057 NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, 1058 NGM_L2CAP_L2CA_GET_INFO, sizeof(*ip) + p->info_size, |
1059 M_WAITOK); | 1059 0); |
1060 if (msg == NULL) { 1061 pcb->token = 0; 1062 error = ENOMEM; 1063 break; 1064 } 1065 msg->header.token = pcb->token; 1066 1067 ip = (ng_l2cap_l2ca_get_info_ip *)(msg->data); --- 155 unchanged lines hidden --- | 1060 if (msg == NULL) { 1061 pcb->token = 0; 1062 error = ENOMEM; 1063 break; 1064 } 1065 msg->header.token = pcb->token; 1066 1067 ip = (ng_l2cap_l2ca_get_info_ip *)(msg->data); --- 155 unchanged lines hidden --- |