ldap.pas 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {
  2. Translation of the LDAP headers for FreePascal
  3. Copyright (C) 2006 by Ivo Steinmann
  4. }
  5. unit ldap;
  6. {$mode objfpc}
  7. interface
  8. uses
  9. ctypes,
  10. lber;
  11. {$linklib ldap}
  12. {$include ldap_featuresh.inc}
  13. {$include ldap_schemah.inc}
  14. {$include ldaph.inc}
  15. implementation
  16. function LDAP_OPT_ON: Pointer;
  17. // #define LDAP_OPT_ON ((void *) &ber_pvt_opt_on)
  18. begin
  19. LDAP_OPT_ON := @ber_pvt_opt_on;
  20. end;
  21. function LDAP_RANGE(n, x, y: ber_int_t): Boolean;
  22. // #define LDAP_RANGE(n,x,y) (((x) <= (n)) && ((n) <= (y)))
  23. begin
  24. LDAP_RANGE := (x <= n) and (n <= y);
  25. end;
  26. function LDAP_ATTR_ERROR(n: ber_int_t): Boolean;
  27. // #define LDAP_ATTR_ERROR(n) LDAP_RANGE((n),0x10,0x15) (* 16-21 *)
  28. begin
  29. LDAP_ATTR_ERROR := LDAP_RANGE(n, $10, $15);
  30. end;
  31. function LDAP_NAME_ERROR(n: ber_int_t): Boolean;
  32. // #define LDAP_NAME_ERROR(n) LDAP_RANGE((n),0x20,0x24) (* 32-34,36 *)
  33. begin
  34. LDAP_NAME_ERROR := LDAP_RANGE(n, $20, $24);
  35. end;
  36. function LDAP_SECURITY_ERROR(n: ber_int_t): Boolean;
  37. // #define LDAP_SECURITY_ERROR(n) LDAP_RANGE((n),0x2F,0x32) (* 47-50 *)
  38. begin
  39. LDAP_SECURITY_ERROR := LDAP_RANGE(n, $2F, $32);
  40. end;
  41. function LDAP_SERVICE_ERROR(n: ber_int_t): Boolean;
  42. // #define LDAP_SERVICE_ERROR(n) LDAP_RANGE((n),0x33,0x36) (* 51-54 *)
  43. begin
  44. LDAP_SERVICE_ERROR := LDAP_RANGE(n, $33, $36);
  45. end;
  46. function LDAP_UPDATE_ERROR(n: ber_int_t): Boolean;
  47. // #define LDAP_UPDATE_ERROR(n) LDAP_RANGE((n),0x40,0x47) (* 64-69,71 *)
  48. begin
  49. LDAP_UPDATE_ERROR := LDAP_RANGE(n, $40, $47);
  50. end;
  51. function LDAP_API_ERROR(n: ber_int_t): Boolean;
  52. // #define LDAP_API_ERROR(n) LDAP_RANGE((n),0x51,0x61) (* 81-97 *)}
  53. begin
  54. LDAP_API_ERROR := n < 0;
  55. end;
  56. function LDAP_API_RESULT(n: ber_int_t): Boolean;
  57. // #define LDAP_API_RESULT(n) (((n) == LDAP_SUCCESS) || LDAP_RANGE((n),0x51,0x61)) (* 0,81-97 *)
  58. begin
  59. LDAP_API_RESULT := n <= 0;
  60. end;
  61. end.