b31c98e3eb6ff1f9704fbc7b77edad097a59e479
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / IGateSpec.java
1 /*
2  * (c) 2015 Cable Television Laboratories, Inc.  All rights reserved.
3  */
4
5 package org.pcmm.gates;
6
7 import org.pcmm.base.IPCMMBaseObject;
8
9 /**
10  * GateSpec describes specific authorization parameters defining a Gate (i.e., QoS limits, timers, etc.).
11  *
12  * From the Packetcable Multimedia specification section 6.1.4
13  *
14  * The GateSpec describes some high-level attributes of the Gate, and contains information regarding the treatment of
15  * other objects specified in the Gate message. Information contained in a GateSpec is outlined below.
16  *
17  * * SessionClassID
18  * * Direction
19  * * Authorized Timer
20  * * Reserved Timer
21  * * Committed Timer
22  * * Committed Recovery Timer
23  * * DSCP/TOS Overwrite
24  * * DSCP/TOS Mask
25  *
26  * SessionClassID provides a way for the Application Manager and the Policy Server to group Gates into different
27  * classes with different authorization characteristics. For example, one could use the SessionClassID to represent
28  * some prioritization or preemption scheme that would allow either the Policy Server or the CMTS to preempt a preauthorized
29  * Gate in favor of allowing a new Gate with a higher priority to be authorized.
30  *
31  * Direction indicates whether the Gate is for an upstream or downstream flow. Depending on this direction, the CMTS
32  * MUST reserve and activate the DOCSIS flows accordingly. For Multicast Gates the CMTS needs to only support
33  * flows or gates in the downstream direction.
34  *
35  * Authorized Timer limits the amount of time the authorization must remain valid before it is reserved (see
36  * Section 6.2).
37  *
38  * Reserved Timer limits the amount of time the reservation must remain valid before the resources are committed (see
39  * Section 6.2).
40  *
41  * Committed Timer limits the amount of time a committed service flow may remain idle.
42  *
43  * Committed Recovery Timer limits the amount of time that a committed service flow can remain without a
44  * subsequent refresh message from the PS/AM once the PS/AM has been notified of inactivity (see Section 6.2).
45  * DSCP/TOS Overwrite field can be used to overwrite the DSCP/TOS field of packets associated with the DOCSIS
46  * Service Flow that corresponds to the Gate. This field may be unspecified in which case the DSCP/TOS field in the
47  * packet is not over-written by the CMTS. This field may be used in both the upstream and downstream directions.
48  * The CMTS MUST support DSCP/TOS overwrite for upstream gates. The CMTS MAY support DSCP/TOS
49  * overwrite for downstream gates. If DSCP/TOS is enabled in a downstream gate and the CMTS does not support that
50  * function, then the field is ignored. The manner in which the CMTS interprets the DSCP/TOS Overwrite & Mask
51  * fields and transforms it into the corresponding DOCSIS Service Flow Parameters is defined in Section 6.4.2.5.
52  */
53 public interface IGateSpec extends IPCMMBaseObject {
54
55     /**
56      * The S-Type for Gate Specifications
57      */
58     byte STYPE = 1;
59
60     /**
61      * <p>
62      * Direction indicates whether the Gate is for an upstream or downstream
63      * flow. Depending on this direction, the CMTS MUST reserve and activate the
64      * DOCSIS flows accordingly. For Multicast Gates the CMTS needs to only
65      * support flows or gates in the downstream direction.
66      * </p>
67      *
68      *
69      */
70     enum Direction {
71
72         UPSTREAM((byte) 1), DOWNSTREAM((byte) 0);
73
74         Direction(byte value) {
75             this.value = value;
76         }
77
78         public byte getValue() {
79             return value;
80         }
81
82         @Override
83         public String toString() {
84             switch (value) {
85             case 1:
86                 return "Upstream";
87             default:
88                 return "Downstream";
89             }
90         }
91
92         private byte value;
93
94         public static Direction valueOf(byte v) {
95             switch (v) {
96             case 0:
97                 return Direction.DOWNSTREAM;
98             case 1:
99                 return Direction.UPSTREAM;
100             default:
101                 throw new IllegalArgumentException("not supported value");
102             }
103         }
104
105     }
106
107     /**
108      * <p>
109      * provides a way for the Application Manager and the Policy Server to group
110      * Gates into different classes with different authorization
111      * characteristics. For example, one could use the SessionClassID to
112      * represent some prioritization or preemption scheme that would allow
113      * either the Policy Server or the CMTS to preempt a pre-authorized Gate in
114      * favor of allowing a new Gate with a higher priority to be authorized.
115      * </p>
116      *
117      * @return session class ID;
118      */
119     ISessionClassID getSessionClassID();
120
121     /**
122      *
123      * @return direction.
124      */
125     Direction getDirection();
126
127     /**
128      * Authorized Timer limits the amount of time the authorization must remain
129      * valid before it is reserved
130      *
131      * @return time in ms;
132      */
133     short getTimerT1();
134
135     /**
136      * Reserved Timer limits the amount of time the reservation must remain
137      * valid before the resources are committed
138      *
139      * @return time in ms;
140      */
141     short getTimerT2();
142
143     /**
144      * Committed Timer limits the amount of time a committed service flow may
145      * remain idle.
146      *
147      * @return time in ms;
148      */
149     short getTimerT3();
150
151     /**
152      * Committed Recovery Timer limits the amount of time that a committed
153      * service flow can remain without a subsequent refresh message from the
154      * PS/AM once the PS/AM has been notified of inactivity
155      *
156      * @return time in ms;
157      */
158     short getTimerT4();
159
160     /**
161      *
162      * @return DSCP/TOS
163      */
164     byte getDSCP_TOSOverwrite();
165
166     /**
167      *
168      * @return - the mask
169      */
170     byte getDSCP_TOSMask();
171
172 }