2 #include <sys/socket.h>
4 #include <netinet/in.h>
11 void nfc_gen_sockaddr(struct sockaddr
**addr
, socklen_t
*addrlen
)
13 struct sockaddr_nfc
*nfc
;
15 // TODO: See also sockaddr_nfc_llcp
16 nfc
= malloc(sizeof(struct sockaddr_nfc
));
20 nfc
->sa_family
= PF_NFC
;
21 nfc
->dev_idx
= rand();
22 nfc
->target_idx
= rand();
23 nfc
->nfc_protocol
= rand() % 5;
24 *addr
= (struct sockaddr
*) nfc
;
25 *addrlen
= sizeof(struct sockaddr_nfc
);
28 void nfc_rand_socket(struct socket_triplet
*st
)
31 st
->protocol
= NFC_SOCKPROTO_LLCP
;
33 st
->type
= SOCK_DGRAM
;
35 st
->type
= SOCK_STREAM
;
39 st
->protocol
= NFC_SOCKPROTO_RAW
;
40 st
->type
= SOCK_SEQPACKET
;
45 void nfc_setsockopt(struct sockopt
*so
)