2 * Copyright (c) 2015 Cable Television Laboratories, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.pcmm.gates;
11 import java.net.InetAddress;
14 * The Extended Classifier object specifies the packet matching rules associated with a Gate, but includes more
15 * detailed information for matching traffic, as well adding, modifying, deleting, activating and inactivating Classifiers.
16 * As defined in sections 6.4.3.1 and 6.4.3.2, for Unicast Gates multiple Extended Classifier objects may be included
17 * in the Gate-Set to allow for complex classifier rules. However, since the ordering of objects in a message and the
18 * order of processing those objects is not mandated, and AM SHOULD NOT send a GateSet with multiple Extended
19 * Classifiers with the same ClassifierID, yet different Actions. When an AM is using Extended Classifier objects, at
20 * least one Extended Classifier is allowed. For Multicast Gates, only one Extended Classifier is required to be supported.
21 * Since the Extended Classifier is based on the DOCSIS IP Classifier, all DOCSIS classifier semantics apply, with the
22 * exception that at least one Extended Classifier be present in a Gate-Set message.
24 * Message length including header == 40
26 public interface IExtendedClassifier extends IClassifier {
31 * Returns the IP Source Mask value
32 * @return - the InetAddress object
34 InetAddress getIPSourceMask();
37 * Returns the IP Destination Mask value
38 * @return - the InetAddress object
40 InetAddress getIPDestinationMask();
43 * Returns the Start Source Port value
44 * @return - the port number
46 short getSourcePortStart();
49 * Returns the End Source Port value
50 * @return - the port number
52 short getSourcePortEnd();
55 * Returns the Start Destination Port value
56 * @return - the port number
58 short getDestinationPortStart();
61 * Returns the End Destination Port value
62 * @return - the port number
64 short getDestinationPortEnd();
67 * The ID value of this classifier
70 short getClassifierID();
73 * The activation state
76 ActivationState getActivationState();
82 * The valid activation state values
84 enum ActivationState {
86 INACTIVE((byte) 0), ACTIVE((byte) 1);
88 ActivationState(byte value) {
92 public byte getValue() {
96 public static ActivationState valueOf(byte v) {
99 return ActivationState.INACTIVE;
101 return ActivationState.ACTIVE;
103 throw new IllegalArgumentException("not supported value");
112 * For the Extended Classifier or the IPv6, the Action field is a
113 * 1 byte unsigned integer with the following values:
115 * <li>0x00, Add classifier</li>
116 * <li>0x01, Replace classifier</li>
117 * <li>0x02, Delete classifier</li>
118 * <li>0x03, No change</li>
128 public byte getByte(){
129 return (byte)this.ordinal();
132 public static Action getFromByte(byte action) {
133 if (action >= 0 && action < Action.values().length) {
134 return Action.values()[action];
136 throw new IllegalArgumentException("action byte out of range[0..3]: " + action);