Пример #1
0
/**
 * Transfers an incoming request to the newtmgr task.  The caller relinquishes
 * ownership of the supplied mbuf upon calling this function, whether this
 * function succeeds or fails.
 *
 * @param nt                    The transport that the request was received
 *                                  over.
 * @param req                   An mbuf containing the newtmgr request.
 *
 * @return                      0 on success; nonzero on failure.
 */
int
nmgr_rx_req(struct nmgr_transport *nt, struct os_mbuf *req)
{
    int rc;

    rc = os_mqueue_put(&nt->nt_imq, mgmt_evq_get(), req);
    if (rc != 0) {
        os_mbuf_free_chain(req);
    }

    return rc;
}
Пример #2
0
static int
nmgr_ble_out(struct nmgr_transport *nt, struct os_mbuf *om)
{
    int rc;

    rc = os_mqueue_put(&nmgr_ble_mq, mgmt_evq_get(), om);
    if (rc != 0) {
        goto err;
    }

    return (0);
err:
    os_mbuf_free_chain(om);
    return (rc);
}