2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.pcep.impl;
10 import io.netty.channel.Channel;
11 import io.netty.util.Timer;
12 import io.netty.util.concurrent.Promise;
14 import org.opendaylight.protocol.pcep.PCEPSessionListener;
15 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
17 import com.google.common.base.Preconditions;
19 public final class DefaultPCEPSessionNegotiator extends AbstractPCEPSessionNegotiator {
20 private final PCEPSessionListener listener;
21 private final int maxUnknownMessages;
23 public DefaultPCEPSessionNegotiator(final Timer timer, final Promise<PCEPSessionImpl> promise, final Channel channel,
24 final PCEPSessionListener listener, final short sessionId, final int maxUnknownMessages, final PCEPOpenObject localPrefs) {
25 super(timer, promise, channel);
26 this.maxUnknownMessages = maxUnknownMessages;
27 this.myLocalPrefs = new PCEPOpenObject(localPrefs.getKeepAliveTimerValue(), localPrefs.getDeadTimerValue(), sessionId, localPrefs.getTlvs());
28 this.listener = Preconditions.checkNotNull(listener);
31 private final PCEPOpenObject myLocalPrefs;
34 protected PCEPOpenObject getInitialProposal() {
39 protected PCEPSessionImpl createSession(final Timer timer, final Channel channel, final PCEPOpenObject localPrefs, final PCEPOpenObject remotePrefs) {
40 return new PCEPSessionImpl(timer, listener, maxUnknownMessages, channel, localPrefs, remotePrefs);
44 protected boolean isProposalAcceptable(final PCEPOpenObject open) {
49 protected PCEPOpenObject getCounterProposal(final PCEPOpenObject open) {
54 protected PCEPOpenObject getRevisedProposal(final PCEPOpenObject suggestion) {