/* Allocates a response buffer. 
If a source buf is provided, its user data is copied into the new buffer. */
void* smp_alloc_rsp(const void *req, void *arg)
/* Allocates a response buffer. 
If a source buf is provided, its user data is copied into the new buffer. */
void* smp_alloc_rsp(const void *req, void *arg)
{
	const struct net_buf *req_nb;
	struct net_buf *rsp_nb;
	struct smp_transport *smpt = arg;
	req_nb = req;
	rsp_nb = smp_packet_alloc();
	if (rsp_nb == NULL) {
		return NULL;
	}
	if (smpt->functions.ud_copy) {
		smpt->functions.ud_copy(rsp_nb, req_nb);
	} else {
		memcpy(net_buf_user_data(rsp_nb),
		       net_buf_user_data((void *)req_nb),
		       req_nb->user_data_size);
	}
	return rsp_nb;
}