1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.dexterim.oscar.server;
20
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24
25 import net.sf.dexterim.oscar.OscarByteBuffer;
26 import net.sf.dexterim.oscar.entity.DWord;
27 import net.sf.dexterim.oscar.entity.Snac;
28 import net.sf.dexterim.oscar.entity.Word;
29
30
31 /***
32 * @author christoph
33 */
34 public class RateInfoResponse implements Response, UnkownMessage {
35 private List rateIds;
36
37 private RateInfoResponse() {
38 this.rateIds = new ArrayList();
39 }
40
41 public static RateInfoResponse create(Snac snac) {
42 RateInfoResponse message = new RateInfoResponse();
43
44 OscarByteBuffer buffer = OscarByteBuffer.wrap(snac.getData());
45
46 int count = buffer.getWord().getValue();
47
48 for (int i=0; i< count; i++) {
49 message.rateIds.add(RateClass.create(buffer));
50 }
51
52 return message;
53 }
54
55 public List getRateIds() {
56 return Collections.unmodifiableList(rateIds);
57 }
58
59 public static class RateClass {
60
61 private DWord windowSize;
62 private DWord clearAvg;
63 private DWord warnAvg;
64 private DWord limitedAvg;
65 private DWord disconnectAvg;
66 private DWord currentAvg;
67 private DWord maxAvg;
68 private Word id;
69
70 private RateClass() {
71
72 }
73
74 public int getIdValue() {
75 return id.getValue();
76 }
77
78 public Word getId() {
79 return id;
80 }
81
82 public static RateClass create(OscarByteBuffer buffer) {
83 RateClass rateClass = new RateClass();
84
85 rateClass.id = buffer.getWord();
86 rateClass.windowSize = buffer.getDWord();
87 rateClass.clearAvg = buffer.getDWord();
88 rateClass.warnAvg = buffer.getDWord();
89 rateClass.limitedAvg = buffer.getDWord();
90 rateClass.disconnectAvg = buffer.getDWord();
91 rateClass.currentAvg = buffer.getDWord();
92 rateClass.maxAvg = buffer.getDWord();
93
94 return rateClass;
95 }
96 /***
97 * @return Returns the clearAvg.
98 */
99 public DWord getClearAvg() {
100 return clearAvg;
101 }
102 /***
103 * @return Returns the currentAvg.
104 */
105 public DWord getCurrentAvg() {
106 return currentAvg;
107 }
108 /***
109 * @return Returns the disconnectAvg.
110 */
111 public DWord getDisconnectAvg() {
112 return disconnectAvg;
113 }
114 /***
115 * @return Returns the limitedAvg.
116 */
117 public DWord getLimitedAvg() {
118 return limitedAvg;
119 }
120 /***
121 * @return Returns the maxAvg.
122 */
123 public DWord getMaxAvg() {
124 return maxAvg;
125 }
126 /***
127 * @return Returns the warnAvg.
128 */
129 public DWord getWarnAvg() {
130 return warnAvg;
131 }
132 /***
133 * @return Returns the windowSize.
134 */
135 public DWord getWindowSize() {
136 return windowSize;
137 }
138 }
139 }