/** 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); }
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); }
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); }