[plt-scheme] two ffis, reviews?
Hello,
For a personal project[1] I'll be needing to access some kind of database.
Initially the plan was to use LDAP and OpenLDAP's libldap, so I started to
make an ffi for that. But even when LDAP seems the right technollogy for the
job, it is almost like black magic, so complex, so little documentation, to
get a piece of information you have to call 10 functions and do 15 checks.
Then alternative plan is to use a typical RDBM, so, I started to make an FFI
for MySQL (the one I know best) and I reached the point where most fuctions
from libmysqlclient are wrapped.
I believe I am going to continue with the sql way, but I am posting here both
ffi (just for the record). I am interested if some of you more knowgleadble
can take a look at them, particulary the mysql and tell me if I am doing
something wrong (I have tested it to some extet). I am particulary interested
in the type management, can it be done better ?
Thank you.
--
Pupeno <pupeno at pupeno.com> (http://pupeno.com)
Vendo: Procesador AMD Athlon XP 2400+: http://pupeno.com/spa/vendo/#Procesador
[1] The project will be fully free software, I just don't want to give the
details of my huge project untill I am more advanced on it (I want to avoid
vapourware).
-------------- next part --------------
; mysqlclient, mysqlclient wrapper for plt scheme
; Copyright (C) 2005 José Pablo Ezequiel "Pupeno" Fernández Silva
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
(module libmysqlclient mzscheme
(require (lib "foreign.ss")) (unsafe!)
; Define something, and at at the same time, provide it.
(define-syntax define/provide
(syntax-rules ()
((_ name body ...)
(begin (define name body ...)
(provide name)))))
; The library
(define libmysqlclient (ffi-lib "libmysqlclient"))
; Types
(define _mysql (make-ctype _pointer #f #f))
(define _mysql-result (make-ctype _pointer #f #f))
(define _mysql-row (make-ctype _pointer #f #f))
(define _field_types (_enum '(mysql-type-decimal
mysql-type-tiny
mysql-type-short
mysql-type-long
mysql-type-float
mysql-type-double
mysql-type-null
mysql-type-timestamp
mysql-type-longlong
mysql-type-int24
mysql-type-date
mysql-type-time
mysql-type-datetime
mysql-type-year
mysql-type-newdate
mysql-type-enum = 247
mysql-type-set = 248
mysql-type-tiny-blob = 249
mysql-type-medium-blob = 250
mysql-type-long-blob = 251
mysql-type-blob = 252
mysql-type-var-string = 253
mysql-type-string = 254
mysql-type-geometry = 255)))
(define-cstruct _mysql-field ((name _string)
(org-name _string)
(table _string)
(org-table _string)
(db _string)
(catalog _string)
(def _string)
(length _ulong)
(max-length _ulong)
(name-length _uint)
(org-name-length _uint)
(table-length _uint)
(org-table-length _uint)
(db-length _uint)
(catalog-length _uint)
(def-length _uint)
(flags _uint)
(decimals _uint)
(charsetnr _uint)
(type _field_types)))
(define _my-ulongulong (make-ctype _uint64 #f #f))
(define _my-bool (make-ctype _byte
(lambda (x) (if x 1 0))
(lambda (x) (not (eq? 0 x)))))
(define _mysql-field-offset (make-ctype _uint #f #f))
(define _mysql-option (_enum '(mysql-opt-connect-timeout
mysql-opt-compress
mysql-opt-named-pipe
mysql-init-command
mysql-read-default-file
mysql-read-default-group
mysql-set-charset-dir
mysql-set-charset-name
mysql-opt-local-infile
mysql-opt-protocol
mysql-shared-memory-base-name
mysql-opt-read-timeout
mysql-opt-write-timeout
mysql-opt-use-result
mysql-opt-use-remote-connection
mysql-opt-use-embedded-connection
mysql-opt-guess-connection
mysql-set-client-ip
mysql-secure-auth)))
(define _mysql-set-option (_enum '(mysql-option-multi-statements-on
mysql-option-multi-statements-off)))
(_bitmask '(mysql-shutdown-killable-connect = 1
mysql-shutdown-killable-trans = 2
mysql-shutdown-killable-lock-table = 4
mysql-shutdown-killable-update = 8))
(define _mysql-shutdown-level
(_enum '(shutdown-default = 0
shutdown-wait-connections = 1 ; mysql-shutdown-killable-connect
shutdown-wait-transactions = 2 ; mysql-shutdown-killable-trans
shutdown-wait-updates = 8 ; mysql-shutdown-killable-update
shutdown-all-buffers = 16 ; mysql-shutdown-killable-update << 1
shutdown-wait-critical-buffers = 17 ;(mysql-shutdown-killable-update << 1)+1
kill-query = 254
kill-connection = 255)))
(define/provide mysql-affected-rows
(get-ffi-obj "mysql_affected_rows" libmysqlclient (_fun _mysql -> _my-ulongulong)))
(define/provide mysql-change-user
(get-ffi-obj "mysql_change_user" libmysqlclient (_fun _mysql _string _string _string -> _my-bool)))
(define/provide mysql-character-set-name
(get-ffi-obj "mysql_character_set_name" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-close
(get-ffi-obj "mysql_close" libmysqlclient (_fun _mysql -> _void)))
(define/provide mysql-data-seek
(get-ffi-obj "mysql_data_seek" libmysqlclient (_fun _mysql-result _my-ulongulong -> _void)))
(define/provide mysql-debug
(get-ffi-obj "mysql_debug" libmysqlclient (_fun _string -> _void)))
(define/provide mysql-dump-debug-info
(get-ffi-obj "mysql_dump_debug_info" libmysqlclient (_fun _mysql -> _int)))
(define/provide mysql-errno
(get-ffi-obj "mysql_errno" libmysqlclient (_fun _mysql -> _uint)))
(define/provide mysql-error
(get-ffi-obj "mysql_error" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-fetch-field
(get-ffi-obj "mysql_fetch_field" libmysqlclient (_fun _mysql-result -> _mysql-field-pointer)))
(define/provide mysql-fetch-fields
(get-ffi-obj "mysql_fetch_fields" libmysqlclient (_fun _mysql-result -> _mysql-field-pointer)))
(define/provide mysql-fetch_field-direct
(get-ffi-obj "mysql_fetch_field_direct" libmysqlclient (_fun _mysql-result _uint -> _mysql-field-pointer)))
(define/provide mysql-fetch-lengths
(get-ffi-obj "mysql_fetch_lengths" libmysqlclient (_fun _mysql-result -> _ulong)))
(define/provide mysql-fetch-row
(get-ffi-obj "mysql_fetch_row" libmysqlclient (_fun _mysql-result -> _mysql-row)))
(define/provide mysql-field-count
(get-ffi-obj "mysql_field_count" libmysqlclient (_fun _mysql -> _uint)))
(define/provide mysql-field-seek
(get-ffi-obj "mysql_field_seek" libmysqlclient (_fun _mysql-result _mysql-field-offset -> _mysql-field-offset)))
(define/provide mysql-field-tell
(get-ffi-obj "mysql_field_tell" libmysqlclient (_fun _mysql-result -> _mysql-field-offset)))
(define/provide mysql-free-result
(get-ffi-obj "mysql_free_result" libmysqlclient (_fun _mysql-result -> _void)))
;TODO: find out what is MY_CHARSET_INFO
; (define/provide mysql-get-character-set-info
; (get-ffi-obj "mysql_get_character_set_info" libmysqlclient (_fun _mysql -> )))
(define/provide mysql-get-client-info
(get-ffi-obj "mysql_get_client_info" libmysqlclient (_fun -> _string)))
(define/provide mysql-get-client-version
(get-ffi-obj "mysql_get_client_version" libmysqlclient (_fun -> _ulong)))
(define/provide mysql-get-host-info
(get-ffi-obj "mysql_get_host_info" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-get-proto-info
(get-ffi-obj "mysql_get_proto_info" libmysqlclient (_fun _mysql -> _uint)))
(define/provide mysql-get-server-info
(get-ffi-obj "mysql_get_server_info" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-get-server-version
(get-ffi-obj "mysql_get_server_version" libmysqlclient (_fun _mysql -> _ulong)))
(define/provide mysql-hex-string
(get-ffi-obj "mysql_hex_string" libmysqlclient (_fun _string _string _ulong -> _ulong)))
(define/provide mysql-info
(get-ffi-obj "mysql_info" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-init
(get-ffi-obj "mysql_init" libmysqlclient (_fun _mysql -> _mysql)))
(define/provide mysql-insert-id
(get-ffi-obj "mysql_insert_id" libmysqlclient (_fun _mysql -> _my-ulongulong)))
(define/provide mysql-kill
(get-ffi-obj "mysql_kill" libmysqlclient (_fun _mysql _ulong -> _int)))
; (define/provide mysql-library-init
; (get-ffi-obj "mysql_library_init" libmysqlclient (_fun _int _pointer _pointer -> _int)))
; (define/provide mysql-library-end
; (get-ffi-obj "mysql_library_end" libmysqlclient (_fun _void -> _void)))
(define/provide mysql-list-dbs
(get-ffi-obj "mysql_list_dbs" libmysqlclient (_fun _mysql _string -> _mysql-result)))
(define/provide mysql-list-fields
(get-ffi-obj "mysql_list_fields" libmysqlclient (_fun _mysql _string _string -> _mysql-result)))
(define/provide mysql-list-processes
(get-ffi-obj "mysql_list_processes" libmysqlclient (_fun _mysql -> _mysql-result)))
(define/provide mysql-list-tables
(get-ffi-obj "mysql_list_tables" libmysqlclient (_fun _mysql _string -> _mysql-result)))
(define/provide mysql-num-fields
(get-ffi-obj "mysql_num_fields" libmysqlclient (_fun _mysql-result -> _uint)))
(define/provide mysql_num_rows
(get-ffi-obj "mysql_num_rows" libmysqlclient (_fun _mysql-result -> _my-ulongulong)))
(define/provide mysql_options
(get-ffi-obj "mysql_options" libmysqlclient (_fun _mysql _mysql-option _string -> _int)))
(define/provide mysql_ping
(get-ffi-obj "mysql_ping" libmysqlclient (_fun _mysql -> _int)))
(define/provide mysql-query
(get-ffi-obj "mysql_query" libmysqlclient (_fun _mysql _string -> _int)))
(define/provide mysql-real-connect
(get-ffi-obj "mysql_real_connect" libmysqlclient
(_fun _mysql _string _string _string
_string _uint _string _ulong -> _mysql)))
(define/provide mysql-real-escape-string
(get-ffi-obj "mysql_real_escape_string" libmysqlclient (_fun _mysql _string _string _ulong -> _ulong)))
(define/provide mysql-real-query
(get-ffi-obj "mysql_real_query" libmysqlclient (_fun _mysql _string _ulong -> _int)))
(define/provide mysql-refresh
(get-ffi-obj "mysql_refresh" libmysqlclient (_fun _mysql _uint -> _int)))
; (define/provide mysql-reload
; (get-ffi-obj "mysql_reload" libmysqlclient (_fun _mysql -> _int)))
(define/provide mysql-row-seek
(get-ffi-obj "mysql_row_seek" libmysqlclient (_fun _mysql-result _pointer -> _pointer)))
(define/provide mysql-row-tell
(get-ffi-obj "mysql_row_tell" libmysqlclient (_fun _mysql-result -> _pointer)))
(define/provide mysql-select-db
(get-ffi-obj "mysql_select_db" libmysqlclient (_fun _mysql _string -> _int)))
(define/provide mysql-set-character-set
(get-ffi-obj "mysql_set_character_set" libmysqlclient (_fun _mysql _string -> _int)))
(define/provide mysql-set-server-option
(get-ffi-obj "mysql_set_server_option" libmysqlclient (_fun _mysql _mysql-set-option -> _int)))
(define/provide mysql-shutdown
(get-ffi-obj "mysql_shutdown" libmysqlclient (_fun _mysql _mysql-shutdown-level -> _int)))
(define/provide mysql-sqlstate
(get-ffi-obj "mysql_sqlstate" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-ssl-set
(get-ffi-obj "mysql_ssl_set" libmysqlclient (_fun _mysql _string _string _string _string _string -> _int)))
(define/provide mysql-stat
(get-ffi-obj "mysql_stat" libmysqlclient (_fun _mysql -> _string)))
(define/provide mysql-store-result
(get-ffi-obj "mysql_store_result" libmysqlclient (_fun _mysql -> _mysql-result)))
(define/provide mysql-thread-id
(get-ffi-obj "mysql_thread_id" libmysqlclient (_fun _mysql -> _ulong)))
(define/provide mysql-use-result
(get-ffi-obj "mysql_use_result" libmysqlclient (_fun _mysql -> _mysql-result)))
(define/provide mysql-warning-count
(get-ffi-obj "mysql_warning_count" libmysqlclient (_fun _mysql -> _uint)))
(define/provide mysql-commit
(get-ffi-obj "mysql_commit" libmysqlclient (_fun _mysql -> _my-bool)))
(define/provide mysql-rollback
(get-ffi-obj "mysql_rollback" libmysqlclient (_fun _mysql -> _my-bool)))
(define/provide mysql-autocommit
(get-ffi-obj "mysql_autocommit" libmysqlclient (_fun _mysql _my-bool -> _my-bool)))
(define/provide mysql-more-results
(get-ffi-obj "mysql_more_results" libmysqlclient (_fun _mysql -> _my-bool)))
(define/provide mysql-next-result
(get-ffi-obj "mysql_next_result" libmysqlclient (_fun _mysql -> _int))))
-------------- next part --------------
; ldap, OpenLDAP's libldap wrapper for plt scheme
; Copyright (C) 2005 José Pablo Ezequiel "Pupeno" Fernández Silva
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
(module ldap mzscheme
(require (only (lib "13.ss" "srfi") string-map))
(require (lib "foreign.ss")) (unsafe!)
; Error reporting for FFI procedures.
(define (not-provided name)
(lambda ()
(lambda all-values
(error 'libldap "your installed libldap version does not provide ~s." name))))
; Define something, and at at the same time, provide it.
(define-syntax define/provide
(syntax-rules ()
((_ name body ...)
(begin (define name body ...)
(provide name)))))
; Library.
(define libldap (ffi-lib "libldap"))
; Some types.
(define ldap (make-ctype _pointer #f #f))
(define ldap-message (make-ctype _pointer #f #f))
; Some information that the standard requires.
(define/provide ldap-api-version 3001)
(define/provide ldap-version-min 2)
(define/provide ldap-version-max 3)
(define/provide ldap-vendor-name "José Pablo Ezequiel \"Pupeno\" Fernández Silva")
(define/provide ldap-vendor-version 0)
; TODO: typedef struct ldapapiinfo
; Initializing an LDAP Session.
(define/provide ldap-open
(get-ffi-obj "ldap_open" libldap (_fun _string _int -> ldap)))
(define/provide ldap-init
(get-ffi-obj "ldap_init" libldap (_fun _string _int -> ldap)))
(define/provide ldap-port 389)
;;; LDAP Session Handle Options.
(define/provide ldap-set-option
(get-ffi-obj "ldap_set_option" libldap (_fun ldap _int _pointer -> _int)))
(define/provide ldap-get-option
(get-ffi-obj "ldap_get_option" libldap (_fun ldap _int _pointer -> _int)))
; TODO: LDAP_OPT_ON, LDAP_OPT_OFF.
;; Options
(define/provide ldap-opt-api-info #x1)
(define/provide ldap-opt-deref #x2)
(define/provide ldap-opt-sizelimit #x3)
(define/provide ldap-opt-timelimit #x4)
(define/provide ldap-opt-referals #x8)
(define/provide ldap-opt-restart #x9)
(define/provide ldap-opt-protocol-version #x11)
; (define/provide ldap-opt- #x)
; TODO: add the rest of the options: /home/pupeno/Temporary/openldap-2.2.28/doc/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt
;; Versions.
(define/provide ldap-version2 (malloc _int))
(ptr-set! ldap-version2 _int 2)
(define/provide ldap-version3 (malloc _int))
(ptr-set! ldap-version3 _int 3)
;;; Working With Controls
; TODO: all.
;;; Authenticating to the directory.
(define/provide ldap-bind
(get-ffi-obj "ldap_bind" libldap (_fun ldap _string _string _int -> _int)))
(define/provide ldap-bind-s
(get-ffi-obj "ldap_bind_s" libldap (_fun ldap _string _string _int -> _int)))
(define/provide ldap-simple-bind
(get-ffi-obj "ldap_simple_bind" libldap (_fun ldap _string _string -> _int)))
(define/provide ldap-simple-bind-s
(get-ffi-obj "ldap_simple_bind_s" libldap (_fun ldap _string _string -> _int)))
(define/provide ldap-kerberos-bind-s
(get-ffi-obj "ldap_kerberos_bind_s" libldap (_fun ldap _string -> _int)
(not-provided "kerberos")))
(define/provide ldap-kerberos-bind1
(get-ffi-obj "ldap_kerberos_bind1" libldap (_fun ldap _string -> _int)
(not-provided "kerberos")))
(define/provide ldap-kerberos-bind1-s
(get-ffi-obj "ldap_kerberos_bind1_s" libldap (_fun ldap _string -> _int)
(not-provided "kerberos")))
(define/provide ldap-kerberos-bind2
(get-ffi-obj "ldap_kerberos_bind2" libldap (_fun ldap _string -> _int)
(not-provided "kerberos")))
(define/provide ldap-kerberos-bind2-s
(get-ffi-obj "ldap_kerberos_bind2_s" libldap (_fun ldap _string -> _int)
(not-provided "kerberos")))
;int ldap_sasl_bind(LDAP *ld, const char *dn, const char *mechanism, struct berval *cred, LDAPControl *sctrls[], LDAPControl *cctrls[], int *msgidp);
;int ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism, struct berval *cred, LDAPControl *sctrls[], LDAPControl *cctrls[], struct berval **servercredp);
;int ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res, struct berval **servercredp, int freeit);
;int ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn, const char *mechs, ;LDAPControl *sctrls[], LDAPControl *cctrls[], unsigned flags, LDAP_SASL_INTERACT_PROC *interact, void *defaults);
;;; Closing the session.
(define/provide ldap-unbind
(get-ffi-obj "ldap_unbind" libldap (_fun ldap -> _int)))
(define/provide ldap-unbind-s
(get-ffi-obj "ldap_unbind_s" libldap (_fun ldap -> _int)))
;;; Searching.
(define/provide ldap-search
(get-ffi-obj "ldap_search" libldap (_fun ldap _string _int _string _pointer _int -> _int)))
(define/provide ldap-search-s
(get-ffi-obj "ldap_search_s" libldap (_fun ldap _string _int _string _pointer _bool (res : (_ptr o _pointer)) -> (ret : _int) -> (list res ret))))
; int ldap_search_st(LDAP *ld, const char *base, int scope, const char *filter, char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res);
;; Scopes
(define/provide ldap-scope-base #x0)
(define/provide ldap-scope-onelevel #x1)
(define/provide ldap-scope-subtree #x2)
;;; Comparing a Value Against an Entry.
(define/provide ldap-compare
(get-ffi-obj "ldap_compare" libldap (_fun ldap _string _string _string -> _int)))
(define/provide ldap-compare-s
(get-ffi-obj "ldap_compare_s" libldap (_fun ldap _string _string _string -> _int)))
;;; Modifying an entry.
; int ldap_modify(LDAP *ld, char *dn, LDAPMod *mods);
; int ldap_modify_s(LDAP *ld, char *dn, LDAPMod *mods);
; void ldap_mods_free(LDAPMod **mods, int freemods);
;;; Modifying the Name of an Entry.
; int ldap_rename(LDAP *ld, const char *dn, const char *newrdn, const char *newparent, int deleteoldrdn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
; int ldap_rename_s(LDAP *ld, const char *dn, const char *newrdn, const char *newparent, int deleteoldrdn, LDAPControl **serverctrls, LDAPControl **clientctrls);
;;; Adding an entry.
; int ldap_add_ext(LDAP *ld, const char *dn, LDAPMod *attrs[], LDAPControl *sctrls[], LDAPControl *cctrls[], int *msgidp);
; int ldap_add_ext_s(LDAP *ld, const char *dn, LDAPMod *attrs[], LDAPControl *sctrls[], LDAPControl *cctrls[]);
; int ldap_add(LDAP *ld, const char *dn, LDAPMod *attrs[]);
; int ldap_add_s(LDAP *ld, const char *dn, LDAPMod *attrs[]);
;;; Deleting an entry.
; int ldap_delete_ext(LDAP *ld, const char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
; int ldap_delete_ext_s( LDAP *ld, const char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls);
; int ldap_delete(LDAP *ld, const char *dn);
; int ldap_delete_s(LDAP *ld, const char *dn);
;;; Extended Operations
; TODO
;;; Obtaining Results and Peeking Inside LDAP Messages
; int ldap_result( LDAP *ld, int msgid, int all, struct timeval *timeout, LDAPMessage **result );
; int ldap_msgfree( LDAPMessage *msg );
; int ldap_msgtype( LDAPMessage *msg );
; int ldap_msgid( LDAPMessage *msg );
;;; Handling Errors and Parsing Results.
(define/provide ldap-err->string
(get-ffi-obj "ldap_err2string" libldap (_fun _int -> _string)))
(define/provide ldap-perror ; Warning, this function might be dangerous.
(get-ffi-obj "ldap_perror" libldap (_fun ldap _string -> _void)))
(define/provide ldap-result->error
(get-ffi-obj "ldap_result2error" libldap (_fun _pointer _pointer _int -> _int)))
;;; Stepping Through a List of Results
(define/provide ldap-first-message
(get-ffi-obj "ldap_first_message" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-next-message
(get-ffi-obj "ldap_next_message" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-count-messages
(get-ffi-obj "ldap_count_messages" libldap (_fun ldap ldap-message -> _int)))
;;; Stepping Through a List of Entries or References.
(define/provide ldap-first-entry
(get-ffi-obj "ldap_first_entry" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-first-reference
(get-ffi-obj "ldap_first_reference" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-next-entry
(get-ffi-obj "ldap_next_entry" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-next-reference
(get-ffi-obj "ldap_next_reference" libldap (_fun ldap ldap-message -> ldap-message)))
(define/provide ldap-count-entries
(get-ffi-obj "ldap_count_entries" libldap (_fun ldap ldap-message -> _int)))
(define/provide ldap-count-references
(get-ffi-obj "ldap_count_references" libldap (_fun ldap ldap-message -> _int)))
;;; Stepping Through the Attributes of an Entry.
(define/provide ldap-first-attribute
(get-ffi-obj "ldap_first_attribute" libldap (_fun ldap ldap-message (berptr : (_ptr o _pointer)) -> (ret : _string) -> (list ret berptr))))
(define/provide ldap-next-attribute
(get-ffi-obj "ldap_next_attribute" libldap (_fun ldap ldap-message _pointer -> _string)))
; void ldap_memfree( char *mem );
;;; Retrieving the Values of an Attribute.
(define/provide ldap-get-values
(get-ffi-obj "ldap_get_values" libldap (_fun ldap ldap-message _string -> _pointer)))
(define/provide ldap-get-values-len
(get-ffi-obj "ldap_get_values_len" libldap (_fun ldap ldap-message _string -> _pointer)))
(define/provide ldap-count-values
(get-ffi-obj "ldap_count_values" libldap (_fun _pointer -> _int)))
(define/provide ldap-count-values-len
(get-ffi-obj "ldap_count_values_len" libldap (_fun _pointer -> _int)))
; void ldap_value_free( char **vals );
; void ldap_value_free_len( struct berval **vals );
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20050912/1cd94fe7/attachment.sig>