KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > netbios > NetBIOSName


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.netbios;
18
19 import java.net.InetAddress JavaDoc;
20 import java.util.StringTokenizer JavaDoc;
21 import java.util.Vector JavaDoc;
22
23 import org.alfresco.filesys.util.IPAddress;
24
25 /**
26  * NetBIOS Name Class.
27  */

28 public class NetBIOSName
29 {
30     // NetBIOS name length
31

32     public static final int NameLength = 16;
33     
34     // NetBIOS name types - <computername> + type
35

36     public static final char WorkStation = 0x00;
37     public static final char Messenger = 0x01;
38     public static final char RemoteMessenger = 0x03;
39     public static final char RASServer = 0x06;
40     public static final char FileServer = 0x20;
41     public static final char RASClientService = 0x21;
42     public static final char MSExchangeInterchange = 0x22;
43     public static final char MSExchangeStore = 0x23;
44     public static final char MSExchangeDirectory = 0x24;
45     public static final char LotusNotesServerService= 0x2B;
46     public static final char ModemSharingService = 0x30;
47     public static final char ModemSharingClient = 0x31;
48     public static final char McCaffeeAntiVirus = 0x42;
49     public static final char SMSClientRemoteControl = 0x43;
50     public static final char SMSAdminRemoteControl = 0x44;
51     public static final char SMSClientRemoteChat = 0x45;
52     public static final char SMSClientRemoteTransfer= 0x46;
53     public static final char DECPathworksService = 0x4C;
54     public static final char MSExchangeIMC = 0x6A;
55     public static final char MSExchangeMTA = 0x87;
56     public static final char NetworkMonitorAgent = 0xBE;
57     public static final char NetworkMonitorApp = 0xBF;
58
59     // <domainname> + type
60

61     public static final char Domain = 0x00; // Group
62
public static final char DomainMasterBrowser = 0x1B;
63     public static final char DomainControllers = 0x1C; // Group
64
public static final char MasterBrowser = 0x1D;
65     public static final char DomainAnnounce = 0x1E;
66
67     // Browse master - __MSBROWSE__ + type
68

69     public static final char BrowseMasterGroup = 0x01;
70
71     // Browse master NetBIOS name
72

73     public static final String JavaDoc BrowseMasterName = "\u0001\u0002__MSBROWSE__\u0002";
74
75     // NetBIOS names
76

77     public static final String JavaDoc SMBServer = "*SMBSERVER";
78     public static final String JavaDoc SMBServer2 = "*SMBSERV";
79
80     // Default time to live for name registrations
81

82     public static final int DefaultTTL = 28800; // 8 hours
83

84     // Name conversion string
85

86     private static final String JavaDoc EncodeConversion = "ABCDEFGHIJKLMNOP";
87
88     // Character set to use when converting the NetBIOS name string to a byte array
89

90     private static String JavaDoc _nameConversionCharset = null;
91
92     // Name string and type
93

94     private String JavaDoc m_name;
95     private char m_type;
96
97     // Name scope
98

99     private String JavaDoc m_scope;
100
101     // Group name flag
102

103     private boolean m_group = false;
104
105     // Local name flag
106

107     private boolean m_local = true;
108
109     // IP address(es) of the owner of this name
110

111     private Vector JavaDoc<byte[]> m_addrList;
112
113     // Time that the name expires and time to live
114

115     private long m_expiry;
116     private int m_ttl; // seconds
117

118     /**
119      * Create a unique NetBIOS name.
120      *
121      * @param name java.lang.String
122      * @param typ char
123      * @param group
124      */

125     public NetBIOSName(String JavaDoc name, char typ, boolean group)
126     {
127         setName(name);
128         setType(typ);
129         setGroup(group);
130     }
131
132     /**
133      * Create a unique NetBIOS name.
134      *
135      * @param name java.lang.String
136      * @param typ char
137      * @param group boolean
138      * @param ipaddr byte[]
139      */

140     public NetBIOSName(String JavaDoc name, char typ, boolean group, byte[] ipaddr)
141     {
142         setName(name);
143         setType(typ);
144         setGroup(group);
145         addIPAddress(ipaddr);
146     }
147
148     /**
149      * Create a unique NetBIOS name.
150      *
151      * @param name java.lang.String
152      * @param typ char
153      * @param group boolean
154      * @param ipList Vector<byte[]>
155      */

156     public NetBIOSName(String JavaDoc name, char typ, boolean group, Vector JavaDoc<byte[]> ipList)
157     {
158         setName(name);
159         setType(typ);
160         setGroup(group);
161         addIPAddresses(ipList);
162     }
163
164     /**
165      * Create a unique NetBIOS name.
166      *
167      * @param name java.lang.String
168      * @param typ char
169      * @param group boolean
170      * @param ipaddr byte[]
171      * @param ttl int
172      */

173     public NetBIOSName(String JavaDoc name, char typ, boolean group, byte[] ipaddr, int ttl)
174     {
175         setName(name);
176         setType(typ);
177         setGroup(group);
178         addIPAddress(ipaddr);
179         setTimeToLive(ttl);
180     }
181
182     /**
183      * Create a unique NetBIOS name.
184      *
185      * @param name java.lang.String
186      * @param typ char
187      * @param group boolean
188      * @param ipList Vector<byte[]>
189      * @param ttl int
190      */

191     public NetBIOSName(String JavaDoc name, char typ, boolean group, Vector JavaDoc<byte[]> ipList, int ttl)
192     {
193         setName(name);
194         setType(typ);
195         setGroup(group);
196         addIPAddresses(ipList);
197         setTimeToLive(ttl);
198     }
199
200     /**
201      * Create a NetBIOS name from a byte array
202      *
203      * @param buf byte[]
204      * @param off int
205      */

206     public NetBIOSName(byte[] buf, int off)
207     {
208         setName(new String JavaDoc(buf, off, NameLength - 1));
209         setType((char) buf[off + NameLength - 1]);
210     }
211
212     /**
213      * Create a NetBIOS name from an encoded name string
214      *
215      * @param name String
216      */

217     public NetBIOSName(String JavaDoc name)
218     {
219         setName(name.substring(0, NameLength - 1).trim());
220         setType(name.charAt(NameLength - 1));
221     }
222
223     /**
224      * Create a NetBIOS name from the specified name and scope
225      *
226      * @param name String
227      * @param scope String
228      */

229     protected NetBIOSName(String JavaDoc name, String JavaDoc scope)
230     {
231         setName(name.substring(0, NameLength - 1).trim());
232         setType(name.charAt(NameLength - 1));
233
234         if (scope != null && scope.length() > 0)
235             setNameScope(scope);
236     }
237
238     /**
239      * Compare objects for equality.
240      *
241      * @return boolean
242      * @param obj java.lang.Object
243      */

244     public boolean equals(Object JavaDoc obj)
245     {
246
247         // Check if the object is a NetBIOSName type object
248

249         if (obj instanceof NetBIOSName)
250         {
251
252             // Check if the NetBIOS name, name type and local/remote flags are equal
253

254             NetBIOSName nbn = (NetBIOSName) obj;
255             if (nbn.getName().equals(getName()) && nbn.getType() == getType() && nbn.isLocalName() == isLocalName())
256                 return true;
257         }
258
259         // Objects are not equal
260

261         return false;
262     }
263
264     /**
265      * Return the system time that the NetBIOS name expires.
266      *
267      * @return long
268      */

269     public final long getExpiryTime()
270     {
271         return m_expiry;
272     }
273
274     /**
275      * Get the names time to live value, in seconds
276      *
277      * @return int
278      */

279     public final int getTimeToLive()
280     {
281         return m_ttl;
282     }
283
284     /**
285      * Return the number of addresses for this NetBIOS name
286      *
287      * @return int
288      */

289     public final int numberOfAddresses()
290     {
291         return m_addrList != null ? m_addrList.size() : 0;
292     }
293
294     /**
295      * Return the specified IP address that owns the NetBIOS name.
296      *
297      * @param idx int
298      * @return byte[]
299      */

300     public final byte[] getIPAddress(int idx)
301     {
302         if (m_addrList == null || idx < 0 || idx >= m_addrList.size())
303             return null;
304         return m_addrList.get(idx);
305     }
306
307     /**
308      * Return the specified IP address that owns the NetBIOS name, as a string.
309      *
310      * @param idx int
311      * @return String
312      */

313     public final String JavaDoc getIPAddressString(int idx)
314     {
315         if (m_addrList == null || idx < 0 || idx >= m_addrList.size())
316             return null;
317
318         // Get the raw IP address and build the address string
319

320         return IPAddress.asString(m_addrList.get(idx));
321     }
322
323     /**
324      * Return the NetBIOS name.
325      *
326      * @return java.lang.String
327      */

328     public final String JavaDoc getName()
329     {
330         return m_name;
331     }
332
333     /**
334      * Return the NetBIOS name as a 16 character string with the name and type
335      *
336      * @return byte[]
337      */

338     public final byte[] getNetBIOSName()
339     {
340
341         // Allocate a buffer to build the full name
342

343         byte[] nameBuf = new byte[NameLength];
344
345         // Get the name string bytes
346

347         byte[] nameBytes = null;
348
349         try
350         {
351             if (hasNameConversionCharacterSet())
352                 nameBytes = getName().getBytes(getNameConversionCharacterSet());
353             else
354                 nameBytes = getName().getBytes();
355         }
356         catch (Exception JavaDoc ex)
357         {
358             ex.printStackTrace();
359         }
360
361         for (int i = 0; i < nameBytes.length; i++)
362             nameBuf[i] = nameBytes[i];
363         for (int i = nameBytes.length; i < NameLength; i++)
364             nameBuf[i] = ' ';
365         nameBuf[NameLength - 1] = (byte) (m_type & 0xFF);
366
367         return nameBuf;
368     }
369
370     /**
371      * Determine if the name has a name scope
372      *
373      * @return boolean
374      */

375     public final boolean hasNameScope()
376     {
377         return m_scope != null ? true : false;
378     }
379
380     /**
381      * Return the name scope
382      *
383      * @return String
384      */

385     public final String JavaDoc getNameScope()
386     {
387         return m_scope;
388     }
389
390     /**
391      * Return the NetBIOS name type.
392      *
393      * @return char
394      */

395     public final char getType()
396     {
397         return m_type;
398     }
399
400     /**
401      * Return a hash code for this object.
402      *
403      * @return int
404      */

405     public int hashCode()
406     {
407         return getName().hashCode() + (int) getType();
408     }
409
410     /**
411      * Returns true if this is a group type NetBIOS name.
412      *
413      * @return boolean
414      */

415     public final boolean isGroupName()
416     {
417         return m_group;
418     }
419
420     /**
421      * Determine if this is a local or remote NetBIOS name.
422      *
423      * @return boolean
424      */

425     public final boolean isLocalName()
426     {
427         return m_local;
428     }
429
430     /**
431      * Returns true if the NetBIOS name is a unique type name.
432      *
433      * @return boolean
434      */

435     public final boolean isUniqueName()
436     {
437         return m_group ? false : true;
438     }
439
440     /**
441      * Remove all TCP/IP addresses from the NetBIOS name
442      */

443     public final void removeAllAddresses()
444     {
445         m_addrList.removeAllElements();
446     }
447
448     /**
449      * Set the system time that this NetBIOS name expires at.
450      *
451      * @param expires long
452      */

453     public final void setExpiryTime(long expires)
454     {
455         m_expiry = expires;
456     }
457
458     /**
459      * Set the names time to live, in seconds
460      *
461      * @param ttl int
462      */

463     public final void setTimeToLive(int ttl)
464     {
465         m_ttl = ttl;
466     }
467
468     /**
469      * Set/clear the group name flag.
470      *
471      * @param flag boolean
472      */

473     public final void setGroup(boolean flag)
474     {
475         m_group = flag;
476     }
477
478     /**
479      * Set the name scope
480      *
481      * @param scope String
482      */

483     public final void setNameScope(String JavaDoc scope)
484     {
485         if (scope == null)
486             m_scope = null;
487         else if (scope.length() > 0 && scope.startsWith("."))
488             m_scope = scope.substring(1);
489         else
490             m_scope = scope;
491     }
492
493     /**
494      * Add an IP address to the list of addresses for this NetBIOS name
495      *
496      * @param ipaddr byte[]
497      */

498     public final void addIPAddress(byte[] ipaddr)
499     {
500         if (m_addrList == null)
501             m_addrList = new Vector JavaDoc<byte[]>();
502         m_addrList.add(ipaddr);
503     }
504
505     /**
506      * Add a list of IP addresses to the list of addresses for this NetBIOS name
507      *
508      * @param ipaddr Vector<byte[]>
509      */

510     public final void addIPAddresses(Vector JavaDoc<byte[]> addrList)
511     {
512         if (m_addrList == null)
513             m_addrList = new Vector JavaDoc<byte[]>();
514
515         // Add the addresses
516

517         for (int i = 0; i < addrList.size(); i++)
518         {
519             byte[] addr = addrList.get(i);
520             m_addrList.add(addr);
521         }
522     }
523
524     /**
525      * Set the local/remote NetBIOS name flag.
526      *
527      * @param local boolean
528      */

529     public final void setLocalName(boolean local)
530     {
531         m_local = local;
532     }
533
534     /**
535      * Set the NetBIOS name.
536      *
537      * @param name java.lang.String
538      */

539     public final void setName(String JavaDoc name)
540     {
541
542         // Check if the name contains a name scope, if so then split the name and scope id
543

544         int pos = name.indexOf(".");
545         if (pos != -1)
546         {
547
548             // Split the name and scope id
549

550             setNameScope(name.substring(pos + 1));
551             m_name = toUpperCaseName(name.substring(0, pos));
552         }
553         else
554         {
555
556             // Set the name
557

558             m_name = toUpperCaseName(name);
559         }
560     }
561
562     /**
563      * Set the NetBIOS name type.
564      *
565      * @param typ char
566      */

567     public final void setType(char typ)
568     {
569         m_type = typ;
570     }
571
572     /**
573      * Convert a name to uppercase
574      *
575      * @return String
576      */

577     public static String JavaDoc toUpperCaseName(String JavaDoc name)
578     {
579
580         // Trim the name, unless it looks like a special name
581

582         if (name.length() > 2 && name.charAt(0) != 0x01 && name.charAt(1) != 0x02)
583             name = name.trim();
584
585         // Convert the string to uppercase
586

587         if (name != null && name.length() > 0)
588         {
589             StringBuffer JavaDoc upperName = new StringBuffer JavaDoc(name.length());
590
591             for (int i = 0; i < name.length(); i++)
592             {
593                 char ch = name.charAt(i);
594                 if (ch >= 'a' && ch <= 'z')
595                     upperName.append(Character.toUpperCase(ch));
596                 else
597                     upperName.append(ch);
598             }
599
600             // Return the uppercased name
601

602             return upperName.toString();
603         }
604
605         // Invalid or empty name
606

607         return "";
608     }
609
610     /**
611      * Determine if the name conversion character set has been configured
612      *
613      * @return boolean
614      */

615     public final static boolean hasNameConversionCharacterSet()
616     {
617         return _nameConversionCharset != null ? true : false;
618     }
619
620     /**
621      * Return the name conversion character set name
622      *
623      * @return String
624      */

625     public final static String JavaDoc getNameConversionCharacterSet()
626     {
627         return _nameConversionCharset;
628     }
629
630     /**
631      * Set the name conversion character set
632      *
633      * @param charSet String
634      */

635     public final static void setNameConversionCharacterSet(String JavaDoc charSet)
636     {
637         _nameConversionCharset = charSet;
638     }
639
640     /**
641      * Return the NetBIOS name as a string.
642      *
643      * @return String
644      */

645     public String JavaDoc toString()
646     {
647         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
648         str.append("[");
649         str.append(m_name);
650
651         if (hasNameScope())
652         {
653             str.append(".");
654             str.append(m_scope);
655         }
656
657         str.append(":");
658         str.append(TypeAsString(m_type));
659         str.append(",");
660         if (m_group == true)
661             str.append("Group,");
662         else
663             str.append("Unique,");
664         if (numberOfAddresses() > 0)
665         {
666             for (int i = 0; i < numberOfAddresses(); i++)
667             {
668                 str.append(getIPAddressString(i));
669                 str.append("|");
670             }
671         }
672         str.append("]");
673         return str.toString();
674     }
675
676     /**
677      * Convert a the NetBIOS name into RFC NetBIOS format.
678      *
679      * @return byte[]
680      */

681     public byte[] encodeName()
682     {
683
684         // Build the name string with the name type, make sure that the host
685
// name is uppercase.
686

687         StringBuffer JavaDoc nbName = new StringBuffer JavaDoc(getName().toUpperCase());
688
689         if (nbName.length() > NameLength - 1)
690             nbName.setLength(NameLength - 1);
691
692         // Space pad the name then add the NetBIOS name type
693

694         while (nbName.length() < NameLength - 1)
695             nbName.append(' ');
696         nbName.append(getType());
697
698         // Allocate the return buffer.
699
//
700
// Length byte + encoded NetBIOS name length + name scope length + name scope
701

702         int len = 34;
703         if (hasNameScope())
704             len += getNameScope().length() + 1;
705
706         byte[] encBuf = new byte[len];
707
708         // Convert the NetBIOS name string to the RFC NetBIOS name format
709

710         int pos = 0;
711         encBuf[pos++] = (byte) 32;
712         int idx = 0;
713
714         while (idx < nbName.length())
715         {
716
717             // Get the current character from the host name string
718

719             char ch = nbName.charAt(idx++);
720
721             if (ch == ' ')
722             {
723
724                 // Append an encoded <SPACE> character
725

726                 encBuf[pos++] = (byte) 'C';
727                 encBuf[pos++] = (byte) 'A';
728             }
729             else
730             {
731
732                 // Append octet for the current character
733

734                 encBuf[pos++] = (byte) EncodeConversion.charAt((int) ch / 16);
735                 encBuf[pos++] = (byte) EncodeConversion.charAt((int) ch % 16);
736             }
737         }
738
739         // Check if there is a NetBIOS name scope to be appended to the encoded name string
740

741         if (hasNameScope())
742         {
743
744             // Get the name scope and uppercase
745

746             StringTokenizer JavaDoc tokens = new StringTokenizer JavaDoc(getNameScope(), ".");
747
748             while (tokens.hasMoreTokens())
749             {
750
751                 // Get the current token
752

753                 String JavaDoc token = tokens.nextToken();
754
755                 // Append the name to the encoded NetBIOS name
756

757                 encBuf[pos++] = (byte) token.length();
758                 for (int i = 0; i < token.length(); i++)
759                     encBuf[pos++] = (byte) token.charAt(i);
760             }
761         }
762
763         // Terminate the encoded name string with a null section length
764

765         encBuf[pos++] = (byte) 0;
766
767         // Return the encoded NetBIOS name
768

769         return encBuf;
770     }
771
772     /**
773      * Find the best match address that the NetBIOS name is registered on that matches one of the
774      * local TCP/IP addresses
775      *
776      * @param addrList InetAddress[]
777      * @return int
778      */

779     public final int findBestMatchAddress(InetAddress JavaDoc[] addrList)
780     {
781
782         // Check if the address list is valid
783

784         if (addrList == null || addrList.length == 0 || numberOfAddresses() == 0)
785             return -1;
786
787         // If the NetBIOS name only has one address then just return the index
788

789         if (numberOfAddresses() == 1)
790             return 0;
791
792         // Search for a matching subnet
793

794         int topCnt = 0;
795         int topIdx = -1;
796
797         for (int localIdx = 0; localIdx < addrList.length; localIdx++)
798         {
799
800             // Get the address bytes for the current local address
801

802             byte[] localAddr = addrList[localIdx].getAddress();
803
804             // Match against the addresses that the NetBIOS name is registered against
805

806             for (int addrIdx = 0; addrIdx < numberOfAddresses(); addrIdx++)
807             {
808
809                 // Get the current remote address bytes
810

811                 byte[] remoteAddr = (byte[]) m_addrList.elementAt(addrIdx);
812                 int ipIdx = 0;
813
814                 while (ipIdx < 4 && remoteAddr[ipIdx] == localAddr[ipIdx])
815                     ipIdx++;
816
817                 // Check if the current address is the best match so far
818

819                 if (ipIdx > topIdx)
820                 {
821
822                     // Update the best match address
823

824                     topIdx = addrIdx;
825                     topCnt = ipIdx;
826                 }
827             }
828         }
829
830         // Return the best match index, or -1 if no match found
831

832         return topIdx;
833     }
834
835     /**
836      * Decode a NetBIOS name string and create a new NetBIOSName object
837      *
838      * @param buf byte[]
839      * @param off int
840      * @return NetBIOSName
841      */

842     public static NetBIOSName decodeNetBIOSName(byte[] buf, int off)
843     {
844
845         // Convert the RFC NetBIOS name string to a normal NetBIOS name string
846

847         StringBuffer JavaDoc nameBuf = new StringBuffer JavaDoc(16);
848
849         int nameLen = (int) buf[off++];
850         int idx = 0;
851         char ch1, ch2;
852
853         while (idx < nameLen)
854         {
855
856             // Get the current encoded character pair from the encoded name string
857

858             ch1 = (char) buf[off++];
859             ch2 = (char) buf[off++];
860
861             if (ch1 == 'C' && ch2 == 'A')
862             {
863
864                 // Append a <SPACE> character
865

866                 nameBuf.append(' ');
867             }
868             else
869             {
870
871                 // Convert back to a character code
872

873                 int val = EncodeConversion.indexOf(ch1) << 4;
874                 val += EncodeConversion.indexOf(ch2);
875
876                 // Append the current character to the decoded name
877

878                 nameBuf.append((char) (val & 0xFF));
879             }
880
881             // Update the encoded string index
882

883             idx += 2;
884
885         }
886
887         // Decode the NetBIOS name scope, if specified
888

889         StringBuffer JavaDoc scopeBuf = new StringBuffer JavaDoc(128);
890         nameLen = (int) buf[off++];
891
892         while (nameLen > 0)
893         {
894
895             // Append a name seperator if not the first name section
896

897             if (scopeBuf.length() > 0)
898                 scopeBuf.append(".");
899
900             // Copy the name scope section to the scope name buffer
901

902             for (int i = 0; i < nameLen; i++)
903                 scopeBuf.append((char) buf[off++]);
904
905             // Get the next name section length
906

907             nameLen = (int) buf[off++];
908         }
909
910         // Create a NetBIOS name
911

912         return new NetBIOSName(nameBuf.toString(), scopeBuf.toString());
913     }
914
915     /**
916      * Decode a NetBIOS name string length
917      *
918      * @param buf byte[]
919      * @param off int
920      * @return int
921      */

922     public static int decodeNetBIOSNameLength(byte[] buf, int off)
923     {
924
925         // Calculate the encoded NetBIOS name string length
926

927         int totLen = 1;
928         int nameLen = (int) buf[off++];
929
930         while (nameLen > 0)
931         {
932
933             // Update the total encoded name length
934

935             totLen += nameLen;
936             off += nameLen;
937
938             // Get the next name section length
939

940             nameLen = (int) buf[off++];
941             totLen++;
942         }
943
944         // Return the encoded NetBIOS name length
945

946         return totLen;
947     }
948
949     /**
950      * Return the NetBIOS name type as a string.
951      *
952      * @param typ char
953      * @return String
954      */

955     public final static String JavaDoc TypeAsString(char typ)
956     {
957
958         // Return the NetBIOS name type string
959

960         String JavaDoc nameTyp = "";
961
962         switch (typ)
963         {
964         case WorkStation:
965             nameTyp = "WorkStation";
966             break;
967         case Messenger:
968             nameTyp = "Messenger";
969             break;
970         case RemoteMessenger:
971             nameTyp = "RemoteMessenger";
972             break;
973         case RASServer:
974             nameTyp = "RASServer";
975             break;
976         case FileServer:
977             nameTyp = "FileServer";
978             break;
979         case RASClientService:
980             nameTyp = "RASClientService";
981             break;
982         case MSExchangeInterchange:
983             nameTyp = "MSExchangeInterchange";
984             break;
985         case MSExchangeStore:
986             nameTyp = "MSExchangeStore";
987             break;
988         case MSExchangeDirectory:
989             nameTyp = "MSExchangeDirectory";
990             break;
991         case LotusNotesServerService:
992             nameTyp = "LotusNotesServerService";
993             break;
994         case ModemSharingService:
995             nameTyp = "ModemSharingService";
996             break;
997         case ModemSharingClient:
998             nameTyp = "ModemSharingClient";
999             break;
1000        case McCaffeeAntiVirus:
1001            nameTyp = "McCaffeeAntiVirus";
1002            break;
1003        case SMSClientRemoteControl:
1004            nameTyp = "SMSClientRemoteControl";
1005            break;
1006        case SMSAdminRemoteControl:
1007            nameTyp = "SMSAdminRemoteControl";
1008            break;
1009        case SMSClientRemoteChat:
1010            nameTyp = "SMSClientRemoteChat";
1011            break;
1012        case SMSClientRemoteTransfer:
1013            nameTyp = "SMSClientRemoteTransfer";
1014            break;
1015        case DECPathworksService:
1016            nameTyp = "DECPathworksService";
1017            break;
1018        case MSExchangeIMC:
1019            nameTyp = "MSExchangeIMC";
1020            break;
1021        case MSExchangeMTA:
1022            nameTyp = "MSExchangeMTA";
1023            break;
1024        case NetworkMonitorAgent:
1025            nameTyp = "NetworkMonitorAgent";
1026            break;
1027        case NetworkMonitorApp:
1028            nameTyp = "NetworkMonitorApp";
1029            break;
1030        case DomainMasterBrowser:
1031            nameTyp = "DomainMasterBrowser";
1032            break;
1033        case MasterBrowser:
1034            nameTyp = "MasterBrowser";
1035            break;
1036        case DomainAnnounce:
1037            nameTyp = "DomainAnnounce";
1038            break;
1039        case DomainControllers:
1040            nameTyp = "DomainControllers";
1041            break;
1042        default:
1043            nameTyp = "0x" + Integer.toHexString((int) typ);
1044            break;
1045        }
1046
1047        return nameTyp;
1048    }
1049}
Popular Tags