f44618dcf548774112549cd3b90f8db297fd2bd4
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / ITransactionID.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  * TransactionID is a 2-byte unsigned integer quantity, which contains a token that is used by the Application Manager
11  * to match responses from the Policy Server and by the Policy Server to match responses from the CMTS to the
12  * previous requests. The TransactionID MUST also contain the command type that identifies the action to be taken or
13  * response.
14  */
15 public interface ITransactionID extends IPCMMBaseObject {
16
17     byte STYPE = 1;
18
19     /**
20      * Returns the transaction identifier value
21      * @return - the ID
22      */
23     short getTransactionIdentifier();
24
25     /**
26      * Returns the command type
27      * @return - the command type
28      */
29     GateCommandType getGateCommandType();
30
31     /**
32      * The supported Synchronization types
33      */
34     enum GateCommandType {
35
36         GATE_SET((short) 4),
37         GATE_SET_ACK((short) 5),
38         GATE_SET_ERR((short) 6),
39         GATE_INFO((short) 7),
40         GATE_INFO_ACK((short) 8),
41         GATE_INFO_ERR((short) 9),
42         GATE_DELETE((short) 10),
43         GATE_DELETE_ACK((short) 11),
44         GATE_DELETE_ERR((short) 12),
45         GATE_RPT_STATE((short) 15),
46         GATE_CMD_ERR((short) 16),
47         PDP_CONFIG((short) 17),
48         PDP_CONFIG_ACK((short) 18),
49         PDP_CONFIG_ERR((short) 19),
50         SYNC_REQUEST((short) 20),
51         SYNC_RPT((short) 21),
52         SYNC_COMPLETE((short) 22),
53         MSG_RECEIPT((short) 23);
54
55         GateCommandType(short value) {
56             this.value = value;
57         }
58
59         public short getValue() {
60             return value;
61         }
62
63         public static GateCommandType valueOf(short v) {
64             switch (v) {
65                 case 4:
66                     return GateCommandType.GATE_SET;
67                 case 5:
68                     return GateCommandType.GATE_SET_ACK;
69                 case 6:
70                     return GateCommandType.GATE_SET_ERR;
71                 case 7:
72                     return GateCommandType.GATE_INFO;
73                 case 8:
74                     return GateCommandType.GATE_INFO_ACK;
75                 case 9:
76                     return GateCommandType.GATE_INFO_ERR;
77                 case 10:
78                     return GateCommandType.GATE_DELETE;
79                 case 11:
80                     return GateCommandType.GATE_DELETE_ACK;
81                 case 12:
82                     return GateCommandType.GATE_DELETE_ERR;
83                 case 15:
84                     return GateCommandType.GATE_RPT_STATE;
85                 case 16:
86                     return GateCommandType.GATE_CMD_ERR;
87                 case 17:
88                     return GateCommandType.PDP_CONFIG;
89                 case 18:
90                     return GateCommandType.PDP_CONFIG_ACK;
91                 case 19:
92                     return GateCommandType.PDP_CONFIG_ERR;
93                 case 20:
94                     return GateCommandType.SYNC_REQUEST;
95                 case 21:
96                     return GateCommandType.SYNC_RPT;
97                 case 22:
98                     return GateCommandType.SYNC_COMPLETE;
99                 case 23:
100                     return GateCommandType.MSG_RECEIPT;
101                 default:
102                     throw new IllegalArgumentException("not supported value");
103             }
104         }
105
106         private short value;
107
108     }
109
110 }