scsh-ldap/scheme/ldap.scm

92 lines
2.2 KiB
Scheme

; ,open define-record-types external-calls
(import-lambda-definition ldap-open-internal
(host port)
"scsh_ldap_open")
(import-lambda-definition ldap-init-internal
(host port)
"scsh_ldap_init")
(import-lambda-definition ldap-bind
(ldap user password method)
"scsh_ldap_bind_s")
(import-lambda-definition ldap-simple-bind
(ldap user password)
"scsh_ldap_simple_bind_s")
(import-lambda-definition ldap-kerberos-bind
(ldap dn)
"scsh_ldap_kerberos_bind_s")
(import-lambda-definition ldap-unbind
(ldap)
"scsh_ldap_unbind_s")
(import-lambda-definition ldap-error-string
(error-code)
"scsh_ldap_error_string")
(import-lambda-definition ldap-result-error
(ldap result)
"scsh_ldap_result_error")
(import-lambda-definition ldap-memfree
(ldap)
"scsh_ldap_memfree")
(import-lambda-definition ldap-msgfree
(ldap)
"scsh_ldap_msgfree")
(import-lambda-definition ldap-search
(ldap base scope filter attributes attributes-only?)
"scsh_ldap_search_s")
(import-lambda-definition ldap-search-timeout
(ldap base scope filter attributes attributes-only?
timeout-secs timeout-usecs)
"scsh_ldap_search_st")
(import-lambda-definition ldap-count-entries
(ldap message)
"scsh_ldap_count_entries")
(import-lambda-definition ldap-first-entry
(ldap message)
"scsh_ldap_first_entry")
(import-lambda-definition ldap-next-entry
(ldap message)
"scsh_ldap_next_entry")
(import-lambda-definition ldap-message-type
(message)
"scsh_ldap_msgtype")
(import-lambda-definition ldap-message-id
(message)
"scsh_ldap_msgid")
(import-lambda-definition ldap-get-values
(ldap message attribute)
"scsh_ldap_get_values")
(define (ldap-open host port)
(let ((ldap (ldap-open-internal host port)))
(if ldap (add-finalizer! ldap ldap-memfree))
ldap))
(define (ldap-init host port)
(let ((ldap (ldap-init-internal host port)))
(if ldap (add-finalizer! ldap ldap-memfree))
ldap))
;;; import functions from C
(define c-value->ldap-success
(make-finite-type-import-function
'ldap-success ldap-success-elements ldap-success-id))