5a7ca0
diff --git a/ncat/ncat_connect.c b/ncat/ncat_connect.c
5a7ca0
index a420126..048dc46 100644
5a7ca0
--- a/ncat/ncat_connect.c
5a7ca0
+++ b/ncat/ncat_connect.c
5a7ca0
@@ -265,20 +265,20 @@ static void connect_report(nsock_iod nsi)
5a7ca0
     union sockaddr_u peer;
5a7ca0
     zmem(&peer, sizeof(peer.storage));
5a7ca0
 
5a7ca0
-    nsock_iod_get_communication_info(nsi, NULL, NULL, NULL, &peer.sockaddr,
5a7ca0
+    nsi_getlastcommunicationinfo(nsi, NULL, NULL, NULL, &peer.sockaddr,
5a7ca0
                                      sizeof(peer.storage));
5a7ca0
     if (o.verbose) {
5a7ca0
 #ifdef HAVE_OPENSSL
5a7ca0
-        if (nsock_iod_check_ssl(nsi)) {
5a7ca0
+        if (nsi_checkssl(nsi)) {
5a7ca0
             X509 *cert;
5a7ca0
             X509_NAME *subject;
5a7ca0
             char digest_buf[SHA1_STRING_LENGTH + 1];
5a7ca0
             char *fp;
5a7ca0
 
5a7ca0
             loguser("SSL connection to %s:%d.", inet_socktop(&peer),
5a7ca0
-                    nsock_iod_get_peerport(nsi));
5a7ca0
+                    nsi_peerport(nsi));
5a7ca0
 
5a7ca0
-            cert = SSL_get_peer_certificate((SSL *)nsock_iod_get_ssl(nsi));
5a7ca0
+            cert = SSL_get_peer_certificate((SSL *)nsi_getssl(nsi));
5a7ca0
             ncat_assert(cert != NULL);
5a7ca0
 
5a7ca0
             subject = X509_get_subject_name(cert);
5a7ca0
@@ -303,7 +303,7 @@ static void connect_report(nsock_iod nsi)
5a7ca0
             else
5a7ca0
 #endif
5a7ca0
                 loguser("Connected to %s:%d.\n", inet_socktop(&peer),
5a7ca0
-                        nsock_iod_get_peerport(nsi));
5a7ca0
+                        nsi_peerport(nsi));
5a7ca0
         }
5a7ca0
 #else
5a7ca0
 #if HAVE_SYS_UN_H
5a7ca0
@@ -312,7 +312,7 @@ static void connect_report(nsock_iod nsi)
5a7ca0
         else
5a7ca0
 #endif
5a7ca0
             loguser("Connected to %s:%d.\n", inet_socktop(&peer),
5a7ca0
-                    nsock_iod_get_peerport(nsi));
5a7ca0
+                    nsi_peerport(nsi));
5a7ca0
 #endif
5a7ca0
     }
5a7ca0
 }
5a7ca0
@@ -892,32 +892,32 @@ int ncat_connect(void)
5a7ca0
         nsock_set_default_engine("select");
5a7ca0
 
5a7ca0
     /* Create an nsock pool */
5a7ca0
-    if ((mypool = nsock_pool_new(NULL)) == NULL)
5a7ca0
+    if ((mypool = nsp_new(NULL)) == NULL)
5a7ca0
         bye("Failed to create nsock_pool.");
5a7ca0
 
5a7ca0
     if (o.debug >= 6)
5a7ca0
-        nsock_set_loglevel(NSOCK_LOG_DBG_ALL);
5a7ca0
+        nsock_set_loglevel(mypool, NSOCK_LOG_DBG_ALL);
5a7ca0
     else if (o.debug >= 3)
5a7ca0
-        nsock_set_loglevel(NSOCK_LOG_DBG);
5a7ca0
+        nsock_set_loglevel(mypool, NSOCK_LOG_DBG);
5a7ca0
     else if (o.debug >= 1)
5a7ca0
-        nsock_set_loglevel(NSOCK_LOG_INFO);
5a7ca0
+        nsock_set_loglevel(mypool, NSOCK_LOG_INFO);
5a7ca0
     else
5a7ca0
-        nsock_set_loglevel(NSOCK_LOG_ERROR);
5a7ca0
+        nsock_set_loglevel(mypool, NSOCK_LOG_ERROR);
5a7ca0
 
5a7ca0
     /* Allow connections to broadcast addresses. */
5a7ca0
     nsock_pool_set_broadcast(mypool, 1);
5a7ca0
 
5a7ca0
 #ifdef HAVE_OPENSSL
5a7ca0
-    set_ssl_ctx_options((SSL_CTX *) nsock_pool_ssl_init(mypool, 0));
5a7ca0
+    set_ssl_ctx_options((SSL_CTX *) nsock_pool_ssl_init(mypool));
5a7ca0
 #endif
5a7ca0
 
5a7ca0
     if (!o.proxytype) {
5a7ca0
         /* A non-proxy connection. Create an iod for a new socket. */
5a7ca0
-        cs.sock_nsi = nsock_iod_new(mypool, NULL);
5a7ca0
+        cs.sock_nsi = nsi_new(mypool, NULL);
5a7ca0
         if (cs.sock_nsi == NULL)
5a7ca0
             bye("Failed to create nsock_iod.");
5a7ca0
 
5a7ca0
-        if (nsock_iod_set_hostname(cs.sock_nsi, o.target) == -1)
5a7ca0
+        if (nsi_set_hostname(cs.sock_nsi, o.target) == -1)
5a7ca0
             bye("Failed to set hostname on iod.");
5a7ca0
 
5a7ca0
 #if HAVE_SYS_UN_H
5a7ca0
@@ -945,7 +945,7 @@ int ncat_connect(void)
5a7ca0
                 strncpy(srcaddr.un.sun_path, tmp_name, sizeof(srcaddr.un.sun_path));
5a7ca0
                 free (tmp_name);
5a7ca0
             }
5a7ca0
-            nsock_iod_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
+            nsi_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
                                 SUN_LEN((struct sockaddr_un *)&srcaddr.storage));
5a7ca0
 
5a7ca0
             if (o.verbose)
5a7ca0
@@ -957,23 +957,23 @@ int ncat_connect(void)
5a7ca0
           case AF_UNSPEC:
5a7ca0
             break;
5a7ca0
           case AF_INET:
5a7ca0
-            nsock_iod_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
+            nsi_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
                                     sizeof(srcaddr.in));
5a7ca0
             break;
5a7ca0
 #ifdef AF_INET6
5a7ca0
           case AF_INET6:
5a7ca0
-            nsock_iod_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
+            nsi_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
                                     sizeof(srcaddr.in6));
5a7ca0
             break;
5a7ca0
 #endif
5a7ca0
 #if HAVE_SYS_UN_H
5a7ca0
           case AF_UNIX:
5a7ca0
-            nsock_iod_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
+            nsi_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
                                     SUN_LEN((struct sockaddr_un *)&srcaddr.storage));
5a7ca0
             break;
5a7ca0
 #endif
5a7ca0
           default:
5a7ca0
-            nsock_iod_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
+            nsi_set_localaddr(cs.sock_nsi, &srcaddr.storage,
5a7ca0
                                     sizeof(srcaddr.storage));
5a7ca0
             break;
5a7ca0
         }
5a7ca0
@@ -986,7 +986,7 @@ int ncat_connect(void)
5a7ca0
                 bye("Sorry, -g can only currently be used with IPv4.");
5a7ca0
             ipopts = buildsrcrte(targetaddrs->addr.in.sin_addr, o.srcrtes, o.numsrcrtes, o.srcrteptr, &ipoptslen);
5a7ca0
 
5a7ca0
-            nsock_iod_set_ipoptions(cs.sock_nsi, ipopts, ipoptslen);
5a7ca0
+            nsi_set_ipoptions(cs.sock_nsi, ipopts, ipoptslen);
5a7ca0
             free(ipopts); /* Nsock has its own copy */
5a7ca0
         }
5a7ca0
 
5a7ca0
@@ -1029,10 +1029,10 @@ int ncat_connect(void)
5a7ca0
 
5a7ca0
         /* Once the proxy negotiation is done, Nsock takes control of the
5a7ca0
            socket. */
5a7ca0
-        cs.sock_nsi = nsock_iod_new2(mypool, connect_socket, NULL);
5a7ca0
+        cs.sock_nsi = nsi_new2(mypool, connect_socket, NULL);
5a7ca0
 
5a7ca0
         /* Create IOD for nsp->stdin */
5a7ca0
-        if ((cs.stdin_nsi = nsock_iod_new2(mypool, 0, NULL)) == NULL)
5a7ca0
+        if ((cs.stdin_nsi = nsi_new2(mypool, 0, NULL)) == NULL)
5a7ca0
             bye("Failed to create stdin nsiod.");
5a7ca0
 
5a7ca0
         post_connect(mypool, cs.sock_nsi);
5a7ca0
@@ -1049,8 +1049,8 @@ int ncat_connect(void)
5a7ca0
         gettimeofday(&end_time, NULL);
5a7ca0
         time = TIMEVAL_MSEC_SUBTRACT(end_time, start_time) / 1000.0;
5a7ca0
         loguser("%lu bytes sent, %lu bytes received in %.2f seconds.\n",
5a7ca0
-            nsock_iod_get_write_count(cs.sock_nsi),
5a7ca0
-            nsock_iod_get_read_count(cs.sock_nsi), time);
5a7ca0
+            nsi_get_write_count(cs.sock_nsi),
5a7ca0
+            nsi_get_read_count(cs.sock_nsi), time);
5a7ca0
     }
5a7ca0
 
5a7ca0
 #if HAVE_SYS_UN_H
5a7ca0
@@ -1061,7 +1061,7 @@ int ncat_connect(void)
5a7ca0
     }
5a7ca0
 #endif
5a7ca0
 
5a7ca0
-    nsock_pool_delete(mypool);
5a7ca0
+    nsp_delete(mypool);
5a7ca0
 
5a7ca0
     return rc == NSOCK_LOOP_ERROR ? 1 : 0;
5a7ca0
 }
5a7ca0
@@ -1127,7 +1127,7 @@ static void connect_handler(nsock_pool nsp, nsock_event evt, void *data)
5a7ca0
             if (o.verbose) {
5a7ca0
                 union sockaddr_u peer;
5a7ca0
                 zmem(&peer, sizeof(peer.storage));
5a7ca0
-                nsock_iod_get_communication_info(cs.sock_nsi, NULL, NULL, NULL,
5a7ca0
+                nsi_getlastcommunicationinfo(cs.sock_nsi, NULL, NULL, NULL,
5a7ca0
                     &peer.sockaddr, sizeof(peer.storage));
5a7ca0
                 loguser("Connection to %s failed: %s.\n", inet_socktop(&peer), socket_strerror(errcode));
5a7ca0
                 loguser("Trying next address...\n");
5a7ca0
@@ -1146,10 +1146,10 @@ static void connect_handler(nsock_pool nsp, nsock_event evt, void *data)
5a7ca0
     }
5a7ca0
 
5a7ca0
 #ifdef HAVE_OPENSSL
5a7ca0
-    if (nsock_iod_check_ssl(cs.sock_nsi)) {
5a7ca0
+    if (nsi_checkssl(cs.sock_nsi)) {
5a7ca0
         /* Check the domain name. ssl_post_connect_check prints an
5a7ca0
            error message if appropriate. */
5a7ca0
-        if (!ssl_post_connect_check((SSL *)nsock_iod_get_ssl(cs.sock_nsi), o.target))
5a7ca0
+        if (!ssl_post_connect_check((SSL *)nsi_getssl(cs.sock_nsi), o.target))
5a7ca0
             bye("Certificate verification error.");
5a7ca0
     }
5a7ca0
 #endif
5a7ca0
@@ -1160,7 +1160,7 @@ static void connect_handler(nsock_pool nsp, nsock_event evt, void *data)
5a7ca0
     }
5a7ca0
 
5a7ca0
     /* Create IOD for nsp->stdin */
5a7ca0
-    if ((cs.stdin_nsi = nsock_iod_new2(nsp, 0, NULL)) == NULL)
5a7ca0
+    if ((cs.stdin_nsi = nsi_new2(nsp, 0, NULL)) == NULL)
5a7ca0
         bye("Failed to create stdin nsiod.");
5a7ca0
 
5a7ca0
     post_connect(nsp, nse_iod(evt));
5a7ca0
@@ -1174,9 +1174,9 @@ static void post_connect(nsock_pool nsp, nsock_iod iod)
5a7ca0
     if (o.cmdexec) {
5a7ca0
         struct fdinfo info;
5a7ca0
 
5a7ca0
-        info.fd = nsock_iod_get_sd(iod);
5a7ca0
+        info.fd = nsi_getsd(iod);
5a7ca0
 #ifdef HAVE_OPENSSL
5a7ca0
-        info.ssl = (SSL *)nsock_iod_get_ssl(iod);
5a7ca0
+        info.ssl = (SSL *)nsi_getssl(iod);
5a7ca0
 #endif
5a7ca0
         /* Convert Nsock's non-blocking socket to an ordinary blocking one. It's
5a7ca0
            possible for a program to write fast enough that it will get an
5a7ca0
@@ -1217,7 +1217,7 @@ static void read_stdin_handler(nsock_pool nsp, nsock_event evt, void *data)
5a7ca0
 
5a7ca0
     if (status == NSE_STATUS_EOF) {
5a7ca0
       if (!o.noshutdown)
5a7ca0
-        shutdown(nsock_iod_get_sd(cs.sock_nsi), SHUT_WR);
5a7ca0
+        shutdown(nsi_getsd(cs.sock_nsi), SHUT_WR);
5a7ca0
         /* In --send-only mode or non-TCP mode, exit after EOF on stdin. */
5a7ca0
         if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.sendonly))
5a7ca0
             nsock_loop_quit(nsp);
5a7ca0
@@ -1288,7 +1288,7 @@ static void read_socket_handler(nsock_pool nsp, nsock_event evt, void *data)
5a7ca0
         ncat_delay_timer(o.linedelay);
5a7ca0
 
5a7ca0
     if (o.telnet)
5a7ca0
-        dotelnet(nsock_iod_get_sd(nse_iod(evt)), (unsigned char *) buf, nbytes);
5a7ca0
+        dotelnet(nsi_getsd(nse_iod(evt)), (unsigned char *) buf, nbytes);
5a7ca0
 
5a7ca0
     /* Write socket data to stdout */
5a7ca0
     Write(STDOUT_FILENO, buf, nbytes);
5a7ca0
diff --git a/ncat/util.h b/ncat/util.h
5a7ca0
index 63f4c6f..f81d577 100644
5a7ca0
--- a/ncat/util.h
5a7ca0
+++ b/ncat/util.h
5a7ca0
@@ -175,6 +175,8 @@ do { \
5a7ca0
 
5a7ca0
 void die(char *);
5a7ca0
 
5a7ca0
+#define NORETURN __attribute__((noreturn))
5a7ca0
+
5a7ca0
 NORETURN void bye(const char *, ...)
5a7ca0
      __attribute__ ((format (printf, 1, 2)));
5a7ca0
 
5a7ca0
diff --git a/ncat/ncat_connect.c b/ncat/ncat_connect.c
5a7ca0
index 048dc46..8680278 100644
5a7ca0
--- a/ncat/ncat_connect.c
5a7ca0
+++ b/ncat/ncat_connect.c
5a7ca0
@@ -905,10 +905,10 @@ int ncat_connect(void)
5a7ca0
         nsock_set_loglevel(mypool, NSOCK_LOG_ERROR);
5a7ca0
 
5a7ca0
     /* Allow connections to broadcast addresses. */
5a7ca0
-    nsock_pool_set_broadcast(mypool, 1);
5a7ca0
+    nsp_setbroadcast(mypool, 1);
5a7ca0
 
5a7ca0
 #ifdef HAVE_OPENSSL
5a7ca0
-    set_ssl_ctx_options((SSL_CTX *) nsock_pool_ssl_init(mypool));
5a7ca0
+    set_ssl_ctx_options((SSL_CTX *) nsp_ssl_init(mypool));
5a7ca0
 #endif
5a7ca0
 
5a7ca0
     if (!o.proxytype) {