Esempio n. 1
0
kdp_return_t kdp_connect
(kdp_connection *c)
{
    kdp_return_t ret;

    CHECK_FATAL (kdp_is_bound (c));
    CHECK_FATAL (! kdp_is_connected (c));

    /* Do a connect transaction. */

    c->request->connect_req.hdr.request = KDP_CONNECT;
    c->request->connect_req.req_reply_port = c->reqport;
    c->request->connect_req.exc_note_port  = c->excport;
    strncpy (c->request->connect_req.greeting, "", 64);
    c->request->connect_req.greeting[63] = '\0';

    ret = kdp_transaction (c, c->request, c->response, "remote_connect");
    if (ret != RR_SUCCESS) {
        return ret;
    }

    if (c->response->writemem_reply.error) {
        c->logger (KDP_LOG_ERROR, "kdp_connect: %s\n",
                   kdp_return_string (c->response->connect_reply.error));
        return RR_CONNECT;
    }

    c->session_key = c->response->hdr.key;
    c->connected = 1;

    return RR_SUCCESS;
}
Esempio n. 2
0
kdp_return_t kdp_disconnect (kdp_connection *c)
{
    kdp_return_t ret;

    CHECK_FATAL (kdp_is_connected (c));

    c->request->disconnect_req.hdr.request = KDP_DISCONNECT;
    ret = kdp_transaction (c, c->request, c->response, "kdp_disconnect");

    if (ret != RR_SUCCESS) {
        return ret;
    }
    c->connected = 0;

    return RR_SUCCESS;
}
Esempio n. 3
0
kdp_return_t
kdp_hostreboot (kdp_connection *c)
{
  kdp_return_t ret;

  CHECK_FATAL (kdp_is_connected (c));

  c->request->hostreboot_req.hdr.request = KDP_HOSTREBOOT;
  c->retries = 1;
  ret = kdp_transaction (c, c->request, c->response, "kdp_hostreboot");

  c->connected = 0;

  if (ret != RR_SUCCESS)
    {
      return ret;
    }

  return RR_SUCCESS;
}
Esempio n. 4
0
kdp_return_t
kdp_reattach (kdp_connection *c)
{
  kdp_return_t ret;

  CHECK_FATAL (!kdp_is_connected (c));

  c->request->reattach_req.hdr.request = KDP_REATTACH;
  c->request->reattach_req.req_reply_port = c->reqport;

  ret = kdp_transaction (c, c->request, c->response, "kdp_reattach");

  if (ret != RR_SUCCESS)
    {
      return ret;
    }

  c->connected = 1;
  return RR_SUCCESS;
}