Refactor PCMM aspects of COPS message data objects.
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / IClassifier.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 import java.net.InetAddress;
10
11 /**
12  * The Classifier object specifies the packet matching rules associated with a Gate. As defined in Sections 6.4.3.1 and
13  * 6.4.3.2, for Unicast Gates multiple Classifier objects may be included in the Gate-Set to allow for complex
14  * classifier rules. When an AM is using Classifier objects, at least one Classifier MUST be provided by the PDP in all
15  * Gate-Set messages. More than one Classifier is allowed for Unicast Gates. Only one classifier is required to be
16  * supported for Multicast Gates. Unlike DOCSIS DSx signaling, Classifiers have no identifier and have no explicit add,
17  * change, or remove operations. The entire set of Classifiers present in a Gate-Set message replaces the entire set of
18  * classifiers for the existing Gate. Equivalence of Classifiers is determined by comparing all fields within the
19  * Classifier. Classifiers may be provided in any order.
20  */
21 public interface IClassifier extends IPCMMBaseObject {
22
23     byte STYPE = 1;
24
25     /**
26      * IP Destination Address or IPv6 Destination Address is the termination
27      * point for the IP flow
28      *
29      * @return destination IP address.
30      */
31     InetAddress getDestinationIPAddress();
32
33     /**
34      * Returns the destination port value
35      * @return - the port number
36      */
37     short getDestinationPort();
38
39     /**
40      * Source IP, IP Source Address, or IPv6 Source Address (in the case of
41      * Extended Classifier or IPv6 Classifier) is the IP address (as seen at the
42      * CMTS) of the originator of the IP flow.
43      *
44      * @return source IP address.
45      */
46     InetAddress getSourceIPAddress();
47
48     /**
49      * Returns the source port value
50      * @return - the port number
51      */
52     short getSourcePort();
53
54     /**
55      * Protocol field, in a legacy Classifier or Extended Classifier, identifies
56      * the type of protocol (e.g., IP, ICMP, etc.). The Next Header Type field
57      * serves a similar function in the IPv6 Classifier.
58      *
59      * @return the protocol.
60      */
61     Protocol getProtocol();
62
63     /**
64      * Priority may be used to distinguish between multiple classifiers that
65      * match a particular packet. This is typically set to a default value since
66      * classifiers are generally intended to be unique.
67      *
68      * @return priority.
69      */
70     byte getPriority();
71
72     /**
73      * Returns the DSCPTOS enumeration value (ENABLE|DISABLE)
74      * @return the enumeration
75      */
76     byte getDSCPTOS();
77
78     /**
79      * Returns the DSCPTOS mask value
80      * @return the mask
81      */
82     byte getDSCPTOSMask();
83
84     /**
85      * Enumeration of supported protocols
86      */
87     enum Protocol {
88         /*ICMP((short) 1), IGMP((short) 2), */
89         NONE((short)0), TCP((short) 6), UDP((short) 17);
90
91         Protocol(short v) {
92             this.value = v;
93         }
94
95         public static Protocol valueOf(short v) {
96             switch (v) {
97                 case 0:
98                     return NONE;
99           /* TODO - Determine why these two values are not being supported???
100             case 1:
101                 return ICMP;
102             case 2:
103                 return IGMP;
104           */
105                 case 6:
106                     return TCP;
107                 default:
108                     return UDP;
109             }
110         }
111         private short value;
112
113         public short getValue() {
114             return value;
115         }
116     }
117
118 }