"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/ldap-sldap.h" (6 Nov 2009, 4808 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 1997-2006 Luke Howard.
    2    This file is part of the nss_ldap library.
    3    Contributed by Luke Howard, <lukeh@padl.com>, 2006.
    4 
    5    The nss_ldap library is free software; you can redistribute it and/or
    6    modify it under the terms of the GNU Library General Public License as
    7    published by the Free Software Foundation; either version 2 of the
    8    License, or (at your option) any later version.
    9 
   10    The nss_ldap library is distributed in the hope that it will be useful,
   11    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13    Library General Public License for more details.
   14 
   15    You should have received a copy of the GNU Library General Public
   16    License along with the nss_ldap library; see the file COPYING.LIB.  If not,
   17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   18    Boston, MA 02111-1307, USA.
   19 
   20    $Id: ldap-sldap.h,v 2.4 2006/01/12 13:06:23 lukeh Exp $
   21  */
   22 
   23 #ifndef _LDAP_NSS_LDAP_LDAP_SLDAP_H
   24 #define _LDAP_NSS_LDAP_LDAP_SLDAP_H
   25 
   26 #define NS_LDAP_VERSION     NS_LDAP_VERSION_2
   27 #define NS_LDAP_VERSION_1   "1.0"
   28 #define NS_LDAP_VERSION_2   "2.0"
   29 
   30 typedef enum {
   31     NS_LDAP_FILE_VERSION_P = 0
   32 } ParamIndexType;
   33 
   34 typedef enum {
   35     NS_LDAP_SUCCESS = 0,
   36     NS_LDAP_OP_FAILED,
   37     NS_LDAP_NOTFOUND,
   38     NS_LDAP_MEMORY,
   39     NS_LDAP_CONFIG,
   40     NS_LDAP_PARTIAL,
   41     NS_LDAP_INTERNAL,
   42     NS_LDAP_INVALID_PARAM,
   43     NS_LDAP_SUCCESS_WITH_INFO
   44 } ns_ldap_return_code;
   45 
   46 typedef struct ns_ldap_search_desc {
   47     char *basedn;
   48     int scope;
   49     char *filter;
   50 } ns_ldap_search_desc_t;
   51 
   52 typedef struct ns_ldap_attribute_map {
   53     char *origAttr;
   54     char **mappedAttr;
   55 } ns_ldap_attribute_map_t;
   56 
   57 typedef struct ns_ldap_objectclass_map {
   58     char *origOC;
   59     char *mappedOC;
   60 } ns_ldap_objectclass_map_t;
   61 
   62 typedef struct ns_ldap_passwd_mgmt {
   63     int pad[2];
   64 } ns_ldap_passwd_mgmt_t;
   65 
   66 typedef struct ns_ldap_error {
   67     int status;
   68     char *message;
   69     ns_ldap_passwd_mgmt_t pwd_mgmt;
   70 } ns_ldap_error_t;
   71 
   72 typedef struct ns_ldap_attr {
   73     char *attrname;
   74     unsigned int value_count;
   75     char **attrvalue;
   76 } ns_ldap_attr_t;
   77 
   78 typedef struct ns_ldap_entry {
   79     unsigned int attr_count;
   80     ns_ldap_attr_t **attr_pair;
   81     struct ns_ldap_entry *next;
   82 } ns_ldap_entry_t;
   83 
   84 typedef struct ns_ldap_result {
   85     unsigned int entries_count;
   86     ns_ldap_entry_t *entry;
   87 } ns_ldap_result_t;
   88 
   89 #define NS_LDAP_HARD        0x001
   90 #define NS_LDAP_ALL_RES     0x002
   91 #define NS_LDAP_FOLLOWREF   0x004
   92 #define NS_LDAP_NOREF       0x008
   93 #define NS_LDAP_SCOPE_BASE  0x010
   94 #define NS_LDAP_SCOPE_ONELEVEL  0x020
   95 #define NS_LDAP_SCOPE_SUBTREE   0x040
   96 #define NS_LDAP_KEEP_CONN   0x080
   97 #define NS_LDAP_NEW_CONN    0x400
   98 #define NS_LDAP_NOMAP       0x800
   99 
  100 #define NS_LDAP_CB_NEXT 0
  101 #define NS_LDAP_CB_DONE 1
  102 
  103 typedef struct ns_ldap_cookie {
  104     char *map;
  105     char *filter;
  106     char **attribute;
  107     int flags;
  108 
  109     int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, char **realfilter, const void *userdata);
  110     int (*callback)(const ns_ldap_entry_t *entry, const void *userdata);
  111     const void *userdata;
  112 
  113     char *mapped_filter;
  114     const char **mapped_attribute;
  115 
  116     int ret;
  117     int cb_ret;
  118     int erange;
  119     ldap_map_selector_t sel;
  120     ent_context_t *state;
  121     ldap_automount_context_t *am_state;
  122 
  123     ns_ldap_result_t *result;
  124     ns_ldap_entry_t *entry;
  125 } ns_ldap_cookie_t;
  126 
  127 char **__ns_ldap_getMappedAttributes(const char *service, const char *attribute);
  128 char **__ns_ldap_getMappedObjectClass(const char *service, const char *attribute);
  129 
  130 ns_ldap_return_code __ns_ldap_getParam(const ParamIndexType type, void ***data, ns_ldap_error_t **errorp);
  131 ns_ldap_return_code __ns_ldap_freeError(ns_ldap_error_t **errorp);
  132 ns_ldap_return_code __ns_ldap_freeEntry(ns_ldap_entry_t **pentry);
  133 ns_ldap_return_code __ns_ldap_freeResult(ns_ldap_result_t **result);
  134 
  135 typedef void ns_cred_t;
  136 
  137 ns_ldap_return_code __ns_ldap_firstEntry(const char *service,
  138     const char *filter,
  139     int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
  140             char **realfilter, const void *userdata),
  141     const char * const *attribute,
  142     const ns_cred_t *cred,
  143     const int flags,
  144     void **cookie,
  145     ns_ldap_result_t ** result,
  146     ns_ldap_error_t **errorp,
  147     const void *userdata);
  148 
  149 ns_ldap_return_code  __ns_ldap_nextEntry(
  150     void *cookie,
  151     ns_ldap_result_t ** result,
  152     ns_ldap_error_t **errorp);
  153 
  154 ns_ldap_return_code  __ns_ldap_endEntry(
  155     void **cookie,
  156     ns_ldap_error_t **errorp);
  157 
  158 ns_ldap_return_code __ns_ldap_list(
  159     const char *service,
  160     const char *filter,
  161     int (*init_filter_cb)(const ns_ldap_search_desc_t *desc, char **realfilter, const void *userdata),
  162     const char * const *attribute,
  163     const ns_cred_t *cred,
  164     const int flags,
  165     ns_ldap_result_t **result,
  166     ns_ldap_error_t **errorp,
  167     int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
  168     const void *userdata);
  169 
  170 ns_ldap_return_code __ns_ldap_err2str(ns_ldap_return_code err, char **strmsg);
  171 
  172 #endif /* _LDAP_NSS_LDAP_LDAP_SLDAP_H */