tortls.h 975 B

12345678910111213141516171819202122232425262728293031
  1. /* Copyright 2003 Roger Dingledine */
  2. /* See LICENSE for licensing information */
  3. /* $Id$ */
  4. #ifndef _TORTLS_H
  5. #define _TORTLS_H
  6. #include "../common/crypto.h"
  7. typedef struct tor_tls_context_st tor_tls_context;
  8. typedef struct tor_tls_st tor_tls;
  9. #define TOR_TLS_ERROR -4
  10. #define TOR_TLS_CLOSE -3
  11. #define TOR_TLS_WANTREAD -2
  12. #define TOR_TLS_WANTWRITE -1
  13. #define TOR_TLS_DONE 0
  14. /* X509* tor_tls_write_certificate(char *certfile, crypto_pk_env_t *rsa, char *nickname); */
  15. int tor_tls_context_new(crypto_pk_env_t *rsa, int isServer, const char *nickname);
  16. tor_tls *tor_tls_new(int sock, int isServer);
  17. void tor_tls_free(tor_tls *tls);
  18. int tor_tls_peer_has_cert(tor_tls *tls);
  19. crypto_pk_env_t *tor_tls_verify(tor_tls *tls);
  20. int tor_tls_read(tor_tls *tls, char *cp, int len);
  21. int tor_tls_write(tor_tls *tls, char *cp, int n);
  22. int tor_tls_handshake(tor_tls *tls);
  23. int tor_tls_shutdown(tor_tls *tls);
  24. int tor_tls_get_pending_bytes(tor_tls *tls);
  25. #endif