Merge changes If0630105,I9d2d5e61,I1cea2a32,Icc05b6a7,Ic57eb4f8, ...
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / IGateSpec.java
1 /**
2  @header@
3  */
4
5
6 package org.pcmm.gates;
7
8 import org.pcmm.base.IPCMMBaseObject;
9
10 /**
11  * <p>
12  * The GateSpec describes some high-level attributes of the Gate, and contains
13  * information regarding the treatment of other objects specified in the Gate
14  * message.
15  * </p>
16  */
17 public interface IGateSpec extends IPCMMBaseObject {
18
19     byte SNUM = 5;
20     byte STYPE = 1;
21     short LENGTH = 16;
22
23     /**
24      * <p>
25      * Direction indicates whether the Gate is for an upstream or downstream
26      * flow. Depending on this direction, the CMTS MUST reserve and activate the
27      * DOCSIS flows accordingly. For Multicast Gates the CMTS needs to only
28      * support flows or gates in the downstream direction.
29      * </p>
30      *
31      *
32      */
33     enum Direction {
34
35         UPSTREAM((byte) 1), DOWNSTREAM((byte) 0);
36
37         Direction(byte value) {
38             this.value = value;
39         }
40
41         public byte getValue() {
42             return value;
43         }
44
45         @Override
46         public String toString() {
47             switch (value) {
48             case 1:
49                 return "Upstream";
50             default:
51                 return "Downstream";
52             }
53         }
54
55         private byte value;
56
57         public static Direction valueOf(byte v) {
58             switch (v) {
59             case 0:
60                 return Direction.DOWNSTREAM;
61             case 1:
62                 return Direction.UPSTREAM;
63             default:
64                 throw new IllegalArgumentException("not supported value");
65             }
66         }
67
68     }
69
70     /**
71      *
72      */
73     enum DSCPTOS {
74
75         ENABLE((byte) 2), OVERRIDE((byte) 0);
76
77         DSCPTOS(byte value) {
78             this.value = value;
79         }
80
81         public byte getValue() {
82             return value;
83         }
84
85         @Override
86         public String toString() {
87             switch (value) {
88             case 1:
89                 return "Enable";
90             default:
91                 return "Override";
92             }
93         }
94
95         public static DSCPTOS valueOf(byte v) {
96             switch (v) {
97             case 0:
98                 return DSCPTOS.OVERRIDE;
99             case 1:
100                 return DSCPTOS.ENABLE;
101             default:
102                 throw new IllegalArgumentException("not supported value");
103             }
104         }
105
106         private byte value;
107
108     }
109
110     /**
111      * <p>
112      * provides a way for the Application Manager and the Policy Server to group
113      * Gates into different classes with different authorization
114      * characteristics. For example, one could use the SessionClassID to
115      * represent some prioritization or preemption scheme that would allow
116      * either the Policy Server or the CMTS to preempt a pre-authorized Gate in
117      * favor of allowing a new Gate with a higher priority to be authorized.
118      * </p>
119      *
120      * @return session class ID;
121      */
122     ISessionClassID getSessionClassID();
123
124     /**
125      * <p>
126      * sets the session class ID;
127      * </p>
128      * <p>
129      * SessionClassID is a 1-byte unsigned integer value which identifies the
130      * proper admission control policy or parameters to be applied for this
131      * Gate. The SessionClassID is a bit field, defined as follows: Bit 0-2:
132      * Priority, a number from 0 to 7, where 0 is low priority and 7 is high.
133      * Bit 3: Preemption, set to enable preemption of bandwidth allocated to
134      * lower priority sessions if necessary (if supported). Bit 4-7:
135      * Configurable, default to 0
136      * </p>
137      */
138     void setSessionClassID(ISessionClassID id);
139
140     /**
141      *
142      * @return direction.
143      */
144     Direction getDirection();
145
146     /**
147      * sets the direction
148      *
149      * @param direction
150      *            Direction
151      */
152     void setDirection(Direction direction);
153
154     /**
155      * Authorized Timer limits the amount of time the authorization must remain
156      * valid before it is reserved
157      *
158      * @return time in ms;
159      */
160     short getTimerT1();
161
162     /**
163      * sets the authorized timer
164      *
165      * @param authTimer
166      *            : authorized timer
167      */
168     void setTimerT1(short authTimer);
169
170     /**
171      * Reserved Timer limits the amount of time the reservation must remain
172      * valid before the resources are committed
173      *
174      * @return time in ms;
175      */
176     short getTimerT2();
177
178     /**
179      * sets the reserved timer.
180      *
181      * @param timer
182      */
183     void setTimerT2(short timer);
184
185     /**
186      * Committed Timer limits the amount of time a committed service flow may
187      * remain idle.
188      *
189      * @return time in ms;
190      */
191     short getTimerT3();
192
193     /**
194      * sets the committed timer.
195      *
196      * @param t
197      *            timer
198      */
199     void setTimerT3(short t);
200
201     /**
202      * Committed Recovery Timer limits the amount of time that a committed
203      * service flow can remain without a subsequent refresh message from the
204      * PS/AM once the PS/AM has been notified of inactivity
205      *
206      * @return time in ms;
207      */
208     short getTimerT4();
209
210     /**
211      * sets the Committed Recovery Timer.
212      *
213      * @param t
214      *            timer
215      */
216     void setTimerT4(short t);
217
218     /**
219      *
220      * @param dscpTos - the object used to overwrite
221      */
222     void setDSCP_TOSOverwrite(DSCPTOS dscpTos);
223
224     // set the DSCP_TOS value
225     void setDSCP_TOSOverwrite(byte dscpTos);
226
227     /**
228      *
229      * @return DSCP/TOS
230      */
231     DSCPTOS getDSCP_TOSOverwrite();
232
233     /**
234      *
235      * @return - the mask
236      */
237     byte getDSCP_TOSMask();
238
239     /**
240      *
241      * @param dscp_tos_mask
242      */
243     void setDSCP_TOSMask(byte dscp_tos_mask);
244
245 }