ldap-tls.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* ldap-tls.h - TLS defines & prototypes internal to the LDAP library */
  2. /* $OpenLDAP$ */
  3. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  4. *
  5. * Copyright 2008-2022 The OpenLDAP Foundation.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted only as authorized by the OpenLDAP
  10. * Public License.
  11. *
  12. * A copy of this license is available in the file LICENSE in the
  13. * top-level directory of the distribution or, alternatively, at
  14. * <http://www.OpenLDAP.org/license.html>.
  15. */
  16. #ifndef _LDAP_TLS_H
  17. #define _LDAP_TLS_H 1
  18. struct tls_impl;
  19. struct tls_ctx;
  20. struct tls_session;
  21. #define CERTPATHSEP ";"
  22. typedef struct tls_ctx tls_ctx;
  23. typedef struct tls_session tls_session;
  24. typedef int (TI_tls_init)(void);
  25. typedef void (TI_tls_destroy)(void);
  26. typedef tls_ctx *(TI_ctx_new)(struct ldapoptions *lo);
  27. typedef void (TI_ctx_ref)(tls_ctx *ctx);
  28. typedef void (TI_ctx_free)(tls_ctx *ctx);
  29. #define ERRBUFSIZE 256
  30. typedef int (TI_ctx_init)(struct ldapoptions *lo, struct ldaptls *lt, int is_server, char *errmsg);
  31. typedef tls_session *(TI_session_new)(tls_ctx *ctx, int is_server);
  32. typedef int (TI_session_connect)(LDAP *ld, tls_session *s, const char *name_in);
  33. typedef int (TI_session_accept)(tls_session *s);
  34. typedef int (TI_session_upflags)(Sockbuf *sb, tls_session *s, int rc);
  35. typedef char *(TI_session_errmsg)(tls_session *s, int rc, char *buf, size_t len );
  36. typedef int (TI_session_dn)(tls_session *sess, struct berval *dn);
  37. typedef int (TI_session_chkhost)(LDAP *ld, tls_session *s, const char *name_in);
  38. typedef int (TI_session_strength)(tls_session *sess);
  39. typedef int (TI_session_unique)(tls_session *sess, struct berval *buf, int is_server);
  40. typedef int (TI_session_endpoint)(tls_session *sess, struct berval *buf, int is_server);
  41. typedef const char *(TI_session_name)(tls_session *s);
  42. typedef int (TI_session_peercert)(tls_session *s, struct berval *der);
  43. typedef int (TI_session_pinning)(LDAP *ld, tls_session *s, char *hashalg, struct berval *hash);
  44. typedef void (TI_thr_init)(void);
  45. typedef struct tls_impl {
  46. const char *ti_name;
  47. TI_tls_init *ti_tls_init; /* library initialization */
  48. TI_tls_destroy *ti_tls_destroy;
  49. TI_ctx_new *ti_ctx_new;
  50. TI_ctx_ref *ti_ctx_ref;
  51. TI_ctx_free *ti_ctx_free;
  52. TI_ctx_init *ti_ctx_init;
  53. TI_session_new *ti_session_new;
  54. TI_session_connect *ti_session_connect;
  55. TI_session_accept *ti_session_accept;
  56. TI_session_upflags *ti_session_upflags;
  57. TI_session_errmsg *ti_session_errmsg;
  58. TI_session_dn *ti_session_my_dn;
  59. TI_session_dn *ti_session_peer_dn;
  60. TI_session_chkhost *ti_session_chkhost;
  61. TI_session_strength *ti_session_strength;
  62. TI_session_unique *ti_session_unique;
  63. TI_session_endpoint *ti_session_endpoint;
  64. TI_session_name *ti_session_version;
  65. TI_session_name *ti_session_cipher;
  66. TI_session_peercert *ti_session_peercert;
  67. TI_session_pinning *ti_session_pinning;
  68. Sockbuf_IO *ti_sbio;
  69. TI_thr_init *ti_thr_init;
  70. int ti_inited;
  71. } tls_impl;
  72. extern tls_impl ldap_int_tls_impl;
  73. #endif /* _LDAP_TLS_H */