001 /*
002 * Copyright 2009-2016 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2009-2016 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.protocol;
022
023
024
025 import java.io.Serializable;
026
027 import com.unboundid.asn1.ASN1Buffer;
028 import com.unboundid.asn1.ASN1Element;
029 import com.unboundid.util.InternalUseOnly;
030
031
032
033 /**
034 * This interface defines a set of methods that should be implemented by all
035 * types of LDAP protocol ops.
036 */
037 @InternalUseOnly()
038 public interface ProtocolOp
039 extends Serializable
040 {
041 /**
042 * Retrieves the BER type for this protocol op.
043 *
044 * @return The BER type for this protocol op.
045 */
046 byte getProtocolOpType();
047
048
049
050 /**
051 * Encodes this protocol op to an ASN.1 element suitable for inclusion in an
052 * encoded LDAP message.
053 *
054 * @return The ASN.1 element containing the encoded protocol op.
055 */
056 ASN1Element encodeProtocolOp();
057
058
059
060 /**
061 * Writes an ASN.1-encoded representation of this LDAP protocol op to the
062 * provided ASN.1 buffer. This method is intended for internal use only and
063 * should not be used by third-party code.
064 *
065 * @param buffer The ASN.1 buffer to which the encoded representation should
066 * be written.
067 */
068 void writeTo(final ASN1Buffer buffer);
069
070
071
072 /**
073 * Appends a string representation of this LDAP protocol op to the provided
074 * buffer.
075 *
076 * @param buffer The buffer to which the string representation should be
077 * appended.
078 */
079 void toString(final StringBuilder buffer);
080 }