1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
--- src/main.c.orig Wed Jul 4 10:28:06 2001
+++ src/main.c Wed Jul 4 10:28:15 2001
@@ -2,7 +2,6 @@
#include "gnutella.h"
#include <signal.h>
-#include <mcheck.h>
#include "interface.h"
#include "support.h"
--- src/search.c.orig Fri May 25 18:52:42 2001
+++ src/search.c Wed Dec 12 16:33:52 2001
@@ -14,17 +14,17 @@
// Known Vendor Codes for reference
-#define BearShareType 'BEAR'
-#define GnotellaType 'GNOT'
-#define GnucleusType 'GNUC'
-#define LimeWireType 'LIME'
-#define MactellaType 'MACT'
-#define ToadNodeType 'TOAD'
-#define GnutType 'GNUT'
-#define GtkGnutellaType 'GTKG'
-#define NapShareType 'NAPS'
+#define BearShareType "BEAR"
+#define GnotellaType "GNOT"
+#define GnucleusType "GNUC"
+#define LimeWireType "LIME"
+#define MactellaType "MACT"
+#define ToadNodeType "TOAD"
+#define GnutType "GNUT"
+#define GtkGnutellaType "GTKG"
+#define NapShareType "NAPS"
// Open Cola Folders Client
-#define OCFoldersType 'OCFG'
+#define OCFoldersType "OCFG"
// some temp strings
static gchar stmp_1[4096];
@@ -907,15 +907,13 @@
GSList *l, *next;
gchar *titles[5], info[400], vendor[100], temp[6];
struct record *rc;
- guint32 row,i,t;
+ guint32 row,i;
vendor[0] = 0;
rs->status = 0;
- if (rs->trailer) { // we have trailer information, decode the vendor specific info
- READ_GUINT32_BE((rs->trailer + 1), t); // put it into a int for easy compare
- switch (t) // remember to skip rs->trailer length byte at [0]
- {
- case GtkGnutellaType: // got Gtk-Gnutella trailer, handle it
+ if (rs->trailer) {
+ // we have trailer information, decode the vendor specific info
+ if ( !strncasecmp ( rs->trailer + 1, GtkGnutellaType, 4 )) {
strcat(vendor,"GtkGnut"); // format bit 3= has uploaded, 2= busy, 0= need push
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 1) && (rs->trailer[6] & 0x04))
@@ -923,54 +921,48 @@
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
// if (dbg > 4) printf("TRAILER=%.4X\n",rs->status); // use for testing
- break;
- case NapShareType: // got NapShare trailer, handle it
+ } else if ( !strncasecmp ( rs->trailer + 1, NapShareType, 4 )) {
strcat(vendor,"NapShare"); // format bit 3= has uploaded, 2= busy, 0= need push
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 1) && (rs->trailer[6] & 0x04))
rs->status = rs->status | 0x02; // bit 1, busy flag
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
- break;
- case LimeWireType: // got LimeWire trailer, handle it
+ } else if ( !strncasecmp ( rs->trailer + 1, LimeWireType, 4 )) {
strcat(vendor,"Lime"); // Not sure, but should be like bearshare
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04))
rs->status = rs->status | 0x02; // bit 1, busy flag
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
- break;
- case BearShareType: // got Bearshare trailer, handle it
+ } else if ( !strncasecmp ( rs->trailer + 1, BearShareType, 4 )) {
strcat(vendor,"Bear"); // Protocol doc says how to decode the bytes, but I cheat
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04))
rs->status = rs->status | 0x02; // bit 1, busy flag
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
- break;
- case GnotellaType: // got Gnotella trailer, handle it
+ } else if ( !strncasecmp ( rs->trailer + 1, GnotellaType, 4 )) {
strcat(vendor,"Gnot"); // same as bearshare
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04))
rs->status = rs->status | 0x02; // bit 1, busy flag
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
- break;
- case GnucleusType: // got Gnucleus trailer, handle it
+ } else if ( !strncasecmp ( rs->trailer + 1, GnucleusType, 4 )) {
strcat(vendor,"Gnuc"); // same as bearshare
rs->status = rs->status | 0x80; // bit 7, known vendor flag
if ((rs->trailer[5] == 2) && (rs->trailer[7] & 0x04))
rs->status = rs->status | 0x02; // bit 1, busy flag
if ((rs->trailer[5] > 0) && (rs->trailer[6] & 0x01))
rs->status = rs->status | 0x01; // bit 0, firewall flag
- break;
- default:
+ } else {
temp[0] = 0;
for (i=0;i<4;i++) { // unknown type, do we have all alpha ?
if (isalpha(rs->trailer[i+1])) temp[i] = rs->trailer[i+1];
@@ -981,7 +973,6 @@
}
temp[4] = 0; // terminate
strcat(vendor,temp);
- break;
} // close switch statement
} // if trailer
if (rs->status & 0x02) strcat(vendor,",Busy");
|