2 #include <sys/socket.h>
4 #include <netinet/in.h>
11 void can_gen_sockaddr(struct sockaddr
**addr
, socklen_t
*addrlen
)
13 struct sockaddr_can
*can
;
15 can
= malloc(sizeof(struct sockaddr_can
));
18 can
->can_family
= AF_CAN
;
19 can
->can_ifindex
= rand();
20 can
->can_addr
.tp
.rx_id
= rand();
21 can
->can_addr
.tp
.tx_id
= rand();
22 *addr
= (struct sockaddr
*) can
;
23 *addrlen
= sizeof(struct sockaddr_can
);
26 void can_rand_socket(struct socket_triplet
*st
)
28 st
->protocol
= rand() % 7; // CAN_NPROTO
29 st
->type
= rand() % TYPE_MAX
;