c14a4d911e036c5218e1fbc132d9e528e5cf85b9
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / PCMMPdpConnection.java
1 /*
2  @header@
3  */
4
5 package org.pcmm;
6
7 import org.umu.cops.prpdp.COPSPdpConnection;
8 import org.umu.cops.prpdp.COPSPdpReqStateMan;
9 import org.umu.cops.stack.COPSHandle;
10 import org.umu.cops.stack.COPSPepId;
11 import org.umu.cops.stack.COPSReqMsg;
12
13 import javax.annotation.concurrent.ThreadSafe;
14 import java.net.Socket;
15
16 /**
17  * Class for managing an provisioning connection at the PDP side for receiving and brokering out COPS messages.
18  */
19 @ThreadSafe
20 public class PCMMPdpConnection extends COPSPdpConnection {
21
22     /**
23      *  PDP policy data processor class
24      */
25     protected final PCMMPdpDataProcess _thisProcess;
26
27     /**
28      * Creates a new PDP connection
29      *
30      * @param pepId PEP-ID of the connected PEP
31      * @param sock Socket connected to PEP
32      * @param process Object for processing policy data
33      */
34     public PCMMPdpConnection(final COPSPepId pepId, final Socket sock, final PCMMPdpDataProcess process,
35                              final short kaTimer, final short acctTimer) {
36         super(pepId, sock, process, kaTimer, acctTimer);
37         _thisProcess = process;
38     }
39
40     public void addStateMan(final COPSHandle handle, final PCMMPdpReqStateMan man) {
41         _managerMap.put(handle, man);
42     }
43
44     /**
45      * Returns an instance of a COPSPdpReqStateMan
46      * @param reqMsg - the request on which to create the state manager
47      * @return - the state manager
48      */
49     protected COPSPdpReqStateMan createStateManager(final COPSReqMsg reqMsg) {
50         return new PCMMPdpReqStateMan(reqMsg.getHeader().getClientType(), reqMsg.getClientHandle(), _thisProcess);
51     }
52
53 }