]> git.sesse.net Git - nbtscanner/blobdiff - nbtscanner.c
Import nbtscanner 0.2.0.
[nbtscanner] / nbtscanner.c
index 223965cecacd61994ebe507dc3311dc526803554..ab454180682ffc9f9356a2f8bf8b3157c90fa6fb 100644 (file)
@@ -51,6 +51,7 @@ void interpret_node_status(char *p, struct in_addr in)
 {
        int numnames = CVAL(p,0);
        char hostname[32], fileservername[32], group[32];
+       char messenger;
 
        /*
         * hopefully this will be enough to identify the host as unknown
@@ -60,6 +61,7 @@ void interpret_node_status(char *p, struct in_addr in)
        strcpy(hostname, "-unknown-nbtscanner-");
        strcpy(fileservername, "-unknown-nbtscanner-");
        strcpy(group, "-unknown-nbtscanner-");
+       messenger = 'n';
 
        p += 1;
        while (numnames--) {
@@ -100,14 +102,18 @@ void interpret_node_status(char *p, struct in_addr in)
                if ((p[0] & 0x80) == 0x80 && ((p[0] & 0x1f) == 0x04) && type == 0x00) {
                        strcpy(group, qname);
                }
+               /* Messenger up (type 0x03) */
+               if (type == 0x03) {
+                       messenger = 'y';
+               }
 
                p += 2;
        }
 
        if (use_mysql) {
-               add_record_mysql(inet_ntoa(in), hostname, fileservername, group);
+               add_record_mysql(inet_ntoa(in), hostname, fileservername, group, messenger);
        } else {
-               printf("%s,%s,%s,%s\n", inet_ntoa(in), hostname, fileservername, group);
+               printf("%s,%s,%s,%s,%c\n", inet_ntoa(in), hostname, fileservername, group, messenger);
        }
 }