~ubuntu-branches/ubuntu/hardy/linux-ftpd-ssl/hardy

« back to all changes in this revision

Viewing changes to ftpd/ssl_port.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Martin
  • Date: 2002-03-23 12:18:50 UTC
  • Revision ID: james.westby@ubuntu.com-20020323121850-v1q5cjdrp8ozukes
Tags: upstream-0.17.12+0.3
ImportĀ upstreamĀ versionĀ 0.17.12+0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ssl_port.h    - standard porting things 
 
2
 *
 
3
 * The modifications to support SSLeay were done by Tim Hudson
 
4
 * tjh@mincom.oz.au
 
5
 *
 
6
 * You can do whatever you like with these patches except pretend that
 
7
 * you wrote them. 
 
8
 *
 
9
 * Email ssl-users-request@mincom.oz.au to get instructions on how to
 
10
 * join the mailing list that discusses SSLeay and also these patches.
 
11
 *
 
12
 */
 
13
 
 
14
#ifndef HEADER_SSL_PORT_H
 
15
#define HEADER_SSL_PORT_H
 
16
 
 
17
#ifdef USE_SSL
 
18
 
 
19
#include <stdio.h>
 
20
 
 
21
#define OLDPROTO NOPROTO
 
22
#define NOPROTO
 
23
#include <openssl/buffer.h>
 
24
#undef NOPROTO
 
25
#define NOPROTO OLDPROTO
 
26
 
 
27
#include <openssl/x509.h>
 
28
#include <openssl/ssl.h>
 
29
#include <openssl/err.h>
 
30
 
 
31
extern SSL *ssl_con;
 
32
extern SSL_CTX *ssl_ctx;
 
33
extern int ssl_debug_flag;
 
34
extern int ssl_only_flag;
 
35
extern int ssl_active_flag;
 
36
extern int ssl_verify_flag;
 
37
extern int ssl_secure_flag;
 
38
extern int ssl_enabled;
 
39
 
 
40
extern int ssl_encrypt_data;
 
41
extern SSL *ssl_data_con;
 
42
extern int ssl_data_active_flag;
 
43
 
 
44
extern char *my_ssl_cert_file;
 
45
extern char *my_ssl_key_file;
 
46
extern int ssl_certsok_flag;
 
47
 
 
48
extern int set_ssl_trace(SSL *s);
 
49
 
 
50
extern FILE *cin, *cout;
 
51
 
 
52
#define is_ssl_fd(X,Y)    ( (SSL_get_fd((X))==0) || \
 
53
                            (SSL_get_fd((X))==1) || \
 
54
                            (SSL_get_fd((X))==pdata) || \
 
55
                            (SSL_get_fd((X))==(Y)) \
 
56
                          )
 
57
 
 
58
#define is_ssl_fp(X,Y)    ( ( (SSL_get_fd((X))==0) && (fileno((Y))==0) ) || \
 
59
                            ( (SSL_get_fd((X))==1) && (fileno((Y))==1) ) || \
 
60
                            ( (SSL_get_fd((X))==pdata) && \
 
61
                                                  (fileno((Y))==pdata) ) || \
 
62
                            (SSL_get_fd((X))==fileno(Y)) \
 
63
                          )
 
64
 
 
65
/* these macros make things much easier to handle ... */
 
66
 
 
67
#define FFLUSH(X)         (ssl_active_flag && (((X)==cin)||((X)==cout)) ? 1 : fflush((X)) )
 
68
 
 
69
#define GETC(X)           (ssl_active_flag && (((X)==cin)||((X)==cout)) ? ssl_getc(ssl_con) : getc((X)) )
 
70
 
 
71
#define DATAGETC(X)       (ssl_data_active_flag && ((fileno(X)==data)||(fileno(X)==pdata)) ? ssl_getc(ssl_data_con) : getc((X)) )
 
72
#define DATAPUTC(X,Y)     (ssl_data_active_flag && ((fileno(Y)==data)||(fileno(Y)==pdata)) ? ssl_putc(ssl_data_con,(X)) : putc((X),(Y)) )
 
73
#define DATAFLUSH(X)      (ssl_data_active_flag && ((fileno(X)==data)||(fileno(X)==pdata)) ? ssl_putc_flush(ssl_data_con) : fflush((X)) )
 
74
 
 
75
#else
 
76
 
 
77
#define GETC(X)           getc((X))
 
78
#define DATAGETC(X)       getc((X))
 
79
#define DATAPUTC(X,Y)     putc((X),(Y))
 
80
#define DATAFLUSH(X)      fflush((X))
 
81
#define FFLUSH(X)         fflush((X))
 
82
 
 
83
#endif /* USE_SSL */
 
84
 
 
85
#endif /*  HEADER_SSL_PORT_H */