108 lines
3.4 KiB
Scheme
108 lines
3.4 KiB
Scheme
(define-record-type ldap-session :ldap-session
|
|
(make-ldap-session c-pointer bound? options messages)
|
|
ldap-session?
|
|
(c-pointer ldap-session-c-pointer)
|
|
(bound? ldap-session-bound? set-ldap-session-bound?!)
|
|
(options ldap-session-options set-ldap-session-options!)
|
|
(messages ldap-session-messages set-ldap-session-messages!))
|
|
|
|
(define-exported-binding "ldap-session" :ldap-session)
|
|
|
|
(define-record-type session-options :session-options
|
|
(make-session-options implicit-unbind-ok? auto-unbind?)
|
|
session-options?
|
|
(implicit-unbind-ok? session-options-implicit-unbind-ok?)
|
|
(auto-unbind? session-options-auto-unbind?))
|
|
|
|
(define (ldap-session-implicit-unbind-ok? session)
|
|
(session-options-implicit-unbind-ok? (ldap-session-options session)))
|
|
|
|
(define (ldap-session-auto-unbind? session)
|
|
(session-options-auto-unbind? (ldap-session-options session)))
|
|
|
|
(define (ldap-session-messages-adjoin! session message)
|
|
(set-ldap-session-messages!
|
|
session (lset-adjoin eq? (ldap-session-messages session) message)))
|
|
|
|
(define (ldap-session-messages-member? session message)
|
|
(memq message (ldap-session-messages session)))
|
|
|
|
(define (ldap-session=? session-a session-b)
|
|
(equal? (ldap-session-c-pointer session-a)
|
|
(ldap-session-c-pointer session-b)))
|
|
|
|
;;; This is the basic type
|
|
(define-record-type ldap-message :ldap-message
|
|
(make-ldap-message c-pointer)
|
|
ldap-message?
|
|
(c-pointer ldap-message-c-pointer))
|
|
|
|
(define-exported-binding "ldap-message" :ldap-message)
|
|
|
|
(define (ldap-message=? session-a session-b)
|
|
(equal? (ldap-message-c-pointer session-a)
|
|
(ldap-message-c-pointer session-b)))
|
|
|
|
;;; The C api does not distinguish ldap-message, ldap-entry and
|
|
;;; ldap-attribute as types, they all have the type LDAPMessage. We
|
|
;;; do.
|
|
(define-record-type ldap-entry :ldap-entry
|
|
(make-ldap-entry message)
|
|
ldap-entry?
|
|
(message ldap-entry-message))
|
|
|
|
(define (ldap-entry=? entry-a entry-b)
|
|
(ldap-message=? (ldap-entry-message entry-a)
|
|
(ldap-entry-message entry-b)))
|
|
|
|
(define-record-type ldap-modification :ldap-modification
|
|
(make-ldap-modification c-pointer)
|
|
ldap-modification?
|
|
(c-pointer ldap-modification-c-pointer))
|
|
|
|
(define-exported-binding "ldap-modification" :ldap-modification)
|
|
|
|
(define-record-type ldap-api-info :ldap-api-info
|
|
(make-ldap-api-info c-pointer)
|
|
ldap-api-info?
|
|
(c-pointer ldap-api-info-c-pointer))
|
|
|
|
(define-exported-binding "ldap-api-info" :ldap-api-info)
|
|
|
|
(import-lambda-definition ldap-api-info-info-version
|
|
(ldap-ai)
|
|
"scsh_ldapapiinfo_get_info_version")
|
|
|
|
(import-lambda-definition ldap-api-info-api-version
|
|
(ldap-ai)
|
|
"scsh_ldapapiinfo_get_api_version")
|
|
|
|
(import-lambda-definition ldap-api-info-protocol-version
|
|
(ldap-ai)
|
|
"scsh_ldapapiinfo_get_protocol_version")
|
|
|
|
(import-lambda-definition ldap-api-info-vendor-name
|
|
(ldap-ai)
|
|
"scsh_ldapapiinfo_get_vendor_name")
|
|
|
|
(import-lambda-definition ldap-api-info-vendor-version
|
|
(ldap-ai)
|
|
"scsh_ldapapiinfo_get_vendor_version")
|
|
|
|
(define-record-type ber-element :ber-element
|
|
(make-ber-element c-pointer)
|
|
ber-element?
|
|
(c-pointer ber-element-c-pointer))
|
|
|
|
(define-exported-binding "ber-element" :ber-element)
|
|
|
|
(define (ldap-success? obj)
|
|
(equal? (ldap-return success) obj))
|
|
|
|
(define convert-ldap-return-code
|
|
(make-finite-type-import-function 'ldap-return ldap-return-elements ldap-return-id))
|
|
|
|
(define convert-ldap-message-type
|
|
(make-finite-type-import-function
|
|
'ldap-message-types ldap-message-types-elements ldap-message-types-id))
|