Merge branch 'master' of ssh://gapil.gnulinux.it/srv/git/gapil
[gapil.git] / sources / mygethost.c
index 76cf84477eb5edd568c52c40bf3d6199b30dfb1a..2167852064349e66599fe5ac5049f19523b1e74a 100644 (file)
  *
  * Author: S. Piccardi Jul. 2004
  *
- * $Id$
- *
  *****************************************************************************/
-#include <netdb.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>        /* C standard library */
-#include <stdio.h>         /* I/O standard library */
-#include <unistd.h>
-#include <arpa/inet.h>
+#include <sys/types.h>   /* primitive system data types */
+#include <sys/stat.h>    /* file characteristics constants and functions */
+#include <stdlib.h>      /* C standard library */
+#include <stdio.h>       /* standard I/O library */
+#include <unistd.h>      /* unix standard library */
+#include <arpa/inet.h>   /* IP addresses conversion utilities */
+#include <netdb.h>       /* C resolver library */
+#include <netinet/tcp.h> /* TCP socket option */
+
 extern int h_errno;
 
 #include "Gapil.h"
 /*
- * Program myhost
+ * Program mygethost
  *
  * Use gethostbyname and print results
  */
@@ -50,6 +50,18 @@ int main(int argc, char *argv[])
  */
     int i;
     struct hostent *data;
+
+    struct sock_level {
+       int level;
+       char * name;
+    } sock_level[] = {
+       SOL_SOCKET, "SOL_SOCKET",
+       SOL_IP,     "SOL_IP",
+       SOL_TCP,    "SOL_TCP",
+       SOL_IPV6,   "SOL_IPV6",
+       SOL_ICMPV6, "SOL_ICMPV6"
+    };
+
     char **alias;
     char *addr;
     char buffer[INET6_ADDRSTRLEN];