2 * Copyright (C) 2011 Intel Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #define pr_fmt(fmt) "llcp: %s: " fmt, __func__
22 #include <linux/init.h>
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/nfc.h>
30 static int sock_wait_state(struct sock
*sk
, int state
, unsigned long timeo
)
32 DECLARE_WAITQUEUE(wait
, current
);
35 pr_debug("sk %p", sk
);
37 add_wait_queue(sk_sleep(sk
), &wait
);
38 set_current_state(TASK_INTERRUPTIBLE
);
40 while (sk
->sk_state
!= state
) {
46 if (signal_pending(current
)) {
47 err
= sock_intr_errno(timeo
);
52 timeo
= schedule_timeout(timeo
);
54 set_current_state(TASK_INTERRUPTIBLE
);
61 __set_current_state(TASK_RUNNING
);
62 remove_wait_queue(sk_sleep(sk
), &wait
);
66 static struct proto llcp_sock_proto
= {
69 .obj_size
= sizeof(struct nfc_llcp_sock
),
72 static int llcp_sock_bind(struct socket
*sock
, struct sockaddr
*addr
, int alen
)
74 struct sock
*sk
= sock
->sk
;
75 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
76 struct nfc_llcp_local
*local
;
78 struct sockaddr_nfc_llcp llcp_addr
;
81 if (!addr
|| addr
->sa_family
!= AF_NFC
)
84 pr_debug("sk %p addr %p family %d\n", sk
, addr
, addr
->sa_family
);
86 memset(&llcp_addr
, 0, sizeof(llcp_addr
));
87 len
= min_t(unsigned int, sizeof(llcp_addr
), alen
);
88 memcpy(&llcp_addr
, addr
, len
);
90 /* This is going to be a listening socket, dsap must be 0 */
91 if (llcp_addr
.dsap
!= 0)
96 if (sk
->sk_state
!= LLCP_CLOSED
) {
101 dev
= nfc_get_device(llcp_addr
.dev_idx
);
107 local
= nfc_llcp_find_local(dev
);
113 llcp_sock
->dev
= dev
;
114 llcp_sock
->local
= nfc_llcp_local_get(local
);
115 llcp_sock
->nfc_protocol
= llcp_addr
.nfc_protocol
;
116 llcp_sock
->service_name_len
= min_t(unsigned int,
117 llcp_addr
.service_name_len
,
118 NFC_LLCP_MAX_SERVICE_NAME
);
119 llcp_sock
->service_name
= kmemdup(llcp_addr
.service_name
,
120 llcp_sock
->service_name_len
,
123 llcp_sock
->ssap
= nfc_llcp_get_sdp_ssap(local
, llcp_sock
);
124 if (llcp_sock
->ssap
== LLCP_SAP_MAX
) {
129 llcp_sock
->reserved_ssap
= llcp_sock
->ssap
;
131 nfc_llcp_sock_link(&local
->sockets
, sk
);
133 pr_debug("Socket bound to SAP %d\n", llcp_sock
->ssap
);
135 sk
->sk_state
= LLCP_BOUND
;
145 static int llcp_raw_sock_bind(struct socket
*sock
, struct sockaddr
*addr
,
148 struct sock
*sk
= sock
->sk
;
149 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
150 struct nfc_llcp_local
*local
;
152 struct sockaddr_nfc_llcp llcp_addr
;
155 if (!addr
|| addr
->sa_family
!= AF_NFC
)
158 pr_debug("sk %p addr %p family %d\n", sk
, addr
, addr
->sa_family
);
160 memset(&llcp_addr
, 0, sizeof(llcp_addr
));
161 len
= min_t(unsigned int, sizeof(llcp_addr
), alen
);
162 memcpy(&llcp_addr
, addr
, len
);
166 if (sk
->sk_state
!= LLCP_CLOSED
) {
171 dev
= nfc_get_device(llcp_addr
.dev_idx
);
177 local
= nfc_llcp_find_local(dev
);
183 llcp_sock
->dev
= dev
;
184 llcp_sock
->local
= nfc_llcp_local_get(local
);
185 llcp_sock
->nfc_protocol
= llcp_addr
.nfc_protocol
;
187 nfc_llcp_sock_link(&local
->raw_sockets
, sk
);
189 sk
->sk_state
= LLCP_BOUND
;
199 static int llcp_sock_listen(struct socket
*sock
, int backlog
)
201 struct sock
*sk
= sock
->sk
;
204 pr_debug("sk %p backlog %d\n", sk
, backlog
);
208 if ((sock
->type
!= SOCK_SEQPACKET
&& sock
->type
!= SOCK_STREAM
) ||
209 sk
->sk_state
!= LLCP_BOUND
) {
214 sk
->sk_max_ack_backlog
= backlog
;
215 sk
->sk_ack_backlog
= 0;
217 pr_debug("Socket listening\n");
218 sk
->sk_state
= LLCP_LISTEN
;
226 void nfc_llcp_accept_unlink(struct sock
*sk
)
228 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
230 pr_debug("state %d\n", sk
->sk_state
);
232 list_del_init(&llcp_sock
->accept_queue
);
233 sk_acceptq_removed(llcp_sock
->parent
);
234 llcp_sock
->parent
= NULL
;
239 void nfc_llcp_accept_enqueue(struct sock
*parent
, struct sock
*sk
)
241 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
242 struct nfc_llcp_sock
*llcp_sock_parent
= nfc_llcp_sock(parent
);
244 /* Lock will be free from unlink */
247 list_add_tail(&llcp_sock
->accept_queue
,
248 &llcp_sock_parent
->accept_queue
);
249 llcp_sock
->parent
= parent
;
250 sk_acceptq_added(parent
);
253 struct sock
*nfc_llcp_accept_dequeue(struct sock
*parent
,
254 struct socket
*newsock
)
256 struct nfc_llcp_sock
*lsk
, *n
, *llcp_parent
;
259 llcp_parent
= nfc_llcp_sock(parent
);
261 list_for_each_entry_safe(lsk
, n
, &llcp_parent
->accept_queue
,
266 if (sk
->sk_state
== LLCP_CLOSED
) {
268 nfc_llcp_accept_unlink(sk
);
272 if (sk
->sk_state
== LLCP_CONNECTED
|| !newsock
) {
273 nfc_llcp_accept_unlink(sk
);
275 sock_graft(sk
, newsock
);
279 pr_debug("Returning sk state %d\n", sk
->sk_state
);
290 static int llcp_sock_accept(struct socket
*sock
, struct socket
*newsock
,
293 DECLARE_WAITQUEUE(wait
, current
);
294 struct sock
*sk
= sock
->sk
, *new_sk
;
298 pr_debug("parent %p\n", sk
);
300 lock_sock_nested(sk
, SINGLE_DEPTH_NESTING
);
302 if (sk
->sk_state
!= LLCP_LISTEN
) {
307 timeo
= sock_rcvtimeo(sk
, flags
& O_NONBLOCK
);
309 /* Wait for an incoming connection. */
310 add_wait_queue_exclusive(sk_sleep(sk
), &wait
);
311 while (!(new_sk
= nfc_llcp_accept_dequeue(sk
, newsock
))) {
312 set_current_state(TASK_INTERRUPTIBLE
);
319 if (signal_pending(current
)) {
320 ret
= sock_intr_errno(timeo
);
325 timeo
= schedule_timeout(timeo
);
326 lock_sock_nested(sk
, SINGLE_DEPTH_NESTING
);
328 __set_current_state(TASK_RUNNING
);
329 remove_wait_queue(sk_sleep(sk
), &wait
);
334 newsock
->state
= SS_CONNECTED
;
336 pr_debug("new socket %p\n", new_sk
);
344 static int llcp_sock_getname(struct socket
*sock
, struct sockaddr
*uaddr
,
347 struct sock
*sk
= sock
->sk
;
348 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
349 DECLARE_SOCKADDR(struct sockaddr_nfc_llcp
*, llcp_addr
, uaddr
);
351 if (llcp_sock
== NULL
|| llcp_sock
->dev
== NULL
)
354 pr_debug("%p %d %d %d\n", sk
, llcp_sock
->target_idx
,
355 llcp_sock
->dsap
, llcp_sock
->ssap
);
357 uaddr
->sa_family
= AF_NFC
;
359 *len
= sizeof(struct sockaddr_nfc_llcp
);
361 llcp_addr
->dev_idx
= llcp_sock
->dev
->idx
;
362 llcp_addr
->target_idx
= llcp_sock
->target_idx
;
363 llcp_addr
->dsap
= llcp_sock
->dsap
;
364 llcp_addr
->ssap
= llcp_sock
->ssap
;
365 llcp_addr
->service_name_len
= llcp_sock
->service_name_len
;
366 memcpy(llcp_addr
->service_name
, llcp_sock
->service_name
,
367 llcp_addr
->service_name_len
);
372 static inline unsigned int llcp_accept_poll(struct sock
*parent
)
374 struct nfc_llcp_sock
*llcp_sock
, *n
, *parent_sock
;
377 parent_sock
= nfc_llcp_sock(parent
);
379 list_for_each_entry_safe(llcp_sock
, n
, &parent_sock
->accept_queue
,
383 if (sk
->sk_state
== LLCP_CONNECTED
)
384 return POLLIN
| POLLRDNORM
;
390 static unsigned int llcp_sock_poll(struct file
*file
, struct socket
*sock
,
393 struct sock
*sk
= sock
->sk
;
394 unsigned int mask
= 0;
396 pr_debug("%p\n", sk
);
398 sock_poll_wait(file
, sk_sleep(sk
), wait
);
400 if (sk
->sk_state
== LLCP_LISTEN
)
401 return llcp_accept_poll(sk
);
403 if (sk
->sk_err
|| !skb_queue_empty(&sk
->sk_error_queue
))
406 if (!skb_queue_empty(&sk
->sk_receive_queue
))
407 mask
|= POLLIN
| POLLRDNORM
;
409 if (sk
->sk_state
== LLCP_CLOSED
)
412 if (sk
->sk_shutdown
& RCV_SHUTDOWN
)
413 mask
|= POLLRDHUP
| POLLIN
| POLLRDNORM
;
415 if (sk
->sk_shutdown
== SHUTDOWN_MASK
)
418 if (sock_writeable(sk
))
419 mask
|= POLLOUT
| POLLWRNORM
| POLLWRBAND
;
421 set_bit(SOCK_ASYNC_NOSPACE
, &sk
->sk_socket
->flags
);
423 pr_debug("mask 0x%x\n", mask
);
428 static int llcp_sock_release(struct socket
*sock
)
430 struct sock
*sk
= sock
->sk
;
431 struct nfc_llcp_local
*local
;
432 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
438 pr_debug("%p\n", sk
);
440 local
= llcp_sock
->local
;
449 if (sk
->sk_state
== LLCP_CONNECTED
)
450 nfc_llcp_disconnect(llcp_sock
);
452 if (sk
->sk_state
== LLCP_LISTEN
) {
453 struct nfc_llcp_sock
*lsk
, *n
;
454 struct sock
*accept_sk
;
456 list_for_each_entry_safe(lsk
, n
, &llcp_sock
->accept_queue
,
458 accept_sk
= &lsk
->sk
;
459 lock_sock(accept_sk
);
461 nfc_llcp_disconnect(lsk
);
462 nfc_llcp_accept_unlink(accept_sk
);
464 release_sock(accept_sk
);
466 sock_orphan(accept_sk
);
470 if (llcp_sock
->reserved_ssap
< LLCP_SAP_MAX
)
471 nfc_llcp_put_ssap(llcp_sock
->local
, llcp_sock
->ssap
);
475 if (sock
->type
== SOCK_RAW
)
476 nfc_llcp_sock_unlink(&local
->raw_sockets
, sk
);
478 nfc_llcp_sock_unlink(&local
->sockets
, sk
);
487 static int llcp_sock_connect(struct socket
*sock
, struct sockaddr
*_addr
,
490 struct sock
*sk
= sock
->sk
;
491 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
492 struct sockaddr_nfc_llcp
*addr
= (struct sockaddr_nfc_llcp
*)_addr
;
494 struct nfc_llcp_local
*local
;
497 pr_debug("sock %p sk %p flags 0x%x\n", sock
, sk
, flags
);
499 if (!addr
|| len
< sizeof(struct sockaddr_nfc
) ||
500 addr
->sa_family
!= AF_NFC
)
503 if (addr
->service_name_len
== 0 && addr
->dsap
== 0)
506 pr_debug("addr dev_idx=%u target_idx=%u protocol=%u\n", addr
->dev_idx
,
507 addr
->target_idx
, addr
->nfc_protocol
);
511 if (sk
->sk_state
== LLCP_CONNECTED
) {
516 dev
= nfc_get_device(addr
->dev_idx
);
522 local
= nfc_llcp_find_local(dev
);
528 device_lock(&dev
->dev
);
529 if (dev
->dep_link_up
== false) {
531 device_unlock(&dev
->dev
);
534 device_unlock(&dev
->dev
);
536 if (local
->rf_mode
== NFC_RF_INITIATOR
&&
537 addr
->target_idx
!= local
->target_idx
) {
542 llcp_sock
->dev
= dev
;
543 llcp_sock
->local
= nfc_llcp_local_get(local
);
544 llcp_sock
->miu
= llcp_sock
->local
->remote_miu
;
545 llcp_sock
->ssap
= nfc_llcp_get_local_ssap(local
);
546 if (llcp_sock
->ssap
== LLCP_SAP_MAX
) {
551 llcp_sock
->reserved_ssap
= llcp_sock
->ssap
;
553 if (addr
->service_name_len
== 0)
554 llcp_sock
->dsap
= addr
->dsap
;
556 llcp_sock
->dsap
= LLCP_SAP_SDP
;
557 llcp_sock
->nfc_protocol
= addr
->nfc_protocol
;
558 llcp_sock
->service_name_len
= min_t(unsigned int,
559 addr
->service_name_len
,
560 NFC_LLCP_MAX_SERVICE_NAME
);
561 llcp_sock
->service_name
= kmemdup(addr
->service_name
,
562 llcp_sock
->service_name_len
,
565 nfc_llcp_sock_link(&local
->connecting_sockets
, sk
);
567 ret
= nfc_llcp_send_connect(llcp_sock
);
571 ret
= sock_wait_state(sk
, LLCP_CONNECTED
,
572 sock_sndtimeo(sk
, flags
& O_NONBLOCK
));
581 nfc_llcp_put_ssap(local
, llcp_sock
->ssap
);
583 nfc_llcp_sock_unlink(&local
->connecting_sockets
, sk
);
593 static int llcp_sock_sendmsg(struct kiocb
*iocb
, struct socket
*sock
,
594 struct msghdr
*msg
, size_t len
)
596 struct sock
*sk
= sock
->sk
;
597 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
600 pr_debug("sock %p sk %p", sock
, sk
);
602 ret
= sock_error(sk
);
606 if (msg
->msg_flags
& MSG_OOB
)
611 if (sk
->sk_type
== SOCK_DGRAM
) {
612 struct sockaddr_nfc_llcp
*addr
=
613 (struct sockaddr_nfc_llcp
*)msg
->msg_name
;
615 if (msg
->msg_namelen
< sizeof(*addr
)) {
622 return nfc_llcp_send_ui_frame(llcp_sock
, addr
->dsap
, addr
->ssap
,
626 if (sk
->sk_state
!= LLCP_CONNECTED
) {
633 return nfc_llcp_send_i_frame(llcp_sock
, msg
, len
);
636 static int llcp_sock_recvmsg(struct kiocb
*iocb
, struct socket
*sock
,
637 struct msghdr
*msg
, size_t len
, int flags
)
639 int noblock
= flags
& MSG_DONTWAIT
;
640 struct sock
*sk
= sock
->sk
;
641 unsigned int copied
, rlen
;
642 struct sk_buff
*skb
, *cskb
;
645 pr_debug("%p %zu\n", sk
, len
);
649 if (sk
->sk_state
== LLCP_CLOSED
&&
650 skb_queue_empty(&sk
->sk_receive_queue
)) {
657 if (flags
& (MSG_OOB
))
660 skb
= skb_recv_datagram(sk
, flags
, noblock
, &err
);
662 pr_err("Recv datagram failed state %d %d %d",
663 sk
->sk_state
, err
, sock_error(sk
));
665 if (sk
->sk_shutdown
& RCV_SHUTDOWN
)
671 rlen
= skb
->len
; /* real length of skb */
672 copied
= min_t(unsigned int, rlen
, len
);
675 if (memcpy_toiovec(msg
->msg_iov
, cskb
->data
, copied
)) {
676 if (!(flags
& MSG_PEEK
))
677 skb_queue_head(&sk
->sk_receive_queue
, skb
);
681 if (sk
->sk_type
== SOCK_DGRAM
&& msg
->msg_name
) {
682 struct nfc_llcp_ui_cb
*ui_cb
= nfc_llcp_ui_skb_cb(skb
);
683 struct sockaddr_nfc_llcp sockaddr
;
685 pr_debug("Datagram socket %d %d\n", ui_cb
->dsap
, ui_cb
->ssap
);
687 sockaddr
.sa_family
= AF_NFC
;
688 sockaddr
.nfc_protocol
= NFC_PROTO_NFC_DEP
;
689 sockaddr
.dsap
= ui_cb
->dsap
;
690 sockaddr
.ssap
= ui_cb
->ssap
;
692 memcpy(msg
->msg_name
, &sockaddr
, sizeof(sockaddr
));
693 msg
->msg_namelen
= sizeof(sockaddr
);
696 /* Mark read part of skb as used */
697 if (!(flags
& MSG_PEEK
)) {
699 /* SOCK_STREAM: re-queue skb if it contains unreceived data */
700 if (sk
->sk_type
== SOCK_STREAM
||
701 sk
->sk_type
== SOCK_DGRAM
||
702 sk
->sk_type
== SOCK_RAW
) {
703 skb_pull(skb
, copied
);
705 skb_queue_head(&sk
->sk_receive_queue
, skb
);
713 /* XXX Queue backlogged skbs */
716 /* SOCK_SEQPACKET: return real length if MSG_TRUNC is set */
717 if (sk
->sk_type
== SOCK_SEQPACKET
&& (flags
& MSG_TRUNC
))
723 static const struct proto_ops llcp_sock_ops
= {
725 .owner
= THIS_MODULE
,
726 .bind
= llcp_sock_bind
,
727 .connect
= llcp_sock_connect
,
728 .release
= llcp_sock_release
,
729 .socketpair
= sock_no_socketpair
,
730 .accept
= llcp_sock_accept
,
731 .getname
= llcp_sock_getname
,
732 .poll
= llcp_sock_poll
,
733 .ioctl
= sock_no_ioctl
,
734 .listen
= llcp_sock_listen
,
735 .shutdown
= sock_no_shutdown
,
736 .setsockopt
= sock_no_setsockopt
,
737 .getsockopt
= sock_no_getsockopt
,
738 .sendmsg
= llcp_sock_sendmsg
,
739 .recvmsg
= llcp_sock_recvmsg
,
740 .mmap
= sock_no_mmap
,
743 static const struct proto_ops llcp_rawsock_ops
= {
745 .owner
= THIS_MODULE
,
746 .bind
= llcp_raw_sock_bind
,
747 .connect
= sock_no_connect
,
748 .release
= llcp_sock_release
,
749 .socketpair
= sock_no_socketpair
,
750 .accept
= sock_no_accept
,
751 .getname
= llcp_sock_getname
,
752 .poll
= llcp_sock_poll
,
753 .ioctl
= sock_no_ioctl
,
754 .listen
= sock_no_listen
,
755 .shutdown
= sock_no_shutdown
,
756 .setsockopt
= sock_no_setsockopt
,
757 .getsockopt
= sock_no_getsockopt
,
758 .sendmsg
= sock_no_sendmsg
,
759 .recvmsg
= llcp_sock_recvmsg
,
760 .mmap
= sock_no_mmap
,
763 static void llcp_sock_destruct(struct sock
*sk
)
765 struct nfc_llcp_sock
*llcp_sock
= nfc_llcp_sock(sk
);
767 pr_debug("%p\n", sk
);
769 if (sk
->sk_state
== LLCP_CONNECTED
)
770 nfc_put_device(llcp_sock
->dev
);
772 skb_queue_purge(&sk
->sk_receive_queue
);
774 nfc_llcp_sock_free(llcp_sock
);
776 if (!sock_flag(sk
, SOCK_DEAD
)) {
777 pr_err("Freeing alive NFC LLCP socket %p\n", sk
);
782 struct sock
*nfc_llcp_sock_alloc(struct socket
*sock
, int type
, gfp_t gfp
)
785 struct nfc_llcp_sock
*llcp_sock
;
787 sk
= sk_alloc(&init_net
, PF_NFC
, gfp
, &llcp_sock_proto
);
791 llcp_sock
= nfc_llcp_sock(sk
);
793 sock_init_data(sock
, sk
);
794 sk
->sk_state
= LLCP_CLOSED
;
795 sk
->sk_protocol
= NFC_SOCKPROTO_LLCP
;
797 sk
->sk_destruct
= llcp_sock_destruct
;
800 llcp_sock
->dsap
= LLCP_SAP_SDP
;
801 llcp_sock
->rw
= LLCP_DEFAULT_RW
;
802 llcp_sock
->miu
= LLCP_DEFAULT_MIU
;
803 llcp_sock
->send_n
= llcp_sock
->send_ack_n
= 0;
804 llcp_sock
->recv_n
= llcp_sock
->recv_ack_n
= 0;
805 llcp_sock
->remote_ready
= 1;
806 llcp_sock
->reserved_ssap
= LLCP_SAP_MAX
;
807 skb_queue_head_init(&llcp_sock
->tx_queue
);
808 skb_queue_head_init(&llcp_sock
->tx_pending_queue
);
809 skb_queue_head_init(&llcp_sock
->tx_backlog_queue
);
810 INIT_LIST_HEAD(&llcp_sock
->accept_queue
);
813 sock
->state
= SS_UNCONNECTED
;
818 void nfc_llcp_sock_free(struct nfc_llcp_sock
*sock
)
820 kfree(sock
->service_name
);
822 skb_queue_purge(&sock
->tx_queue
);
823 skb_queue_purge(&sock
->tx_pending_queue
);
824 skb_queue_purge(&sock
->tx_backlog_queue
);
826 list_del_init(&sock
->accept_queue
);
830 nfc_llcp_local_put(sock
->local
);
833 static int llcp_sock_create(struct net
*net
, struct socket
*sock
,
834 const struct nfc_protocol
*nfc_proto
)
838 pr_debug("%p\n", sock
);
840 if (sock
->type
!= SOCK_STREAM
&&
841 sock
->type
!= SOCK_DGRAM
&&
842 sock
->type
!= SOCK_RAW
)
843 return -ESOCKTNOSUPPORT
;
845 if (sock
->type
== SOCK_RAW
)
846 sock
->ops
= &llcp_rawsock_ops
;
848 sock
->ops
= &llcp_sock_ops
;
850 sk
= nfc_llcp_sock_alloc(sock
, sock
->type
, GFP_ATOMIC
);
857 static const struct nfc_protocol llcp_nfc_proto
= {
858 .id
= NFC_SOCKPROTO_LLCP
,
859 .proto
= &llcp_sock_proto
,
860 .owner
= THIS_MODULE
,
861 .create
= llcp_sock_create
864 int __init
nfc_llcp_sock_init(void)
866 return nfc_proto_register(&llcp_nfc_proto
);
869 void nfc_llcp_sock_exit(void)
871 nfc_proto_unregister(&llcp_nfc_proto
);