001 /*
002 * Copyright 2009-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2009-2014 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 import com.unboundid.util.NotExtensible;
031 import com.unboundid.util.ThreadSafety;
032 import com.unboundid.util.ThreadSafetyLevel;
033
034
035
036 /**
037 * This interface defines a set of methods that should be implemented by all
038 * types of LDAP protocol ops.
039 */
040 @InternalUseOnly()
041 @NotExtensible()
042 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
043 public interface ProtocolOp
044 extends Serializable
045 {
046 /**
047 * Retrieves the BER type for this protocol op.
048 *
049 * @return The BER type for this protocol op.
050 */
051 byte getProtocolOpType();
052
053
054
055 /**
056 * Encodes this protocol op to an ASN.1 element suitable for inclusion in an
057 * encoded LDAP message.
058 *
059 * @return The ASN.1 element containing the encoded protocol op.
060 */
061 ASN1Element encodeProtocolOp();
062
063
064
065 /**
066 * Writes an ASN.1-encoded representation of this LDAP protocol op to the
067 * provided ASN.1 buffer. This method is intended for internal use only and
068 * should not be used by third-party code.
069 *
070 * @param buffer The ASN.1 buffer to which the encoded representation should
071 * be written.
072 */
073 void writeTo(final ASN1Buffer buffer);
074
075
076
077 /**
078 * Appends a string representation of this LDAP protocol op to the provided
079 * buffer.
080 *
081 * @param buffer The buffer to which the string representation should be
082 * appended.
083 */
084 void toString(final StringBuilder buffer);
085 }