Package freenet.clients.fcp

Source Code of freenet.clients.fcp.FCPResponse

package freenet.clients.fcp;

import freenet.node.Node;
import freenet.support.SimpleFieldSet;

/**
* FCP message sent from the node to the client.
*/
public abstract class FCPResponse extends FCPMessage {
  protected final SimpleFieldSet fs;

  /**
   * @param fcpIdentifier FCP-level identifier for pairing requests and responses.
   *                      If null the field is omitted.
   */
  public FCPResponse(String fcpIdentifier) {
    fs = new SimpleFieldSet(true);
    fs.putOverwrite(IDENTIFIER, fcpIdentifier);
  }

  @Override
  public SimpleFieldSet getFieldSet() {
    return fs;
  }

  @Override
  public abstract String getName();

  @Override
  public void run(FCPConnectionHandler handler, Node node) throws MessageInvalidException {
    throw new MessageInvalidException(ProtocolErrorMessage.INVALID_MESSAGE, getName() +
             " is a reply from the node; the client should not send it.", null, false);
  }

}
TOP

Related Classes of freenet.clients.fcp.FCPResponse

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.