1 package org.umu.cops.ospep;
3 import org.umu.cops.prpep.COPSPepConnection;
4 import org.umu.cops.stack.COPSClientSI;
5 import org.umu.cops.stack.COPSDecisionMsg;
6 import org.umu.cops.stack.COPSException;
7 import org.umu.cops.stack.COPSHandle;
9 import java.net.Socket;
10 import java.util.Collection;
13 * COPSPepConnection represents a PEP-PDP Connection Manager.
14 * Responsible for processing messages received from PDP.
16 public class COPSPepOSConnection extends COPSPepConnection {
19 * Creates a new PEP connection
20 * @param clientType PEP's client-type
21 * @param sock Socket connected to PDP
23 public COPSPepOSConnection(final short clientType, final Socket sock) {
24 super(clientType, sock);
28 protected void handleDecisionMsg(final COPSDecisionMsg dMsg) throws COPSException {
29 final COPSPepOSReqStateMan manager = (COPSPepOSReqStateMan)_managerMap.get(dMsg.getClientHandle());
30 manager.processDecision(dMsg);
34 * Adds a new request state
35 * @param handle Client's handle
36 * @param process Policy data processing object
37 * @param clientSIs Client data from the outsourcing event
38 * @return The newly created request state manager
39 * @throws COPSException
41 protected COPSPepOSReqStateMan addRequestState(final COPSHandle handle, final COPSPepOSDataProcess process,
42 final Collection<COPSClientSI> clientSIs) throws COPSException {
43 final COPSPepOSReqStateMan manager = new COPSPepOSReqStateMan(_clientType, handle, process, clientSIs, _sock);
44 if (_managerMap.get(handle) != null)
45 throw new COPSPepException("Duplicate Handle, rejecting " + handle.getId().str());
46 _managerMap.put(handle, manager);
47 manager.initRequestState();