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