Alien-uv

 view release on metacpan or  search on metacpan

libuv/docs/src/guide/utilities.rst  view on Meta::CPAN


.. code-block:: c
    :linenos:
    :emphasize-lines: 2

    struct ftp_baton {
        uv_work_t req;
        char *host;
        int port;
        char *username;
        char *password;
    }

.. code-block:: c
    :linenos:
    :emphasize-lines: 2

    ftp_baton *baton = (ftp_baton*) malloc(sizeof(ftp_baton));
    baton->req.data = (void*) baton;
    baton->host = strdup("my.webhost.com");
    baton->port = 21;

libuv/docs/src/misc.rst  view on Meta::CPAN

                struct sockaddr_in6 address6;
            } address;
            union {
                struct sockaddr_in netmask4;
                struct sockaddr_in6 netmask6;
            } netmask;
        } uv_interface_address_t;

.. c:type:: uv_passwd_t

    Data type for password file information.

    ::

        typedef struct uv_passwd_s {
            char* username;
            long uid;
            long gid;
            char* shell;
            char* homedir;
        } uv_passwd_t;

libuv/docs/src/misc.rst  view on Meta::CPAN

    include the terminating null). On `UV_ENOBUFS` failure `size` is set to the
    required length for `buffer`, including the null byte.

    .. warning::
        `uv_os_tmpdir()` is not thread safe.

    .. versionadded:: 1.9.0

.. c:function:: int uv_os_get_passwd(uv_passwd_t* pwd)

    Gets a subset of the password file entry for the current effective uid (not
    the real uid). The populated data includes the username, euid, gid, shell,
    and home directory. On non-Windows systems, all data comes from
    :man:`getpwuid_r(3)`. On Windows, uid and gid are set to -1 and have no
    meaning, and shell is `NULL`. After successfully calling this function, the
    memory allocated to `pwd` needs to be freed with
    :c:func:`uv_os_free_passwd`.

    .. versionadded:: 1.9.0

.. c:function:: void uv_os_free_passwd(uv_passwd_t* pwd)

libuv/samples/socks5-proxy/client.c  view on Meta::CPAN

  }

  methods = s5_auth_methods(parser);
  if ((methods & S5_AUTH_NONE) && can_auth_none(cx->sx, cx)) {
    s5_select_auth(parser, S5_AUTH_NONE);
    conn_write(incoming, "\5\0", 2);  /* No auth required. */
    return s_req_start;
  }

  if ((methods & S5_AUTH_PASSWD) && can_auth_passwd(cx->sx, cx)) {
    /* TODO(bnoordhuis) Implement username/password auth. */
  }

  conn_write(incoming, "\5\377", 2);  /* No acceptable auth. */
  return s_kill;
}

/* TODO(bnoordhuis) Implement username/password auth. */
static int do_handshake_auth(client_ctx *cx) {
  UNREACHABLE();
  return do_kill(cx);
}

static int do_req_start(client_ctx *cx) {
  conn *incoming;

  incoming = &cx->incoming;
  ASSERT(incoming->rdstate == c_stop);

libuv/samples/socks5-proxy/s5.c  view on Meta::CPAN

#include <string.h>  /* memset() */

enum {
  s5_version,
  s5_nmethods,
  s5_methods,
  s5_auth_pw_version,
  s5_auth_pw_userlen,
  s5_auth_pw_username,
  s5_auth_pw_passlen,
  s5_auth_pw_password,
  s5_req_version,
  s5_req_cmd,
  s5_req_reserved,
  s5_req_atyp,
  s5_req_atyp_host,
  s5_req_daddr,
  s5_req_dport0,
  s5_req_dport1,
  s5_dead
};

libuv/samples/socks5-proxy/s5.c  view on Meta::CPAN

        }
        if (cx->arg0 == cx->userlen) {
          cx->username[cx->userlen] = '\0';
          cx->state = s5_auth_pw_passlen;
        }
        break;

      case s5_auth_pw_passlen:
        cx->arg0 = 0;
        cx->passlen = c;
        cx->state = s5_auth_pw_password;
        break;

      case s5_auth_pw_password:
        if (cx->arg0 < cx->passlen) {
          cx->password[cx->arg0] = c;
          cx->arg0 += 1;
        }
        if (cx->arg0 == cx->passlen) {
          cx->password[cx->passlen] = '\0';
          cx->state = s5_req_version;
          err = s5_auth_verify;
          goto out;
        }
        break;

      case s5_req_version:
        if (c != 5) {
          err = s5_bad_version;
          goto out;

libuv/samples/socks5-proxy/s5.h  view on Meta::CPAN

  uint32_t arg0;  /* Scratch space for the state machine. */
  uint32_t arg1;  /* Scratch space for the state machine. */
  uint8_t state;
  uint8_t methods;
  uint8_t cmd;
  uint8_t atyp;
  uint8_t userlen;
  uint8_t passlen;
  uint16_t dport;
  uint8_t username[257];
  uint8_t password[257];
  uint8_t daddr[257];  /* TODO(bnoordhuis) Merge with username/password. */
} s5_ctx;

void s5_init(s5_ctx *ctx);

s5_err s5_parse(s5_ctx *cx, uint8_t **data, size_t *size);

/* Only call after s5_parse() has returned s5_want_auth_method. */
unsigned int s5_auth_methods(const s5_ctx *cx);

/* Call after s5_parse() has returned s5_want_auth_method. */



( run in 0.575 second using v1.01-cache-2.11-cpan-49f99fa48dc )