[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] C bindings : xen_session_login_with_password

Harsh Modawel wrote:
> Hi,
>    I had few questions regarding the function the client should
> provide to "Query the server and return the response" i.e. The client
> function passed in call to xen_session_login_with_password()
> session->call_func = call_func;
> I see that the xen calls do pass data(input) in the XML-format while
> calling this client function.
> My questions are -
> 1) How should I use that data ? (as its already in XML format).
> I can't pass it as it is to server, nor I can use xmlrpc_client_call
> on it, hence was wondering, the intention ?

That data is ready to be passed to the server.  Just put it as payload
in some transport and send it along.  See
tools/libxen/test/test_bindings.c.  Also FYI, here is example
(simplified) from xen cim providers

static int call_func(const void *data, size_t len, void *user_handle,
                     void *result_handle, xen_result_func result_func)
   xen_utils_session *s = (xen_utils_session *)user_handle;
   char *read_buf = NULL;
   int ccode = 0;
   /* Send data to xend xmlrpc server. */
   if (!xen_utils_xend_post(s->socket, (char *)data, len))
      return -1;

   /* Read response from xend. */
   ccode = xen_utils_xend_read(s->socket, &read_buf);

   /* Check for errors and handle appropriately */
    /* Call result_func to process response */
      result_func(read_buf, strlen(read_buf), result_handle);
   /* Free buffer containing result */
   if (read_buf)
   return ccode;


> 2) Where should I store the result (so that XenCaller can read it). I
> guess, on success I should be returning a NULL value, as the return is
> stored in "error", followed by calls "if (error)".
> 3) In which format does that api expect the result data ? (same XML
> format or should I make use of xmlrpc calls to take out the value from
> the response).
> 4) If one knows the link/doc I should have read, then please let me know.
> Regards,
> -harsh
> _______________________________________________
> xen-api mailing list
> xen-api@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api

xen-api mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.