class interface LDAP
   --  LDAP Access Routines.

feature(s) from MEMORY
   --  Status Report :

   collecting: BOOLEAN
      --  Is garbage collection enabled ?

feature(s) from MEMORY
   --  Status setting :

   collection_off
      --  Disable garbage collection.

   collection_on
      --  Enable garbage collection.

feature(s) from MEMORY
   --  Removal :

   dispose
      --  go away

   full_collect
      --  Force a full collection cycle if garbage collection is
      --  enabled; do nothing otherwise.

feature(s) from MEMORY
   --  The Guru section (low level memory management) :

   pointer_size: INTEGER
      --  The size in number of bytes for a pointer.

   malloc (size: INTEGER): POINTER
      --  Memory allocation of size byte.
      require
         size > 0

   calloc (number_of_objects, size_of_one: INTEGER): POINTER
      --  Allocates memory for an array of number_of_objects elements
      --  of size_of_one bytes each and returns a pointer to the 
      --  allocated memory.
      --   The memory is set to zero.
      require
         number_of_objects > 0;
         size_of_one >= 1

   realloc (pointer: POINTER ;size: INTEGER): POINTER
      --  Memory re-allocation of size byte.
      require
         pointer.is_not_null;
         size > 0

feature(s) from LDAP
   --  Initialization stuff

   set_host (to: STRING)
      --  Set the server to bind to

   set_port (to: INTEGER)
      --  Set the port to bind to

   set_binddn (to: STRING)
      --  Set the DN to bind as

   set_bindpw (to: STRING)
      --  Set the bind password

   set_searchbase (to: STRING)
      --  Set the search base

   connect
      --  Connect to an LDAP server
      ensure
         connected

   bind
      --  Bind to an LDAP server, otherwise, we're anonymous
      require
         connected

feature(s) from LDAP
   --  Searching

   search (filter: STRING ;scope: INTEGER)
      --  Execute a search on a filter
      require
         connected
      ensure
         got_search

   nresults: INTEGER
      --  Find out how many entries we found
      require
         got_search

   first_entry
      --  Get the first entry
      require
         got_search

   next_entry
      --  Get the next entry
      require
         got_search

   list_attributes: ARRAY[STRING]
      --  List all attributes in the current entry.
      --  NOTE: You must call first_entry before you call this.
      require
         got_entry

   get_values (att: STRING): ARRAY[STRING]
      --  Get the values for a given attribute in an existing entry.
      --  NOTE: You must call first_entry before you call this.
      require
         got_entry

feature(s) from LDAP
   --  Compare

   compare (dn, attr, value: STRING): BOOLEAN
      --  Do an LDAP comparison to see if there's an attr=value for the
      --  specified dn.
      require
         dn /= Void;
         attr /= Void;
         value /= Void

feature(s) from LDAP
   --  Add/modify

   mod_add (attr, value: STRING)
      --  Store an entry to be added in a modify or add
      require
         attr /= Void;
         value /= Void;
         connected

   mod_replace (attr, value: STRING)
      --  Store an entry to be replaced in a modify
      require
         attr /= Void;
         value /= Void;
         connected

   mod_delete (attr: STRING)
      --  Store an entry to be deleted in a modify
      require
         attr /= Void;
         connected

   add (dn: STRING)
      --  Add an LDAP entry for the given DN and predefined set of mods
      require
         connected;
         dn /= Void;
         have_mods

   modify (dn: STRING)
      --  Modify an LDAP entry for the given DN and predefined set of mods
      require
         connected;
         dn /= Void;
         have_mods

   mod_clean
      --  Clean up mod list.
      --  There is a bug in here triggered by doing an attribute delete,
      --  Eiffel's nice enough to cover it up until I can deal with it.

feature(s) from LDAP
   --  Delete

   delete (dn: STRING)
      require
         connected;
         dn /= Void

feature(s) from LDAP
   --  Status

   got_entry: BOOLEAN
      --  Have we done a search and got an entry?

   got_search: BOOLEAN
      --  Have we succesfully done a search?

   connected: BOOLEAN
      --  Are we connected to an LDAP server?

   have_mods: BOOLEAN
      --  Do we have a mod list yet?  (for add/modify)

   error_message: STRING
      --  Get the last error message
      require
         connected


end of LDAP