4 package org.pcmm.gates.impl;
6 import org.pcmm.base.impl.PCMMBaseObject;
7 import org.pcmm.gates.IExtendedClassifier;
9 import java.net.InetAddress;
10 import java.net.UnknownHostException;
15 public class ExtendedClassifier extends PCMMBaseObject implements
18 public ExtendedClassifier() {
19 this(LENGTH, STYPE, SNUM);
23 * @param data - the data bytes to parse
25 public ExtendedClassifier(byte[] data) {
30 * @param len - the classifier's length
31 * @param sType - the sType value
32 * @param sNum - the sNum value
34 public ExtendedClassifier(short len, byte sType, byte sNum) {
35 super(len, sType, sNum);
41 * @see org.pcmm.gates.IClassifier#getDestinationIPAddress()
44 public InetAddress getDestinationIPAddress() {
46 return InetAddress.getByAddress(getBytes((short) 12, (short) 4));
47 } catch (UnknownHostException e) {
57 * org.pcmm.gates.IClassifier#setDestinationIPAddress(java.net.InetAddress)
60 public void setDestinationIPAddress(InetAddress address) {
61 setBytes(address.getAddress(), (short) 12);
67 * @see org.pcmm.gates.IClassifier#getDestinationPort()
70 public short getDestinationPort() {
71 return getShort((short) 24);
77 * @see org.pcmm.gates.IClassifier#setDestinationPort(short)
80 public void setDestinationPort(short p) {
81 setShort(p, (short) 24);
87 * @see org.pcmm.gates.IClassifier#getSourceIPAddress()
90 public InetAddress getSourceIPAddress() {
92 return InetAddress.getByAddress(getBytes((short) 4, (short) 4));
93 } catch (UnknownHostException e) {
102 * @see org.pcmm.gates.IClassifier#setSourceIPAddress(java.net.InetAddress)
105 public void setSourceIPAddress(InetAddress a) {
106 setBytes(a.getAddress(), (short) 4);
112 * @see org.pcmm.gates.IClassifier#getSourcePort()
115 public short getSourcePort() {
116 return getShort((short) 20);
122 * @see org.pcmm.gates.IClassifier#setSourcePort(short)
125 public void setSourcePort(short p) {
126 setShort(p, (short) 20);
132 * @see org.pcmm.gates.IClassifier#getProtocol()
135 public short getProtocol() {
136 return getShort((short) 0);
142 * @see org.pcmm.gates.IClassifier#setProtocol(short)
145 public void setProtocol(short p) {
146 setShort(p, (short) 0);
152 * @see org.pcmm.gates.IClassifier#getPriority()
155 public byte getPriority() {
156 return getByte((short) 30);
162 * @see org.pcmm.gates.IClassifier#setPriority(byte)
165 public void setPriority(byte p) {
166 setByte(p, (short) 30);
172 * @see org.pcmm.gates.IExtendedClassifier#getIPSourceMask()
175 public InetAddress getIPSourceMask() {
177 return InetAddress.getByAddress(getBytes((short) 8, (short) 4));
178 } catch (UnknownHostException e) {
188 * org.pcmm.gates.IExtendedClassifier#setIPSourceMask(java.net.InetAddress)
191 public void setIPSourceMask(InetAddress a) {
192 setBytes(a.getAddress(), (short) 8);
198 * @see org.pcmm.gates.IExtendedClassifier#getIPDestinationMask()
201 public InetAddress getIPDestinationMask() {
203 return InetAddress.getByAddress(getBytes((short) 16, (short) 4));
204 } catch (UnknownHostException e) {
214 * org.pcmm.gates.IExtendedClassifier#setIPDestinationMask(java.net.InetAddress
218 public void setIPDestinationMask(InetAddress m) {
219 setBytes(m.getAddress(), (short) 16);
225 * @see org.pcmm.gates.IExtendedClassifier#getSourcePortStart()
228 public short getSourcePortStart() {
229 return getShort((short) 20);
233 public void setSourcePortStart(short p) {
234 setShort(p, (short) 20);
240 * @see org.pcmm.gates.IExtendedClassifier#getSourcePortEnd()
243 public short getSourcePortEnd() {
244 return getShort((short) 22);
248 public void setSourcePortEnd(short p) {
249 setShort(p, (short) 22);
255 * @see org.pcmm.gates.IExtendedClassifier#getDestinationPortStart()
258 public short getDestinationPortStart() {
259 return getShort((short) 24);
263 public void setDestinationPortStart(short p) {
264 setShort(p, (short) 24);
270 * @see org.pcmm.gates.IExtendedClassifier#getDestinationPortEnd()
273 public short getDestinationPortEnd() {
274 return getShort((short) 26);
278 public void setDestinationPortEnd(short p) {
279 setShort(p, (short) 26);
285 * @see org.pcmm.gates.IExtendedClassifier#getClassifierID()
288 public short getClassifierID() {
289 return getShort((short) 28);
293 public void setClassifierID(short p) {
294 setShort(p, (short) 28);
300 * @see org.pcmm.gates.IExtendedClassifier#getActivationState()
303 public byte getActivationState() {
304 return getByte((short) 31);
308 public void setActivationState(byte s) {
309 setByte(s, (short) 31);
315 * @see org.pcmm.gates.IExtendedClassifier#getAction()
318 public byte getAction() {
319 return getByte((short) 32);
323 public void setAction(byte a) {
324 setByte(a, (short) 32);
328 public byte getDSCPTOS() {
329 return getByte((short) 2);
333 public void setDSCPTOS(byte v) {
334 setByte(v, (short) 2);
338 public byte getDSCPTOSMask() {
339 return getByte((short) 3);
343 public void setDSCPTOSMask(byte v) {
344 setByte(v, (short) 3);