/usr/include/kldap/ldif.h is in kdepimlibs5-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /*
This file is part of libkldap.
Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KLDAP_LDIF_H
#define KLDAP_LDIF_H
#include <QtCore/QString>
#include <QtCore/QByteArray>
#include "ldapdn.h"
#include "kldap_export.h"
namespace KLDAP {
/**
* Ldif
*
* Ldif implements an RFC 2849 compliant Ldif parser. Ldif files are used to
* represent directory information on LDAP-based servers, or to describe a set
* of changes which are to be applied to a directory.
*/
class KLDAP_EXPORT Ldif
{
public:
typedef enum {
None, NewEntry, EndEntry, Item, Control, Err, MoreData
} ParseValue;
typedef enum {
Entry_None, Entry_Add, Entry_Del, Entry_Mod, Entry_Modrdn
} EntryType;
typedef enum {
Mod_None, Mod_Add, Mod_Replace, Mod_Del
} ModType;
Ldif();
Ldif( const Ldif &that );
Ldif &operator=( const Ldif &that );
virtual ~Ldif();
/**
* Assembles fieldname and value into a valid Ldif line, BASE64 encodes the
* value if necessary and optionally splits into more lines.
* @param fieldname The name of the entry.
* @param value The value of the entry.
* @param linelen Maximum length of the lines in the result.
* @param url If true, encode value as url ( use :< ).
*/
static QByteArray assembleLine( const QString &fieldname,
const QByteArray &value, uint linelen=0,
bool url=false );
/**
* This is the same as the above function, the only difference that
* this accepts QString as the value.
*/
static QByteArray assembleLine( const QString &fieldname,
const QString &value, uint linelen=0,
bool url=false );
/**
* Splits one line from an Ldif file to attribute and value components.
* @return true if value is an URL, false otherwise
*/
static bool splitLine( const QByteArray &line, QString &fieldname,
QByteArray &value );
/**
* Splits a control specification (without the "control:" directive)
* @param line is the control directive
* @param oid will contain the OID
* @param critical will contain the criticality of control
* @param value is the control value
*/
static bool splitControl( const QByteArray &line, QString &oid,
bool &critical, QByteArray &value );
/**
* Starts the parsing of a new Ldif
*/
void startParsing();
/**
* Process one Ldif line
*/
ParseValue processLine();
/**
* Process the Ldif until a complete item can be returned
* @return NewEntry if a new DN encountered, Item if a new item returned,
* Err if the Ldif contains error, EndEntry if the parser reached the end
* of the current entry and MoreData if the parser encountered the end of
* the current chunk of the Ldif.
*
* If you want to finish the parsing after receiving MoreData, then call
* endLdif(), so the parser can safely flush the current entry.
*/
ParseValue nextItem();
/**
* Sets a chunk of Ldif. Call before startParsing(), or if nextItem()
* returned MoreData.
* @param ldif the Ldif chunk to set
*/
void setLdif( const QByteArray &ldif );
/**
* Indicates the end of the Ldif file/stream. Call if nextItem() returned
* MoreData, but actually you don't have more data.
*/
void endLdif();
/**
* Returns the requested LDAP operation extracted from the current entry.
*/
EntryType entryType() const;
/**
* Returns the LDAP modify request type if entryType() returned Entry_Mod.
*/
int modType() const;
/**
* Returns the Distinguished Name of the current entry.
*/
LdapDN dn() const;
/**
* Returns the new Relative Distinguished Name if modType() returned
* Entry_Modrdn.
*/
QString newRdn() const;
/**
* Returns the new parent of the entry if modType() returned Entry_Modrdn.
*/
QString newSuperior() const;
/**
* Returns if the delete of the old RDN is required.
*/
bool delOldRdn() const;
/**
* Returns the attribute name.
*/
QString attr() const;
/**
* Returns the attribute value.
*/
QByteArray value() const;
/**
* Returns if val() is an url
*/
bool isUrl() const;
/**
* Returns the criticality level when modType() returned Control.
*/
bool isCritical() const;
/**
* Returns the OID when modType() returned Control.
*/
QString oid() const;
/**
* Returns the line number which the parser processes.
*/
uint lineNumber() const;
private:
class LdifPrivate;
LdifPrivate *const d;
};
}
#endif
|