Mercurial > hg > nginx-quic
annotate src/event/ngx_event_openssl.h @ 828:597c83dad983
fix format
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 30 Oct 2006 20:03:49 +0000 |
parents | cec32b3753ac |
children | 1b60ecc8cdb7 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
397
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
397
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
397
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
397
diff
changeset
|
5 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
397
diff
changeset
|
6 |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #ifndef _NGX_EVENT_OPENSSL_H_INCLUDED_ |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #define _NGX_EVENT_OPENSSL_H_INCLUDED_ |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 #include <ngx_config.h> |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_core.h> |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 #include <openssl/ssl.h> |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 #include <openssl/err.h> |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
541 | 17 #if OPENSSL_VERSION_NUMBER >= 0x00907000 |
18 #include <openssl/engine.h> | |
547 | 19 #define NGX_SSL_ENGINE 1 |
541 | 20 #endif |
21 | |
547 | 22 #define NGX_SSL_NAME "OpenSSL" |
23 | |
24 | |
671 | 25 #define ngx_ssl_session_t SSL_SESSION |
26 #define ngx_ssl_conn_t SSL | |
27 | |
28 | |
547 | 29 typedef struct { |
30 SSL_CTX *ctx; | |
31 ngx_log_t *log; | |
32 } ngx_ssl_t; | |
541 | 33 |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
395
f8f0f1834266
nginx-0.0.7-2004-07-16-21:11:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
394
diff
changeset
|
35 typedef struct { |
671 | 36 ngx_ssl_conn_t *connection; |
647 | 37 |
547 | 38 ngx_int_t last; |
39 ngx_buf_t *buf; | |
40 | |
41 ngx_connection_handler_pt handler; | |
396
6f3b20c1ac50
nginx-0.0.7-2004-07-18-23:11:20 import
Igor Sysoev <igor@sysoev.ru>
parents:
395
diff
changeset
|
42 |
547 | 43 ngx_event_handler_pt saved_read_handler; |
44 ngx_event_handler_pt saved_write_handler; | |
479 | 45 |
547 | 46 unsigned handshaked:1; |
47 unsigned buffer:1; | |
48 unsigned no_wait_shutdown:1; | |
49 unsigned no_send_shutdown:1; | |
50 } ngx_ssl_connection_t; | |
395
f8f0f1834266
nginx-0.0.7-2004-07-16-21:11:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
394
diff
changeset
|
51 |
f8f0f1834266
nginx-0.0.7-2004-07-16-21:11:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
394
diff
changeset
|
52 |
547 | 53 #define NGX_SSL_SSLv2 2 |
54 #define NGX_SSL_SSLv3 4 | |
55 #define NGX_SSL_TLSv1 8 | |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
56 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
57 |
547 | 58 #define NGX_SSL_BUFFER 1 |
577 | 59 #define NGX_SSL_CLIENT 2 |
395
f8f0f1834266
nginx-0.0.7-2004-07-16-21:11:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
394
diff
changeset
|
60 |
547 | 61 #define NGX_SSL_BUFSIZE 16384 |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
64 ngx_int_t ngx_ssl_init(ngx_log_t *log); |
547 | 65 ngx_int_t ngx_ssl_create(ngx_ssl_t *ssl, ngx_uint_t protocols); |
563 | 66 ngx_int_t ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, |
67 ngx_str_t *cert, ngx_str_t *key); | |
647 | 68 ngx_int_t ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, |
671 | 69 ngx_str_t *cert, ngx_int_t depth); |
547 | 70 ngx_int_t ngx_ssl_generate_rsa512_key(ngx_ssl_t *ssl); |
71 ngx_int_t ngx_ssl_create_connection(ngx_ssl_t *ssl, ngx_connection_t *c, | |
543 | 72 ngx_uint_t flags); |
577 | 73 |
74 ngx_int_t ngx_ssl_set_session(ngx_connection_t *c, ngx_ssl_session_t *session); | |
611 | 75 #define ngx_ssl_get_session(c) SSL_get1_session(c->ssl->connection) |
76 #define ngx_ssl_free_session SSL_SESSION_free | |
671 | 77 #define ngx_ssl_get_connection(sc) SSL_get_ex_data(sc, ngx_connection_index) |
611 | 78 |
79 | |
671 | 80 ngx_int_t ngx_ssl_get_protocol(ngx_connection_t *c, ngx_pool_t *pool, |
81 ngx_str_t *s); | |
82 ngx_int_t ngx_ssl_get_cipher_name(ngx_connection_t *c, ngx_pool_t *pool, | |
83 ngx_str_t *s); | |
647 | 84 ngx_int_t ngx_ssl_get_subject_dn(ngx_connection_t *c, ngx_pool_t *pool, |
85 ngx_str_t *s); | |
86 ngx_int_t ngx_ssl_get_issuer_dn(ngx_connection_t *c, ngx_pool_t *pool, | |
87 ngx_str_t *s); | |
671 | 88 ngx_int_t ngx_ssl_get_serial_number(ngx_connection_t *c, ngx_pool_t *pool, |
89 ngx_str_t *s); | |
90 | |
647 | 91 |
611 | 92 |
577 | 93 |
547 | 94 ngx_int_t ngx_ssl_handshake(ngx_connection_t *c); |
469 | 95 ssize_t ngx_ssl_recv(ngx_connection_t *c, u_char *buf, size_t size); |
539 | 96 ssize_t ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size); |
577 | 97 ssize_t ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl); |
394
e7a68e14ccd3
nginx-0.0.7-2004-07-16-10:33:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
98 ngx_chain_t *ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, |
489 | 99 off_t limit); |
394
e7a68e14ccd3
nginx-0.0.7-2004-07-16-10:33:35 import
Igor Sysoev <igor@sysoev.ru>
parents:
393
diff
changeset
|
100 ngx_int_t ngx_ssl_shutdown(ngx_connection_t *c); |
583 | 101 void ngx_cdecl ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
489 | 102 char *fmt, ...); |
509 | 103 void ngx_ssl_cleanup_ctx(void *data); |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
104 |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
105 |
671 | 106 extern int ngx_connection_index; |
107 | |
108 | |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
109 #endif /* _NGX_EVENT_OPENSSL_H_INCLUDED_ */ |