Exemplo n.º 1
0
/** Clear the contents of the URL. */
PN_EXTERN void pn_url_clear(pn_url_t *url) {
    pn_url_set_scheme(url, NULL);
    pn_url_set_username(url, NULL);
    pn_url_set_password(url, NULL);
    pn_url_set_host(url, NULL);
    pn_url_set_port(url, NULL);
    pn_url_set_path(url, NULL);
    pn_string_clear(url->str);
}
Exemplo n.º 2
0
void pni_reactor_set_connection_peer_address(pn_connection_t *connection,
                                             const char *host,
                                             const char *port)
{
    pn_url_t *url = pn_url();
    pn_url_set_host(url, host);
    pn_url_set_port(url, port);
    pn_record_t *record = pn_connection_attachments(connection);
    if (!pn_record_has(record, PNI_CONN_PEER_ADDRESS)) {
      pn_record_def(record, PNI_CONN_PEER_ADDRESS, PN_OBJECT);
    }
    pn_record_set(record, PNI_CONN_PEER_ADDRESS, url);
    pn_decref(url);
}
Exemplo n.º 3
0
void pn_reactor_set_connection_host(pn_reactor_t *reactor,
                                    pn_connection_t *connection,
                                    const char *host,
                                    const char *port)
{
    (void)reactor;  // ignored
    pn_url_t *url = pn_url();
    pn_url_set_host(url, host);
    pn_url_set_port(url, port);
    pn_record_t *record = pn_connection_attachments(connection);
    if (!pn_record_has(record, PNI_CONN_URL)) {
        pn_record_def(record, PNI_CONN_URL, PN_OBJECT);
    }
    pn_record_set(record, PNI_CONN_URL, url);
    pn_decref(url);
}
Exemplo n.º 4
0
void defaults(pn_url_t* u) {
  const char* scheme = pn_url_get_scheme(u);
  const char* port = pn_url_get_port(u);
  if (!scheme || *scheme=='\0' ) pn_url_set_scheme(u, url::AMQP.c_str());
  if (!port || *port=='\0' ) pn_url_set_port(u, pn_url_get_scheme(u));
}