scsh-ldap/scheme/types.scm

86 lines
2.8 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-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-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-type ldap-message-type-elements ldap-message-type-id))