4 package org.pcmm.gates.impl;
6 import org.pcmm.base.impl.PCMMBaseObject;
7 import org.pcmm.gates.IGateSpec;
8 import org.pcmm.gates.ISessionClassID;
13 public class GateSpec extends PCMMBaseObject implements IGateSpec {
15 // GateSpec flags are Direction (bit 0) and DSCPTOS overwrite enable (bit 1)
16 private byte flags = 0;
19 super(LENGTH, STYPE, SNUM);
22 public GateSpec(byte[] data) {
27 public ISessionClassID getSessionClassID() {
28 return new SessionClassID(getByte((short) 3));
32 public void setSessionClassID(ISessionClassID id) {
33 setByte(id.toSingleByte(), (short) 3);
37 public Direction getDirection() {
38 return Direction.valueOf(getByte((short) 0));
42 public void setDirection(Direction direction) {
43 // OR in the Direction flag with the DSCPTOS enable flag
44 flags |= direction.getValue();
45 setByte(flags, (short) 0);
49 public short getTimerT1() {
50 return getShort((short) 4);
54 public void setTimerT1(short authTimer) {
55 setShort(authTimer, (short) 4);
59 public short getTimerT2() {
60 return getShort((short) 6);
64 public void setTimerT2(short timer) {
65 setShort(timer, (short) 6);
70 public short getTimerT3() {
71 return getShort((short) 8);
75 public void setTimerT3(short t) {
76 setShort(t, (short) 8);
81 public short getTimerT4() {
82 return getShort((short) 10);
86 public void setTimerT4(short t) {
87 setShort(t, (short) 10);
91 public void setDSCP_TOSOverwrite(DSCPTOS dscpTos) {
92 // OR in the DSCPTOS enable flag with the Direction flag
93 setDSCP_TOSOverwrite(dscpTos.getValue());
97 public void setDSCP_TOSOverwrite(byte dscpTos) {
99 setByte(flags, (short) 1);
104 public DSCPTOS getDSCP_TOSOverwrite() {
105 return DSCPTOS.valueOf(getByte((short) 1));
109 public byte getDSCP_TOSMask() {
110 return getByte((short) 2);
114 public void setDSCP_TOSMask(byte dscp_tos_mask) {
115 setByte(dscp_tos_mask, (short) 2);