View Javadoc
1   //////////////////////////////////////////////////////////////////////////////
2   // dexterIM - Instant Messaging Framework
3   // Copyright (C) 2003  Christoph Walcher
4   //
5   // This program is free software; you can redistribute it and/or modify
6   // it under the terms of the GNU General Public License as published by
7   // the Free Software Foundation; either version 2 of the License, or
8   // (at your option) any later version.
9   //
10  // This program is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  // GNU General Public License for more details.
14  //
15  // You should have received a copy of the GNU General Public License
16  // along with this program; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  //////////////////////////////////////////////////////////////////////////////
19  package net.sf.dexterim.oscar.entity;
20  
21  
22  /***
23   * @author christoph
24   * TODO Document
25   */
26  public class TLVFactory {
27    private static TLVFactory instance;
28  
29    private TLVFactory() {
30  
31    }
32  
33    public TLV createScreenName() {
34      return new TLV(0x0001);
35    }
36  
37    public TLV createCapabilityID() {
38      return new TLV(0x0005);
39    }
40    
41    public TLV createRoastedPassword() {
42      return new TLV(0x0002);
43    }
44  
45    public TLV createClientIdString() {
46      return new TLV(0x0003);
47    }
48    
49    public TLV createBOSServerAddress() {
50      return new TLV(0x0005);
51    }
52    
53    public TLV createAuthorizationCookie() {
54      return new TLV(0x0006);
55    }
56    public TLV createClientCountry() {
57        return new TLV(0x000E);
58    }
59    
60    public TLV createClientLanguage() {
61      return new TLV(0x000F);
62    }
63  
64      
65    public TLV createClientDistributionNumber() {
66      return new TLV(new Word(new byte[] { 0x00, 0x14 }));
67    }
68  
69    public TLV createClientId() {
70      return new TLV(new Word(new byte[] { 0x00, 0x016 }));
71    }
72  
73    public TLV createClientMajorVersion() {
74      return new TLV(new Word(new byte[] { 0x00, 0x17 }));
75    }
76  
77    public TLV createClientMinorVersion() {
78      return new TLV(new Word(new byte[] { 0x00, 0x18 }));
79    }
80  
81    public TLV createClientLesserVersion() {
82      return new TLV(new Word(new byte[] { 0x00, 0x19 }));
83    }
84  
85    public TLV createClientBuildNumber() {
86      return new TLV(new Word(new byte[] { 0x00, 0x1A }));
87    }
88  
89    public TLV createMOTDString() {
90      return new TLV(new Word(new byte[] { 0x00, 0x0B }));
91    }
92  
93    
94    public static synchronized TLVFactory getInstance() {
95      if (instance == null) {
96        instance = new TLVFactory();
97      }
98  
99      return instance;
100   }
101 
102   /***
103    * @return
104    */
105   public TLV createCookie() {
106     return new TLV(new Word(new byte[] { 0x00, 0x06 }));
107   }
108 }